added operation canceled script

This commit is contained in:
Elian Van Cutsem 2020-01-25 17:24:33 +01:00
parent 7c7fe3f33c
commit 6f92a8c04e

View File

@ -154,8 +154,7 @@ install() {
sudo -S <<< $REPLY $0 --${theme} --${screen} sudo -S <<< $REPLY $0 --${theme} --${screen}
fi fi
} || { } || {
prompt "\n Operation canceled Bye" operation_canceled
exit 1
} }
fi fi
} }
@ -173,7 +172,7 @@ run_dialog() {
2) theme="tela" ;; 2) theme="tela" ;;
3) theme="stylish" ;; 3) theme="stylish" ;;
4) theme="slaze" ;; 4) theme="slaze" ;;
*) prompt "Canceled" ;; *) operation_canceled ;;
esac esac
tui=$(dialog --backtitle "GRUB2 THEMES" \ tui=$(dialog --backtitle "GRUB2 THEMES" \
--radiolist "Choose icon style : " 15 40 5 \ --radiolist "Choose icon style : " 15 40 5 \
@ -182,7 +181,7 @@ run_dialog() {
case "$tui" in case "$tui" in
1) icon="white" ;; 1) icon="white" ;;
2) icon="color" ;; 2) icon="color" ;;
*) prompt "Canceled" ;; *) operation_canceled ;;
esac esac
tui=$(dialog --backtitle "GRUB2 THEMES" \ tui=$(dialog --backtitle "GRUB2 THEMES" \
--radiolist "Choose your Display Resolution : " 15 40 5 \ --radiolist "Choose your Display Resolution : " 15 40 5 \
@ -193,11 +192,17 @@ run_dialog() {
1) screen="1080p" ;; 1) screen="1080p" ;;
2) screen="2k" ;; 2) screen="2k" ;;
3) screen="4k" ;; 3) screen="4k" ;;
*) prompt "Canceled" ;; *) operation_canceled ;;
esac esac
fi fi
} }
operation_canceled() {
clear
prompt "\n Operation canceled by user Bye"
exit 1
}
install_dialog() { install_dialog() {
if [ ! "$(which dialog 2> /dev/null)" ]; then if [ ! "$(which dialog 2> /dev/null)" ]; then
prompt -i "\n 'dialog' needs to be installed for this shell" prompt -i "\n 'dialog' needs to be installed for this shell"
@ -272,8 +277,7 @@ remove() {
sudo -S <<< $REPLY $0 --remove --${theme} sudo -S <<< $REPLY $0 --remove --${theme}
fi fi
} || { } || {
prompt "\n Operation canceled Bye" operation_canceled
exit 1
} }
fi fi
} }
@ -292,8 +296,7 @@ if [[ $# -lt 1 ]] && [[ $UID -ne $ROOT_UID ]]; then
[[ -n "$REPLY" ]]&& { [[ -n "$REPLY" ]]&& {
exec sudo -S <<< $REPLY $0 exec sudo -S <<< $REPLY $0
}|| { }|| {
prompt "\n Operation canceled Bye" operation_canceled
exit 1
} }
fi fi