Consolidate some scripts; simplify unneeded logic; take OS as arg
This commit is contained in:
@@ -1,31 +1,22 @@
|
||||
#!/bin/zsh
|
||||
|
||||
local single_script_filter=""
|
||||
local dry="0"
|
||||
|
||||
execute() {
|
||||
log "execute $@"
|
||||
[[ $dry != "1" ]] && "$@"
|
||||
}
|
||||
|
||||
log() {
|
||||
[[ $dry != "1" ]] && echo "$@" || echo "[DRY RUN]: $@"
|
||||
}
|
||||
|
||||
while [[ $# > 0 ]]; do
|
||||
[[ $1 == "--dry" ]] && dry="1" || single_script_filter="$1"
|
||||
single_script_filter="$1" # if using param, export BOX_SETUP_OS first if needed
|
||||
shift
|
||||
done
|
||||
|
||||
log "install_programs // single_script_filter: $single_script_filter"
|
||||
echo "---- installing programs ----------------------"
|
||||
|
||||
local scripts=$(find ./installs_and_builds -maxdepth 1 -mindepth 1 -type f | sort)
|
||||
for script in ${=scripts}; do
|
||||
if [[ -x $script ]]; then
|
||||
if echo "$script" | grep -qv "$single_script_filter"; then
|
||||
log "filter is $single_script_filter // ignoring: $script"
|
||||
continue
|
||||
continue # $single_script_filter set, ignore others
|
||||
fi
|
||||
execute ./$script
|
||||
echo "executing: $script"
|
||||
./$script
|
||||
fi
|
||||
done
|
||||
|
||||
|
Reference in New Issue
Block a user