From 4abea243103bec9d84324fa1ed382574d8dc7d10 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Sun, 17 Dec 2017 11:15:42 -0700 Subject: [PATCH] Avoid loading settings twice --- Build Linux | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Build Linux b/Build Linux index 2186ff41..59ee9149 100755 --- a/Build Linux +++ b/Build Linux @@ -68,7 +68,24 @@ function copy_archiso() { rmdir "$LIVE_DIR/airootfs/etc/udev" --ignore-fail-on-non-empty } -function copy_settings() { +function load_settings() { + # Check if settings already loaded + ## Code based on StackOverflow Q&A + ## Question: https://stackoverflow.com/q/3601515 + ## Asked by: https://stackoverflow.com/users/260127/prosseek + ## Edited by: https://stackoverflow.com/users/3924118/nbro + ## Answer: https://stackoverflow.com/a/13864829 + ## Answer by: https://stackoverflow.com/users/1633643/lionel + ## Answer edit: https://stackoverflow.com/users/-1/community + if [ -z ${KIT_NAME_FULL+x} ]; then + # KIT_NAME_FULL is unset + : # pass + else + # KIT_NAME_FULL is set + return 0 # Skip loading settings from main.py + fi + + # Copy settings if [[ ! -e "$BUILD_DIR/main.py" ]] || ask "Overwrite main.py?"; then cp -bv "$ROOT_DIR/.bin/Scripts/settings/main.py" "$BUILD_DIR/main.py" fi @@ -254,7 +271,7 @@ function build_full() { # Prep for build cleanup install_deps - copy_settings + load_settings update_repo copy_archiso update_archlive @@ -265,12 +282,12 @@ function build_full() { # Check input case $1 in --build-arch) - copy_settings + load_settings build_arch ;; --copy-archiso) - copy_settings + load_settings copy_archiso update_archlive ;;