checkAndInstallDep fct updated

This commit is contained in:
Francois B 2018-03-14 19:50:07 +01:00
parent af0f78741e
commit b098c67991
2 changed files with 11 additions and 10 deletions

View file

@ -319,12 +319,12 @@ function installPackage () {
# #
# check dependency and install it if necessary # check dependency and install it if necessary
# input : package manager, package name # input : package manager, package name, cmd/bin to check
#FIXME: #FIXME:
function checkAndInstallDep () { function checkAndInstallDep () {
if ! which $2 >/dev/null; then if ! which $3 >/dev/null; then
printf "[DEP] check dependency : $2 [ ""$BOLDROUGE""!!"$NORMAL" ]\n" printf "[DEP] dependency $2 not found [ ""$BOLDROUGE""!!"$NORMAL" ]\n"
printf "[ERR] dependency $2 not found\n" &>> $logFile printf "[DEP] dependency $2 not found\n" &>> $logFile
case $1 in case $1 in
"apt") "apt")
installPackage apt $2 installPackage apt $2

View file

@ -396,7 +396,7 @@ function installIconsMenu () {
function installPlankThemes () { function installPlankThemes () {
msg "Installing Plank themes" msg "Installing Plank themes"
checkAndInstallDep apt plank checkAndInstallDep apt plank plank
if ! (( $(ps -ef | grep -v grep | grep plank | wc -l) > 0 )); then if ! (( $(ps -ef | grep -v grep | grep plank | wc -l) > 0 )); then
plank 2&>1 >/dev/null & plank 2&>1 >/dev/null &
@ -1006,7 +1006,7 @@ function enableNumLockX () {
msg "Adding NumLockX to MDM/LightDM Default Init" msg "Adding NumLockX to MDM/LightDM Default Init"
#FIXME: #FIXME:
checkAndInstallDep apt numlockx checkAndInstallDep apt numlockx numlockx
if which lightdm >/dev/null; then 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 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 () { function addScreenfetchBashrc () {
msg "Adding screenfetch to .bashrc" msg "Adding screenfetch to .bashrc"
checkAndInstallDep apt screenfetch checkAndInstallDep apt screenfetch screenfetch
runCmd "touch /home/$myHomedir/.bashrc" runCmd "touch /home/$myHomedir/.bashrc"
printf "\n" printf "\n"
runCmd "echo 'screenfetch -t' | tee -a /home/$myHomedir/.bashrc" runCmd "echo 'screenfetch -t' | tee -a /home/$myHomedir/.bashrc"
@ -1060,7 +1060,7 @@ function installUnattendedUpgrades () {
# display useful system/hardware informations # display useful system/hardware informations
# #
function toolInxi () { function toolInxi () {
checkAndInstallDep apt inxi checkAndInstallDep apt inxi inxi
inxi -F inxi -F
} }
@ -1068,7 +1068,7 @@ function toolInxi () {
# check bandwith and latency of the internet connection # check bandwith and latency of the internet connection
# #
function toolSpeedtestCli () { function toolSpeedtestCli () {
checkAndInstallDep pip speedtest-cli checkAndInstallDep pip speedtest-cli speedtest-cli
speedtest-cli speedtest-cli
} }
@ -1112,7 +1112,7 @@ function toolAutoremove () {
# #
function toolClearOldKernels () { function toolClearOldKernels () {
msg "Removing old kernels (keeping the 3 last kernels)" 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" runCmd "sudo purge-old-kernels --keep 3"
} }
@ -1120,6 +1120,7 @@ function toolClearOldKernels () {
# force soundcards detection # force soundcards detection
# #
function toolSoundCardsDetection () { function toolSoundCardsDetection () {
msg "Detecting ALSA sound cards compatible"
runCmd "sudo alsa force-reload" runCmd "sudo alsa force-reload"
} }