]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
make.sh: run_command: Fix basedir in and outside the chroot
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 5 Jul 2024 10:43:26 +0000 (10:43 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Jul 2024 15:39:44 +0000 (15:39 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
make.sh

diff --git a/make.sh b/make.sh
index bbd21b91d4bc789765e5a3aa3db87da1338e89e5..0d146903cad19ae4c5c8ef97b695edca29b77e63 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -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