-
Notifications
You must be signed in to change notification settings - Fork 29
/
site-updater.sh
executable file
·42 lines (32 loc) · 1.34 KB
/
site-updater.sh
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
#!/bin/sh
cd $(dirname $0)
. ./etc/update.vars
[ -f ./etc/update.vars.custom ] && . ./etc/update.vars.custom
[ ! -f $TOUCHFILE ] && touch $TOUCHFILE
TMP=$(mktemp XXXXXXXXXX)
trap 'rm -f $TMP;exit' 0 1 2 15
if [ -d ./.git ]; then
git pull origin master 2>&1 | tee $TMP
if grep "i2p2www/translations/" "$TMP" >/dev/null ; then
echo "Translations updated, compiling messages"
./compile-messages.sh
fi
echo "Git revision: $(git log -n 1 | grep commit | sed 's/commit: //' | sed 's/ .*$//')" >./i2p2www/pages/include/mtnversion
if grep "^git: updating 'i2p2www/.*\.py\|^mtn: updating 'i2p2www/.*/.*\.py" "$TMP" >/dev/null ; then
echo "Python files changed, restarting server"
touch $TOUCHFILE
fi
else
$MTN pull -k "" "mtn://$MTNURL?$MTNBRANCH"
$MTN up 2>&1 | tee $TMP
if grep "^mtn: \(add\|patch\|dropp\|updat\)\(ed\|ing\) 'i2p2www/translations/" "$TMP" >/dev/null ; then
echo "Translations updated, compiling messages"
./compile-messages.sh
fi
echo "Monotone revision: $(mtn log --no-files --no-graph --to h: | grep Revision | sed 's/Revision: //')" >./i2p2www/pages/include/mtnversion
if grep "^mtn: updating 'i2p2www/.*\.py\|^mtn: updating 'i2p2www/.*/.*\.py" "$TMP" >/dev/null ; then
echo "Python files changed, restarting server"
touch $TOUCHFILE
fi
fi
[ -f ./.pybabel-stamp ] || ./compile-messages.sh