Updated Build Linux --build-iso / main.py sections
* --build-iso loads main.py from $LIVE_DIR instead of $BUILD_DIR * Ensures that the settings in $LIVE_DIR and the final ISO match * --build-iso loads main.py silently * Avoids editing the file twice under --build-all * The ownership of the $OUT_DIR and ISO are set to $REAL_USER instead of root
This commit is contained in:
parent
d9155b9b7e
commit
6f80f0e708
1 changed files with 18 additions and 11 deletions
29
Build Linux
29
Build Linux
|
|
@ -71,20 +71,26 @@ function load_settings() {
|
||||||
## Answer: https://stackoverflow.com/a/13864829
|
## Answer: https://stackoverflow.com/a/13864829
|
||||||
## Answer by: https://stackoverflow.com/users/1633643/lionel
|
## Answer by: https://stackoverflow.com/users/1633643/lionel
|
||||||
## Answer edit: https://stackoverflow.com/users/-1/community
|
## Answer edit: https://stackoverflow.com/users/-1/community
|
||||||
|
_main_path="$BUILD_DIR/main.py"
|
||||||
if [ ! -z ${KIT_NAME_FULL+x} ]; then
|
if [ ! -z ${KIT_NAME_FULL+x} ]; then
|
||||||
# KIT_NAME_FULL is set
|
# KIT_NAME_FULL is set
|
||||||
return 0 # Skip loading settings from main.py
|
return 0 # Skip loading settings from main.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy settings
|
if [[ "${1:-}" == "--edit" ]]; then
|
||||||
if [[ ! -e "$BUILD_DIR/main.py" ]] || ask "Overwrite main.py?"; then
|
# Copy settings
|
||||||
cp -bv "$ROOT_DIR/.bin/Scripts/settings/main.py" "$BUILD_DIR/main.py"
|
if [[ ! -e "$BUILD_DIR/main.py" ]] || ask "Overwrite main.py?"; then
|
||||||
dos2unix "$BUILD_DIR/main.py"
|
cp -bv "$ROOT_DIR/.bin/Scripts/settings/main.py" "$BUILD_DIR/main.py"
|
||||||
fi
|
dos2unix "$BUILD_DIR/main.py"
|
||||||
|
fi
|
||||||
|
|
||||||
# Edit settings
|
# Edit settings
|
||||||
read -p "Press Enter to open settings... " -r
|
read -p "Press Enter to open settings... " -r
|
||||||
"$EDITOR" "$BUILD_DIR/main.py"
|
"$EDITOR" "$BUILD_DIR/main.py"
|
||||||
|
else
|
||||||
|
# Load settings from $LIVE_DIR
|
||||||
|
_main_path="$LIVE_DIR/airootfs/usr/local/bin/settings/main.py"
|
||||||
|
fi
|
||||||
|
|
||||||
# Load settings
|
# Load settings
|
||||||
while read line; do
|
while read line; do
|
||||||
|
|
@ -92,7 +98,7 @@ function load_settings() {
|
||||||
line="$(echo "$line" | sed -r 's/[\r\n]+//')"
|
line="$(echo "$line" | sed -r 's/[\r\n]+//')"
|
||||||
eval "$line"
|
eval "$line"
|
||||||
fi
|
fi
|
||||||
done < "$BUILD_DIR/main.py"
|
done < "$_main_path"
|
||||||
}
|
}
|
||||||
|
|
||||||
function copy_live_env() {
|
function copy_live_env() {
|
||||||
|
|
@ -325,6 +331,7 @@ function build_iso() {
|
||||||
|
|
||||||
echo "Reverting permissions..."
|
echo "Reverting permissions..."
|
||||||
chown $REAL_USER:$REAL_USER "$LIVE_DIR" -R
|
chown $REAL_USER:$REAL_USER "$LIVE_DIR" -R
|
||||||
|
chown $REAL_USER:$REAL_USER "$OUT_DIR" -R
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_full() {
|
function build_full() {
|
||||||
|
|
@ -338,7 +345,7 @@ function build_full() {
|
||||||
cleanup
|
cleanup
|
||||||
fix_kit_permissions
|
fix_kit_permissions
|
||||||
install_deps
|
install_deps
|
||||||
load_settings
|
load_settings --edit
|
||||||
update_repo
|
update_repo
|
||||||
copy_live_env
|
copy_live_env
|
||||||
update_live_env
|
update_live_env
|
||||||
|
|
@ -370,7 +377,7 @@ case ${1:-} in
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-p|--prep-live-env)
|
-p|--prep-live-env)
|
||||||
load_settings
|
load_settings --edit
|
||||||
copy_live_env
|
copy_live_env
|
||||||
update_live_env
|
update_live_env
|
||||||
echo Done
|
echo Done
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue