-
Notifications
You must be signed in to change notification settings - Fork 6
/
devel.sh
executable file
·77 lines (58 loc) · 1.44 KB
/
devel.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
#
# ./devel.sh [common] [-c] [-f] [-s]
# Build devel instance, rsync to server and push to git if changes in git are present.
# Can monitor for git changes, i.e. continuous run(-c).
#
# For service-like usage, see run.sh.
# For common options, see './common.sh -h'.
# Specific order of options is required!
#
# Options:
# -c continuous run
# -f run even with no changes present
# -s simulate; do not rsync/push
#
#
. $(dirname "`readlink -e "$0"`")/common.sh || exit 1
[[ "$1" == "-c" ]] && { CONT="$1" ; shift ; } || CONT=
[[ "$1" == "-f" ]] && {
logg "Force update"
shift
:
} || {
[[ "$CONT" ]] && logg "Git monitoring..."
while :; do
scd "website" -s && gitnchange && \
scd "website/content" -s && gitnchange && {
[[ "$CONT" ]] || {
echo "Already Up To date :)"
exit 0
}
sleep 300
continue
}
break
done
}
[[ "$1" == '-s' ]] && { SIM="$1" ; shift ; } || SIM=
MSG='Devel update\n'
upgit "website"
upgit "website/content"
buildsite
prepgit devel
vrun -a $SIM "git push"
HTML="/var/www/html/"
scd "website"
vrun -a $SIM "$RSYN rss.py $DST/root/"
vrun -a $SIM "$RSYN rss.py $DST$HTML"
scd "website/_site"
vrun -a $SIM "$RSYN * $DST$HTML"
vrun -a $SIM "$RSYN * $DST/root/_site/"
[[ "$CONT" ]] || exit 0
scd
logg "Done\n"
logg "`date -I'seconds'`"
C="`readlink -e "$0"` -c"
logg "exec $C"
exec $C -c