Permalink
Browse files

Monitor if update is running

  • Loading branch information...
NEMS Linux
NEMS Linux committed Feb 8, 2019
1 parent 121ced7 commit 7fcef588b29f073be322c4877280a4640b83d322
Showing with 34 additions and 6 deletions.
  1. +15 −0 fixes.sh
  2. +13 −0 info.sh
  3. +6 −6 update.sh
@@ -10,6 +10,19 @@
exit
fi

# Just in case nems-quickfix is running
fixes=$(/usr/local/bin/nems-info fixes)
if [[ $fixes == 1 ]]; then
echo 'NEMS Linux is currently updating itself. Please wait...'
while [[ $fixes == 1 ]]
do
sleep 1
fixes=$(/usr/local/bin/nems-info fixes)
done
fi
echo $$ > /var/run/nems-fixes.pid


# By default, do not reboot after update
reboot=0

@@ -521,6 +534,8 @@ if [ $(dpkg-query -W -f='${Status}' memtester 2>/dev/null | grep -c "ok installe
apt-get -y install memtester
fi

rm -f /var/run/nems-fixes.pid

# If a reboot is required, do it now
if [[ $reboot == 1 ]]; then
/sbin/reboot
13 info.sh
@@ -359,6 +359,19 @@ elif [[ $COMMAND == "fixes" ]]; then
echo 0
fi

elif [[ $COMMAND == "update" ]]; then
if [[ -e /var/run/nems-update.pid ]]; then
pid=$(cat /var/run/nems-update.pid)
if ps -p $pid > /dev/null
then
echo 1
else
echo 0
fi
else
echo 0
fi


# Output usage info as no valid command line argument was provided
else
@@ -17,16 +17,16 @@ else
done

# Just in case nems-quickfix is running
fixes=$(/usr/local/bin/nems-info fixes)
if [[ $fixes == 1 ]]; then
update=$(/usr/local/bin/nems-info update)
if [[ $update == 1 ]]; then
echo 'NEMS Linux is currently updating itself. Please wait...'
while [[ $fixes == 1 ]]
while [[ $update == 1 ]]
do
sleep 1
fixes=$(/usr/local/bin/nems-info fixes)
update=$(/usr/local/bin/nems-info update)
done
fi
echo $$ > /var/run/nems-fixes.pid
echo $$ > /var/run/nems-update.pid

# Update nems-migrator
printf "Updating nems-migrator... "
@@ -180,4 +180,4 @@ else
fi
echo ""

rm -f /var/run/nems-fixes.pid
rm -f /var/run/nems-update.pid

0 comments on commit 7fcef58

Please sign in to comment.