From b098c679918806b172402385e983f6a76ef5fd9a Mon Sep 17 00:00:00 2001 From: Francois B Date: Wed, 14 Mar 2018 19:50:07 +0100 Subject: [PATCH] checkAndInstallDep fct updated --- core_functions.sh | 8 ++++---- install_functions.sh | 13 +++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core_functions.sh b/core_functions.sh index 0ea1813..f4a25fd 100644 --- a/core_functions.sh +++ b/core_functions.sh @@ -319,12 +319,12 @@ function installPackage () { # # check dependency and install it if necessary -# input : package manager, package name +# input : package manager, package name, cmd/bin to check #FIXME: function checkAndInstallDep () { - if ! which $2 >/dev/null; then - printf "[DEP] check dependency : $2 [ ""$BOLDROUGE""!!"$NORMAL" ]\n" - printf "[ERR] dependency $2 not found\n" &>> $logFile + if ! which $3 >/dev/null; then + printf "[DEP] dependency $2 not found [ ""$BOLDROUGE""!!"$NORMAL" ]\n" + printf "[DEP] dependency $2 not found\n" &>> $logFile case $1 in "apt") installPackage apt $2 diff --git a/install_functions.sh b/install_functions.sh index 2c8b506..99ec5cd 100644 --- a/install_functions.sh +++ b/install_functions.sh @@ -396,7 +396,7 @@ function installIconsMenu () { function installPlankThemes () { msg "Installing Plank themes" - checkAndInstallDep apt plank + checkAndInstallDep apt plank plank if ! (( $(ps -ef | grep -v grep | grep plank | wc -l) > 0 )); then plank 2&>1 >/dev/null & @@ -1006,7 +1006,7 @@ function enableNumLockX () { msg "Adding NumLockX to MDM/LightDM Default Init" #FIXME: - checkAndInstallDep apt numlockx + checkAndInstallDep apt numlockx numlockx if which lightdm >/dev/null; then sudo cp /etc/lightdm/lightdm.conf.d/70-linuxmint.conf /etc/lightdm/lightdm.conf.d/70-linuxmint.conf.yggbak @@ -1030,7 +1030,7 @@ function enableTmpRAM () { # function addScreenfetchBashrc () { msg "Adding screenfetch to .bashrc" - checkAndInstallDep apt screenfetch + checkAndInstallDep apt screenfetch screenfetch runCmd "touch /home/$myHomedir/.bashrc" printf "\n" runCmd "echo 'screenfetch -t' | tee -a /home/$myHomedir/.bashrc" @@ -1060,7 +1060,7 @@ function installUnattendedUpgrades () { # display useful system/hardware informations # function toolInxi () { - checkAndInstallDep apt inxi + checkAndInstallDep apt inxi inxi inxi -F } @@ -1068,7 +1068,7 @@ function toolInxi () { # check bandwith and latency of the internet connection # function toolSpeedtestCli () { - checkAndInstallDep pip speedtest-cli + checkAndInstallDep pip speedtest-cli speedtest-cli speedtest-cli } @@ -1112,7 +1112,7 @@ function toolAutoremove () { # function toolClearOldKernels () { msg "Removing old kernels (keeping the 3 last kernels)" - checkAndInstallDep apt byobu + checkAndInstallDep apt byobu purge-old-kernels runCmd "sudo purge-old-kernels --keep 3" } @@ -1120,6 +1120,7 @@ function toolClearOldKernels () { # force soundcards detection # function toolSoundCardsDetection () { + msg "Detecting ALSA sound cards compatible" runCmd "sudo alsa force-reload" }