-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcpsupdate.sh
executable file
·109 lines (86 loc) · 2.18 KB
/
cpsupdate.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# supported_comps=('director' 'manager' 'lib' 'tools' 'frontend')
CPSVERSION="2.0.0"
director="cpsdirector-$CPSVERSION.tar.gz"
manager="ConPaaS-$CPSVERSION.tar.gz"
lib="cpslib-$CPSVERSION.tar.gz"
tools="cps-tools-$CPSVERSION.tar.gz"
frontend="cpsfrontend-$CPSVERSION.tar.gz"
taballs=""
# IP_PREFIX=192.168.13
IP_ADDRESS=192.168.56.2
rm -f *$CPSVERSION*.tar.gz
./mkdist.sh $CPSVERSION "$@"
TMPFILE='/tmp/cpsinstall'
cat <<EOT >> $TMPFILE
#!/bin/bash
IP_ADDRESS=$IP_ADDRESS
#IP_ADDRESS="\$(ip addr show | perl -ne 'print "\$1\n" if /inet ([\d.]+).*scope global/' | grep "$IP_PREFIX" | head -1)"
#DIRECTOR_URL="https://\${IP_ADDRESS}:5555"
#echo \$DIRECTOR_URL
EOT
ls $lib > /dev/null 2>&1 &&
{
cat <<EOT >> $TMPFILE
sudo rm -r /usr/local/lib/python2.7/dist-packages/cpslib-*-py2.7.egg/
sudo easy_install cpslib-*.tar.gz
rm cpslib-*.tar.gz
EOT
taballs+="$lib "
}
ls $director > /dev/null 2>&1 &&
{
cat <<EOT >> $TMPFILE
echo "#installing director"
#cp /etc/cpsdirector/director.cfg .
sudo rm -rf /usr/local/lib/python2.7/dist-packages/cpsdirector-*-py2.7.egg
tar -xaf cpsdirector-*.tar.gz
rm -f cpsdirector-*.tar.gz
cd cpsdirector-*
echo \$IP_ADDRESS | sudo make install
cd ..
sudo rm -rf cpsdirector-*
#mv director.cfg /etc/cpsdirector/
sudo sqlite3 /etc/cpsdirector/director.db 'delete from resource; delete from service'
sudo service apache2 restart
EOT
taballs+="$director "
}
ls $manager > /dev/null 2>&1 &&
{
cat <<EOT >> $TMPFILE
mv $manager /etc/cpsdirector/ConPaaS.tar.gz
EOT
taballs+="$manager "
}
ls $tools > /dev/null 2>&1 &&
{
cat <<EOT >> $TMPFILE
sudo rm -rf /usr/local/lib/python2.7/dist-packages/cps_tools/
tar xaf cps-tools*
cd cps-tools-*
./configure --sysconf=/etc
sudo make install
#mkdir -p $HOME/.conpaas
cps-user get_certificate
cd ..
sudo rm -rf cps-tools*
EOT
taballs+="$tools "
}
ls $frontend > /dev/null 2>&1 &&
{
cat <<EOT >> $TMPFILE
tar -xaf cpsfrontend*.tar.gz
rm cpsfrontend*.tar.gz
sudo cp -r cpsfrontend-*/www/* /var/www/
rm -rf cpsfrontend*
EOT
taballs+="$frontend "
}
echo ""
echo "Uploading tarballs and execution script:"
scp $TMPFILE $taballs conpaas:
ssh conpaas 'bash cpsinstall; rm cpsinstall'
# ssh conpaas 'cat cpsinstall; rm cpsinstall'
rm -f ${TMPFILE}