blob: c24105d82b7860491bd296f7897495ef9f7ffc34 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/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 $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
|