yggdrasil_ng/yggdrasil.sh

307 lines
7.1 KiB
Bash
Raw Permalink Normal View History

2017-12-27 13:54:15 +00:00
#!/bin/bash
#------------------------------------------------------------------------------#
# Yggdrasil NG #
# compatibility : Mint 18, Ubuntu 16.04, Elementary and other derivatives #
# author : Francois B. (Makotosan/Shakasan) #
# licence : GPLv3 #
2018-01-23 17:50:18 +00:00
# website : https://makotonoblog.be/ #
2017-12-27 13:54:15 +00:00
#------------------------------------------------------------------------------#
#
2017-12-30 22:08:45 +00:00
# include functions and vars from external files
2017-12-27 13:54:15 +00:00
#
dir=$(dirname $0)
if [ ! $dir == "/opt/yggdrasil" ]; then
source /opt/yggdrasil/vars.sh
source /opt/yggdrasil/core_functions.sh
source /opt/yggdrasil/repo_functions.sh
source /opt/yggdrasil/install_functions.sh
source /opt/yggdrasil/menus_functions.sh
source /opt/yggdrasil/tools_functions.sh
else
source $(dirname $0)/vars.sh
source $(dirname $0)/core_functions.sh
source $(dirname $0)/repo_functions.sh
source $(dirname $0)/install_functions.sh
source $(dirname $0)/menus_functions.sh
source $(dirname $0)/tools_functions.sh
fi
2017-12-27 13:54:15 +00:00
#
2017-12-30 22:08:45 +00:00
# check if the script is running in root/sudo
2017-12-29 10:46:53 +00:00
# NEVER run the script as root or with sudo !!!!
2017-12-30 22:08:45 +00:00
#
2017-12-29 10:46:53 +00:00
if ! [ "$UID" -ne "0" ]; then
printf "\n"
2018-03-22 10:36:39 +00:00
printf $BOLDROUGE"Yggdrasil can't be run as root/sudo, please retry as normal user"$NORMAL
2017-12-29 10:46:53 +00:00
printf "\n\n"
exit
fi
2017-12-27 13:54:15 +00:00
2017-12-30 22:08:45 +00:00
#
2017-12-27 13:54:15 +00:00
# add a mark to the log file at every script run
2017-12-30 22:08:45 +00:00
#
2017-12-29 15:43:47 +00:00
echo "--[ Yggdrasil log ]--[ "$cDate" ]--[ "$cTime" ]-----------------------" >> $logFile
2017-12-27 13:54:15 +00:00
2017-12-30 22:08:45 +00:00
#-----------------------------------------------------------------------------#
# Headless Mode #
#-----------------------------------------------------------------------------#
2017-12-29 10:46:53 +00:00
#
# arguments/options management with getopts
2018-03-30 07:39:12 +00:00
while getopts ":h,v,f,c,u,a,d,q,s,t,n,g,w,p,k,T" option; do
2017-12-29 10:46:53 +00:00
case "$option" in
a) # install all apps
2018-03-30 07:39:12 +00:00
msg "Initializing"
2018-03-14 18:34:00 +00:00
yggInit
2018-03-30 07:39:12 +00:00
msg "Updating the system"
2018-01-05 06:38:36 +00:00
updateSystem
2018-03-30 07:39:12 +00:00
msg "Installing Apps"
2017-12-30 21:47:59 +00:00
installBase
2018-03-21 07:41:43 +00:00
installOffice
2017-12-30 21:47:59 +00:00
installBurningTools
installEbook
installGames
2018-03-30 07:39:12 +00:00
installSteam
2017-12-30 21:47:59 +00:00
installInternet
installJava9
installMiscUtilities
installMultimedia
installNetTools
installOffice
2018-03-30 07:39:12 +00:00
installWine
installCajaPlugins
installNautilusAndPlugins
installGimpPlugins
2018-03-25 10:47:40 +00:00
installPidginPlugins
installRhythmBoxPlugins
2018-03-30 07:39:12 +00:00
msg "Installing HW related"
installWebcam
updateMicrocode
2018-03-30 07:39:12 +00:00
msg "Applying system customizations"
enableUFW
enableNumLockX
addScreenfetchBashrc
enableHistoryTS
installUnattendedUpgrades
2018-03-30 07:39:12 +00:00
msg "Installing external apps"
installViber
installFranz
installTeamViewer13
toolAutoremove
2018-03-24 16:24:42 +00:00
exit
;;
f) # full install
2018-03-30 07:39:12 +00:00
msg "Initializing"
yggInit
2018-03-30 07:39:12 +00:00
msg "Updating the system"
updateSystem
2018-03-30 07:39:12 +00:00
msg "Installing Apps"
installBase
installOffice
installBurningTools
installEbook
installGames
2018-03-30 07:39:12 +00:00
installSteam
installInternet
installJava9
installMiscUtilities
installMultimedia
installNetTools
installOffice
2018-03-30 07:39:12 +00:00
installWine
installCajaPlugins
installNautilusAndPlugins
installGimpPlugins
2018-03-25 10:47:40 +00:00
installPidginPlugins
installRhythmBoxPlugins
2018-03-30 07:39:12 +00:00
msg "Installing HW related"
installWebcam
updateMicrocode
2018-03-30 07:39:12 +00:00
installCardReader
msg "Applying system customizations"
enableUFW
enableNumLockX
addScreenfetchBashrc
enableHistoryTS
installUnattendedUpgrades
2018-03-30 07:39:12 +00:00
enableUnbound
msg "Installing additional themes/icons"
installIcons
installThemes
2018-03-30 07:39:12 +00:00
msg "Installing external apps"
installViber
installFranz
installTeamViewer13
toolAutoremove
2017-12-29 10:46:53 +00:00
exit
;;
c) # install themes and icons
2018-03-14 18:34:00 +00:00
yggInit
updateSystem
2017-12-30 21:47:59 +00:00
installIcons
installThemes
2017-12-29 10:46:53 +00:00
exit
;;
2018-03-30 07:39:12 +00:00
w) # nitrogen
yggInit
updateSystem
installNitrogen
exit
;;
d) # install Unbound DNS Cache
yggInit
updateSystem
enableUnbound
exit
;;
2018-03-30 07:39:12 +00:00
q) # cardreader
yggInit
updateSystem
installCardReader
exit
;;
s) # solaar for logitech devices
yggInit
updateSystem
installSolaar
exit
;;
t) # tlp (laptop or low energy usage)
yggInit
updateSystem
installTLP
exit
;;
n) # latest nvidia driver (see menus if need older version)
yggInit
updateSystem
2018-05-01 23:25:14 +00:00
installNvidia396
exit
;;
g) # latest feee graphic drivers, mesa, ...
yggInit
updateSystem
installOibaf
exit
;;
k)
yggInit
updateSystem
kernelUpdate
exit
;;
2018-01-03 21:59:50 +00:00
u)
2018-03-14 18:34:00 +00:00
yggInit
2018-01-03 21:59:50 +00:00
updateSystem
exit
;;
2018-03-30 07:39:12 +00:00
p)
toolAutoremove
exit
;;
2017-12-29 10:46:53 +00:00
h) # display help
usage
exit
;;
v) # display version number
printf "Yggdrasil version : $version\n"
exit
;;
:) # display error message in case of missing argument(s)
usage
printf "\nError : Option $OPTARG : missing argument\n"
exit 1
;;
\?) # display error message in case of invalid option
usage
printf "\nError : $OPTARG : invalid option\n"
exit 1
;;
esac
done
2017-12-30 22:08:45 +00:00
#-----------------------------------------------------------------------------#
# Menu Mode #
#-----------------------------------------------------------------------------#
2017-12-29 10:46:53 +00:00
2018-03-22 10:14:26 +00:00
# show Yggdrasil logo
2017-12-30 21:12:24 +00:00
dispLogo
2017-12-29 10:46:53 +00:00
2018-03-22 10:14:26 +00:00
# show system informations
dispSysInfos
2017-12-27 13:54:15 +00:00
2017-12-28 18:27:44 +00:00
# Useless by itself, but is used to don't be annoyed later in the script
2017-12-27 13:54:15 +00:00
sudo echo
2018-03-14 18:39:12 +00:00
# init, check and install/update dependencies
2018-03-14 18:34:00 +00:00
yggInit
2017-12-27 13:54:15 +00:00
pressKey
# Apps dir created if necessary
mkdir -p /home/$myHomedir/Apps
2017-12-30 22:08:45 +00:00
#-----------------------------------------------------------------------------#
# Main menu #
#-----------------------------------------------------------------------------#
2017-12-27 13:54:15 +00:00
while true; do # main menu loop
mainMenuOptions=$(whiptail \
--title "Yggdrasil $version - Main Menu" \
--menu "This tool will help you to install all needed applications and cutomize your fresh install of Mint/Ubuntu/Elementary/..." \
25 80 16 \
"1" "System update" \
"2" "Applications" \
"3" "Applications (BETA)" \
"4" "Applications (Nightly)" \
"5" "Themes & Icons" \
"6" "Dev Apps" \
"7" "System Config" \
"8" "System Tools" \
"9" "Reboot this computer" \
"10" "About Yggdrasil" \
"11" "Quit" 3>&1 1>&2 2>&3)
2017-12-27 13:54:15 +00:00
case $mainMenuOptions in
"1")
updateSystem
pressKey
;;
"2")
showAppInstallMenu
;;
"3")
2017-12-27 13:54:15 +00:00
showAppBetaInstallMenu
;;
"4")
2017-12-27 13:54:15 +00:00
showAppNightlyInstallMenu
;;
"5")
2017-12-27 13:54:15 +00:00
showThemesInstallMenu
;;
"6")
2017-12-27 13:54:15 +00:00
showDevInstallMenu
;;
"7")
2017-12-27 13:54:15 +00:00
showConfigMenu;
;;
"8")
2017-12-27 13:54:15 +00:00
showSysToolsMenu
;;
"9")
2017-12-27 13:54:15 +00:00
showRebootBoxMenu
;;
"10")
2017-12-27 13:54:15 +00:00
showAboutBoxMenu
;;
"11")
2017-12-27 13:54:15 +00:00
exit
;;
esac # main menu
done # end of main menu loop
clear
2017-12-30 22:08:45 +00:00
exit