make.sh: run_command: Fix basedir in and outside the chroot

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2024-07-05 10:43:26 +00:00
parent 7ee70f04ea
commit 0059a357de

20
make.sh
View File

@@ -730,13 +730,17 @@ run_command() {
local pkg
local actions=()
local chroot="false"
local basedir="${BASEDIR}"
local command=()
local quiet="false"
while [ $# -gt 0 ]; do
case "${1}" in
--chroot)
chroot="true"
command+=( "enterchroot" )
# Move the basedir
basedir="/usr/src"
;;
--quiet)
@@ -762,7 +766,8 @@ run_command() {
shift
done
local command=(
# Build the command
command+=(
# Run a shell
"bash"
@@ -770,16 +775,9 @@ run_command() {
"-x"
# Run the following command
"-c" "cd /usr/src/lfs && make -f ${pkg} LFS_BASEDIR=/usr/src ${actions[@]}"
"-c" "cd ${basedir}/lfs && make -f ${pkg} LFS_BASEDIR=${basedir} ${actions[@]}"
)
# Run this in chroot?
case "${chroot}" in
true)
command=( "enterchroot" "${command[@]}" )
;;
esac
# Return code
local r=0