Skip to content

Commit 8f4f2f4

Browse files
authored
Whiptail: Improve Dialogue to work with ESC (#6003)
1 parent f15e4ea commit 8f4f2f4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

misc/build.func

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ write_config() {
227227
if whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "Write configfile" --yesno "Do you want to write the selections to a config file?" 10 60; then
228228
FILEPATH="/opt/community-scripts/${NSAPP}.conf"
229229
if [[ ! -f $FILEPATH ]]; then
230-
cat <<EOF >"$FILEPATH"
230+
cat <<EOF >"$FILEPATH"
231231
# ${NSAPP} Configuration File
232232
# Generated on $(date)
233233

@@ -264,7 +264,7 @@ EOF
264264
echo -e "${INFO}${BOLD}${RD}Configuration file already exists at ${FILEPATH}${CL}"
265265
if whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "Overwrite configfile" --yesno "Do you want to overwrite the existing config file?" 10 60; then
266266
rm -f "$FILEPATH"
267-
cat <<EOF >"$FILEPATH"
267+
cat <<EOF >"$FILEPATH"
268268
# ${NSAPP} Configuration File
269269
# Generated on $(date)
270270

@@ -875,17 +875,18 @@ install_script() {
875875
header_info
876876
while true; do
877877

878-
CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --menu "Choose an option:" \
878+
TMP_CHOICE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \
879879
18 60 6 \
880880
"1" "Default Settings" \
881881
"2" "Default Settings (with verbose)" \
882882
"3" "Advanced Settings" \
883883
"4" "Use Config File" \
884884
"5" "Diagnostic Settings" \
885-
"6" "Exit" --nocancel --default-item "1" 3>&1 1>&2 2>&3)
885+
"6" "Exit" \
886+
--default-item "1" 3>&1 1>&2 2>&3) || true
886887

887-
if [ $? -ne 0 ]; then
888-
echo -e "${CROSS}${RD} Menu canceled. Exiting.${CL}"
888+
if [ -z "$TMP_CHOICE" ]; then
889+
echo -e "\n${CROSS}${RD}Menu canceled. Exiting script.${CL}\n"
889890
exit 0
890891
fi
891892

@@ -943,11 +944,11 @@ install_script() {
943944

944945
;;
945946
6)
946-
echo -e "${CROSS}${RD}Exiting.${CL}"
947+
echo -e "\n${CROSS}${RD}Script terminated. Have a great day!${CL}\n"
947948
exit 0
948949
;;
949950
*)
950-
echo -e "${CROSS}${RD}Invalid option, please try again.${CL}"
951+
echo -e "\n${CROSS}${RD}Invalid option, please try again.${CL}\n"
951952
;;
952953
esac
953954
done

0 commit comments

Comments
 (0)