Browse Source

Cleanup legacy in upgrade script

Alexandre Aubin 3 years ago
parent
commit
0079d5325c
1 changed files with 17 additions and 16 deletions
  1. 17 16
      scripts/upgrade

+ 17 - 16
scripts/upgrade

@@ -38,14 +38,23 @@ if [ -d /var/www/vpnadmin ]; then
   ynh_secure_remove /var/www/vpnadmin
 fi
 
-# Removing sudoer file from before 2.x / Yunohost 4.3
+#=================================================
+# SPECIAL UPGRADE FOR VERSIONS < 2.0
+#=================================================
+
+# Old stuff
+
+[ -z "$(ynh_app_setting_get $app domain)" ] || ynh_app_setting_delete $app domain
+[ -z "$(ynh_app_setting_get $app path)" ] || ynh_app_setting_delete $app path
+[ -z "$(ynh_app_setting_get $app is_public)" ] || ynh_app_setting_delete $app is_public
+[ -z "$(ynh_app_setting_get $app final_path)" ] || ynh_app_setting_delete $app final_path
+
 if [ -e "/etc/sudoers.d/${app}_ynh" ]; then
   ynh_secure_remove "/etc/sudoers.d/${app}_ynh"
 fi
 
-#=================================================
-# SPECIAL UPGRADE FOR VERSIONS < 2.0
-#=================================================
+# New stuff
+
 if [ -z "$dns_method" ]; then
     ynh_app_setting_set --app=$app --key=dns_method --value=custom
 fi
@@ -53,21 +62,13 @@ if [ -z "$nameservers" ]; then
     nameservers="$(grep -o -P '\s*nameserver\s+\K[abcdefabcdef\d.:]+' /etc/resolv.dnsmasq.conf | sort | uniq | paste -s -d, -)"
     ynh_app_setting_set --app=$app --key=nameservers --value="$nameservers"
 fi
-## Versions known to have a buggy backup script
-#buggy_versions="1.0.0 1.0.1 1.1.0"
-#curr_version=$(read_manifest version)
-#if echo $buggy_versions | grep -w $curr_version > /dev/null; then
-#  echo "Your current version of ${app} is very old: ${curr_version}. Please ignore the next warning." >&2
-#fi
-#
+
 ##=================================================
 ## BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
 ##=================================================
-#
-#ynh_backup_before_upgrade
-#ynh_clean_setup () {
-#    ynh_restore_upgradebackup
-#}
+
+# Not done because vpnclient backup ain't so relevant I guess ?
+
 ## Exit if an error occurs during the execution of the script
 ynh_abort_if_errors