convert: Support -y

This commit is contained in:
tschettervictor
2025-05-23 09:22:26 -06:00
committed by GitHub
parent 9798da4900
commit e2dd2280de

View File

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