diff options
Diffstat (limited to 'skywire.install')
-rw-r--r-- | skywire.install | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/skywire.install b/skywire.install index d5a5e893027c..6c5392731be6 100644 --- a/skywire.install +++ b/skywire.install @@ -1,44 +1,33 @@ post_install() { - systemctl disable --now skywire-hypervisor.service + #kill any instance that was running + systemctl disable --now skywire.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 + #config generation writes in the current dir; + #so we want to make anything spawned by the process appear as a subdirectory of /root + cd ~/ + #try to reuse old config + [[ -f /opt/skywire/skywire.json ]] && cp -b /opt/skywire/skywire.json ~/skywire.json + #generate hypervisor configuration + skywire-cli visor gen-config --is-hypervisor -p -r -o skywire.json + mv skywire.json /opt/skywire/skywire.json + skywire-tls-gen + echo "Skywire has been configured, starting now on https://127.0.0.1:8000" + systemctl enable --now skywire.service + echo "run keypkg-gen to generate the distributable public key package" } -pre-upgrade() { -systemctl disable --now skywire-hypervisor.service -systemctl disable --now skywire-visor.service -skywire-halt -} +#pre-upgrade() { +#} post_upgrade() { post_install } pre-remove() { - systemctl disable --now skywire-hypervisor.service + systemctl disable --now skywire.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 +rm -rf /opt/skywire } |