This commit is contained in:
Francois B 2018-03-22 11:45:57 +01:00
parent 9dce0f2f5d
commit 23cde88239

View file

@ -29,12 +29,12 @@ function smsg () {
# #
function msg () { function msg () {
printf "\n" printf "\n"
printf "$JAUNE" printf $JAUNE
if [ "$#" -gt "0" ]; then if [ "$#" -gt "0" ]; then
printf "$*\n" printf "$*\n"
/usr/bin/notify-send -t 7000 "$*" /usr/bin/notify-send -t 7000 "$*"
fi fi
printf "$NORMAL" printf $NORMAL
} }
# #
@ -43,9 +43,9 @@ function msg () {
function retCode () { function retCode () {
typeset ret_code="$1" typeset ret_code="$1"
if [ $ret_code == 0 ]; then if [ $ret_code == 0 ]; then
printf "[ ""$BOLDVERT""OK"$NORMAL" ] " printf "[ "$BOLDVERT"OK"$NORMAL" ] "
else else
printf "[ ""$BOLDROUGE""!!"$NORMAL" ] " printf "[ "$BOLDROUGE"!!"$NORMAL" ] "
fi fi
printf "\n" printf "\n"
} }
@ -73,9 +73,9 @@ function pressKey () {
if which mpg123 >/dev/null; then if which mpg123 >/dev/null; then
mpg123 -q $scriptDir/notify.mp3 & mpg123 -q $scriptDir/notify.mp3 &
fi fi
printf "$INV" printf $INV
read -p "Press <Enter> key to continue ..." read -p "Press <Enter> key to continue ..."
printf "$NORMAL" printf $NORMAL
} }
# #
@ -113,7 +113,7 @@ function yggInit () {
printf "[INIT][UMAKE] PPA not found, adding PPA...\n" &>> $logFile printf "[INIT][UMAKE] PPA not found, adding PPA...\n" &>> $logFile
addPPA "ubuntu-desktop/ubuntu-make" addPPA "ubuntu-desktop/ubuntu-make"
else else
printf "[INIT][UMAKE] PPA found [ ""$BOLDVERT""OK"$NORMAL" ] \n" printf "[INIT][UMAKE] PPA found [ "$BOLDVERT"OK"$NORMAL" ] \n"
fi fi
printf "[INIT][APT] update " printf "[INIT][APT] update "
@ -130,7 +130,7 @@ function yggInit () {
printf "\n[INIT][UMAKE] not found, installing...\n" &>> $logFile printf "\n[INIT][UMAKE] not found, installing...\n" &>> $logFile
installPackage apt "ubuntu-make" installPackage apt "ubuntu-make"
else else
printf "[INIT][UMAKE] found [ ""$BOLDVERT""OK"$NORMAL" ] \n" printf "[INIT][UMAKE] found [ "$BOLDVERT"OK"$NORMAL" ] \n"
fi fi
if ! which gem >/dev/null; then if ! which gem >/dev/null; then
@ -138,7 +138,7 @@ function yggInit () {
printf "\n[INIT][GEM] not found, installing...\n" &>> $logFile printf "\n[INIT][GEM] not found, installing...\n" &>> $logFile
installPackage apt "ruby-dev" installPackage apt "ruby-dev"
else else
printf "[INIT][GEM] found [ ""$BOLDVERT""OK"$NORMAL" ] \n" printf "[INIT][GEM] found [ "$BOLDVERT"OK"$NORMAL" ] \n"
fi fi
if ! which snap >/dev/null; then if ! which snap >/dev/null; then
@ -146,7 +146,7 @@ function yggInit () {
printf "\n[INIT][SNAP] not found, installing...\n" &>> $logFile printf "\n[INIT][SNAP] not found, installing...\n" &>> $logFile
installPackage apt "snapd" installPackage apt "snapd"
else else
printf "[INIT][SNAP] found [ ""$BOLDVERT""OK"$NORMAL" ] \n" printf "[INIT][SNAP] found [ "$BOLDVERT"OK"$NORMAL" ] \n"
fi fi
if ! which npm >/dev/null; then if ! which npm >/dev/null; then
@ -154,7 +154,7 @@ function yggInit () {
printf "\n[INIT][NPM] not found, installing...\n" &>> $logFile printf "\n[INIT][NPM] not found, installing...\n" &>> $logFile
installPackage apt "npm" installPackage apt "npm"
else else
printf "[INIT][NPM] found [ ""$BOLDVERT""OK"$NORMAL" ] \n" printf "[INIT][NPM] found [ "$BOLDVERT"OK"$NORMAL" ] \n"
fi fi
if ! which pip3 >/dev/null; then if ! which pip3 >/dev/null; then
@ -167,7 +167,7 @@ function yggInit () {
printf "[INIT]" printf "[INIT]"
installPackage pip "setuptools" installPackage pip "setuptools"
else else
printf "[INIT][PIP] found [ ""$BOLDVERT""OK"$NORMAL" ] \n" printf "[INIT][PIP] found [ "$BOLDVERT"OK"$NORMAL" ] \n"
printf "[INIT]" printf "[INIT]"
installPackage pip "pip" installPackage pip "pip"
printf "[INIT]" printf "[INIT]"
@ -226,10 +226,8 @@ function addPPA () {
ret_code=$? ret_code=$?
retCode $ret_code retCode $ret_code
else else
printf "[PPA] PPA already added [ ""$BOLDVERT""OK"$NORMAL" ] \n" printf "[PPA] PPA already added [ "$BOLDVERT"OK"$NORMAL" ] \n"
fi fi
} }
# #
@ -250,7 +248,6 @@ function addKey () {
"2") "2")
printf "[REPO] adding key $2 from $1 " printf "[REPO] adding key $2 from $1 "
printf "\n[REPO] adding key $2 from $1\n" &>> $logFile printf "\n[REPO] adding key $2 from $1\n" &>> $logFile
#sudo apt-key adv --keyserver $1 --recv-keys $2 - &>> $logFile
gpg --keyserver $1 --recv-keys $2 &>> $logFile \ gpg --keyserver $1 --recv-keys $2 &>> $logFile \
&& gpg -a --export $2 | sudo apt-key add - &>> $logFile && gpg -a --export $2 | sudo apt-key add - &>> $logFile
ret_code=$? ret_code=$?
@ -357,7 +354,7 @@ function installPackage () {
# #
function checkAndInstallDep () { function checkAndInstallDep () {
if ! which $3 >/dev/null; then if ! which $3 >/dev/null; then
printf "[DEP] dependency $2 not found [ ""$BOLDROUGE""!!"$NORMAL" ]\n" printf "[DEP] dependency $2 not found [ "$BOLDROUGE"!!"$NORMAL" ]\n"
printf "[DEP] dependency $2 not found\n" &>> $logFile printf "[DEP] dependency $2 not found\n" &>> $logFile
case $1 in case $1 in
"apt") "apt")
@ -531,7 +528,7 @@ function createAppShortcut () {
# #
function dispLogo () { function dispLogo () {
printf "\n" printf "\n"
printf "$BOLDJAUNE" printf $BOLDJAUNE
printf "██╗ ██╗ ██████╗ ██████╗ ██████╗ ██████╗ █████╗ ███████╗██╗██╗ \n" printf "██╗ ██╗ ██████╗ ██████╗ ██████╗ ██████╗ █████╗ ███████╗██╗██╗ \n"
printf "╚██╗ ██╔╝██╔════╝ ██╔════╝ ██╔══██╗██╔══██╗██╔══██╗██╔════╝██║██║ \n" printf "╚██╗ ██╔╝██╔════╝ ██╔════╝ ██╔══██╗██╔══██╗██╔══██╗██╔════╝██║██║ \n"
printf " ╚████╔╝ ██║ ███╗██║ ███╗██║ ██║██████╔╝███████║███████╗██║██║ \n" printf " ╚████╔╝ ██║ ███╗██║ ███╗██║ ██║██████╔╝███████║███████╗██║██║ \n"
@ -550,7 +547,7 @@ function usage () {
dispLogo dispLogo
dispSysInfos dispSysInfos
printf "\n" printf "\n"
printf "$NORMAL" printf $NORMAL
printf "Usage : yggdrasil [options]\n" printf "Usage : yggdrasil [options]\n"
printf " -f : full install (see doc for more details)\n" printf " -f : full install (see doc for more details)\n"
printf " -c : install gtk themes and icons\n" printf " -c : install gtk themes and icons\n"
@ -560,18 +557,18 @@ function usage () {
} }
function dispSysInfos () { function dispSysInfos () {
printf "$BOLDVERT""Architecture : ""$NORMAL" printf $BOLDVERT"Architecture : "$NORMAL
uname -m uname -m
printf "$BOLDVERT""User (userdir) :""$NORMAL"" $myHomedir\n" printf $BOLDVERT"User (userdir) :"$NORMAL" $myHomedir\n"
printf "$BOLDVERT""OS : ""$NORMAL" printf $BOLDVERT"OS : "$NORMAL
lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}' lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'
printf "$BOLDVERT""Kernel : ""$NORMAL" printf $BOLDVERT"Kernel : "$NORMAL
uname -r uname -r
printf "$BOLDVERT""Desktop : ""$NORMAL" printf $BOLDVERT"Desktop : "$NORMAL
case $XDG_CURRENT_DESKTOP in case $XDG_CURRENT_DESKTOP in
"ENLIGHTENMENT") "ENLIGHTENMENT")
printf "Enlightenment" printf "Enlightenment"
@ -607,7 +604,7 @@ function dispSysInfos () {
;; ;;
esac esac
printf "$BOLDVERT""Shell : ""$NORMAL" printf $BOLDVERT"Shell : "$NORMAL
shellType=$(ps -p $PPID -o cmd --no-heading) shellType=$(ps -p $PPID -o cmd --no-heading)
shellType=${shellType/-} shellType=${shellType/-}
shellType=${shellType//*\/} shellType=${shellType//*\/}