-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-html-pages
executable file
·54 lines (46 loc) · 1.88 KB
/
build-html-pages
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
#!/bin/bash
set -e -u
if [[ "$(whoami)" != apy ]]; then
echo "ERROR: Run this script as user 'apy', e.g. with 'sudo -u apy /home/apy/build-html-pages'"
exit 1
fi
if ! status=$(systemctl status -n0 apy); then
echo "ERROR: It seems APY isn't running:"
echo "${status}"
echo
echo "We need APY for compiling apertium-html-tools."
echo "Please ask someone with sudo to do 'systemctl start apy'."
exit 1
fi
if ! curl localhost:2737; then
echo
echo "WARNING: APY isn't answering; waiting a bit in case it was just started ..."
echo
sleep 10
fi
tmp=$(mktemp -t gtweb-html-pages.XXXXXXXX)
trap 'rm -f "${tmp}"' EXIT
set -x
cd ~/apertium-html-tools
for goal in jorgal tolkimine mt mt-testing; do
export CONFIG=../html-tools-confs/"${goal}".conf
git checkout -- .
make clean
# html-tools config doesn't yet let you restrict locales, TODO
cat ../html-tools-confs/locales-"${goal}".json > assets/strings/locales.json
if [[ "${goal}" = mt ]]; then
# Add a little message in /mt:
jq '.Translate_Input_Placeholder |= .+"\n\nPrográmmat davvisámegillii jorgalit dušše sánis sátnái." ' < assets/strings/sme.json > "${tmp}"
/usr/bin/mv "${tmp}" assets/strings/sme.json
jq '.Translate_Input_Placeholder |= .+"\n\nProgrammene TIL nordsamisk oversetter bare ord for ord." ' < assets/strings/nob.json > "${tmp}"
/usr/bin/mv "${tmp}" assets/strings/nob.json
jq '.Translate_Input_Placeholder |= .+"\n\nWhen translating TO North Sámi, we only translate word for word." ' < assets/strings/eng.json > "${tmp}"
/usr/bin/mv "${tmp}" assets/strings/eng.json
fi
make -s -j yeti || make yeti
rsync -a --delete-after build/ "${goal}"/
done
git checkout -- .
set +x
echo
echo 'Up-to-date! Now "rsync -a /home/apy/apertium-html-tools/ /opt/apy/", then try http://gtweb.uit.no/jorgal and translate something'