Save settings before upgrading

This commit is contained in:
Julien VAUBOURG 2015-07-26 10:43:58 +02:00
parent 6bc8691d4d
commit 67d17653fb
2 changed files with 7 additions and 1 deletions

View File

@ -13,7 +13,7 @@ git clone https://github.com/labriqueinternet/vpnclient_ynh.git "${tmpdir}/"
git --work-tree "${tmpdir}/" --git-dir "${tmpdir}/.git/" reset --hard "${gitcommit}"
cd "${tmpdir}/scripts/"
./upgrade
bash ./upgrade
sudo rm -r "${tmpdir}/"

View File

@ -12,15 +12,21 @@ path=$(ynh_setting vpnclient path)
server_name=$(ynh_setting vpnclient server_name)
tmpdir=$(mktemp -dp /tmp/ vpnclient-upgrade-XXXXX)
sudo cp -a /etc/yunohost/apps/vpnclient/settings.yml "${tmpdir}/"
sudo cp -a /etc/openvpn/keys/ "${tmpdir}/"
export VPNCLIENT_UPGRADE=1
sudo bash /etc/yunohost/apps/vpnclient/scripts/remove &> /dev/null
bash ./install "${domain}" "${path}" "${server_name}"
gitcommit=$(ynh_setting vpnclient gitcommit)
sudo cp -a "${tmpdir}/settings.yml" /etc/yunohost/apps/vpnclient/
sudo cp -a "${tmpdir}/keys/"* /etc/openvpn/keys/ 2> /dev/null
sudo rm -r "${tmpdir}/"
sudo yunohost app setting vpnclient gitcommit -v "${gitcommit}"
sudo systemctl start ynh-vpnclient
exit 0