forked from SquareBracketAssociates/EnterprisePharo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
push-results-to-server.sh
executable file
·47 lines (33 loc) · 1.04 KB
/
push-results-to-server.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
#!/usr/bin/env bash
set -e
SERVER=files.pharo.org
BASEDIR=/appli/files.pharo.org/books/enterprisepharo/book
SERVER_USER=filepharosync
TMP_DIR='~cassou/enterprisepharo-book'
PILLAR_COMMAND="./pillar"
chapters=$($PILLAR_COMMAND show inputFiles 2>/dev/null)
ssh $SERVER sh <<EOF
sudo su --login --command "mkdir -p \"$BASEDIR\"" "$SERVER_USER"
rm -rf $TMP_DIR
mkdir $TMP_DIR
EOF
rm -rf to-push
mkdir -p to-push/html/figures
cp book-result/EnterprisePharo.pdf to-push/
# Push all css/js files
cp -R support/html/* to-push/html
# Push all .html chapters
for chapter in $chapters; do
html="${chapter%%.*}.html"
# Hack to change the references to support files (e.g., .css, .js)
sed 'sX../support/html/XX' $html > to-push/html/$(basename $html)
# copy the figures
cp -R $(dirname $html)/figures/* to-push/html/figures/ 2>/dev/null || true
done
cd to-push/html
cd ../..
echo Pushing all files to $SERVER
scp -r to-push $SERVER:$TMP_DIR
ssh $SERVER sh <<EOF
sudo su --login --command "cp -R $TMP_DIR/to-push/* $BASEDIR" filepharosync
EOF