-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspbuilder.update.in
50 lines (43 loc) · 1.21 KB
/
spbuilder.update.in
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
46
47
48
49
#!/bin/sh
#
# ex:set ai shiftwidth=4 inputtab=spaces smarttab noautotab:
#
SPB_SHUTDOWN=%SPB_SHUTDOWN%
LANG=${LANG:-"en_AU.utf8"}
sed -i -e "s/^export LANG=.*/export LANG=$LANG/" /etc/profile.d/lang.sh
. /root/.spbuilderrc
# Check whether repo has been updated since last run of hoorex
echo "Checking repo data ..."
repo_updated=$(find /mnt/slackbuilds/ \
-name \*.info \
-newer $HOME/.local/share/hoorex/repoData.pkl \
-print -quit)
if [ -z $repo_updated ]; then
echo "No need to run hoorex (data already up to date with repo)."
else
echo -n "Updating hoorex repo data (~17sec.) ... "
hoorex -f -s /mnt/slackbuilds
echo "OK, hoorex repo data up to date."
fi
# Wait for network
tries=0
while test $tries -lt 10 ; do
echo "Waiting for network ... [$tries]"
ping -q -c 1 10.1.1.1 2>/dev/null
if test $? -eq 0 ; then
break
fi
tries=$(expr $tries + 1)
sleep 1
done
echo "Updating packages ..."
slapt-get --update
slapt-get --upgrade -y
slapt-get --clean
echo "Packages updated OK"
if [ $SPB_SHUTDOWN -eq 1 ]; then
echo "Shutting down now ..."
shutdown -h now
else
echo "SPB_SHUTDOWN = 0 so keeping container $(hostname) running ..."
fi