Browse Source

Update to last standard

maniack 6 years ago
parent
commit
9294176a2d
5 changed files with 16 additions and 10 deletions
  1. 0 1
      check_process
  2. 13 6
      scripts/change_url
  3. 1 1
      scripts/install
  4. 1 1
      scripts/remove
  5. 1 1
      scripts/restore

+ 0 - 1
check_process

@@ -16,7 +16,6 @@
 		upgrade=1	from_commit=d79ec131b3038ff4695c3317b5d3ee4eda9c8932
 		upgrade=1	from_commit=d79ec131b3038ff4695c3317b5d3ee4eda9c8932
 		backup_restore=1
 		backup_restore=1
 		multi_instance=0
 		multi_instance=0
-		incorrect_path=1
 		port_already_use=1 (4711)
 		port_already_use=1 (4711)
 		change_url=1
 		change_url=1
 ;;; Levels
 ;;; Levels

+ 13 - 6
scripts/change_url

@@ -30,14 +30,21 @@ ynh_script_progression --message="Load settings" --weight=2
 final_path=$(ynh_app_setting_get $app final_path)
 final_path=$(ynh_app_setting_get $app final_path)
 
 
 #=================================================
 #=================================================
-# CHECK THE SYNTAX OF THE PATHS
+# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
 #=================================================
 #=================================================
-ynh_script_progression --message="Check the syntax of the paths"
+ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=11
 
 
-test -n "$old_path" || old_path="/"
-test -n "$new_path" || new_path="/"
-new_path=$(ynh_normalize_url_path $new_path)
-old_path=$(ynh_normalize_url_path $old_path)
+# Backup the current version of the app
+ynh_backup_before_upgrade
+ynh_clean_setup () {
+	# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
+	ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
+
+	# restore it if the upgrade fails
+	ynh_restore_upgradebackup
+}
+# Exit if an error occurs during the execution of the script
+ynh_abort_if_errors
 
 
 #=================================================
 #=================================================
 # ACTIVATE MAINTENANCE MODE
 # ACTIVATE MAINTENANCE MODE

+ 1 - 1
scripts/install

@@ -357,7 +357,7 @@ cp ../conf/dnsmasq_regenconf_hook /usr/share/yunohost/hooks/conf_regen/50-dnsmas
 # ADVERTISE SERVICE IN ADMIN PANEL
 # ADVERTISE SERVICE IN ADMIN PANEL
 #=================================================
 #=================================================
 
 
-yunohost service add pihole-FTL --log "/var/log/pihole-FTL.log"
+yunohost service add pihole-FTL --description "PiHole backend service" --log "/var/log/pihole-FTL.log"
 
 
 #=================================================
 #=================================================
 # RESTRAIN THE ACCESS TO THE ADMIN ONLY
 # RESTRAIN THE ACCESS TO THE ADMIN ONLY

+ 1 - 1
scripts/remove

@@ -26,7 +26,7 @@ port=$(ynh_app_setting_get $app port)
 #=================================================
 #=================================================
 
 
 # Check if the service is declared in YunoHost
 # Check if the service is declared in YunoHost
-if yunohost service status | grep -q pihole-FTL
+if ynh_exec_fully_quiet yunohost service status pihole-FTL
 then
 then
 	ynh_print_info "Remove pihole-FTL service" >&2
 	ynh_print_info "Remove pihole-FTL service" >&2
 	yunohost service remove pihole-FTL
 	yunohost service remove pihole-FTL

+ 1 - 1
scripts/restore

@@ -102,7 +102,7 @@ ynh_install_app_dependencies $app_depencencies
 # ADVERTISE SERVICE IN ADMIN PANEL
 # ADVERTISE SERVICE IN ADMIN PANEL
 #=================================================
 #=================================================
 
 
-yunohost service add pihole-FTL --log "/var/log/pihole-FTL.log"
+yunohost service add pihole-FTL --description "PiHole backend service" --log "/var/log/pihole-FTL.log"
 
 
 #=================================================
 #=================================================
 # RESTORE THE CRON FILE
 # RESTORE THE CRON FILE