Using safer bash config for Build Linux script

This commit is contained in:
2Shirt 2018-01-27 15:19:04 -07:00
parent 3d8af3cb0a
commit 1cd3571253

View file

@ -2,6 +2,11 @@
# #
## Wizard Kit: Live Linux Build Tool ## Wizard Kit: Live Linux Build Tool
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
# Prep # Prep
DATE="$(date +%F)" DATE="$(date +%F)"
DATETIME="$(date +%F_%H%M)" DATETIME="$(date +%F_%H%M)"
@ -21,7 +26,7 @@ elif which vim >/dev/null 2>&1; then
else else
EDITOR=vi EDITOR=vi
fi fi
if which sudo >/dev/null 2>&1; then if [ ! -z ${SUDO_USER+x} ]; then
REAL_USER="$SUDO_USER" REAL_USER="$SUDO_USER"
fi fi
@ -243,15 +248,15 @@ function update_repo() {
# Archive current files # Archive current files
if [[ -d "$REPO_DIR" ]]; then if [[ -d "$REPO_DIR" ]]; then
mkdir "$BUILD_DIR/Archive" 2>/dev/null mkdir -p "$BUILD_DIR/Archive" 2>/dev/null
archive="$BUILD_DIR/Archive/$(date "+%F_%H%M%S")" archive="$BUILD_DIR/Archive/$(date "+%F_%H%M%S")"
mv -bv "$REPO_DIR" "$archive" mv -bv "$REPO_DIR" "$archive"
fi fi
sleep 1s sleep 1s
# Build custom repo packages # Build custom repo packages
mkdir "$REPO_DIR" 2>/dev/null mkdir -p "$REPO_DIR" 2>/dev/null
mkdir "$TEMP_DIR" 2>/dev/null mkdir -p "$TEMP_DIR" 2>/dev/null
pushd "$TEMP_DIR" >/dev/null pushd "$TEMP_DIR" >/dev/null
while read -r p; do while read -r p; do
echo "Building: $p" echo "Building: $p"
@ -325,32 +330,38 @@ function build_full() {
} }
# Check input # Check input
case $1 in case ${1:-} in
-b|--build-full) -b|--build-full)
build_full build_full
echo Done
;; ;;
-f|--fix-perms) -f|--fix-perms)
fix_kit_permissions fix_kit_permissions
echo Done
;; ;;
-i|--install-deps) -i|--install-deps)
install_deps install_deps
echo Done
;; ;;
-o|--build-iso) -o|--build-iso)
load_settings load_settings
build_iso build_iso
echo Done
;; ;;
-p|--prep-live-env) -p|--prep-live-env)
load_settings load_settings
copy_live_env copy_live_env
update_live_env update_live_env
echo Done
;; ;;
-u|--update-repo) -u|--update-repo)
update_repo update_repo
echo Done
;; ;;
*) *)