Skip to content

Commit

Permalink
Allow disabling all installation steps with the EXECUTE_ALL_STEPS var
Browse files Browse the repository at this point in the history
  • Loading branch information
nothingface0 committed Apr 5, 2024
1 parent ab7a5af commit 8139e50
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions deploy_dqmgui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ set -ex
# Main directory we're installing into.
INSTALLATION_DIR=/data/srv

# Default value set for each step flag. Set this to 0 to skip all steps.
# This helps if you want to only run only a few steps of the installation only.
EXECUTE_ALL_STEPS=1

# This scipt's directory
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)

Expand Down Expand Up @@ -555,14 +559,6 @@ declare -a installation_steps=(preliminary_checks
clean_acrontab
install_acrontab)

# Create dynamic flags to selectively disable/enable steps of the installation
# Those flags are named "do_" with the name of the function, e.g. "do_install_yui" for
# the "install_yui" step and "do_check_dependencies" for "check_dependencies".
# We set those flags to 1 by default.
for step in "${installation_steps[@]}"; do
eval "do_${step}=1"
done

# Parse command line arguments -- use <key>=<value> to override the flags mentioned above.
# e.g. do_install_yui=0
for ARGUMENT in "$@"; do
Expand All @@ -572,6 +568,20 @@ for ARGUMENT in "$@"; do
eval "$KEY=$VALUE"
done

# Create dynamic flags to selectively disable/enable steps of the installation
# Those flags are named "do_" with the name of the function, e.g. "do_install_yui" for
# the "install_yui" step and "do_check_dependencies" for "check_dependencies".
# We set those flags to the value of EXECUTE_ALL_STEPS by default.
for step in "${installation_steps[@]}"; do
flag_name="do_${step}"
if [ -z "${!flag_name}" ]; then
echo "${flag_name} not defined"
eval "do_${step}=$EXECUTE_ALL_STEPS"
else
echo "${flag_name} defined and is ${!flag_name}"
fi
done

## Internal temporary paths
ROOT_TMP_DIR="${TMP_BASE_PATH}/root"
ROOT_TMP_BUILD_DIR="${TMP_BASE_PATH}/root_build"
Expand Down

0 comments on commit 8139e50

Please sign in to comment.