feat: allow specific install targets
This commit is contained in:
@@ -12,6 +12,14 @@ A local repository can be installed by running:
|
||||
|
||||
./script/install
|
||||
|
||||
Once installed, updates can be applied by running:
|
||||
|
||||
dots
|
||||
|
||||
A specific script can be installed by running:
|
||||
|
||||
dots script1 script2 ...
|
||||
|
||||
### Automated setup
|
||||
|
||||
This repository can be installed without a local copy
|
||||
|
||||
@@ -5,8 +5,8 @@ set -eo pipefail
|
||||
# Script to run all install scripts contained in install.d
|
||||
#
|
||||
|
||||
printf "\n\t <<< dots installer >>>\n"
|
||||
printf "\t========================\n\n\n"
|
||||
printf "\n\t <<< dots >>>\n"
|
||||
printf "\t==============\n\n\n"
|
||||
|
||||
# Prevent running as root
|
||||
if [[ $EUID -eq 0 && -z "$SKIP_SUDO_CHECK" ]]; then
|
||||
@@ -49,12 +49,28 @@ if [[ ! -f "$log_target" ]]; then
|
||||
fi
|
||||
log_abs_target=$(readlink -f "$log_target")
|
||||
|
||||
# Set up targets
|
||||
targets=($@)
|
||||
|
||||
# Run install scripts
|
||||
install() {
|
||||
run() {
|
||||
echo "Running \"$(basename "$0")\" at \"$(date)\""
|
||||
echo "Running as \"$(whoami)\" on \"$(hostname)\""
|
||||
if [[ -n "$targets" ]]; then
|
||||
echo "Running ${#targets[@]} install target(s): ${targets[@]}"
|
||||
else
|
||||
echo "Running all install targets"
|
||||
fi
|
||||
|
||||
for script in $install_dir/*.sh; do
|
||||
if [[ -n "$targets" ]]; then
|
||||
script_name=$(basename $script .sh)
|
||||
script_name=${script_name#*-}
|
||||
if [[ ! " ${targets[*]} " =~ " $script_name " ]]; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
script_name=$(basename $script)
|
||||
printf "\n\n<<< $script_name:\n"
|
||||
source $script
|
||||
@@ -63,7 +79,7 @@ install() {
|
||||
done
|
||||
}
|
||||
echo "install: Logging to \"$log_abs_target\""
|
||||
install 2>&1 | tee "$log_abs_target"
|
||||
run 2>&1 | tee "$log_abs_target"
|
||||
|
||||
# Clean up
|
||||
unset uuid dir install_dir log_dir log_abs_target log_target
|
||||
|
||||
Reference in New Issue
Block a user