Merge pull request #92 from Dragon8oy/simplify-root-args

Simplify logic for restarting program with authentication
This commit is contained in:
Vince 2020-10-17 21:36:01 +08:00 committed by GitHub
commit 30cae75f57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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'
;;