From c9387d1df67e9b8422232e15996caaf29f7e84f5 Mon Sep 17 00:00:00 2001 From: Francois B Date: Wed, 14 Mar 2018 19:34:00 +0100 Subject: [PATCH] yggInit added + . --- core_functions.sh | 84 +++++++++++++++++++++++++++++++---------------- repo_functions.sh | 1 - yggdrasil.sh | 9 +++-- 3 files changed, 62 insertions(+), 32 deletions(-) diff --git a/core_functions.sh b/core_functions.sh index c1d6f6c..2ada343 100644 --- a/core_functions.sh +++ b/core_functions.sh @@ -100,6 +100,56 @@ function isMate () { fi } +# +# check and install required dependencies for Yggdrasil +# +function yggInit () { + if ! which gem >/dev/null; then + printf "[INIT][GEM] not found, installing...\n" + printf "\n[INIT][GEM] not found, installing...\n" &>> $logFile + installPackage apt "ruby-dev" + else + printf "[INIT][GEM] found [ ""$BOLDVERT""OK"$NORMAL" ] \n" + fi + + if ! which snap >/dev/null; then + printf "[INIT][SNAP] not found, installing...\n" + printf "\n[INIT][SNAP] not found, installing...\n" &>> $logFile + installPackage apt "snapd" + else + printf "[INIT][SNAP] found [ ""$BOLDVERT""OK"$NORMAL" ] \n" + fi + + if ! which npm >/dev/null; then + printf "[INIT][NPM] not found, installing...\n" + printf "\n[INIT][NPM] not found, installing...\n" &>> $logFile + installPackage apt "npm" + else + printf "[INIT][NPM] found [ ""$BOLDVERT""OK"$NORMAL" ] \n" + fi + + printf "[INIT]" + installPackage apt "apt-transport-https" + + if ! which pip3 >/dev/null; then + printf "[INIT][PIP] not found, installing...\n" + printf "\n[INIT][PIP] not found, installing...\n" &>> $logFile + printf "[INIT]" + installPackage apt "python3-pip" + printf "[INIT]" + installPackage pip "pip" + printf "[INIT]" + installPackage pip "setuptools" + else + printf "[INIT][PIP] found [ ""$BOLDVERT""OK"$NORMAL" ] \n" + printf "[INIT]" + installPackage pip "pip" + printf "[INIT]" + installPackage pip "setuptools" + fi +} + + # # system update #TODO: add pip, npm, gem @@ -125,18 +175,12 @@ function updateSystem () { ret_code=$? retCode $ret_code - if ! which snap >/dev/null; then - printf "[ERR] snap not found, installing...\n" - printf "\n[ERR] snap not found, installing...\n" &>> $logFile - installPackage apt "snapd" + if which snap >/dev/null; then + printf "[SNAP] refresh " + printf "\n[SNAP] refresh\n" &>> $logFile + sudo snap refresh &>> $logFile ret_code=$? - if [ $ret_code == 0 ]; then - printf "[SNAP] refresh " - printf "\n[SNAP] refresh\n" &>> $logFile - sudo snap refresh &>> $logFile - ret_code=$? - retCode $ret_code - fi + retCode $ret_code fi repoAdded=0 @@ -278,12 +322,6 @@ function installPackage () { sudo -H pip3 install --upgrade $pkg &>> $logFile ret_code=$? retCode $ret_code - else - printf "[ERR] pip3 not found, installing...\n" - printf "\n[ERR] pip3 not found, installing...\n" &>> $logFile - installPackage apt "python3-pip" - installPackage pip "pip" - installPackage pip "setuptools" fi ;; "npm") @@ -293,10 +331,6 @@ function installPackage () { sudo npm install -g $pkg &>> $logFile ret_code=$? retCode $ret_code - else - printf "[ERR] npm not found, installing...\n" - printf "\n[ERR] npm not found, installing...\n" &>> $logFile - installPackage apt "npm" fi ;; "gem") @@ -306,10 +340,6 @@ function installPackage () { sudo gem install $pkg &>> $logFile ret_code=$? retCode $ret_code - else - printf "[ERR] gem not found, installing...\n" - printf "\n[ERR] gem not found, installing...\n" &>> $logFile - installPackage apt "ruby-dev" fi ;; "snap") @@ -319,10 +349,6 @@ function installPackage () { sudo snap install $pkg --classic &>> $logFile ret_code=$? retCode $ret_code - else - printf "[ERR] snap not found, installing...\n" - printf "\n[ERR] snap not found, installing...\n" &>> $logFile - installPackage apt "snapd" fi ;; esac diff --git a/repo_functions.sh b/repo_functions.sh index e9bd155..bc672e1 100644 --- a/repo_functions.sh +++ b/repo_functions.sh @@ -433,7 +433,6 @@ function addSpecificRepo_DockerCE () { "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" } - # # Gyazo # diff --git a/yggdrasil.sh b/yggdrasil.sh index 67784fc..0b4c0c6 100755 --- a/yggdrasil.sh +++ b/yggdrasil.sh @@ -41,6 +41,7 @@ echo "--[ Yggdrasil log ]--[ "$cDate" ]--[ "$cTime" ]-----------------------" >> while getopts ":h,v,f,c,t,u" option; do case "$option" in t) #test purpose only + yggInit #installIdea #installNetTools installOffice @@ -48,9 +49,9 @@ while getopts ":h,v,f,c,t,u" option; do ;; f) # install all apps #TODO: + yggInit updateSystem addRequiredPPA - msg "Installing all Apps" installBase installBurningTools installCajaPlugins @@ -70,12 +71,13 @@ while getopts ":h,v,f,c,t,u" option; do ;; c) # install themes and icons #TODO: - msg "Installing all Themes and Icons" + yggInit installIcons installThemes exit ;; u) + yggInit updateSystem exit ;; @@ -119,6 +121,9 @@ uname -m # Useless by itself, but is used to don't be annoyed later in the script sudo echo +# check and install/update dependencies +yggInit + pressKey # Apps dir created if necessary