Do not delete deployment if currently active
This commit is contained in:
parent
16147a7251
commit
189de128a6
1 changed files with 13 additions and 0 deletions
13
arkdep
13
arkdep
|
@ -184,6 +184,12 @@ remove_deployment () {
|
|||
[[ -z $2 ]] && \
|
||||
printf 'No deployment defined\n' && exit 1
|
||||
|
||||
# Ensure deployment is not currently active
|
||||
if grep "$2" /proc/cmdline > /dev/null; then
|
||||
printf 'Target is currently active deployment\n'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure user only provided a single target
|
||||
[[ ! -z $3 ]] && \
|
||||
printf 'Multiple targets provided, remove only accepts a single target at a time\n' && exit 1
|
||||
|
@ -440,12 +446,19 @@ deploy () {
|
|||
|
||||
# Remove old deployments
|
||||
for deployment in ${remove_deployments[@]}; do
|
||||
|
||||
# Ensure deployment is not currently active
|
||||
if grep "$deployment" /proc/cmdline > /dev/null; then
|
||||
break
|
||||
fi
|
||||
|
||||
printf "\e[1;34m-->\e[0m\e[1m Removing old deployment $deployment\e[0m\n"
|
||||
rm -v /boot/loader/entries/$deployment.conf
|
||||
btrfs property set -f -ts $(readlink -m $arkdep_dir/deployments/$deployment) ro false
|
||||
rm -rfv $(readlink -m $arkdep_dir/deployments/$deployment)
|
||||
rm -rfv $(readlink -m /boot/arkdep/$deployment)
|
||||
grep -rv $deployment $(readline -m $arkdep_dir/tracker) > $arkdep_dir/tracker
|
||||
|
||||
done
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue