From 6ba888480e2a27ba2e7f70d636a7420814dc8654 Mon Sep 17 00:00:00 2001 From: Stuart Hayhurst Date: Sat, 17 Oct 2020 14:23:45 +0100 Subject: [PATCH] Simplify logic for restarting program with authentication --- install.sh | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/install.sh b/install.sh index 41819e3..ecd2e59 100755 --- a/install.sh +++ b/install.sh @@ -195,11 +195,7 @@ install() { read -p "[ Trusted ] Specify the root password : " -t${MAX_DELAY} -s [[ -n "$REPLY" ]] && { if [[ -n "${theme}" && -n "${screen}" ]]; then - if [[ ${THEME_DIR} == '/boot/grub/themes' ]]; then - sudo -S <<< $REPLY $0 --boot --${theme} --${icon} --${screen} --${custom_background} - else - sudo -S <<< $REPLY $0 --${theme} --${icon} --${screen} --${custom_background} - fi + sudo -S <<< $REPLY "$0" "${PROG_ARGS[@]}" fi } || { operation_canceled @@ -346,11 +342,7 @@ remove() { read -p "[ trusted ] specify the root password : " -t${MAX_DELAY} -s [[ -n "$REPLY" ]] && { if [[ -n "${theme}" ]]; then - if [[ ${THEME_DIR} == '/boot/grub/themes' ]]; then - sudo -S <<< $REPLY $0 --remove --boot --${theme} - else - sudo -S <<< $REPLY $0 --remove --${theme} - fi + sudo -S <<< $REPLY "$0" "${PROG_ARGS[@]}" fi } || { operation_canceled @@ -377,6 +369,7 @@ if [[ $# -lt 1 ]] && [[ $UID -ne $ROOT_UID ]] && [[ ! -x /usr/bin/dialog ]] ; t fi while [[ $# -ge 1 ]]; do + PROG_ARGS+=("${1}") case "${1}" in -b|--boot) THEME_DIR="/boot/grub/themes" @@ -414,9 +407,6 @@ while [[ $# -ge 1 ]]; do -C|--custom-background|--custom) custom_background='custom-background' ;; - -D|--default-background) - custom_background='default-background' - ;; -r|--remove) remove='true' ;;