yggdrasil_ng/yggdrasil.sh

198 lines
4.7 KiB
Bash
Raw 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
#
2017-12-30 22:08:45 +00:00
source ./vars.sh
source ./core_functions.sh
source ./repo_functions.sh
source ./install_functions.sh
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"
printf "$BOLDROUGE""This script can't be run as root/sudo, please retry as normal user""$NORMAL"
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-01-05 06:14:58 +00:00
while getopts ":h,v,f,c,t,u" option; do
2017-12-29 10:46:53 +00:00
case "$option" in
2018-01-01 15:58:02 +00:00
t) #test purpose only
2018-03-14 18:34:00 +00:00
yggInit
2018-03-04 22:57:31 +00:00
#installIdea
#installNetTools
2018-03-04 22:57:31 +00:00
installOffice
2018-01-01 15:58:02 +00:00
exit
;;
2018-01-05 06:14:58 +00:00
f) # install all apps
2017-12-30 21:47:59 +00:00
#TODO:
2018-03-14 18:34:00 +00:00
yggInit
2018-01-05 06:38:36 +00:00
updateSystem
2018-01-05 06:14:58 +00:00
addRequiredPPA
2017-12-30 21:47:59 +00:00
installBase
installBurningTools
installCajaPlugins
installEbook
installGames
installGimpPlugins
installInternet
installJava9
installMiscUtilities
installMultimedia
installNetTools
installOffice
installPidginPlugins
installRhythmBoxPlugins
installWine
2017-12-29 10:46:53 +00:00
exit
;;
c) # install themes and icons
2017-12-30 21:47:59 +00:00
#TODO:
2018-03-14 18:34:00 +00:00
yggInit
2017-12-30 21:47:59 +00:00
installIcons
installThemes
2017-12-29 10:46:53 +00:00
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
;;
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
clear
2017-12-30 21:12:24 +00:00
dispLogo
2017-12-29 10:46:53 +00:00
2017-12-27 13:54:15 +00:00
printf "$BOLDVERT""User (userdir) :""$NORMAL"" $myHomedir\n"
printf "$BOLDVERT""OS : ""$NORMAL"
lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'
printf "$BOLDVERT""Kernel : ""$NORMAL"
uname -r
printf "$BOLDVERT""Architecture : ""$NORMAL"
uname -m
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:34:00 +00:00
# check and install/update dependencies
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" "Add required PPA/Repo" \
"3" "Applications" \
"4" "Applications (BETA)" \
"5" "Applications (Nightly)" \
"6" "Themes & Icons" \
"7" "Dev Apps" \
"8" "System Config" \
"9" "System Tools" \
"10" "Reboot this computer" \
"11" "About Yggdrasil" \
"12" "Quit" 3>&1 1>&2 2>&3)
case $mainMenuOptions in
"1")
updateSystem
pressKey
;;
"2")
addRequiredPPA
pressKey
;;
"3")
showAppInstallMenu
;;
"4")
showAppBetaInstallMenu
;;
"5")
showAppNightlyInstallMenu
;;
"6")
showThemesInstallMenu
;;
"7")
showDevInstallMenu
;;
"8")
showConfigMenu;
;;
"9")
showSysToolsMenu
;;
"10")
showRebootBoxMenu
;;
"11")
showAboutBoxMenu
;;
"12")
exit
;;
esac # main menu
done # end of main menu loop
clear
2017-12-30 22:08:45 +00:00
exit