]> git.phdru.name Git - phdru.name/cgi-bin/blog-ru/search-tags.git/blob - update
chmod -R a+rX cgi-bin
[phdru.name/cgi-bin/blog-ru/search-tags.git] / update
1 #! /bin/sh
2
3 current="`git config --get --path remote.current.url`"
4 origin="`git config --get --path remote.origin.url`"
5
6 if [ -n "$origin" ]; then
7    if [ -n "$current" ]; then
8       echo "UNKNOWN ERROR"
9    else
10       echo "This script must be run in the origin directory: $origin"
11    fi >&2
12    exit 1
13 elif [ -z "$current" ]; then
14    echo "UNKNOWN ERROR" >&2
15    exit 1
16 fi
17
18 git pull --ff-only current master &&
19
20 web="`git config --get --path remote.web.url`" &&
21 [ -n "$web" ] && git push web
22
23 # Copy templates and generated files with timestamps to avoid rebuilding
24 rsync -ahP "$current"/html/html.py "$current"/html/html.tmpl \
25            "$current"/html/redirect.py "$current"/html/redirect.tmpl html &&
26
27 # Copy files generated by yacc
28 rsync -ahP "$current"/parser.out "$current"/parsetab.py . &&
29
30 cgi="`git config --get --path remote.cgi.url`" &&
31 if [ -n "$cgi" ]; then
32    umask 022 && cd "$cgi" && git pull origin &&
33    rsync -ahP "$current"/html/html.py "$current"/html/html.tmpl \
34               "$current"/html/redirect.py "$current"/html/redirect.tmpl html &&
35    rsync -ahP "$current"/parser.out "$current"/parsetab.py . &&
36    compyleall && chmod -R a+rX .
37 fi &&
38
39 cd "$current" && exec git pull origin