-
Notifications
You must be signed in to change notification settings - Fork 2
/
update
executable file
·48 lines (38 loc) · 1.43 KB
/
update
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
#!/bin/bash
set -e -u
if [[ "$(whoami)" != root ]]; then
echo "Run this script with sudo" >&2
exit 1
fi
D="$(dirname "$0")"
declare -r D
# In case the "git pull" updates this script itself, we put it all in
# a function, since bash reads the file as it's executing it:
# http://stackoverflow.com/a/18036284/69663
main () {
cd "$D"
if find . -not -uid "$(id -u apy)" | grep .; then
echo "Found files not owned by apy here, please chown apy:apy" >&2
exit 1
elif grep -q @GLIB_CFLAGS@ /usr/lib64/pkgconfig/hfst.pc; then
echo "Please run \"sed -i.orig 's/@GLIB_CFLAGS@//' /usr/lib64/pkgconfig/hfst.pc\"" >&2
exit 1
fi
sudo -u apy git pull
sudo -u apy git submodule update --init --recursive
sudo -u apy ./build-apy-server
rsync -avh --delete /home/apy/apertium-html-tools/ /opt/apy/
systemctl restart apy
sleep 1
sudo -u apy ./build-html-pages
rsync -avh --delete /home/apy/apertium-html-tools/ /opt/apy/
mkdir -p /opt/divvun/gc/ck
( cd ./divvun-webdemo/ && cp -r -- lib index.html ./*.css locales /opt/divvun/gc/ )
( cd ./ckeditor-divvungc/ && cp -r -- lib index.html ./*.css locales ck-plugins /opt/divvun/gc/ck/ )
if ! find etc/ usr/ -type f -print0 | xargs -r0I{} diff -q '{}' '/{}'; then
echo "Configuration files changed – you should run $D/install-and-enable-services"
else
systemctl status apy
fi
}
main