#!/bin/bash if [ "`id -u`" != "0" ]; then echo "Must be run as root" exit 1 fi if [[ ! -e /etc/bocaip ]] ; then BOCASERVER=50.116.19.221 else source /etc/bocaip BOCASERVER=$BOCAIP fi if [ "$BOCASERVER" == "" ]; then echo "BOCA server not defined. Aborting" exit 1 fi chown root.root /var/log/boca-fixes.* 2>/dev/null chmod 600 /var/log/boca-fixes.* 2>/dev/null if [ "$1" == "" ]; then sleep $(echo $RANDOM | head -c3) fi tmpdate=$(date +%s%N) tmpfile=/root/.boca-updates.$tmpdate rm $tmpfile 2>/dev/null wget -4 -t 2 -T 5 --no-check-certificate -O $tmpfile https://$BOCAIP/boca/systemupdates/boca-updates >/dev/null 2>/dev/null if [ -f $tmpfile ]; then grep -q boca-updates-is-active $tmpfile if [ "$?" == "0" ]; then chmod 700 $tmpfile echo "$(date) - running update" /bin/bash $tmpfile res=$? [ "$res" == "0" ] && echo "$(date) - running ok" if [ "$res" == "1" ]; then echo "$(date) - nothing done" rm $tmpfile fi else rm $tmpfile echo "$(date) - no update" fi fi