Commit adb95b33 authored by Rafael Monnerat's avatar Rafael Monnerat

Backup tapVPN files instead remove directly

 This preserve old tapVPN working while upgrade the packages.
parent 4a80b69b
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
if [ -f /etc/openvpn/vifib.conf ]; then
cp -f /etc/openvpn/vifib.conf /etc/openvpn/vifib.backup.conf
mkdir -p /etc/openvpn/vifib-keys
cp -rf /etc/openvpn/vifib-keys /etc/openvpn/vifib-backup-keys
sed -i "s/\/etc\/openvpn\/vifib-keys/\/etc\/openvpn\/vifib-backup-keys/g" /etc/openvpn/vifib.backup.conf
fi
#DEBHELPER#
exit 0
......@@ -14,9 +14,9 @@ case "$1" in
;;
esac
if [ -f /etc/openvpn/vifib.conf ]; then
cp -f /etc/openvpn/vifib.conf /etc/openvpn/vifib.backup.conf
cp -rf /etc/openvpn/vifib-keys/ /etc/openvpn/vifib-backup-keys
sed -i "s/\/etc\/openvpn\/vifib-keys/\/etc\/openvpn\/vifib-backup-keys/g" /etc/openvpn/vifib.backup.conf
cp -f /etc/openvpn/vifib.conf /etc/openvpn/vifib.backup.conf
cp -rf /etc/openvpn/vifib-keys/ /etc/openvpn/vifib-backup-keys
sed -i "s/\/etc\/openvpn\/vifib-keys/\/etc\/openvpn\/vifib-backup-keys/g" /etc/openvpn/vifib.backup.conf
fi
#DEBHELPER#
......
......@@ -96,6 +96,14 @@ mkdir -p $RPM_BUILD_ROOT/opt/slapos/log
/
%defattr(-,root,root)
%pre
if [ -f /etc/openvpn/vifib.conf ]; then
cp -f /etc/openvpn/vifib.conf /etc/openvpn/vifib.backup.conf
mkdir -p /etc/openvpn/vifib-keys
cp -rf /etc/openvpn/vifib-keys /etc/openvpn/vifib-backup-keys
sed -i "s/\/etc\/openvpn\/vifib-keys/\/etc\/openvpn\/vifib-backup-keys/g" /etc/openvpn/vifib.backup.conf
fi
%post
echo """To generate slapos configuration run '#slapos node register'"""
if [ -f /bin/systemctl ]; then
......@@ -105,9 +113,9 @@ fi
%preun
if [ -f /etc/openvpn/vifib.conf ]; then
cp -f /etc/openvpn/vifib.conf /etc/openvpn/vifib.backup.conf
cp -rf /etc/openvpn/vifib-keys/ /etc/openvpn/vifib-backup-keys
sed -i "s/\/etc\/openvpn\/vifib-keys/\/etc\/openvpn\/vifib-backup-keys/g" /etc/openvpn/vifib.backup.conf
cp -f /etc/openvpn/vifib.conf /etc/openvpn/vifib.backup.conf
cp -rf /etc/openvpn/vifib-keys/ /etc/openvpn/vifib-backup-keys
sed -i "s/\/etc\/openvpn\/vifib-keys/\/etc\/openvpn\/vifib-backup-keys/g" /etc/openvpn/vifib.backup.conf
fi
if [ -f /bin/systemctl ]; then
systemctl stop slapos-node.service
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment