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 ...@@ -14,9 +14,9 @@ case "$1" in
;; ;;
esac esac
if [ -f /etc/openvpn/vifib.conf ]; then if [ -f /etc/openvpn/vifib.conf ]; then
cp -f /etc/openvpn/vifib.conf /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 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 sed -i "s/\/etc\/openvpn\/vifib-keys/\/etc\/openvpn\/vifib-backup-keys/g" /etc/openvpn/vifib.backup.conf
fi fi
#DEBHELPER# #DEBHELPER#
......
...@@ -96,6 +96,14 @@ mkdir -p $RPM_BUILD_ROOT/opt/slapos/log ...@@ -96,6 +96,14 @@ mkdir -p $RPM_BUILD_ROOT/opt/slapos/log
/ /
%defattr(-,root,root) %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 %post
echo """To generate slapos configuration run '#slapos node register'""" echo """To generate slapos configuration run '#slapos node register'"""
if [ -f /bin/systemctl ]; then if [ -f /bin/systemctl ]; then
...@@ -105,9 +113,9 @@ fi ...@@ -105,9 +113,9 @@ fi
%preun %preun
if [ -f /etc/openvpn/vifib.conf ]; then if [ -f /etc/openvpn/vifib.conf ]; then
cp -f /etc/openvpn/vifib.conf /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 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 sed -i "s/\/etc\/openvpn\/vifib-keys/\/etc\/openvpn\/vifib-backup-keys/g" /etc/openvpn/vifib.backup.conf
fi fi
if [ -f /bin/systemctl ]; then if [ -f /bin/systemctl ]; then
systemctl stop slapos-node.service 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