From be105bb5749d8668a18734ae9bb65c9317a09368 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 24 Apr 2019 03:11:53 +0200 Subject: [PATCH] Apply last example_ynh --- conf/systemd.service | 2 +- manifest.json | 2 +- scripts/backup | 25 ++++++++--------- scripts/change_url | 35 ++++++++---------------- scripts/install | 52 +++++++++++++++++------------------ scripts/remove | 36 ++++++++++++------------ scripts/restore | 44 +++++++++++++----------------- scripts/upgrade | 65 ++++++++++++++++++++------------------------ 8 files changed, 118 insertions(+), 143 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 4c9bd16..58d15f0 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ EnvironmentFile=__FINALPATH__/.env -WorkingDirectory=__FINALPATH__ +WorkingDirectory=__FINALPATH__/ ExecStart=/bin/sh -c 'node ./dist/bin/server >> /var/log/__APP__/__APP__.log 2>&1' [Install] diff --git a/manifest.json b/manifest.json index e19b3ef..2ab0633 100644 --- a/manifest.json +++ b/manifest.json @@ -13,7 +13,7 @@ "name": "yalh76" }, "requirements": { - "yunohost": ">= 3.4" + "yunohost": ">= 3.5" }, "multi_instance": true, "services": [ diff --git a/scripts/backup b/scripts/backup index b6d3f96..fd087db 100644 --- a/scripts/backup +++ b/scripts/backup @@ -8,7 +8,6 @@ #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh -source ../settings/scripts/ynh_systemd_action source /usr/share/yunohost/helpers #================================================= @@ -24,47 +23,47 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get $app final_path) -domain=$(ynh_app_setting_get $app domain) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +domain=$(ynh_app_setting_get --app=$app --key=domain) #================================================= # STANDARD BACKUP STEPS #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_print_info "Backing up the main app directory..." +ynh_print_info --message="Backing up the main app directory..." -ynh_backup "$final_path" +ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_print_info "Backing up nginx web server configuration..." +ynh_print_info --message="Backing up nginx web server configuration..." -ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # SPECIFIC BACKUP #================================================= # BACKUP LOGROTATE #================================================= -ynh_print_info "Backing up logrotate configuration..." +ynh_print_info --message="Backing up logrotate configuration..." -ynh_backup "/etc/logrotate.d/$app" +ynh_backup --src_path="/etc/logrotate.d/$app" #================================================= # BACKUP SYSTEMD #================================================= -ynh_print_info "Backing up systemd configuration..." +ynh_print_info --message="Backing up systemd configuration..." -ynh_backup "/etc/systemd/system/$app.service" +ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index 12c1cf6..74e8caf 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,24 +24,13 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_print_info --message="Loading installation settings..." # Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get $app final_path) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) # Add settings here as needed by your application -#db_name=$(ynh_app_setting_get "$app" db_name) -#db_pwd=$(ynh_app_setting_get $app db_pwd) -port=$(ynh_app_setting_get $app port) - -#================================================= -# CHECK THE SYNTAX OF THE PATHS -#================================================= - -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) +port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED @@ -64,7 +53,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_print_info "Updating nginx web server configuration..." +ynh_print_info --message="Updating nginx web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -72,7 +61,7 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf if [ $change_path -eq 1 ] then # Make a backup of the original nginx config file if modified - ynh_backup_if_checksum_is_different "$nginx_conf_path" + ynh_backup_if_checksum_is_different --file="$nginx_conf_path" # Set global variables for nginx helper domain="$old_domain" path_url="$new_path" @@ -84,10 +73,10 @@ fi if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location - ynh_delete_file_checksum "$nginx_conf_path" + ynh_delete_file_checksum --file="$nginx_conf_path" mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location - ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf" + ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi #================================================= @@ -111,11 +100,11 @@ else new_domain_uri="$new_domain$new_path" fi -ynh_replace_string "EXTERNAL_URL=.*" "EXTERNAL_URL=https://$new_domain_uri/" "$final_path/.env" +ynh_replace_string --match_string="EXTERNAL_URL=.*" --replace_string="EXTERNAL_URL=https://$new_domain_uri/" --target_file="$final_path/.env" -ynh_backup_if_checksum_is_different "$final_path/.env" +ynh_backup_if_checksum_is_different --file="$final_path/.env" # Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum "$final_path/.env" +ynh_store_file_checksum --file="$final_path/.env" #================================================= # START SERVICE @@ -129,7 +118,7 @@ sleep 10 #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_print_info --message="Reloading nginx web server..." systemctl reload nginx @@ -137,4 +126,4 @@ systemctl reload nginx # END OF SCRIPT #================================================= -ynh_print_info "Change of URL completed for $app" +ynh_print_info --message="Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 73ed0b2..99333d9 100644 --- a/scripts/install +++ b/scripts/install @@ -32,38 +32,38 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_print_info "Validating installation parameters..." +ynh_print_info --message="Validating installation parameters..." final_path=/var/www/$app -test ! -e "$final_path" || ynh_die "This path already contains a folder" +test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register $app $domain $path_url +ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_print_info "Storing installation settings..." +ynh_print_info --message="Storing installation settings..." -ynh_app_setting_set $app domain $domain -ynh_app_setting_set $app path $path_url -ynh_app_setting_set $app is_public $is_public +ynh_app_setting_set --app=$app --key=domain --value=$domain +ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # STANDARD MODIFICATIONS #================================================= # FIND AND OPEN A PORT #================================================= -ynh_print_info "Configuring firewall ..." +ynh_print_info --message="Configuring firewall ..." # Find a free port port=$(ynh_find_port 8095) -ynh_app_setting_set $app port $port +ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_print_info "Installing dependencies ..." +ynh_print_info --message="Installing dependencies ..." ynh_install_app_dependencies $pkg_dependencies ynh_install_nodejs 10 @@ -71,16 +71,16 @@ ynh_install_nodejs 10 #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info "Setting up source files ..." +ynh_print_info --message="Setting up source files ..." -ynh_app_setting_set $app final_path $final_path +ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source "$final_path" +ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info "Configuring nginx web server..." +ynh_print_info --message="Configuring nginx web server..." # Create a dedicated nginx config ynh_add_nginx_config @@ -88,7 +88,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info "Configuring system user ..." +ynh_print_info --message="Configuring system user ..." # Create a system user ynh_system_user_create "$app" "$final_path" @@ -130,7 +130,7 @@ popd #================================================= # SETUP SYSTEMD #================================================= -ynh_print_info "Configuring a systemd service ..." +ynh_print_info --message="Configuring a systemd service ..." # Create a dedicated systemd config ynh_add_systemd_config @@ -148,17 +148,17 @@ else domain_uri="$domain$path_url" fi -ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "$final_path/.env" -ynh_replace_string "__PORT__" "$port" "$final_path/.env" -ynh_replace_string "__DOMAIN_URI__" "$domain_uri" "$final_path/.env" -ynh_replace_string "__FINALPATH__" "$final_path" "$final_path/.env" +ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="$final_path/.env" +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/.env" +ynh_replace_string --match_string="__DOMAIN_URI__" --replace_string="$domain_uri" --target_file="$final_path/.env" +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.env" #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= # Calculate and store the config file checksum into the app settings -ynh_store_file_checksum "$final_path/.env" +ynh_store_file_checksum --file="$final_path/.env" #================================================= # GENERIC FINALIZATION @@ -172,7 +172,7 @@ chown -R "$app":"$app" "$final_path" #================================================= # SETUP LOGROTATE #================================================= -ynh_print_info "Configuring log rotation ..." +ynh_print_info --message="Configuring log rotation ..." # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -188,19 +188,19 @@ yunohost service add $app --description "$app daemon for distbin" --log "/var/lo #================================================= # SETUP SSOWAT #================================================= -ynh_print_info "Configuring SSOwat ..." +ynh_print_info --message="Configuring SSOwat ..." # Make app public if necessary if [ $is_public -eq 1 ] then # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set $app unprotected_uris "/" + ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_print_info --message="Reloading nginx web server..." systemctl reload nginx @@ -215,4 +215,4 @@ sleep 10 # END OF SCRIPT #================================================= -ynh_print_info "Installation of $app completed" +ynh_print_info --message="Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 2352e91..a797fe9 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,13 +12,13 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -port=$(ynh_app_setting_get $app port) -final_path=$(ynh_app_setting_get $app final_path) +domain=$(ynh_app_setting_get --app=$app --key=domain) +port=$(ynh_app_setting_get --app=$app --key=port) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE @@ -29,14 +29,14 @@ final_path=$(ynh_app_setting_get $app final_path) # Remove a service from the admin panel, added by `yunohost service add` if yunohost service status $app >/dev/null 2>&1 then - ynh_print_info "Removing $app service" + ynh_print_info --message="Removing $app service" yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_print_info "Stopping and removing the systemd service" +ynh_print_info --message="Stopping and removing the systemd service" # Remove the dedicated systemd config ynh_remove_systemd_config @@ -44,7 +44,7 @@ ynh_remove_systemd_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_print_info "Removing dependencies" +ynh_print_info --message="Removing dependencies" # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -53,15 +53,15 @@ ynh_remove_nodejs #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info "Removing app main directory" +ynh_print_info --message="Removing app main directory" # Remove the app directory securely -ynh_secure_remove "$final_path" +ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info "Removing nginx web server configuration" +ynh_print_info --message="Removing nginx web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config @@ -69,7 +69,7 @@ ynh_remove_nginx_config #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_print_info "Removing logrotate configuration" +ynh_print_info --message="Removing logrotate configuration" # Remove the app-specific logrotate config ynh_remove_logrotate @@ -77,35 +77,35 @@ ynh_remove_logrotate #================================================= # CLOSE A PORT #================================================= -ynh_print_info "Close ports" +ynh_print_info --message="Closing a port..." if yunohost firewall list | grep -q "\- $port$" then - ynh_print_info "Closing port $port" + ynh_print_info --message="Closing port $port" ynh_exec_warn_less yunohost firewall disallow TCP $port fi #================================================= # SPECIFIC REMOVE #================================================= -# REMOVE THE CRON FILE +# REMOVE FILE #================================================= # Remove the log files -ynh_secure_remove "/var/log/$app/" +ynh_secure_remove --file="/var/log/$app/" #================================================= # GENERIC FINALIZATION #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info "Removing the dedicated system user" +ynh_print_info --message="Removing the dedicated system user" # Delete a system user -ynh_system_user_delete $app +ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Removal of $app completed" +ynh_print_info --message="Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 374982d..e745f06 100644 --- a/scripts/restore +++ b/scripts/restore @@ -24,23 +24,23 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading settings..." +ynh_print_info --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path) -final_path=$(ynh_app_setting_get $app final_path) +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_print_info "Validating restoration parameters..." +ynh_print_info --message="Validating restoration parameters..." -ynh_webpath_available $domain $path_url \ - || ynh_die "Path not available: ${domain}${path_url}" +ynh_webpath_available --domain=$domain --path_url=$path_url \ + || ynh_die --message="Path not available: ${domain}${path_url}" test ! -d $final_path \ - || ynh_die "There is already a directory: $final_path " + || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS @@ -48,22 +48,22 @@ test ! -d $final_path \ # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_print_info "Restoring the app main directory..." +ynh_print_info --message="Restoring the app main directory..." -ynh_restore_file "$final_path" +ynh_restore_file --origin_path="$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_print_info "Recreating the dedicated system user..." +ynh_print_info --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) -ynh_system_user_create "$app" "$final_path" +ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # RESTORE USER RIGHTS @@ -84,7 +84,7 @@ chown -R "$app":"$app" "/var/log/$app" #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_print_info "Reinstalling dependencies..." +ynh_print_info --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies @@ -93,9 +93,9 @@ ynh_install_nodejs 10 #================================================= # RESTORE SYSTEMD #================================================= -ynh_print_info "Restoring the systemd configuration..." +ynh_print_info --message="Restoring the systemd configuration..." -ynh_restore_file "/etc/systemd/system/$app.service" +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service systemctl daemon-reload @@ -105,24 +105,18 @@ systemctl daemon-reload yunohost service add $app --log "/var/log/$app/$app.log" -#================================================= -# RESTORE THE CRON FILE -#================================================= - -#ynh_restore_file "/etc/cron.d/$app" - #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= -ynh_restore_file "/etc/logrotate.d/$app" +ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_print_info --message="Reloading nginx web server..." systemctl reload nginx @@ -144,4 +138,4 @@ sleep 10 # END OF SCRIPT #================================================= -ynh_print_info "Restoration completed for $app" +ynh_print_info --message="Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 78ca538..5c9d7fa 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,40 +12,40 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path) -is_public=$(ynh_app_setting_get $app is_public) -final_path=$(ynh_app_setting_get $app final_path) -port=$(ynh_app_setting_get $app port) +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +is_public=$(ynh_app_setting_get --app=$app --key=is_public) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_print_info "Ensuring downward compatibility..." +ynh_print_info --message="Ensuring downward compatibility..." # Fix is_public as a boolean value if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set $app is_public 1 + ynh_app_setting_set --app=$app --key=is_public --value=1 is_public=1 elif [ "$is_public" = "No" ]; then - ynh_app_setting_set $app is_public 0 + ynh_app_setting_set --app=$app --key=is_public --value=0 is_public=0 fi # If final_path doesn't exist, create it if [ -z $final_path ]; then final_path=/var/www/$app - ynh_app_setting_set $app final_path $final_path + ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info "Backing up the app before upgrading (may take a while)..." +ynh_print_info --message="Backing up the app before upgrading (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -57,13 +57,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# CHECK THE PATH -#================================================= - -# Normalize the URL path syntax -path_url=$(ynh_normalize_url_path $path_url) - #================================================= # STOP SERVICE #================================================= @@ -75,15 +68,15 @@ ynh_systemd_action --action=stop --service_name=$app #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info "Upgrading source files..." +ynh_print_info --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src# -ynh_setup_source "$final_path" +ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info "Upgrading nginx web server configuration..." +ynh_print_info --message="Upgrading nginx web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config @@ -91,7 +84,7 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_print_info "Upgrading dependencies..." +ynh_print_info --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_dependencies ynh_remove_nodejs @@ -100,10 +93,10 @@ ynh_install_nodejs 10 #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info "Making sure dedicated system user exists..." +ynh_print_info --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) -ynh_system_user_create "$app" "$final_path" +ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # SPECIFIC UPGRADE @@ -146,19 +139,19 @@ else domain_uri="$domain$path_url" fi -ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "$final_path/.env" -ynh_replace_string "__PORT__" "$port" "$final_path/.env" -ynh_replace_string "__DOMAIN_URI__" "$domain_uri" "$final_path/.env" -ynh_replace_string "__FINALPATH__" "$final_path" "$final_path/.env" +ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="$final_path/.env" +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/.env" +ynh_replace_string --match_string="__DOMAIN_URI__" --replace_string="$domain_uri" --target_file="$final_path/.env" +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.env" -ynh_backup_if_checksum_is_different "$final_path/.env" +ynh_backup_if_checksum_is_different --file="$final_path/.env" # Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum "$final_path/.env" +ynh_store_file_checksum --file="$final_path/.env" #================================================= # SETUP LOGROTATE #================================================= -ynh_print_info "Upgrading logrotate configuration..." +ynh_print_info --message="Upgrading logrotate configuration..." # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append @@ -166,7 +159,7 @@ ynh_use_logrotate --non-append #================================================= # SETUP SYSTEMD #================================================= -ynh_print_info "Upgrading systemd configuration..." +ynh_print_info --message="Upgrading systemd configuration..." # Create a dedicated systemd config ynh_add_systemd_config @@ -190,19 +183,19 @@ chown -R "$app":"$app" "/var/log/$app" #================================================= # SETUP SSOWAT #================================================= -ynh_print_info "Upgrading SSOwat configuration..." +ynh_print_info --message="Upgrading SSOwat configuration..." # Make app public if necessary if [ $is_public -eq 1 ] then # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set $app unprotected_uris "/" + ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_print_info --message="Reloading nginx web server..." systemctl reload nginx @@ -217,4 +210,4 @@ sleep 10 # END OF SCRIPT #================================================= -ynh_print_info "Upgrade of $app completed" +ynh_print_info --message="Upgrade of $app completed"