Browse Source

More multi-profile work

bryan 2 years ago
parent
commit
860631cf7d
1 changed files with 3 additions and 1 deletions
  1. 3 1
      openwrtbuilder

+ 3 - 1
openwrtbuilder

@@ -526,6 +526,9 @@ init() {
 
 
     debug || echo "To enable debugging output, use --debug or -d"
     debug || echo "To enable debugging output, use --debug or -d"
 
 
+    # Save the script directory
+    SCRIPTDIR="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit $? ; pwd -P)"
+
     if [[ -e "/etc/os-release" ]]; then
     if [[ -e "/etc/os-release" ]]; then
         source "/etc/os-release"
         source "/etc/os-release"
     else
     else
@@ -629,7 +632,6 @@ main() {
         declare -gn P_ARR="$profile"
         declare -gn P_ARR="$profile"
 
 
         # Fallback to SCRIPTDIR if BUILDROOT has not been set
         # Fallback to SCRIPTDIR if BUILDROOT has not been set
-        SCRIPTDIR="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit $? ; pwd -P)"
         BUILDROOT="${BUILDROOT:=$SCRIPTDIR}"
         BUILDROOT="${BUILDROOT:=$SCRIPTDIR}"
         FILESDIR="${FILESDIR:=$BUILDROOT/files}"
         FILESDIR="${FILESDIR:=$BUILDROOT/files}"