mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-19 00:30:05 +01:00
convert: Support -y
This commit is contained in:
@@ -265,19 +265,27 @@ if [ "$#" -eq 1 ]; then
|
||||
elif ! grep -qw ".bastille" "${bastille_jailsdir}/${TARGET}/fstab"; then
|
||||
error_exit "[ERROR]: ${TARGET} is not a thin container."
|
||||
fi
|
||||
|
||||
# Make sure the user agree with the conversion
|
||||
# Be interactive here since this cannot be easily undone
|
||||
while :; do
|
||||
warn "\n[WARNING]: Jail conversion from thin to thick can't be undone!\n"
|
||||
# shellcheck disable=SC2162
|
||||
|
||||
# Ask if user is sure they want to convert the jail
|
||||
# but only if AUTO_YES=0
|
||||
if [ "${AUTO_YES}" -ne 1 ]; then
|
||||
warn "/n[WARNING]: Jail conversion from thin to thick can't be undone!\n"
|
||||
# shellcheck disable=SC3045
|
||||
read -p "Do you really wish to convert '${TARGET}' into a thick container? [y/N]:" yn
|
||||
case ${yn} in
|
||||
[Yy]) start_convert;;
|
||||
[Nn]) exit 0;;
|
||||
read -p "Are you sure you want to continue? [y|n]:" _answer
|
||||
case "${_answer}" in
|
||||
[Yy]|[Yy][Ee][Ss])
|
||||
start_convert
|
||||
;;
|
||||
[Nn]|[Nn][Oo])
|
||||
error_exit "[ERROR]: Cancelled by user."
|
||||
;;
|
||||
*)
|
||||
error_exit "[ERROR]: Invalid input. Please answer 'y' or 'n'."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
elif [ "${AUTO_YES}" -eq 1 ]; then
|
||||
start_convert
|
||||
fi
|
||||
|
||||
elif [ "$#" -eq 2 ]; then
|
||||
|
||||
@@ -292,4 +300,4 @@ elif [ "$#" -eq 2 ]; then
|
||||
convert_jail_to_release "${TARGET}" "${CONVERT_RELEASE}"
|
||||
else
|
||||
usage
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user