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