-
Notifications
You must be signed in to change notification settings - Fork 67
/
mod-deploy.sh
executable file
·56 lines (46 loc) · 2.87 KB
/
mod-deploy.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
#!/bin/bash
set -e
cd $(dirname ${0})
if ping -c 1 -W 0.05 192.168.51.1 > /dev/null; then
elif ping -c 1 -W 0.2 moddwarf.local > /dev/null; then
elif ping -c 1 -W 0.2 modduox.local > /dev/null; then
elif ping -c 1 -W 0.2 modduo.local > /dev/null; then
else
echo "not connected"
exit 1
fi
# needed since ssh rsa deprecation/breakage
SSH_OPTIONS="-o PubkeyAcceptedAlgorithms=+ssh-rsa"
SCP_OPTIONS="${SSH_OPTIONS} -O"
ssh ${SSH_OPTIONS} ${TARGET} mount / -o remount,rw
ssh ${SSH_OPTIONS} ${TARGET} rm -rf /usr/share/mod/html/css
ssh ${SSH_OPTIONS} ${TARGET} rm -rf /usr/share/mod/html/js
ssh ${SSH_OPTIONS} ${TARGET} mkdir -p /usr/share/mod/html/css/fontello/{css,font} /usr/share/mod/html/js/{lib/slick/fonts,utils}
ssh ${SSH_OPTIONS} ${TARGET} rm -f /usr/lib/python3.*/site-packages/mod/*.py*
ssh ${SSH_OPTIONS} ${TARGET} rm -f /usr/lib/python3.*/site-packages/mod/communication/*.py*
ssh ${SSH_OPTIONS} ${TARGET} rm -f /usr/lib/python3.*/site-packages/modtools/*.py*
scp ${SCP_OPTIONS} html/*.html ${TARGET}:/usr/share/mod/html/
scp ${SCP_OPTIONS} html/include/*.html ${TARGET}:/usr/share/mod/html/include/
scp ${SCP_OPTIONS} html/resources/*.html ${TARGET}:/usr/share/mod/html/resources/
scp ${SCP_OPTIONS} html/css/*.css ${TARGET}:/usr/share/mod/html/css/
scp ${SCP_OPTIONS} html/css/fontello/css/*.css ${TARGET}:/usr/share/mod/html/css/fontello/css/
scp ${SCP_OPTIONS} html/css/fontello/font/*.* ${TARGET}:/usr/share/mod/html/css/fontello/font/
scp ${SCP_OPTIONS} html/js/*.js ${TARGET}:/usr/share/mod/html/js/
scp ${SCP_OPTIONS} html/js/lib/*.js ${TARGET}:/usr/share/mod/html/js/lib/
scp ${SCP_OPTIONS} html/js/lib/slick/*.{css,gif} ${TARGET}:/usr/share/mod/html/js/lib/slick/
scp ${SCP_OPTIONS} html/js/lib/slick/*min.js ${TARGET}:/usr/share/mod/html/js/lib/slick/
scp ${SCP_OPTIONS} html/js/lib/slick/fonts/*.* ${TARGET}:/usr/share/mod/html/js/lib/slick/fonts/
scp ${SCP_OPTIONS} html/js/utils/*.js ${TARGET}:/usr/share/mod/html/js/utils/
scp ${SCP_OPTIONS} html/img/*.png ${TARGET}:/usr/share/mod/html/img/
scp ${SCP_OPTIONS} html/img/*.svg ${TARGET}:/usr/share/mod/html/img/
scp ${SCP_OPTIONS} mod/*.py ${TARGET}:/usr/lib/python3.*/site-packages/mod/
scp ${SCP_OPTIONS} mod/communication/*.py ${TARGET}:/usr/lib/python3.*/site-packages/mod/communication/
scp ${SCP_OPTIONS} modtools/*.py ${TARGET}:/usr/lib/python3.*/site-packages/modtools/
ssh ${SSH_OPTIONS} ${TARGET} rm -rf /usr/lib/python3.*/site-packages/mod/__pycache__
ssh ${SSH_OPTIONS} ${TARGET} rm -rf /usr/lib/python3.*/site-packages/mod/communication/__pycache__
ssh ${SSH_OPTIONS} ${TARGET} rm -rf /usr/lib/python3.*/site-packages/modtools/__pycache__
echo "all ok"