forked from evolix/evobackup
bkctld-archive/remove: confirmation defaults to 'No'
This commit is contained in:
parent
7c6fefd00b
commit
1960e9097a
|
@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
* bkctld-archive: confirmation defaults to 'No'
|
||||||
|
* bkctld-remove: confirmation defaults to 'No'
|
||||||
* bkctld-remove: remove config directory
|
* bkctld-remove: remove config directory
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
|
@ -24,13 +24,13 @@ test -d "${archive_jail_path}" && error "${jail_name}: archive already exists" 2
|
||||||
if [ "${FORCE}" != "1" ]; then
|
if [ "${FORCE}" != "1" ]; then
|
||||||
answer=""
|
answer=""
|
||||||
while :; do
|
while :; do
|
||||||
printf "> Are you sure you want to archive jail \`%s'? [Y,n,?] " "${jail_name}"
|
printf "> Are you sure you want to archive jail \`%s'? [y,N,?] " "${jail_name}"
|
||||||
read -r answer
|
read -r answer
|
||||||
case $answer in
|
case $answer in
|
||||||
[Yy]|"" )
|
[Yy] )
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
[Nn] )
|
[Nn]|"" )
|
||||||
tty -s && echo "Abort." >&2
|
tty -s && echo "Abort." >&2
|
||||||
exit 101
|
exit 101
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -28,13 +28,13 @@ fi
|
||||||
if [ "${FORCE}" != "1" ]; then
|
if [ "${FORCE}" != "1" ]; then
|
||||||
answer=""
|
answer=""
|
||||||
while :; do
|
while :; do
|
||||||
printf "> Are you sure you want to delete jail \`%s'? [Y,n,?] " "${jail_name}"
|
printf "> Are you sure you want to delete jail \`%s'? [y,N,?] " "${jail_name}"
|
||||||
read -r answer
|
read -r answer
|
||||||
case $answer in
|
case $answer in
|
||||||
[Yy]|"" )
|
[Yy] )
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
[Nn] )
|
[Nn]|"" )
|
||||||
tty -s && echo "Abort." >&2
|
tty -s && echo "Abort." >&2
|
||||||
exit 101
|
exit 101
|
||||||
;;
|
;;
|
||||||
|
@ -51,14 +51,16 @@ fi
|
||||||
|
|
||||||
rm -f "${CONFDIR}/${jail_name}"
|
rm -f "${CONFDIR}/${jail_name}"
|
||||||
rm -rf "$(jail_config_dir "${jail_name}")"
|
rm -rf "$(jail_config_dir "${jail_name}")"
|
||||||
|
|
||||||
jail_inode=$(stat --format=%i "${jail_path}")
|
jail_inode=$(stat --format=%i "${jail_path}")
|
||||||
if [ "${jail_inode}" -eq 256 ]; then
|
if [ "${jail_inode}" -eq 256 ]; then
|
||||||
/bin/btrfs subvolume delete "${jail_path}" | debug
|
/bin/btrfs subvolume delete "${jail_path}" | debug
|
||||||
else
|
else
|
||||||
rm -rf "${jail_path:?}" | debug
|
rm -rf "${jail_path:?}" | debug
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: use functions here
|
# TODO: use functions here
|
||||||
if [ -d "${incs_path}" ]; then
|
if [ -d "${incs_path}" ]; then
|
||||||
incs=$(ls "${incs_path}")
|
incs=$(ls "${incs_path}")
|
||||||
for inc in ${incs}; do
|
for inc in ${incs}; do
|
||||||
inc_inode=$(stat --format=%i "${incs_path}/${inc}")
|
inc_inode=$(stat --format=%i "${incs_path}/${inc}")
|
||||||
|
@ -70,5 +72,6 @@ if [ -d "${incs_path}" ]; then
|
||||||
done
|
done
|
||||||
rmdir --ignore-fail-on-non-empty "${incs_path}" | debug
|
rmdir --ignore-fail-on-non-empty "${incs_path}" | debug
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"${LIBDIR}/bkctld-firewall" "${jail_name}"
|
"${LIBDIR}/bkctld-firewall" "${jail_name}"
|
||||||
notice "Delete jail \`${jail_name}' : OK"
|
notice "Delete jail \`${jail_name}' : OK"
|
||||||
|
|
Loading…
Reference in a new issue