5 Commits 9cac89578a ... c6985dc484

Auteur SHA1 Message Date
  yunohost-bot c6985dc484 Auto-update READMEs il y a 1 mois
  eric_G 97e3cfc9a9 Merge pull request #64 from yunohost-bot/auto-helpers-2.1 il y a 1 mois
  eric_G ce378ac03d cleaning il y a 1 mois
  eric_G 2f5c51a960 Merge remote-tracking branch 'origin/testing' into pr/64 il y a 1 mois
  Yunohost-Bot c15e937131 [autopatch] Automatic patch attempt for helpers 2.1 il y a 1 an
10 fichiers modifiés avec 65 ajouts et 339 suppressions
  1. 1 0
      .gitignore
  2. 2 2
      README.md
  3. 6 3
      manifest.toml
  4. 8 20
      scripts/_common.sh
  5. 6 9
      scripts/backup
  6. 0 248
      scripts/config
  7. 16 17
      scripts/install
  8. 4 5
      scripts/remove
  9. 9 9
      scripts/restore
  10. 13 26
      scripts/upgrade

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
 *~
 *.sw[op]
 Notes
+.DS_Store

+ 2 - 2
README.md

@@ -4,13 +4,13 @@ It shall NOT be edited by hand.
 -->
 
 <h1>
-  <img src="https://raw.githubusercontent.com/YunoHost/apps/master/logos/archivist.png" width="32px" alt="Logo of Archivist">
+  <img src="https://raw.githubusercontent.com/YunoHost/apps/main/logos/archivist.png" width="32px" alt="Logo of Archivist">
   Archivist, packaged for YunoHost
 </h1>
 
 Automatic backups
 
-![Version: 1.3.4~ynh2](https://img.shields.io/badge/Version-1.3.4~ynh2-rgba(0,150,0,1)?style=for-the-badge)
+[![Version: 1.3.4~ynh2](https://img.shields.io/badge/Version-1.3.4~ynh2-rgb(18,138,11)?style=for-the-badge)](https://ci-apps.yunohost.org/ci/apps/archivist/)
 
 <div align="center">
 <a href="https://apps.yunohost.org/app/archivist"><img height="100px" src="https://github.com/YunoHost/yunohost-artwork/raw/refs/heads/main/badges/neopossum-badges/badge_more_info_on_the_appstore.svg"/></a>

+ 6 - 3
manifest.toml

@@ -16,11 +16,14 @@ license = "GPL-3.0"
 code = "https://github.com/maniackcrudelis/archivist"
 
 [integration]
-yunohost = ">= 11.2.9"
+yunohost = ">= 12.1.17"
+helpers_version = "2.1"
 architectures = "all"
 multi_instance = true
-ldap = "not_relevant"
-sso = "not_relevant"
+
+ldap = false
+sso = false
+
 disk = "50M"
 ram.build = "100M"
 ram.runtime = "100M"

+ 8 - 20
scripts/_common.sh

@@ -1,11 +1,7 @@
 #!/bin/bash
 
 #=================================================
-# COMMON VARIABLES
-#=================================================
-
-#=================================================
-# PERSONAL HELPERS
+# COMMON VARIABLES AND CUSTOM HELPERS
 #=================================================
 
 _set_frequencies() {
@@ -31,27 +27,19 @@ _set_frequencies() {
             frequency_human="once a month on the first sunday"
             ;;
         *)
-            ynh_die --message="Unsupported frequency $frequency" ;;
+            ynh_die "Unsupported frequency $frequency" ;;
     esac
 
     # For POST_INSTALL.md
-    ynh_app_setting_set --app="$app" --key=frequency_human --value="$frequency_human"
+    ynh_app_setting_set --key=frequency_human --value="$frequency_human"
 }
 
 _fix_frequencies() {
     case "$frequency" in
-        Daily)          frequency="daily" ; ynh_app_setting_set --app="$app" --key="frequency" --value="$frequency" ;;
-        "Each 3 days")  frequency="days_3" ; ynh_app_setting_set --app="$app" --key="frequency" --value="$frequency" ;;
-        "Weekly")       frequency="weekly" ; ynh_app_setting_set --app="$app" --key="frequency" --value="$frequency" ;;
-        "Biweekly")     frequency="weeks_2" ; ynh_app_setting_set --app="$app" --key="frequency" --value="$frequency" ;;
-        "Monthly")      frequency="monthly" ; ynh_app_setting_set --app="$app" --key="frequency" --value="$frequency" ;;
+        Daily)          frequency="daily" ; ynh_app_setting_set --key="frequency" --value="$frequency" ;;
+        "Each 3 days")  frequency="days_3" ; ynh_app_setting_set --key="frequency" --value="$frequency" ;;
+        "Weekly")       frequency="weekly" ; ynh_app_setting_set --key="frequency" --value="$frequency" ;;
+        "Biweekly")     frequency="weeks_2" ; ynh_app_setting_set --key="frequency" --value="$frequency" ;;
+        "Monthly")      frequency="monthly" ; ynh_app_setting_set --key="frequency" --value="$frequency" ;;
     esac
 }
-
-#=================================================
-# EXPERIMENTAL HELPERS
-#=================================================
-
-#=================================================
-# FUTURE OFFICIAL HELPERS
-#=================================================

+ 6 - 9
scripts/backup

@@ -8,33 +8,30 @@
 source ../settings/scripts/_common.sh
 source /usr/share/yunohost/helpers
 
-#=================================================
-# DECLARE DATA AND CONF FILES TO BACKUP
-#=================================================
-ynh_print_info --message="Declaring files to be backed up..."
+ynh_print_info "Declaring files to be backed up..."
 
 #=================================================
 # BACKUP THE APP MAIN DIR
 #=================================================
 
-ynh_backup --src_path="$install_dir"
+ynh_backup "$install_dir"
 
 #=================================================
 # BACKUP SYSTEM
 #=================================================
 
-ynh_backup --src_path="/etc/logrotate.d/$app"
+ynh_backup "/etc/logrotate.d/$app"
 
-ynh_backup --src_path="/etc/cron.d/$app"
+ynh_backup "/etc/cron.d/$app"
 
 #=================================================
 # BACKUP VARIOUS FILES
 #=================================================
 
-ynh_backup --src_path="/var/log/$app/"
+ynh_backup "/var/log/$app/"
 
 #=================================================
 # END OF SCRIPT
 #=================================================
 
-ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
+ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

+ 0 - 248
scripts/config

@@ -1,248 +0,0 @@
-#!/bin/bash
-
-#=================================================
-# GENERIC STARTING
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
-source _common.sh
-source /usr/share/yunohost/helpers
-
-#=================================================
-# RETRIEVE ARGUMENTS
-#=================================================
-
-app=$YNH_APP_INSTANCE_NAME
-
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-
-#=================================================
-# SPECIFIC CODE
-#=================================================
-# DECLARE GENERIC FUNCTION
-#=================================================
-
-config_file="$final_path/Backup_list.conf"
-passkey="$final_path/passkey"
-
-get_config_value() {
-    option_name="$1"
-    # Get the value of this option in the config file
-    grep "^$option_name=" "$config_file" | cut -d= -f2
-}
-
-#=================================================
-# LOAD VALUES
-#=================================================
-
-# Load the real value from the app config or elsewhere.
-# Then get the value from the form.
-# If the form has a value for a variable, take the value from the form,
-# Otherwise, keep the value from the app config.
-
-# Encryption
-old_encrypt="$(get_config_value encrypt)"
-encrypt="${YNH_CONFIG_MAIN_ENCRYPTION_ENCRYPT:-$old_encrypt}"
-
-# Encryption password
-ynh_print_OFF
-old_encrypt_password="$(cat $passkey)"
-encrypt_password="${YNH_CONFIG_MAIN_ENCRYPTION_ENCRYPTION_PWD:-$old_encrypt_password}"
-ynh_print_ON
-
-# Compression algorithms
-old_ynh_compression="$(get_config_value ynh_compression_mode)"
-old_ynh_compression=${old_ynh_compression:-gzip}
-ynh_compression="${YNH_CONFIG_MAIN_COMPRESSION_YNH:-$old_ynh_compression}"
-old_files_compression="$(get_config_value files_compression_mode)"
-old_files_compression=${old_files_compression:-gzip}
-files_compression="${YNH_CONFIG_MAIN_COMPRESSION_FILES:-$old_files_compression}"
-
-# ynh_core_backup
-old_ynh_core_backup="$(get_config_value ynh_core_backup)"
-ynh_core_backup="${YNH_CONFIG_MAIN_BACKUP_TYPES_CORE_BACKUP:-$old_ynh_core_backup}"
-
-# ynh_app_backup
-if [ -n "$(get_config_value ynh_app_backup)" ]
-then
-    old_ynh_app_backup=true
-else
-    old_ynh_app_backup=false
-fi
-ynh_app_backup="${YNH_CONFIG_MAIN_BACKUP_TYPES_APPS_BACKUP:-$old_ynh_app_backup}"
-
-# Frequency
-old_frequency="$(grep "^frequency: " "/etc/yunohost/apps/$app/settings.yml" | cut -d' ' -f2)"
-frequency="${YNH_CONFIG_MAIN_BACKUP_OPTIONS_FREQUENCY:-$old_frequency}"
-
-# Max size
-old_max_size="$(get_config_value max_size)"
-max_size="${YNH_CONFIG_MAIN_BACKUP_OPTIONS_MAX_SIZE:-$old_max_size}"
-
-# Overwrite cron file
-old_overwrite_cron="$(ynh_app_setting_get $app overwrite_cron)"
-overwrite_cron="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_CRON:-$old_overwrite_cron}"
-
-# Type of admin mail configuration
-old_admin_mail_html="$(ynh_app_setting_get $app admin_mail_html)"
-admin_mail_html="${YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE:-$old_admin_mail_html}"
-
-#=================================================
-# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND
-#=================================================
-
-show_config() {
-    # here you are supposed to read some config file/database/other then print the values
-    # ynh_return "YNH_CONFIG_${PANEL_ID}_${SECTION_ID}_${OPTION_ID}=value"
-
-    ynh_return "YNH_CONFIG_MAIN_ENCRYPTION_ENCRYPT=$encrypt"
-    ynh_return "YNH_CONFIG_MAIN_ENCRYPTION_ENCRYPTION_PWD="
-
-    ynh_return "YNH_CONFIG_MAIN_COMPRESSION_YNH=$ynh_compression"
-    ynh_return "YNH_CONFIG_MAIN_COMPRESSION_FILES=$files_compression"
-
-    ynh_return "YNH_CONFIG_MAIN_BACKUP_TYPES_CORE_BACKUP=$ynh_core_backup"
-    ynh_return "YNH_CONFIG_MAIN_BACKUP_TYPES_APPS_BACKUP=$ynh_app_backup"
-
-    ynh_return "YNH_CONFIG_MAIN_BACKUP_OPTIONS_FREQUENCY=$frequency"
-    ynh_return "YNH_CONFIG_MAIN_BACKUP_OPTIONS_MAX_SIZE=$max_size"
-
-    ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_CRON=$overwrite_cron"
-
-    ynh_return "YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE=$admin_mail_html"
-}
-
-#=================================================
-# MODIFY THE CONFIGURATION
-#=================================================
-
-apply_config() {
-
-    #=================================================
-    # MODIFY THE PASSWORD
-    #=================================================
-
-    # Change the password if needed
-    if [ "$encrypt" ]
-    then
-        ynh_print_OFF
-        test -n "$encrypt_password" || ynh_die --message="The password for encryption can't be empty if you choose to enable encryption."
-        ynh_print_ON
-        # Replace the password by the previous one
-        passkey="$final_path/passkey"
-        ynh_print_OFF; echo "$encrypt_password" > "$passkey"; ynh_print_ON
-        chmod 400 "$passkey"
-        ynh_replace_string --match_string="^cryptpass=.*" --replace_string="cryptpass=$passkey" --target_file="$config_file"
-    fi
-
-    #=================================================
-    # MODIFY ENCRYPT SETTING
-    #=================================================
-
-    # Change encrypt in the config file
-    ynh_replace_string --match_string="^encrypt=.*" --replace_string="encrypt=$encrypt" --target_file="$config_file"
-
-    #=================================================
-    # MODIFY SETTINGS
-    #=================================================
-
-    # Change the compression algorithms
-    # Replace "No compression" by "none" for the config file
-    if [ "$ynh_compression" == "No compression" ]; then
-        ynh_compression=none
-    fi
-    if [ "$ynh_compression" != "$old_ynh_compression" ]
-    then
-        # Update the config, or add the config if not yet existing
-        if grep "^ynh_compression_mode=" "$config_file"
-        then
-            ynh_replace_string --match_string="^ynh_compression_mode=.*" --replace_string="ynh_compression_mode=$ynh_compression" --target_file="$config_file"
-        else
-            echo "ynh_compression_mode=$ynh_compression" >> "$config_file"
-        fi
-    fi
-    # Replace "No compression" by "none" for the config file
-    if [ "$files_compression" == "No compression" ]; then
-        files_compression=none
-    fi
-    if [ "$files_compression" != "$old_files_compression" ]
-    then
-        # Update the config, or add the config if not yet existing
-        if grep "^files_compression_mode=" "$config_file"
-        then
-            ynh_replace_string --match_string="^files_compression_mode=.*" --replace_string="files_compression_mode=$files_compression" --target_file="$config_file"
-        else
-            echo "files_compression_mode=$files_compression" >> "$config_file"
-        fi
-        
-    fi
-
-    # Change ynh_core_backup in the config file
-    ynh_replace_string --match_string="^ynh_core_backup=.*" --replace_string="ynh_core_backup=$ynh_core_backup" --target_file="$config_file"
-
-    # Change ynh_app_backup in the config file
-    if [ "$ynh_app_backup" = true ] && [ "$old_ynh_app_backup" = false ]
-    then
-        # If ynh_app_backup changed from false to true.
-        # Add all current applications to the backup
-        while read backup_app
-        do
-            ynh_print_info --message="Add a backup for the app $backup_app."
-            ynh_replace_string --match_string="^ynh_app_backup=$" --replace_string="ynh_app_backup=$backup_app\n&" --target_file="$config_file"
-        done <<< "$(yunohost app list -i | grep id: | sed 's/.*id: //')"
-    elif [ "$ynh_app_backup" = false ] && [ "$old_ynh_app_backup" = true ]
-    then
-        # Remove all app currently backup
-        # By deleting all line starting by 'ynh_app_backup=' and having something after '='
-        sed -i "/^ynh_app_backup=.\+$/d" "$config_file"
-    fi
-
-    # Change frequency in the cron file and store the value into the settings
-    ynh_app_setting_set --app=$app --key=frequency --value="$frequency"
-    if [ "$frequency" = "Daily" ]; then
-        cron_freq="0 2 * * *"
-        run_freq="every day"
-    elif [ "$frequency" = "Each 3 days" ]; then
-        cron_freq="0 2 */3 * *"
-        run_freq="each 3 days"
-    elif [ "$frequency" = "Weekly" ]; then
-        cron_freq="0 2 * * 0"
-        run_freq="once a week on sunday"
-    elif [ "$frequency" = "Biweekly" ]; then
-        cron_freq="0 2 * * 0/2"
-        run_freq="one sunday out of two"
-    else	# Monthly
-        cron_freq="0 2 1 * *"
-        run_freq="once a month on the first sunday"
-    fi
-    ynh_replace_string --match_string=".* root" --replace_string="$cron_freq root" --target_file=/etc/cron.d/$app
-
-    # Change max_size in the config file
-    ynh_replace_string --match_string="^max_size=.*" --replace_string="max_size=$max_size" --target_file="$config_file"
-
-    #=================================================
-    # MODIFY OVERWRITTING SETTINGS
-    #=================================================
-
-    # Set overwrite_cron
-    ynh_app_setting_set --app=$app --key=overwrite_cron --value="$overwrite_cron"
-
-    #=================================================
-    # MODIFY EMAIL SETTING
-    #=================================================
-
-    # Set admin_mail_html
-    ynh_app_setting_set --app=$app --key=admin_mail_html --value="$admin_mail_html"
-}
-
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# SELECT THE ACTION FOLLOWING THE GIVEN ARGUMENT
-#=================================================
-
-case $1 in
-show) show_config;;
-apply) apply_config;;
-esac

+ 16 - 17
scripts/install

@@ -12,31 +12,30 @@ source /usr/share/yunohost/helpers
 #=================================================
 
 if [ "$encrypt" -eq 1 ] && [ -z "$encryption_pwd" ]; then
-    ynh_die --message="encryption_pwd can't be empty if you choose to enable encryption."
+    ynh_die "encryption_pwd can't be empty if you choose to enable encryption."
 fi
 # Not saved as settings by default
-ynh_app_setting_set --app="$app" --key="encryption_pwd" --value="$encryption_pwd"
+ynh_app_setting_set --key="encryption_pwd" --value="$encryption_pwd"
 
 _set_frequencies
 
-ynh_app_setting_set --app="$app" --key=overwrite_cron --value=1
+ynh_app_setting_set --key=overwrite_cron --value=1
 
 #=================================================
 # DOWNLOAD, CHECK AND UNPACK SOURCE
 #=================================================
-ynh_script_progression --message="Setting up source files..." --weight=3
+ynh_script_progression "Setting up source files..."
 
 # Download, check integrity, uncompress and patch the source from app.src
 ynh_setup_source --dest_dir="$install_dir"
 
 chown -R "root:root" "$install_dir"
-
 chown -R "root:root" "$data_dir"
 
 #=================================================
 # CONFIGURE ARCHIVIST
 #=================================================
-ynh_script_progression --message="Configuring Archivist..." --weight=2
+ynh_script_progression "Configuring Archivist..."
 
 if [ "$encrypt" -eq 1 ]; then
     encrypt=true
@@ -57,37 +56,37 @@ fi
 config_file="$install_dir/Backup_list.conf"
 cp "$install_dir/Backup_list.conf.default" "$config_file"
 
-ynh_replace_string --target_file="$config_file" --match_string="^backup_dir=.*" --replace_string="backup_dir=$data_dir/backup"
-ynh_replace_string --target_file="$config_file" --match_string="^enc_backup_dir=.*" --replace_string="enc_backup_dir=$data_dir/encrypted_backup"
+ynh_replace --file="$config_file" --match="^backup_dir=.*" --replace="backup_dir=$data_dir/backup"
+ynh_replace --file="$config_file" --match="^enc_backup_dir=.*" --replace="enc_backup_dir=$data_dir/encrypted_backup"
 
-ynh_replace_string --target_file="$config_file" --match_string="^encrypt=.*" --replace_string="encrypt=$encrypt"
-ynh_replace_string --target_file="$config_file" --match_string="^cryptpass=.*" --replace_string="cryptpass=$passkey"
+ynh_replace --file="$config_file" --match="^encrypt=.*" --replace="encrypt=$encrypt"
+ynh_replace --file="$config_file" --match="^cryptpass=.*" --replace="cryptpass=$passkey"
 
-ynh_replace_string --target_file="$config_file" --match_string="^ynh_core_backup=.*" --replace_string="ynh_core_backup=$core_backup"
+ynh_replace --file="$config_file" --match="^ynh_core_backup=.*" --replace="ynh_core_backup=$core_backup"
 
 if [ $apps_backup -eq 1 ]; then
     # Add all current applications to the backup
     while read -r backup_app; do
-        ynh_replace_string --target_file="$config_file" --match_string="^ynh_app_backup=$" --replace_string="ynh_app_backup=$backup_app\n&"
+        ynh_replace --file="$config_file" --match="^ynh_app_backup=$" --replace="ynh_app_backup=$backup_app\n&"
     done <<< "$(yunohost app list | grep 'id:' | sed 's/.*id: //')"
 fi
 
 # Calculate and store the config file checksum into the app settings
-ynh_store_file_checksum --file="$config_file"
+ynh_store_file_checksum "$config_file"
 
 #=================================================
 # SYSTEM CONFIGURATION
 #=================================================
-ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
+ynh_script_progression "Adding system configurations related to $app..."
 
 # Use logrotate to manage application logfile(s)
-ynh_use_logrotate
+ynh_config_add_logrotate
 
 # Add Cron configuration file
-ynh_add_config --template="archivist.cron" --destination="/etc/cron.d/$app"
+ynh_config_add --template="archivist.cron" --destination="/etc/cron.d/$app"
 
 #=================================================
 # END OF SCRIPT
 #=================================================
 
-ynh_script_progression --message="Installation of $app completed" --last
+ynh_script_progression "Installation of $app completed"

+ 4 - 5
scripts/remove

@@ -10,17 +10,16 @@ source /usr/share/yunohost/helpers
 #=================================================
 # REMOVE SYSTEM CONFIGURATIONS
 #=================================================
-ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
+ynh_script_progression "Removing system configurations related to $app..."
 
 # Remove the app-specific logrotate config
-ynh_remove_logrotate
+ynh_config_remove_logrotate
 
 # Remove a cron file
-ynh_secure_remove --file="/etc/cron.d/$app"
-
+ynh_safe_rm "/etc/cron.d/$app"
 
 #=================================================
 # END OF SCRIPT
 #=================================================
 
-ynh_script_progression --message="Removal of $app completed" --last
+ynh_script_progression "Removal of $app completed"

+ 9 - 9
scripts/restore

@@ -11,38 +11,38 @@ source /usr/share/yunohost/helpers
 #=================================================
 # RESTORE THE APP MAIN DIR
 #=================================================
-ynh_script_progression --message="Restoring the app main directory..." --weight=1
+ynh_script_progression "Restoring the app main directory..."
 
-ynh_restore_file --origin_path="$install_dir"
+ynh_restore "$install_dir"
 
 chown -R "root:root" "$install_dir"
 
 #=================================================
 # RESTORE THE DATA DIRECTORY
 #=================================================
-ynh_script_progression --message="Restoring the data directory..." --weight=1
+ynh_script_progression "Restoring the data directory..."
 
-ynh_restore_file --origin_path="$data_dir" --not_mandatory
+ynh_restore "$data_dir"
 
 chown -R "root:root" "$data_dir"
 
 #=================================================
 # RESTORE SYSTEM CONFIGURATIONS
 #=================================================
-ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
+ynh_script_progression "Restoring system configurations related to $app..."
 
-ynh_restore_file --origin_path="/etc/logrotate.d/$app"
+ynh_restore "/etc/logrotate.d/$app"
 
-ynh_restore_file --origin_path="/etc/cron.d/$app"
+ynh_restore "/etc/cron.d/$app"
 
 #=================================================
 # RESTORE VARIOUS FILES
 #=================================================
 
-ynh_restore_file --origin_path="/var/log/$app/"
+ynh_restore "/var/log/$app/"
 
 #=================================================
 # END OF SCRIPT
 #=================================================
 
-ynh_script_progression --message="Restoration completed for $app" --last
+ynh_script_progression "Restoration completed for $app"

+ 13 - 26
scripts/upgrade

@@ -10,7 +10,7 @@ source /usr/share/yunohost/helpers
 #=================================================
 # ENSURE DOWNWARD COMPATIBILITY
 #=================================================
-ynh_script_progression --message="Ensuring downward compatibility..."
+ynh_script_progression "Ensuring downward compatibility..."
 
 _fix_frequencies
 _set_frequencies
@@ -23,63 +23,50 @@ if [ -z "${encrypt:-}" ]; then
     else
         encrypt=0
     fi
-    ynh_app_setting_set --app="$app" --key="encrypt" --value="$encrypt"
+    ynh_app_setting_set --key="encrypt" --value="$encrypt"
 fi
 
 # If core_backup doesn't exist, create it
-if [ -z "${core_backup:-}" ]; then
-    core_backup="$(grep "^ynh_core_backup=" "$install_dir/Backup_list.conf" | cut -d= -f2)"
-    ynh_app_setting_set --app="$app" --key="core_backup" --value="$core_backup"
-fi
+ynh_app_setting_set_default --key=core_backup --value="$(grep "^ynh_core_backup=" "$install_dir/Backup_list.conf" | cut -d= -f2)"
 
 # If apps_backup doesn't exist, create it
-if [ -z "${apps_backup:-}" ]; then
-    apps_backup="$(grep --count --max-count=1 "^ynh_app_backup=" "$install_dir/Backup_list.conf")"
-    ynh_app_setting_set --app="$app" --key="apps_backup" --value="$apps_backup"
-fi
+ynh_app_setting_set_default --key=apps_backup --value="$(grep --count --max-count=1 "^ynh_app_backup=" "$install_dir/Backup_list.conf")"
 
 # If overwrite_cron doesn't exist, create it
-if [ -z "${overwrite_cron:-}" ]; then
-    overwrite_cron=1
-    ynh_app_setting_set --app="$app" --key="overwrite_cron" --value="$overwrite_cron"
-fi
+ynh_app_setting_set_default --key=overwrite_cron --value=1
 
 # If admin_mail_html doesn't exist, create it
-if [ -z "${admin_mail_html:-}" ]; then
-    admin_mail_html=1
-    ynh_app_setting_set --app="$app" --key="admin_mail_html" --value="$admin_mail_html"
-fi
+ynh_app_setting_set_default --key=admin_mail_html --value=1
 
 #=================================================
 # DOWNLOAD, CHECK AND UNPACK SOURCE
 #=================================================
-ynh_script_progression --message="Upgrading source files..." --weight=2
+ynh_script_progression "Upgrading source files..."
 
 # Download, check integrity, uncompress and patch the source from app.src
-ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="passkey Backup_list.conf"
+ynh_setup_source --dest_dir="$install_dir" --full_replace --keep="passkey Backup_list.conf"
 
 chown -R "root:root" "$install_dir"
-
 #=================================================
 # UPDATE A CONFIG FILE
 #=================================================
-ynh_script_progression --message="Updating $app's configuration files..." --weight=1
+ynh_script_progression "Updating $app's configuration files..."
 
 #=================================================
 # REAPPLY SYSTEM CONFIGURATIONS
 #=================================================
-ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
+ynh_script_progression "Upgrading system configurations related to $app..."
 
 # Use logrotate to manage app-specific logfile(s)
-ynh_use_logrotate --non-append
+ynh_config_add_logrotate
 
 if (( overwrite_cron == 1 )); then
     # Add Cron configuration file
-    ynh_add_config --template="archivist.cron" --destination="/etc/cron.d/$app"
+    ynh_config_add --template="archivist.cron" --destination="/etc/cron.d/$app"
 fi
 
 #=================================================
 # END OF SCRIPT
 #=================================================
 
-ynh_script_progression --message="Upgrade of $app completed" --last
+ynh_script_progression "Upgrade of $app completed"