Add unattended mode

This commit is contained in:
LinuxSquare 2023-09-29 21:51:32 +02:00
parent acc20e9927
commit e498ededd3

View file

@ -13,6 +13,7 @@ done
# VARIABLES
declare debuglevel=3
declare dryrun=false
declare attended=true
declare bedir="$(getValueByKey 'be_env_dir')"
declare grubdir="$(getValueByKey 'grub_conf_dir')"
declare -a bootenvs
@ -23,7 +24,8 @@ operations:
$(basename ${0}) {-h --help}
$(basename ${0}) {-V --version}
$(basename ${0}) {-v --verbose}
$(basename ${0}) {-n --dryrun}"
$(basename ${0}) {-n --dryrun}
$(basename ${0}) {--noconfirm}"
}
function version() {
@ -39,7 +41,7 @@ the terms of the ${LICENSE}"
##
OPT_SHORT="hVvn"
OPT_LONG="help,version,verbose,dryrun"
OPT_LONG="help,version,verbose,dryrun,noconfirm"
TEMP=$(getopt -o ${OPT_SHORT} --long ${OPT_LONG} -n $(basename ${0}) -- "$@")
if [ "$?" != 0 ]; then
@ -65,6 +67,9 @@ while true; do
-n|--dryrun)
dryrun=true
;;
--noconfirm)
attended=false
;;
--)
shift
break
@ -104,7 +109,9 @@ chmod 755 "${grubdir}/$(getValueByKey 'filename')"
grub-mkconfig -o $(getValueByKey 'grub_cfg')
less $(getValueByKey 'grub_cfg')
if $attended; then
less $(getValueByKey 'grub_cfg')
fi
##
# SCRIPT END