Set default vars in not defined in config

This commit is contained in:
Dennis ten Hoove 2023-12-10 20:14:42 +01:00
parent 3402eedcde
commit 69389b4511

13
arkdep
View file

@ -23,13 +23,13 @@ if [[ ! -n $1 ]]; then
arkdep deploy
Check for updates, if available download and deploy
arkdep deploy arkanelinux-dev
arkdep deploy test-arkanelinux-kde
Download and deploy the latest release of the defined image variant
arkdep deploy - stable_v1
Download the defined image release from the default variant
arkdep deploy arkanelinux-dev stable_v1
arkdep deploy test-arkanelinux-kde stable_v1
Download the defined image release from the specified variant
arkdep remove stable_v1
@ -46,6 +46,13 @@ declare -r arkdep_dir='/arkdep/'
#
source $(readlink -m $arkdep_dir/config)
# Set default variables if config variables are undefined
[[ -z ${enable_overlay+x} ]] && enable_overlay=1 && printf '\e[1;33m<!>\e[0m\e[1m enable_overlay not defined in config, using default\e[0m\n'
[[ -z ${repo_url+x} ]] && repo_url='https://arkanelinux.org/arkdep' && printf '\e[1;33m<!>\e[0m\e[1m repo_url not defined in config, using default\e[0m\n'
[[ -z ${repo_default_image+x} ]] && repo_default_image='arkanelinux' && printf '\e[1;33m<!>\e[0m\e[1m repo_default_image not defined in config, using default\e[0m\n'
[[ -z ${deploy_keep+x} ]] && deploy_keep=3 && printf '\e[1;33m<!>\e[0m\e[1m deploy_config not defined in config, using default\e[0m\n'
[[ -z ${clean_cache_on_remove+x} ]] && clean_cache_on_remove=1 && printf '\e[1;33m<!>\e[0m\e[1m clean_cache_on_remove not defined in config, using default\e[0m\n'
## Common functions
#
# Cleanup and quit if error
@ -56,7 +63,7 @@ cleanup_and_quit () {
# Ensure we do not try to remove our current deployment
if grep "$(readlink -m $arkdep_dir/deployments/$deployment)" /proc/cmdline > /dev/null; then
printf "\e[1;33m<!>\e[0m\e[1m Cleanup target is current active deployment, skipping\e[0m\n"
printf '\e[1;33m<!>\e[0m\e[1m Cleanup target is current active deployment, skipping\e[0m\n'
exit 1
fi