blob: d5a5e893027c1568a35b3909f258ecb5b88f418e (
plain)
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
|
post_install() {
systemctl disable --now skywire-hypervisor.service
systemctl disable --now skywire-visor.service
skywire-halt
skywire-cli visor gen-config -ro /etc/skywire-visor.json
if pacman -Qi hypervisorconfig > /dev/null ; then
local hvisorkey=$(cat /usr/lib/skycoin/skywire/hypervisor.txt)
echo "Setting hypervisor key to $hvisorkey"
else
skywire-hypervisor gen-config -ro /etc/skywire-hypervisor.json
local hvisorkey=$(cat /etc/skywire-hypervisor.json | grep "public_key" | awk '{print substr($2,2,66)}')
echo "Setting hypervisor key to $hvisorkey"
#setting key and cert in hypervisor config file
skywire-tls-gen
sed -i 's+"enable_tls": false,+"enable_tls": true,+g' /etc/skywire-hypervisor.json
sed -i 's+"tls_cert_file": "",+"tls_cert_file": "/usr/lib/skycoin/skywire/ssl/cert.pem",+g' /etc/skywire-hypervisor.json
sed -i 's+"tls_key_file": ""+"tls_key_file": "/usr/lib/skycoin/skywire/ssl/key.pem"+g' /etc/skywire-hypervisor.json
echo "Starting hypervisor on 127.0.0.1:8000"
systemctl enable --now skywire-hypervisor.service
fi
sed -i 's/"hypervisors".*/"hypervisors": ["'"${hvisorkey}"'"],/' /etc/skywire-visor.json
systemctl enable --now skywire-visor.service
}
pre-upgrade() {
systemctl disable --now skywire-hypervisor.service
systemctl disable --now skywire-visor.service
skywire-halt
}
post_upgrade() {
post_install
}
pre-remove() {
systemctl disable --now skywire-hypervisor.service
systemctl disable --now skywire-visor.service
skywire-halt
}
post_remove() {
rm -rf /etc/skywire-hypervisor.json /etc/skywire-visor.json /usr/lib/skycoin/skywire
}
|