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
if [ "$ygginitCount" -eq "0" ]; then
msg "Initializing" msg "Initializing"
yggInit yggInit
msg "Updating the system" msg "Updating the system"
updateSystem 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
if [ "$ygginitCount" -eq "0" ]; then
msg "Initializing" msg "Initializing"
yggInit yggInit
msg "Updating the system" msg "Updating the system"
updateSystem 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
if [ "$ygginitCount" -eq "0" ]; then
msg "Initializing" msg "Initializing"
yggInit yggInit
msg "Updating the system" msg "Updating the system"
updateSystem updateSystem
ygginitCount=$(($ygginitCount+1))
fi
msg "Installing Icons/Themes" msg "Installing Icons/Themes"
installIcons installIcons
installThemes installThemes
exit
;; ;;
w) # nitrogen w) # nitrogen
if [ "$ygginitCount" -eq "0" ]; then
msg "Initializing" msg "Initializing"
yggInit yggInit
msg "Updating the system" msg "Updating the system"
updateSystem updateSystem
ygginitCount=$(($ygginitCount+1))
fi
msg "Installing Nitrogen" msg "Installing Nitrogen"
installNitrogen installNitrogen
exit
;; ;;
d) # install Unbound DNS Cache d) # install Unbound DNS Cache
if [ "$ygginitCount" -eq "0" ]; then
msg "Initializing" msg "Initializing"
yggInit yggInit
msg "Updating the system" msg "Updating the system"
updateSystem updateSystem
ygginitCount=$(($ygginitCount+1))
fi
msg "Installing Unbound" msg "Installing Unbound"
installUnbound installUnbound
exit
;; ;;
q) # cardreader q) # cardreader
if [ "$ygginitCount" -eq "0" ]; then
msg "Initializing" msg "Initializing"
yggInit yggInit
msg "Updating the system" msg "Updating the system"
updateSystem 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
if [ "$ygginitCount" -eq "0" ]; then
msg "Initializing" msg "Initializing"
yggInit yggInit
msg "Updating the system" msg "Updating the system"
updateSystem 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)
if [ "$ygginitCount" -eq "0" ]; then
msg "Initializing" msg "Initializing"
yggInit yggInit
msg "Updating the system" msg "Updating the system"
updateSystem 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)
if [ "$ygginitCount" -eq "0" ]; then
msg "Initializing" msg "Initializing"
yggInit yggInit
msg "Updating the system" msg "Updating the system"
updateSystem 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, ...
if [ "$ygginitCount" -eq "0" ]; then
msg "Initializing" msg "Initializing"
yggInit yggInit
msg "Updating the system" msg "Updating the system"
updateSystem updateSystem
ygginitCount=$(($ygginitCount+1))
fi
msg "Installing Free Graphic Drivers" msg "Installing Free Graphic Drivers"
installOibaf installOibaf
exit
;; ;;
k) k)
if [ "$ygginitCount" -eq "0" ]; then
msg "Initializing" msg "Initializing"
yggInit yggInit
msg "Updating the system" msg "Updating the system"
updateSystem 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 #
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#