mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 03:33:25 +02:00
make.sh: Bind-mount /etc/resolv.conf and /etc/hosts
This allows us to have name resolution in the shell without any manual configuration. Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
28
make.sh
28
make.sh
@@ -313,6 +313,8 @@ exiterror() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prepareenv() {
|
prepareenv() {
|
||||||
|
local network="false"
|
||||||
|
|
||||||
# Are we running the right shell?
|
# Are we running the right shell?
|
||||||
if [ -z "${BASH}" ]; then
|
if [ -z "${BASH}" ]; then
|
||||||
exiterror "BASH environment variable is not set. You're probably running the wrong shell."
|
exiterror "BASH environment variable is not set. You're probably running the wrong shell."
|
||||||
@@ -339,6 +341,10 @@ prepareenv() {
|
|||||||
required_space="${1#--required-space=}"
|
required_space="${1#--required-space=}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
--network)
|
||||||
|
network="true"
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
exiterror "Unknown argument: ${1}"
|
exiterror "Unknown argument: ${1}"
|
||||||
;;
|
;;
|
||||||
@@ -461,6 +467,26 @@ prepareenv() {
|
|||||||
# Mount the images directory
|
# Mount the images directory
|
||||||
mount --bind "${IMAGES_DIR}" "${BUILD_DIR}/usr/src/images"
|
mount --bind "${IMAGES_DIR}" "${BUILD_DIR}/usr/src/images"
|
||||||
|
|
||||||
|
# Bind-mount files requires for networking if requested
|
||||||
|
if [ "${network}" = "true" ]; then
|
||||||
|
local file
|
||||||
|
|
||||||
|
for file in /etc/resolv.conf /etc/hosts; do
|
||||||
|
# Skip if the source files does not exist
|
||||||
|
if [ ! -e "${file}" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create the destination if it does not exist
|
||||||
|
if [ ! -e "${BUILD_DIR}/${file}" ]; then
|
||||||
|
touch "${BUILD_DIR}/${file}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Mount the file read-only
|
||||||
|
mount --bind -o ro "${file}" "${BUILD_DIR}/${file}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Configure the ccache
|
# Configure the ccache
|
||||||
export CCACHE_TEMPDIR="/tmp"
|
export CCACHE_TEMPDIR="/tmp"
|
||||||
export CCACHE_COMPILERCHECK="string:toolchain-${TOOLCHAINVER} ${BUILD_ARCH}"
|
export CCACHE_COMPILERCHECK="string:toolchain-${TOOLCHAINVER} ${BUILD_ARCH}"
|
||||||
@@ -2329,7 +2355,7 @@ shell)
|
|||||||
|
|
||||||
# enter a shell inside LFS chroot
|
# enter a shell inside LFS chroot
|
||||||
# may be used to changed kernel settings
|
# may be used to changed kernel settings
|
||||||
prepareenv
|
prepareenv --network
|
||||||
entershell
|
entershell
|
||||||
;;
|
;;
|
||||||
clean)
|
clean)
|
||||||
|
|||||||
Reference in New Issue
Block a user