add $SUDO into spinner control.

This commit is contained in:
Promofaux 2016-01-24 21:19:23 +00:00
parent c179936b54
commit eec14be10d

View file

@ -70,12 +70,10 @@ fi
###All credit for the below function goes to http://fitnr.com/showing-a-bash-spinner.html ###All credit for the below function goes to http://fitnr.com/showing-a-bash-spinner.html
spinner(){ spinner(){
local pid=$1 local pid=$1
local delay=0.001
local spinstr='/-\|'
spin='-\|/' spin='-\|/'
i=0 i=0
while kill -0 $pid 2>/dev/null while $SUDO kill -0 $pid 2>/dev/null
do do
i=$(( (i+1) %4 )) i=$(( (i+1) %4 ))
printf "\b${spin:$i:1}" printf "\b${spin:$i:1}"
@ -324,7 +322,7 @@ checkForDependencies(){
echo -n "::: Checking for $i..." echo -n "::: Checking for $i..."
if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; then if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo -n " Not found! Installing...." echo -n " Not found! Installing...."
$SUDO apt-get -y -qq install $i > /dev/null & spinner $! $SUDO apt-get -y -qq install $i > /dev/null & spinner $!
echo " done!" echo " done!"
else else
echo " already installed!" echo " already installed!"