kaz-vagrant/files/vm-upgrade.sh

54 lines
1.4 KiB
Bash
Raw Normal View History

2023-02-03 16:35:24 +01:00
#!/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
2023-02-07 22:11:03 +01:00
# hotfix pour btrfs
sed -i -e "s/template=self.template/template=self.template, bdevtype='btrfs'/" /usr/local/lib/python3.9/dist-packages/backends/LxcBackend.py
2023-02-03 16:35:24 +01:00
# On récupère le dernier kaz-vagrant
2023-05-26 10:04:35 +02:00
if [ -z "${KAZBRANCH}" ] ; then
KAZBRANCH="master"
fi
2023-02-03 16:35:24 +01:00
cd /tmp
2023-05-26 10:04:35 +02:00
git clone https://git.kaz.bzh/KAZ/kaz-vagrant.git || (cd kaz-vagrant && git fetch && git switch "${KAZBRANCH}" && git pull)
2023-02-03 16:35:24 +01:00
cd /tmp/kaz-vagrant
2023-05-26 10:04:35 +02:00
git switch "${KAZBRANCH}"
2023-02-03 16:35:24 +01:00
# On écrase les anciens fichiers
cp -ar /tmp/kaz-vagrant/files/snster-kaz /root/
2023-02-03 16:36:58 +01:00
# crypto keys
2023-05-17 15:49:43 +02:00
cp -ar /etc/letsencrypt /root/snster-kaz/hoster-a/kaz1/
cp -ar /etc/letsencrypt /root/snster-kaz/hoster-b/kaz2/
2023-02-03 16:36:58 +01:00
cp -ar /etc/letsencrypt /root/snster-kaz/isp-a/home/
2023-05-26 10:04:35 +02:00
cp -ar /etc/letsencrypt /root/snster-kaz/mica/infra/
2023-02-03 16:35:24 +01:00
# 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
2023-05-17 15:49:43 +02:00
$SNSTER destroy hoster-a-router
$SNSTER destroy hoster-b-router
2023-02-03 16:35:24 +01:00
$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