Browse Source

Small corrections

Maniack Crudelis 7 years ago
parent
commit
5039df052d
5 changed files with 31 additions and 22 deletions
  1. 2 2
      check_process
  2. 7 7
      scripts/backup
  3. 7 1
      scripts/install
  4. 8 8
      scripts/restore
  5. 7 4
      scripts/upgrade

+ 2 - 2
check_process

@@ -7,8 +7,8 @@
 		admin="john"	(USER)
 		language="fr"
 		is_public=1	(PUBLIC|public=1|private=0)
-  	password="pass"
-  	port="666"	(PORT)
+		password="pass"
+		port="666"	(PORT)
 	; Checks
 		pkg_linter=1
 		setup_sub_dir=1

+ 7 - 7
scripts/backup

@@ -2,13 +2,6 @@
 
 #=================================================
 # GENERIC START
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-# Exit on command errors and treat access to unset variables as an error
-set -eu
-
 #=================================================
 # IMPORT GENERIC HELPERS
 #=================================================
@@ -21,6 +14,13 @@ fi
 source _common.sh
 source /usr/share/yunohost/helpers
 
+#=================================================
+# MANAGE SCRIPT FAILURE
+#=================================================
+
+# Exit if an error occurs during the execution of the script
+ynh_abort_if_errors
+
 #=================================================
 # LOAD SETTINGS
 #=================================================

+ 7 - 1
scripts/install

@@ -141,7 +141,7 @@ ynh_systemd_config
 chown -R $app: $final_path
 
 # Set the app as temporarily public for curl call
-ynh_app_setting_set $app unprotected_uris "/"
+ynh_app_setting_set $app skipped_uris "/"
 # Reload SSOwat config
 yunohost app ssowatconf
 
@@ -151,6 +151,12 @@ systemctl reload nginx
 # Installation with curl
 ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
 
+#=================================================
+# MODIFY A CONFIG FILE
+#=================================================
+
+ynh_replace_string "match_string" "replace_string" "$final_path/CONFIG_FILE"
+
 #=================================================
 # STORE THE CHECKSUM OF THE CONFIG FILE
 #=================================================

+ 8 - 8
scripts/restore

@@ -2,13 +2,6 @@
 
 #=================================================
 # GENERIC START
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-# Exit on command errors and treat access to unset variables as an error
-set -eu
-
 #=================================================
 # IMPORT GENERIC HELPERS
 #=================================================
@@ -21,6 +14,13 @@ fi
 source _common.sh
 source /usr/share/yunohost/helpers
 
+#=================================================
+# MANAGE SCRIPT FAILURE
+#=================================================
+
+# Exit if an error occurs during the execution of the script
+ynh_abort_if_errors
+
 #=================================================
 # LOAD SETTINGS
 #=================================================
@@ -113,7 +113,7 @@ systemctl enable $app.service
 ynh_restore_file "/etc/cron.d/$app"
 
 #=================================================
-# BACKUP THE LOGROTATE CONFIGURATION
+# RESTORE THE LOGROTATE CONFIGURATION
 #=================================================
 
 ynh_restore_file "/etc/logrotate.d/$app"

+ 7 - 4
scripts/upgrade

@@ -44,7 +44,7 @@ fi
 
 # If final_path doesn't exist, create it
 if [ -z $final_path ]; then
-	final_path=$(ynh_sanitize_dbid $app)
+	final_path=/var/www/$app
 	ynh_app_setting_set $app final_path $final_path
 fi
 
@@ -52,11 +52,14 @@ fi
 # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
 #=================================================
 
-ynh_backup_before_upgrade	# Backup the current version of the app
+# Backup the current version of the app
+ynh_backup_before_upgrade
 ynh_clean_setup () {
-	ynh_restore_upgradebackup	# restore it if the upgrade fails
+	# restore it if the upgrade fails
+	ynh_restore_upgradebackup
 }
-ynh_abort_if_errors	# Exit if an error occurs during the execution of the script
+# Exit if an error occurs during the execution of the script
+ynh_abort_if_errors
 
 #=================================================
 # CHECK THE PATH