Simplify logic for restarting program with authentication

This commit is contained in:
Stuart Hayhurst 2020-10-17 14:23:45 +01:00
parent 026b20a394
commit 6ba888480e

View File

@ -195,11 +195,7 @@ install() {
read -p "[ Trusted ] Specify the root password : " -t${MAX_DELAY} -s read -p "[ Trusted ] Specify the root password : " -t${MAX_DELAY} -s
[[ -n "$REPLY" ]] && { [[ -n "$REPLY" ]] && {
if [[ -n "${theme}" && -n "${screen}" ]]; then if [[ -n "${theme}" && -n "${screen}" ]]; then
if [[ ${THEME_DIR} == '/boot/grub/themes' ]]; then sudo -S <<< $REPLY "$0" "${PROG_ARGS[@]}"
sudo -S <<< $REPLY $0 --boot --${theme} --${icon} --${screen} --${custom_background}
else
sudo -S <<< $REPLY $0 --${theme} --${icon} --${screen} --${custom_background}
fi
fi fi
} || { } || {
operation_canceled operation_canceled
@ -346,11 +342,7 @@ remove() {
read -p "[ trusted ] specify the root password : " -t${MAX_DELAY} -s read -p "[ trusted ] specify the root password : " -t${MAX_DELAY} -s
[[ -n "$REPLY" ]] && { [[ -n "$REPLY" ]] && {
if [[ -n "${theme}" ]]; then if [[ -n "${theme}" ]]; then
if [[ ${THEME_DIR} == '/boot/grub/themes' ]]; then sudo -S <<< $REPLY "$0" "${PROG_ARGS[@]}"
sudo -S <<< $REPLY $0 --remove --boot --${theme}
else
sudo -S <<< $REPLY $0 --remove --${theme}
fi
fi fi
} || { } || {
operation_canceled operation_canceled
@ -377,6 +369,7 @@ if [[ $# -lt 1 ]] && [[ $UID -ne $ROOT_UID ]] && [[ ! -x /usr/bin/dialog ]] ; t
fi fi
while [[ $# -ge 1 ]]; do while [[ $# -ge 1 ]]; do
PROG_ARGS+=("${1}")
case "${1}" in case "${1}" in
-b|--boot) -b|--boot)
THEME_DIR="/boot/grub/themes" THEME_DIR="/boot/grub/themes"
@ -414,9 +407,6 @@ while [[ $# -ge 1 ]]; do
-C|--custom-background|--custom) -C|--custom-background|--custom)
custom_background='custom-background' custom_background='custom-background'
;; ;;
-D|--default-background)
custom_background='default-background'
;;
-r|--remove) -r|--remove)
remove='true' remove='true'
;; ;;