Browse Source

Save settings before upgrading

Julien VAUBOURG 9 years ago
parent
commit
61bd608b9d
2 changed files with 9 additions and 1 deletions
  1. 1 1
      scripts/restore
  2. 8 0
      scripts/upgrade

+ 1 - 1
scripts/restore

@@ -15,7 +15,7 @@ git --work-tree "${tmpdir}/" --git-dir "${tmpdir}/.git/" reset --hard "${gitcomm
 
 export PIRATEBOX_GITCOMMIT_UPSTREAM=$gitcommit_upstream
 cd "${tmpdir}/scripts/"
-./upgrade 
+bash ./upgrade 
 
 sudo rm -r "${tmpdir}/"
 

+ 8 - 0
scripts/upgrade

@@ -16,15 +16,23 @@ opt_renaming=$(ynh_setting piratebox opt_renaming)
 opt_chat=$(ynh_setting piratebox opt_chat)
 
 tmpdir=$(mktemp -dp /tmp/ piratebox-upgrade-XXXXX)
+sudo cp -a /etc/yunohost/apps/piratebox/settings.yml "${tmpdir}/"
 sudo mv /var/www/piratebox/public/uploads/ "${tmpdir}/"
 
 export PIRATEBOX_UPGRADE=1
 sudo bash /etc/yunohost/apps/piratebox/scripts/remove &> /dev/null
 bash ./install "${domain}" "${path}" "${opt_domain}" "${opt_name}" "${opt_deleting}" "${opt_renaming}" "${opt_chat}"
 
+gitcommit=$(ynh_setting piratebox gitcommit)
+gitcommit_upstream=$(ynh_setting piratebox gitcommit_upstream)
+
+sudo cp -a "${tmpdir}/settings.yml" /etc/yunohost/apps/piratebox/
 sudo mv "${tmpdir}/uploads/"* /var/www/piratebox/public/uploads/ 2> /dev/null
 sudo rm -r "${tmpdir}/"
 
+sudo yunohost app setting piratebox gitcommit -v "${gitcommit}"
+sudo yunohost app setting piratebox gitcommit_upstream -v "${gitcommit_upstream}"
+
 # Changes
 
 if [ "$(ynh_setting piratebox opt_maxspace)" == '' ]; then