diff --git a/README.md b/README.md index 88afe53..39f7165 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,9 @@ Jirafeau is a web site permitting to upload a file in a simple way and give an u #### Supported architectures -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/jirafeau%20%28Official%29.svg)](https://ci-apps.yunohost.org/ci/apps/jirafeau/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/jirafeau%20%28Official%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/jirafeau/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/jirafeau%20%28Official%29.svg)](https://ci-stretch.nohost.me/ci/apps/jirafeau/) +* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/jirafeau%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/jirafeau/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/jirafeau%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/jirafeau/) +* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/jirafeau%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/jirafeau/) ## Limitations @@ -43,6 +43,7 @@ Jirafeau is a web site permitting to upload a file in a simple way and give an u * Report a bug: https://github.com/YunoHost-Apps/jirafeau_ynh/issues * Jirafeau website: https://gitlab.com/mojo42/Jirafeau + * Upstream app repository: https://gitlab.com/mojo42/Jirafeau * YunoHost website: https://yunohost.org/ --- diff --git a/check_process b/check_process index 8715c53..c67ae70 100644 --- a/check_process +++ b/check_process @@ -20,16 +20,7 @@ port_already_use=0 change_url=1 ;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto - Level 4=na Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Options Email= Notification=none diff --git a/manifest.json b/manifest.json index 934b452..2a347ff 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "julien.malik@paraiso.me" }, "requirements": { - "yunohost": ">= 3.2.0" + "yunohost": ">= 3.5.0" }, "multi_instance": false, "services": [ diff --git a/scripts/backup b/scripts/backup index 77d8c0c..5873ab2 100644 --- a/scripts/backup +++ b/scripts/backup @@ -17,48 +17,45 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --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 OF THE MAIN DIR OF THE APP #================================================= -ynh_print_info "Backing up the main app directory..." +ynh_script_progression --message="Backing up the main app directory..." -ynh_backup "$final_path" +ynh_backup --src_path="$final_path" #================================================= # BACKUP OF THE DATA DIR #================================================= -ynh_print_info "Backing up data directory..." +ynh_script_progression --message="Backing up data directory..." -# The 1 parameter indicates the directory is "big", -# so that it won't be backed up before upgrade -# This argument has to be the third one. -ynh_backup "/home/yunohost.app/$app" "/home/yunohost.app/$app" 1 +ynh_backup --src_path="/home/yunohost.app/$app" --is_big #================================================= # BACKUP OF THE NGINX CONFIGURATION #================================================= -ynh_print_info "Backing up nginx web server configuration..." +ynh_script_progression --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" #================================================= # BACKUP OF THE PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Backing up php-fpm configuration..." +ynh_script_progression --message="Backing up php-fpm configuration..." -ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last diff --git a/scripts/change_url b/scripts/change_url index 5708ecc..4e4774f 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,18 +24,9 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." -final_path=$(ynh_app_setting_get $app final_path) - -#================================================= -# CHECK PATHS SYNTAX -#================================================= - -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) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED @@ -58,7 +49,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_print_info "Updating nginx web server configuration..." +ynh_script_progression --message="Updating nginx web server configuration..." --weight=2 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -66,7 +57,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" @@ -78,10 +69,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 #================================================= @@ -89,19 +80,19 @@ fi #================================================= # Change domain name in parameters.yml -ynh_replace_string "\$cfg['web_root'] = .*" "\$cfg['web_root'] = 'https://' . '$new_domain' . '${new_path%/}' . '/';" "$final_path/lib/config.local.php" +ynh_replace_string --match_string="\$cfg['web_root'] = .*" --replace_string="\$cfg['web_root'] = 'https://' . '$new_domain' . '${new_path%/}' . '/';" --target_file="$final_path/lib/config.local.php" #================================================= # GENERIC FINALISATION #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." -systemctl reload nginx +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Change of url completed for $app" +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index 6477788..ad18600 100755 --- a/scripts/install +++ b/scripts/install @@ -31,41 +31,39 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_print_info "Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" -# Normalize the url path syntax -path_url=$(ynh_normalize_url_path $path_url) - # 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_script_progression --message="Storing installation settings..." -ynh_app_setting_set $app domain $domain -ynh_app_setting_set $app path $path_url -ynh_app_setting_set $app admin $admin_user -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=admin --value=$admin_user +ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # STANDARD MODIFICATIONS #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info "Setting up source files..." +ynh_script_progression --message="Setting up source files..." --weight=3 -ynh_app_setting_set $app final_path $final_path -ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie dans $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 --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info "Configuring nginx web server..." +ynh_script_progression --message="Configuring nginx web server..." # Create a dedicated nginx config ynh_add_nginx_config @@ -73,15 +71,15 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info "Configuring system user..." +ynh_script_progression --message="Configuring system user..." --weight=2 # Create a system user -ynh_system_user_create $app +ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Configuring php-fpm..." +ynh_script_progression --message="Configuring php-fpm..." --weight=2 # Create a dedicated php-fpm config ynh_add_fpm_config @@ -98,32 +96,32 @@ cp "../conf/config.local.php" "$jirafeauconfigfile" # Set and save upload password, allowing an empty one if [ -z "$upload_password" ] then - ynh_replace_string "__YNH_UPLOAD_PASSWORD__" "" "$jirafeauconfigfile" - ynh_app_setting_set $app upload_password "" + ynh_replace_string --match_string="__YNH_UPLOAD_PASSWORD__" --replace_string="" --target_file="$jirafeauconfigfile" + ynh_app_setting_set --app=$app --key=upload_password --value="" else - ynh_replace_string "__YNH_UPLOAD_PASSWORD__" "'$upload_password'" "$jirafeauconfigfile" - ynh_app_setting_set $app upload_password "$upload_password" + ynh_replace_string --match_string="__YNH_UPLOAD_PASSWORD__" --replace_string="'$upload_password'" --target_file="$jirafeauconfigfile" + ynh_app_setting_set --app=$app --key=upload_password --value="$upload_password" fi #================================================= # CONFIGURE JIRAFEAU #================================================= -ynh_print_info "Configuring jirafeau..." +ynh_script_progression --message="Configuring jirafeau..." var_root=/home/yunohost.app/$app -ynh_replace_string "__YNH_DOMAIN__" "$domain" "$jirafeauconfigfile" +ynh_replace_string --match_string="__YNH_DOMAIN__" --replace_string="$domain" --target_file="$jirafeauconfigfile" if [ "$path_url" = "/" ] then - ynh_replace_string "__YNH_WWW_PATH__" "" "$jirafeauconfigfile" + ynh_replace_string --match_string="__YNH_WWW_PATH__" --replace_string="" --target_file="$jirafeauconfigfile" else - ynh_replace_string "__YNH_WWW_PATH__" "$path_url" "$jirafeauconfigfile" + ynh_replace_string --match_string="__YNH_WWW_PATH__" --replace_string="$path_url" --target_file="$jirafeauconfigfile" fi -ynh_replace_string "__YNH_VAR_ROOT__" "$var_root" "$jirafeauconfigfile" -ynh_replace_string "__YNH_ADMIN_USER__" "$admin_user" "$jirafeauconfigfile" +ynh_replace_string --match_string="__YNH_VAR_ROOT__" --replace_string="$var_root" --target_file="$jirafeauconfigfile" +ynh_replace_string --match_string="__YNH_ADMIN_USER__" --replace_string="$admin_user" --target_file="$jirafeauconfigfile" # Calculate and store the config file checksum into the app settings -ynh_store_file_checksum "$jirafeauconfigfile" +ynh_store_file_checksum --file="$jirafeauconfigfile" # Remove the install.php rm $final_path/install.php @@ -143,25 +141,25 @@ chmod -R 700 $var_root #================================================= # SETUP SSOWAT #================================================= -ynh_print_info "Configuring SSOwat..." +ynh_script_progression --message="Configuring SSOwat..." -ynh_app_setting_set $app unprotected_uris "/" +ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" if [ $is_public -eq 0 ] then domain_regex=$(echo "$domain" | sed 's@-@.@g') [ "$path_url" = "/" ] && path_url="" - ynh_app_setting_set $app protected_regex "$domain_regex$path_url/$","$domain_regex$path_url/admin.php.*$" + ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/$","$domain_regex$path_url/admin.php.*$" fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." -systemctl reload nginx +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Installation of $app completed" +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index b6c8ac2..ade82c6 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,27 +12,27 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -final_path=$(ynh_app_setting_get $app final_path) +domain=$(ynh_app_setting_get --app=$app --key=domain) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE #================================================= # REMOVE THE MAIN DIR OF THE APP #================================================= -ynh_print_info "Removing app main directory" +ynh_script_progression --message="Removing app main directory..." # Remove the app directory securely -ynh_secure_remove "$final_path" +ynh_secure_remove --file="$final_path" #================================================= # REMOVE THE NGINX CONFIGURATION #================================================= -ynh_print_info "Removing nginx web server configuration" +ynh_script_progression --message="Removing nginx web server configuration..." # Remove the dedicated nginx config ynh_remove_nginx_config @@ -40,7 +40,7 @@ ynh_remove_nginx_config #================================================= # REMOVE THE PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Removing php-fpm configuration" +ynh_script_progression --message="Removing php-fpm configuration..." --weight=2 # Remove the dedicated php-fpm config ynh_remove_fpm_config @@ -50,22 +50,22 @@ ynh_remove_fpm_config #================================================= # REMOVE THE DATA DIRECTORY #================================================= -ynh_print_info "Removing data directory" +ynh_script_progression --message="Removing data directory..." -ynh_secure_remove "/home/yunohost.app/$app" +ynh_secure_remove --file="/home/yunohost.app/$app" #================================================= # GENERIC FINALISATION #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info "Removing the dedicated system user" +ynh_script_progression --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_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 3811c56..a94399e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -17,24 +17,24 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading settings..." +ynh_script_progression --message="Loading settings..." --weight=2 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) -db_name=$(ynh_app_setting_get $app db_name) +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) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_print_info "Validating restoration parameters..." +ynh_script_progression --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 RESTORE STEPS @@ -42,52 +42,47 @@ 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_script_progression --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_script_progression --message="Recreating the dedicated system user..." --weight=2 # Create the dedicated user (if not existing) -ynh_system_user_create $app +ynh_system_user_create --username=$app #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # SPECIFIC RESTORE #================================================= # RESTORE THE DATA OF JIRAFEAU #================================================= -ynh_print_info "Restoring the data directory..." +ynh_script_progression --message="Restoring the data directory..." --weight=2 datadir="/home/yunohost.app/$app" -# The data directory will be restored only if it exists in the backup archive -# So only if it was backup previously. -if [ -d "$YNH_BACKUP_DIR/apps/$app/backup$datadir" ] -then - ynh_restore_file "$datadir" -else - # Create app folders - mkdir -p "$datadir"/{files,links,async,block} -fi +# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup. +ynh_restore_file --origin_path="$datadir" --not_mandatory #================================================= # RESTORE USER RIGHTS #================================================= +# Create app folders +mkdir -p "$datadir"/{files,links,async,block} chown -R $app:root /home/yunohost.app/$app #================================================= @@ -95,13 +90,13 @@ chown -R $app:root /home/yunohost.app/$app #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_print_info "Reloading nginx web server and php-fpm..." +ynh_script_progression --message="Reloading nginx web server and php-fpm..." -systemctl reload php7.0-fpm -systemctl reload nginx +ynh_systemd_action --service_name=php7.0-fpm --action=reload +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Restoration completed for $app" +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 00cdc9d..cae86d6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,41 +12,47 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." --weight=2 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path) -admin_user=$(ynh_app_setting_get $app admin_user) -upload_password=$(ynh_app_setting_get $app upload_password) -final_path=$(ynh_app_setting_get $app final_path) -is_public=$(ynh_app_setting_get $app is_public) +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +admin_user=$(ynh_app_setting_get --app=$app --key=admin_user) +is_public=$(ynh_app_setting_get --app=$app --key=is_public) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +upload_password=$(ynh_app_setting_get --app=$app --key=upload_password) + +#================================================= +# CHECK VERSION +#================================================= + +upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_print_info "Ensuring downward compatibility..." +ynh_script_progression --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 +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_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3 # Backup the current version of the app ynh_backup_before_upgrade @@ -62,22 +68,26 @@ ynh_abort_if_errors #================================================= # Normalize the URL path syntax -path_url=$(ynh_normalize_url_path $path_url) +path_url=$(ynh_normalize_url_path --path_url=$path_url) #================================================= # STANDARD UPGRADE STEPS #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info "Upgrading source files..." -# Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source "$final_path" +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + ynh_script_progression --message="Upgrading source files..." --weight=2 + + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$final_path" +fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info "Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 # Create a dedicated nginx config ynh_add_nginx_config @@ -85,15 +95,15 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info "Making sure dedicated system user exists..." +ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) -ynh_system_user_create $app +ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Upgrading php-fpm configuration..." +ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 # Create a dedicated php-fpm config ynh_add_fpm_config @@ -106,39 +116,39 @@ ynh_add_fpm_config jirafeauconfigfile="$final_path/lib/config.local.php" -ynh_backup_if_checksum_is_different "$final_path/lib/config.local.php" +ynh_backup_if_checksum_is_different --file="$final_path/lib/config.local.php" cp "../conf/config.local.php" "$final_path/lib/config.local.php" # Set and save upload password, allowing an empty one if [ -z "$upload_password" ] then - ynh_replace_string "__YNH_UPLOAD_PASSWORD__" "" "$jirafeauconfigfile" - ynh_app_setting_set $app upload_password "" + ynh_replace_string --match_string="__YNH_UPLOAD_PASSWORD__" --replace_string="" --target_file="$jirafeauconfigfile" + ynh_app_setting_set --app=$app --key=upload_password --value="" else - ynh_replace_string "__YNH_UPLOAD_PASSWORD__" "'$upload_password'" "$jirafeauconfigfile" - ynh_app_setting_set $app upload_password "$upload_password" + ynh_replace_string --match_string="__YNH_UPLOAD_PASSWORD__" --replace_string="'$upload_password'" --target_file="$jirafeauconfigfile" + ynh_app_setting_set --app=$app --key=upload_password --value="$upload_password" fi #================================================= # CONFIGURE JIRAFEAU #================================================= -ynh_print_info "Upgrading jirafeau configuration..." +ynh_script_progression --message="Upgrading jirafeau configuration..." var_root=/home/yunohost.app/$app -ynh_replace_string "__YNH_DOMAIN__" "$domain" "$jirafeauconfigfile" +ynh_replace_string --match_string="__YNH_DOMAIN__" --replace_string="$domain" --target_file="$jirafeauconfigfile" if [ "$path_url" = "/" ] then - ynh_replace_string "__YNH_WWW_PATH__" "" "$jirafeauconfigfile" + ynh_replace_string --match_string="__YNH_WWW_PATH__" --replace_string="" --target_file="$jirafeauconfigfile" else - ynh_replace_string "__YNH_WWW_PATH__" "$path_url" "$jirafeauconfigfile" + ynh_replace_string --match_string="__YNH_WWW_PATH__" --replace_string="$path_url" --target_file="$jirafeauconfigfile" fi -ynh_replace_string "__YNH_VAR_ROOT__" "$var_root" "$jirafeauconfigfile" -ynh_replace_string "__YNH_ADMIN_USER__" "$admin_user" "$jirafeauconfigfile" +ynh_replace_string --match_string="__YNH_VAR_ROOT__" --replace_string="$var_root" --target_file="$jirafeauconfigfile" +ynh_replace_string --match_string="__YNH_ADMIN_USER__" --replace_string="$admin_user" --target_file="$jirafeauconfigfile" # Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum "$jirafeauconfigfile" +ynh_store_file_checksum --file="$jirafeauconfigfile" # Remove the install.php rm $final_path/install.php @@ -158,25 +168,25 @@ chmod -R 700 $var_root #================================================= # SETUP SSOWAT #================================================= -ynh_print_info "Upgrading SSOwat configuration..." +ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=2 -ynh_app_setting_set $app unprotected_uris "/" +ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" if [ $is_public -eq 0 ] then domain_regex=$(echo "$domain" | sed 's@-@.@g') [ "$path_url" = "/" ] && path_url="" - ynh_app_setting_set $app protected_regex "$domain_regex$path_url/$","$domain_regex$path_url/admin.php.*$" + ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/$","$domain_regex$path_url/admin.php.*$" fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." -systemctl reload nginx +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Upgrade of $app completed" +ynh_script_progression --message="Upgrade of $app completed" --last