[arkdep] Check if target is active deployment on remove before asking for confirmation
This commit is contained in:
parent
50f39d89ee
commit
960034ba5a
1 changed files with 8 additions and 8 deletions
16
arkdep
16
arkdep
|
@ -465,6 +465,14 @@ remove_deployment () {
|
||||||
|
|
||||||
declare target=${hits[0]}
|
declare target=${hits[0]}
|
||||||
|
|
||||||
|
printf "Removing $target\n"
|
||||||
|
|
||||||
|
# Ensure deployment is not currently active
|
||||||
|
if grep -q "$arkdep_dir/deployments/$target/rootfs" /proc/cmdline; then
|
||||||
|
printf '\e[1;33m<!>\e[0m\e[1m Target is current active deployment\e[0m\n'
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $interactive_mode -eq 1 ]] && [[ $cleanup_no_confirm -ne 1 ]] && [[ $ARKDEP_CONFIRM -ne 1 ]]; then
|
if [[ $interactive_mode -eq 1 ]] && [[ $cleanup_no_confirm -ne 1 ]] && [[ $ARKDEP_CONFIRM -ne 1 ]]; then
|
||||||
printf "$target will be removed.\n\n"
|
printf "$target will be removed.\n\n"
|
||||||
read -p 'Proceed with removal? [Y/n] ' remove_confirm
|
read -p 'Proceed with removal? [Y/n] ' remove_confirm
|
||||||
|
@ -474,14 +482,6 @@ remove_deployment () {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "Removing $target\n"
|
|
||||||
|
|
||||||
# Ensure deployment is not currently active
|
|
||||||
if grep -q "$arkdep_dir/deployments/$target/rootfs" /proc/cmdline; then
|
|
||||||
printf '\e[1;33m<!>\e[0m\e[1m Target is current active deployment\e[0m\n'
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove bootloader entry
|
# Remove bootloader entry
|
||||||
rm -rfv $arkdep_boot/loader/entries/$target.conf
|
rm -rfv $arkdep_boot/loader/entries/$target.conf
|
||||||
rm -rfv $arkdep_boot/arkdep/$target
|
rm -rfv $arkdep_boot/arkdep/$target
|
||||||
|
|
Loading…
Add table
Reference in a new issue