cli args management improved + yggInit usage frequency optimized

This commit is contained in:
shakasan 2018-05-30 13:15:57 +02:00
parent bc8a46fd5d
commit d369bdbdca
3 changed files with 90 additions and 55 deletions

View file

@ -574,6 +574,7 @@ function dispLogo () {
printf " ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝╚══════╝\n" printf " ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝╚══════╝\n"
printf "$BOLDROUGE Customize Linux Mint & Ubuntu derivatives made easier\n" printf "$BOLDROUGE Customize Linux Mint & Ubuntu derivatives made easier\n"
printf "$BOLDBLANC ver "$version" - GPLv3 - Francois B. (Makotosan) - makotonoblog.be\n" printf "$BOLDBLANC ver "$version" - GPLv3 - Francois B. (Makotosan) - makotonoblog.be\n"
printf $NORMAL
printf "\n" printf "\n"
} }

View file

@ -36,6 +36,12 @@ cDate=$(date +%d-%m-%Y)
# #
repoAdded=0 repoAdded=0
#
# ygginit flag for CLI mode
#
ygginitCount=0
# #
# shell color codes # shell color codes
# #

View file

@ -54,16 +54,22 @@ echo "--[ Yggdrasil log ]--[ "$cDate" ]--[ "$cTime" ]-----------------------" >>
# Headless Mode # # Headless Mode #
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# display logo in CLI mode
[[ $# -gt 0 ]] && dispLogo
# #
# arguments/options management with getopts # arguments/options management with getopts
while getopts ":h,v,f,c,u,a,d,q,s,t,n,g,w,p,k,T" option; do while getopts ":h,v,f,c,u,a,d,q,s,t,n,g,w,p,k,T" option; do
case "$option" in case "$option" in
a) # install all apps a) # install all apps
msg "Initializing" if [ "$ygginitCount" -eq "0" ]; then
yggInit msg "Initializing"
msg "Updating the system" yggInit
updateSystem msg "Updating the system"
updateSystem
ygginitCount=$(($ygginitCount+1))
fi
msg "Installing Apps" msg "Installing Apps"
installBase installBase
installOffice installOffice
@ -97,13 +103,15 @@ while getopts ":h,v,f,c,u,a,d,q,s,t,n,g,w,p,k,T" option; do
installTeamViewer13 installTeamViewer13
installXnViewMP installXnViewMP
toolAutoremove toolAutoremove
exit
;; ;;
f) # full install f) # full install
msg "Initializing" if [ "$ygginitCount" -eq "0" ]; then
yggInit msg "Initializing"
msg "Updating the system" yggInit
updateSystem msg "Updating the system"
updateSystem
ygginitCount=$(($ygginitCount+1))
fi
msg "Installing Apps" msg "Installing Apps"
installBase installBase
installOffice installOffice
@ -142,89 +150,106 @@ while getopts ":h,v,f,c,u,a,d,q,s,t,n,g,w,p,k,T" option; do
installTeamViewer13 installTeamViewer13
installXnViewMP installXnViewMP
toolAutoremove toolAutoremove
exit
;; ;;
c) # install themes and icons c) # install themes and icons
msg "Initializing" if [ "$ygginitCount" -eq "0" ]; then
yggInit msg "Initializing"
msg "Updating the system" yggInit
updateSystem msg "Updating the system"
updateSystem
ygginitCount=$(($ygginitCount+1))
fi
msg "Installing Icons/Themes" msg "Installing Icons/Themes"
installIcons installIcons
installThemes installThemes
exit
;; ;;
w) # nitrogen w) # nitrogen
msg "Initializing" if [ "$ygginitCount" -eq "0" ]; then
yggInit msg "Initializing"
msg "Updating the system" yggInit
updateSystem msg "Updating the system"
updateSystem
ygginitCount=$(($ygginitCount+1))
fi
msg "Installing Nitrogen" msg "Installing Nitrogen"
installNitrogen installNitrogen
exit
;; ;;
d) # install Unbound DNS Cache d) # install Unbound DNS Cache
msg "Initializing" if [ "$ygginitCount" -eq "0" ]; then
yggInit msg "Initializing"
msg "Updating the system" yggInit
updateSystem msg "Updating the system"
updateSystem
ygginitCount=$(($ygginitCount+1))
fi
msg "Installing Unbound" msg "Installing Unbound"
installUnbound installUnbound
exit
;; ;;
q) # cardreader q) # cardreader
msg "Initializing" if [ "$ygginitCount" -eq "0" ]; then
yggInit msg "Initializing"
msg "Updating the system" yggInit
updateSystem msg "Updating the system"
updateSystem
ygginitCount=$(($ygginitCount+1))
fi
msg "Installing Card Readers Apps" msg "Installing Card Readers Apps"
installCardReader installCardReader
exit
;; ;;
s) # solaar for logitech devices s) # solaar for logitech devices
msg "Initializing" if [ "$ygginitCount" -eq "0" ]; then
yggInit msg "Initializing"
msg "Updating the system" yggInit
updateSystem msg "Updating the system"
updateSystem
ygginitCount=$(($ygginitCount+1))
fi
msg "Installing Solaar" msg "Installing Solaar"
installSolaar installSolaar
exit
;; ;;
t) # tlp (laptop or low energy usage) t) # tlp (laptop or low energy usage)
msg "Initializing" if [ "$ygginitCount" -eq "0" ]; then
yggInit msg "Initializing"
msg "Updating the system" yggInit
updateSystem msg "Updating the system"
updateSystem
ygginitCount=$(($ygginitCount+1))
fi
msg "Installing TLP" msg "Installing TLP"
installTLP installTLP
exit
;; ;;
n) # latest nvidia driver (see menus if need older version) n) # latest nvidia driver (see menus if need older version)
msg "Initializing" if [ "$ygginitCount" -eq "0" ]; then
yggInit msg "Initializing"
msg "Updating the system" yggInit
updateSystem msg "Updating the system"
updateSystem
ygginitCount=$(($ygginitCount+1))
fi
msg "Installing Nvidia Latest Driver" msg "Installing Nvidia Latest Driver"
installNvidia396 installNvidia396
exit
;; ;;
g) # latest feee graphic drivers, mesa, ... g) # latest feee graphic drivers, mesa, ...
msg "Initializing" if [ "$ygginitCount" -eq "0" ]; then
yggInit msg "Initializing"
msg "Updating the system" yggInit
updateSystem msg "Updating the system"
updateSystem
ygginitCount=$(($ygginitCount+1))
fi
msg "Installing Free Graphic Drivers" msg "Installing Free Graphic Drivers"
installOibaf installOibaf
exit
;; ;;
k) k)
msg "Initializing" if [ "$ygginitCount" -eq "0" ]; then
yggInit msg "Initializing"
msg "Updating the system" yggInit
updateSystem msg "Updating the system"
updateSystem
ygginitCount=$(($ygginitCount+1))
fi
msg "Updating Kernel" msg "Updating Kernel"
kernelUpdate kernelUpdate
exit
;; ;;
u) u)
msg "Initializing" msg "Initializing"
@ -258,6 +283,9 @@ while getopts ":h,v,f,c,u,a,d,q,s,t,n,g,w,p,k,T" option; do
esac esac
done done
# if CLI mode, no need to run the menus...
[[ $# -gt 0 ]] && exit
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# Menu Mode # # Menu Mode #
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#