kaz-vagrant/files/vm-upgrade.sh
2023-02-03 16:36:58 +01:00

46 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Upgrade de tout sauf kaz-prod
if [ -z "${KAZGUARD}" ] ; then
exit 1
fi
set -e
# On met à jour SNSTER
cd /root/snster
git switch main
git pull
./install.sh
# On récupère le dernier kaz-vagrant
cd /tmp
git clone https://git.kaz.bzh/KAZ/kaz-vagrant.git || (cd kaz-vagrant && git pull)
cd /tmp/kaz-vagrant
git switch develop-snster
# On écrase les anciens fichiers
cp -ar /tmp/kaz-vagrant/files/snster-kaz /root/
# crypto keys
cp -ar /etc/letsencrypt /root/snster-kaz/kaz/prod/
cp -ar /etc/letsencrypt /root/snster-kaz/isp-a/home/
# On détruit et reconstruit tout sauf kaz-prod
SNSTER="snster -c /root/snster-kaz"
$SNSTER destroy isp-a-home
$SNSTER destroy isp-a-infra
$SNSTER destroy isp-a-router
$SNSTER destroy kaz-router
$SNSTER destroy mica-router
$SNSTER destroy mica-infra
$SNSTER destroy opendns-router
$SNSTER destroy opendns-resolver
$SNSTER destroy root-p-router
$SNSTER destroy root-p-rootns
$SNSTER destroy tld-sns-router
$SNSTER destroy tld-sns-ns
$SNSTER destroy transit-a-router
$SNSTER create
$SNSTER start