From 19a6ae7d64574cb482f55ceb9c7cb69c4cbbad10 Mon Sep 17 00:00:00 2001 From: Julien VAUBOURG Date: Sun, 26 Jul 2015 10:43:44 +0200 Subject: [PATCH] Save settings before upgrading --- scripts/restore | 2 +- scripts/upgrade | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index e962243..cd6f18a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -7,7 +7,7 @@ git clone https://github.com/labriqueinternet/hotspot_ynh.git "${tmpdir}/" git --work-tree "${tmpdir}/" --git-dir "${tmpdir}/.git/" reset --hard "${gitcommit}" cd "${tmpdir}/scripts/" -./upgrade +bash ./upgrade sudo rm -r "${tmpdir}/" diff --git a/scripts/upgrade b/scripts/upgrade index f8162ee..cd0a54e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,10 +18,20 @@ else firmware_nonfree=no fi +tmpdir=$(mktemp -dp /tmp/ hotspot-upgrade-XXXXX) +sudo cp -a /etc/yunohost/apps/hotspot/settings.yml "${tmpdir}/" + export HOTSPOT_UPGRADE=1 sudo bash /etc/yunohost/apps/hotspot/scripts/remove &> /dev/null bash ./install "${domain}" "${path}" "${wifi_ssid}" "${wifi_passphrase}" "${firmware_nonfree}" +gitcommit=$(ynh_setting hotspot gitcommit) + +sudo cp -a "${tmpdir}/settings.yml" /etc/yunohost/apps/hotspot/ +sudo rm -r "${tmpdir}/" + +sudo yunohost app setting hotspot gitcommit -v "${gitcommit}" + # Changes if [ "$(ynh_setting hotspot ip6_firewall)" == '' ]; then