diff --git a/conf/cron b/conf/cron index ac8001a9..92ac65a2 100644 --- a/conf/cron +++ b/conf/cron @@ -1 +1 @@ -* * * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/artisan schedule:run >> /dev/null 2>&1 +* * * * * __APP__ /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/artisan schedule:run >> /dev/null 2>&1 diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf deleted file mode 100644 index f7960328..00000000 --- a/conf/extra_php-fpm.conf +++ /dev/null @@ -1,4 +0,0 @@ -; Additional php.ini defines, specific to this pool of workers. - -php_admin_value[upload_max_filesize] = 100M -php_admin_value[post_max_size] = 100M diff --git a/conf/horizon.conf b/conf/horizon.conf index f65edfb2..29fb2159 100644 --- a/conf/horizon.conf +++ b/conf/horizon.conf @@ -1,6 +1,6 @@ [program:__APP__-horizon] process_name=%(program_name)s -command=php__PHPVERSION__ __INSTALL_DIR__/artisan horizon +command=php__PHP_VERSION__ __INSTALL_DIR__/artisan horizon autostart=true autorestart=true user=__APP__ diff --git a/conf/nginx.conf b/conf/nginx.conf index e4abe618..de2df59c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -12,7 +12,7 @@ location __PATH__/ { try_files $uri $uri/ @pixelfed; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock; fastcgi_index index.php; include fastcgi_params; diff --git a/manifest.toml b/manifest.toml index cea96577..5b268876 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,8 @@ userdoc = "https://docs.pixelfed.org/" code = "https://github.com/pixelfed/pixelfed" [integration] -yunohost = ">= 11.2.12" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = "all" multi_instance = true ldap = false @@ -44,6 +45,7 @@ ram.runtime = "100M" allow_email = true [resources.install_dir] + group = "www-data:r-x" [resources.permissions] main.url = "/" diff --git a/scripts/_common.sh b/scripts/_common.sh index bb3f8d89..fd6b45c3 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,23 +1,10 @@ #!/bin/bash #================================================= -# COMMON VARIABLES -#================================================= - -YNH_COMPOSER_VERSION="2.2.21" - -#================================================= -# PERSONAL HELPERS -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= +composer_version="2.2.21" # Create a dedicated supervisor config # @@ -27,13 +14,13 @@ YNH_COMPOSER_VERSION="2.2.21" # # This will use the template `../conf/.service`. # -# See the documentation of `ynh_add_config` for a description of the template +# See the documentation of `ynh_config_add` for a description of the template # format and how placeholders are replaced with actual variables. # # Requires YunoHost version 2.7.11 or higher. ynh_add_supervisor_config () { # Declare an array to define the options of this helper. - local legacy_args=stv + #REMOVEME? local legacy_args=stv local -A args_array=( [s]=service= [t]=template= [v]=others_var=) local service local template @@ -44,9 +31,9 @@ ynh_add_supervisor_config () { local template="${template:-supervisor.service}" others_var="${others_var:-}" - [[ -z "$others_var" ]] || ynh_print_warn --message="Packagers: using others_var is unecessary since Yunohost 4.2" + [[ -z "$others_var" ]] || ynh_print_warn "Packagers: using others_var is unecessary since Yunohost 4.2" - ynh_add_config --template="$YNH_APP_BASEDIR/conf/$template" --destination="/etc/supervisor/conf.d/$service.conf" + ynh_config_add --template="$YNH_APP_BASEDIR/conf/$template" --destination="/etc/supervisor/conf.d/$service.conf" supervisorctl reread supervisorctl update @@ -60,7 +47,7 @@ ynh_add_supervisor_config () { # Requires YunoHost version 2.7.2 or higher. ynh_remove_supervisor_config () { # Declare an array to define the options of this helper. - local legacy_args=s + #REMOVEME? local legacy_args=s local -A args_array=( [s]=service= ) local service # Manage arguments with getopts @@ -70,8 +57,8 @@ ynh_remove_supervisor_config () { local finalsupervisorconf="/etc/supervisor/conf.d/$service.conf" if [ -e "$finalsupervisorconf" ] then - ynh_supervisor_action --service_name=$service --action=stop - ynh_secure_remove --file="$finalsupervisorconf" + ynh_supervisor_action --service=$service --action=stop + ynh_safe_rm "$finalsupervisorconf" supervisorctl reread supervisorctl update fi @@ -79,10 +66,10 @@ ynh_remove_supervisor_config () { # Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started # -# usage: ynh_supervisor_action [--service_name=service_name] [--action=action] [ [--line_match="line to match"] [--log_path=log_path] [--timeout=300] [--length=20] ] -# | arg: -n, --service_name= - Name of the service to start. Default : `$app` +# usage: ynh_supervisor_action [--service=service_name] [--action=action] [ [--wait_until="line to match"] [--log_path=log_path] [--timeout=300] [--length=20] ] +# | arg: -n, --service= - Name of the service to start. Default : `$app` # | arg: -a, --action= - Action to perform with supervisorctl. Default: start -# | arg: -l, --line_match= - Line to match - The line to find in the log to attest the service have finished to boot. If not defined it don't wait until the service is completely started. +# | arg: -l, --wait_until= - Line to match - The line to find in the log to attest the service have finished to boot. If not defined it don't wait until the service is completely started. # | arg: -p, --log_path= - Log file - Path to the log file. Default : `/var/log/$app/$app.log` # | arg: -t, --timeout= - Timeout - The maximum time to wait before ending the watching. Default : 300 seconds. # | arg: -e, --length= - Length of the error log : Default : 20 @@ -90,7 +77,7 @@ ynh_remove_supervisor_config () { # Requires YunoHost version 3.5.0 or higher. ynh_supervisor_action() { # Declare an array to define the options of this helper. - local legacy_args=nalpte + #REMOVEME? local legacy_args=nalpte declare -Ar args_array=( [n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length= ) local service_name local action @@ -155,7 +142,7 @@ ynh_supervisor_action() { # Read the log until the sentence is found, that means the app finished to start. Or run until the timeout if grep --extended-regexp --quiet "$line_match" "$templog" then - ynh_print_info --message="The service $service_name has correctly executed the action ${action}." + ynh_print_info "The service $service_name has correctly executed the action ${action}." break fi if [ $i -eq 3 ]; then @@ -172,12 +159,12 @@ ynh_supervisor_action() { fi if [ $i -eq $timeout ] then - ynh_print_warn --message="The service $service_name didn't fully executed the action ${action} before the timeout." - ynh_print_warn --message="Please find here an extract of the end of the log of the service $service_name:" + ynh_print_warn "The service $service_name didn't fully executed the action ${action} before the timeout." + ynh_print_warn "Please find here an extract of the end of the log of the service $service_name:" ynh_exec_warn journalctl --quiet --no-hostname --no-pager --lines=$length --unit=$service_name if [ -e "$log_path" ] then - ynh_print_warn --message="\-\-\-" + ynh_print_warn "\-\-\-" ynh_exec_warn tail --lines=$length "$log_path" fi fi diff --git a/scripts/backup b/scripts/backup index 535642d5..09d204d0 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,37 +1,28 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts 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 THE NGINX CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf" #================================================= # SPECIFIC BACKUP @@ -39,29 +30,29 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" # BACKUP LOGROTATE #================================================= -ynh_backup --src_path="/etc/logrotate.d/$app" +ynh_backup "/etc/logrotate.d/$app" #================================================= # BACKUP SUPERVISOR CONFIGURATION #================================================= -ynh_backup --src_path="/etc/supervisor/conf.d/${app}-horizon.conf" +ynh_backup "/etc/supervisor/conf.d/${app}-horizon.conf" #================================================= # BACKUP VARIOUS FILES #================================================= -ynh_backup --src_path="/etc/cron.d/$app" +ynh_backup "/etc/cron.d/$app" #================================================= # BACKUP THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Backing up the PostgreSQL database..." +ynh_print_info "Backing up the PostgreSQL database..." -ynh_psql_dump_db --database="$db_name" > db.sql +ynh_psql_dump_db > db.sql #================================================= # 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)." diff --git a/scripts/change_url b/scripts/change_url index 6aa0860a..9372400f 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,71 +1,61 @@ #!/bin/bash -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD MODIFICATIONS #================================================= # STOP SUPERVISOR SERVICE #================================================= -ynh_script_progression --message="Stopping a supervisor service..." --weight=1 +ynh_script_progression "Stopping a supervisor service..." -ynh_supervisor_action --service_name="${app}-horizon" --action="stop" --log_path="/var/log/$app/${app}-horizon.log" +ynh_supervisor_action --service="${app}-horizon" --action="stop" --log_path="/var/log/$app/${app}-horizon.log" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 +ynh_script_progression "Updating NGINX web server configuration..." -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # SPECIFIC MODIFICATIONS #================================================= # UPDATE CONFIG FILE #================================================= -ynh_script_progression --message="Updating config file..." --weight=1 +ynh_script_progression "Updating config file..." config="$install_dir/.env" -ynh_backup_if_checksum_is_different --file="$config" -ynh_replace_string --match_string="APP_URL=.*" --replace_string="APP_URL=https://$new_domain" --target_file="$config" -ynh_replace_string --match_string="ADMIN_DOMAIN=.*" --replace_string="ADMIN_DOMAIN=\"$new_domain\"" --target_file="$config" -ynh_replace_string --match_string="APP_DOMAIN=.*" --replace_string="APP_DOMAIN=\"$new_domain\"" --target_file="$config" -ynh_replace_string --match_string="MAIL_FROM_ADDRESS=.*" --replace_string="MAIL_FROM_ADDRESS=\"pixelfed@$new_domain\"" --target_file="$config" +ynh_backup_if_checksum_is_different "$config" +ynh_replace --match="APP_URL=.*" --replace="APP_URL=https://$new_domain" --file="$config" +ynh_replace --match="ADMIN_DOMAIN=.*" --replace="ADMIN_DOMAIN=\"$new_domain\"" --file="$config" +ynh_replace --match="APP_DOMAIN=.*" --replace="APP_DOMAIN=\"$new_domain\"" --file="$config" +ynh_replace --match="MAIL_FROM_ADDRESS=.*" --replace="MAIL_FROM_ADDRESS=\"pixelfed@$new_domain\"" --file="$config" # Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$config" +ynh_store_file_checksum "$config" #================================================= # APPLY CHANGES #================================================= -ynh_script_progression --message="Applying changes..." --weight=1 +ynh_script_progression "Applying changes..." pushd "$install_dir" - php$phpversion artisan config:clear - php$phpversion artisan config:cache - php$phpversion artisan route:clear - php$phpversion artisan route:cache - php$phpversion artisan horizon:purge + php$php_version artisan config:clear + php$php_version artisan config:cache + php$php_version artisan route:clear + php$php_version artisan route:cache + php$php_version artisan horizon:purge popd -#================================================= -# GENERIC FINALISATION #================================================= # START SUPERVISOR SERVICE #================================================= -ynh_script_progression --message="Starting a supervisor service..." --weight=1 +ynh_script_progression "Starting a supervisor service..." -ynh_supervisor_action --service_name="${app}-horizon" --action="start" --log_path="systemd" --line_match="success: ${app}-horizon" +ynh_supervisor_action --service="${app}-horizon" --action="start" --log_path="systemd" --wait_until="success: ${app}-horizon" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression "Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 9b385c3b..4e6ed9b9 100644 --- a/scripts/install +++ b/scripts/install @@ -1,104 +1,100 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers +ynh_app_setting_set --key=php_upload_max_filesize --value=100M + #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= app_key="base64:$(ynh_string_random --length=32 | base64)" -fpm_footprint="low" -fpm_free_footprint=0 -fpm_usage="low" +#REMOVEME? Everything about fpm_footprint is removed in helpers2.1... | fpm_footprint="low" +#REMOVEME? Everything about fpm_free_footprint is removed in helpers2.1... | fpm_free_footprint=0 +#REMOVEME? Everything about fpm_usage is removed in helpers2.1... | fpm_usage="low" #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_app_setting_set --app=$app --key=app_key --value=$app_key -ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint -ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint -ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage +ynh_app_setting_set --key=app_key --value=$app_key +#REMOVEME? Everything about fpm_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_footprint --value=$fpm_footprint +#REMOVEME? Everything about fpm_free_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_free_footprint --value=$fpm_free_footprint +#REMOVEME? Everything about fpm_usage is removed in helpers2.1... | ynh_app_setting_set --key=fpm_usage --value=$fpm_usage #================================================= # CONFIGURE REDIS DATABASE #================================================= -ynh_script_progression --message="Creating a Redis database..." --weight=1 +ynh_script_progression "Creating a Redis database..." redis_db=$(ynh_redis_get_free_db) -ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" +ynh_app_setting_set --key=redis_db --value="$redis_db" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 +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" -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # PATCHING SOURCE #================================================= -ynh_script_progression --message="Patching source files..." --weight=1 +ynh_script_progression "Patching source files..." # Prevent privilege escalation by injecting commands in an email name # This described in more detail on the manpage https://www.postfix.org/sendmail.1.html under security -ynh_replace_string --match_string="'/usr/sbin/sendmail -bs'" --replace_string="'/usr/sbin/sendmail -bs -- '" --target_file=$install_dir/config/mail.php +ynh_replace --match="'/usr/sbin/sendmail -bs'" --replace="'/usr/sbin/sendmail -bs -- '" --file=$install_dir/config/mail.php #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 +ynh_script_progression "Configuring PHP-FPM..." -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --group=www-data +ynh_config_add_phpfpm # FIXMEhelpers2.1 : --group=www-data to be replaced with php_group=www-data to be added in _common.sh -ynh_add_nginx_config +ynh_config_add_nginx #================================================= # SPECIFIC SETUP #================================================= # INSTALL COMPOSER DEPENDENCIES #================================================= -ynh_script_progression --message="Installing composer dependencies..." --weight=1 +ynh_script_progression "Installing composer dependencies..." -ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --composerversion="$YNH_COMPOSER_VERSION" --workdir="$install_dir" +ynh_composer_install +ynh_composer_exec install --no-dev #================================================= # CREATE LOG FILE #================================================= -ynh_script_progression --message="Creating log file..." --weight=1 +ynh_script_progression "Creating log file..." mkdir -p "/var/log/$app/" touch "/var/log/$app/${app}-horizon.log" -chown -R $app: "/var/log/$app/" -chmod -R 600 "/var/log/$app/" +#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app: "/var/log/$app/" +#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R 600 "/var/log/$app/" #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 +ynh_script_progression "Adding $app's configuration..." -ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" +ynh_config_add --template=".env" --destination="$install_dir/.env" # Pixelfed app should be able to edit its settings from the admin panel -chmod 600 "$install_dir/.env" -chown $app:$app "$install_dir/.env" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 600 "$install_dir/.env" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/.env" #================================================= # SETUP SUPERVISOR #================================================= -ynh_script_progression --message="Configuring a supervisor service..." --weight=1 +ynh_script_progression "Configuring a supervisor service..." # Create a dedicated supervisor config ynh_add_supervisor_config --service="${app}-horizon" --template=horizon.conf @@ -106,51 +102,49 @@ ynh_add_supervisor_config --service="${app}-horizon" --template=horizon.conf #================================================= # DEPLOY #================================================= -ynh_script_progression --message="Deploying..." --weight=1 +ynh_script_progression "Deploying..." pushd "$install_dir" - php$phpversion artisan -n key:generate --force - php$phpversion artisan horizon:install - php$phpversion artisan horizon:publish - php$phpversion artisan passport:keys - php$phpversion artisan config:clear - php$phpversion artisan config:cache - php$phpversion artisan route:cache - php$phpversion artisan view:cache - php$phpversion artisan storage:link - php$phpversion artisan migrate --force - php$phpversion artisan update - php$phpversion artisan horizon:purge - php$phpversion artisan import:cities 2>/dev/null - php$phpversion artisan instance:actor - php$phpversion artisan passport:client --personal <<< "\\n" + php$php_version artisan -n key:generate --force + php$php_version artisan horizon:install + php$php_version artisan horizon:publish + php$php_version artisan passport:keys + php$php_version artisan config:clear + php$php_version artisan config:cache + php$php_version artisan route:cache + php$php_version artisan view:cache + php$php_version artisan storage:link + php$php_version artisan migrate --force + php$php_version artisan update + php$php_version artisan horizon:purge + php$php_version artisan import:cities 2>/dev/null + php$php_version artisan instance:actor + php$php_version artisan passport:client --personal <<< "\\n" popd #================================================= # INSTALL THE CRON FILE #================================================= -ynh_script_progression --message="Installing the cron file..." --weight=1 +ynh_script_progression "Installing the cron file..." -ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +ynh_config_add --template="cron" --destination="/etc/cron.d/$app" -#================================================= -# GENERIC FINALIZATION #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 +ynh_script_progression "Configuring log rotation..." # Use logrotate to manage application logfile(s) -ynh_use_logrotate --logfile="/var/log/$app/${app}-horizon.log" -ynh_use_logrotate --logfile="/var/www/$app/storage/logs/laravel.log" --specific_user=$app/www-data +ynh_config_add_logrotate "/var/log/$app/${app}-horizon.log" +ynh_config_add_logrotate "/var/www/$app/storage/logs/laravel.log" #================================================= # PATCH PERMISSIONS for v0.11.5 versions and higher #================================================= -ynh_script_progression --message="Patching permissions (for version 0.11.5 and newer)..." --weight=1 +ynh_script_progression "Patching permissions (for version 0.11.5 and newer)..." # Default configuration doesn't work -ynh_replace_string --match_string="'private' => 0700," --replace_string="'private' => 0750," --target_file=$install_dir/config/filesystems.php +ynh_replace --match="'private' => 0700," --replace="'private' => 0750," --file=$install_dir/config/filesystems.php # Repair permissions for files created after v0.11.5 and before this patch if [ -d "$install_dir/public/storage/m/_v2/" ]; then @@ -163,20 +157,20 @@ fi #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression "Integrating service in YunoHost..." yunohost service add "supervisor" --description="Supervisor daemon for $app" --log="/var/log/$app/${app}-horizon.log" #================================================= # START SUPERVISOR SERVICE #================================================= -ynh_script_progression --message="Starting a supervisor service..." --weight=1 +ynh_script_progression "Starting a supervisor service..." # Start a supervisor service -ynh_supervisor_action --service_name="${app}-horizon" --action="reload" --log_path="systemd" --line_match="success: ${app}-horizon" +ynh_supervisor_action --service="${app}-horizon" --action="reload" --log_path="systemd" --wait_until="success: ${app}-horizon" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 4371e1d4..ec58003f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers @@ -16,16 +10,16 @@ source /usr/share/yunohost/helpers #================================================= # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status "supervisor" >/dev/null +if ynh_hide_warnings yunohost service status "supervisor" >/dev/null then - ynh_script_progression --message="Removing supervisor service..." + ynh_script_progression "Removing supervisor service..." yunohost service remove "supervisor" fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_script_progression --message="Stopping and removing the supervisor service..." --weight=1 +ynh_script_progression "Stopping and removing the supervisor service..." # Remove the dedicated supervisor config ynh_remove_supervisor_config --service="${app}-horizon" @@ -33,43 +27,43 @@ ynh_remove_supervisor_config --service="${app}-horizon" #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 +ynh_script_progression "Removing logrotate configuration..." # Remove the app-specific logrotate config -ynh_remove_logrotate +ynh_config_remove_logrotate #================================================= # REMOVE THE REDIS DATABASE #================================================= -ynh_script_progression --message="Removing the Redis database..." --weight=1 +ynh_script_progression "Removing the Redis database..." ynh_redis_remove_db "$redis_db" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 +ynh_script_progression "Removing NGINX web server configuration..." # Remove the dedicated NGINX config -ynh_remove_nginx_config +ynh_config_remove_nginx #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 +ynh_script_progression "Removing PHP-FPM configuration..." # Remove the dedicated PHP-FPM config -ynh_remove_fpm_config +ynh_config_remove_phpfpm #================================================= # SPECIFIC REMOVE #================================================= # REMOVE VARIOUS FILES #================================================= -ynh_script_progression --message="Removing various files..." --weight=1 +ynh_script_progression "Removing various files..." # Remove a cron file -ynh_secure_remove --file="/etc/cron.d/$app" +ynh_safe_rm "/etc/cron.d/$app" # Remove the log files @@ -77,4 +71,4 @@ ynh_secure_remove --file="/etc/cron.d/$app" # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 085b019e..826375d4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -13,95 +7,92 @@ 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" - -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +ynh_restore "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" #================================================= # PATCHING SOURCE #================================================= -ynh_script_progression --message="Patching source files..." --weight=1 +ynh_script_progression "Patching source files..." # Prevent privilege escalation by injecting commands in an email name # This described in more detail on the manpage https://www.postfix.org/sendmail.1.html under security -ynh_replace_string --match_string="'/usr/sbin/sendmail -bs'" --replace_string="'/usr/sbin/sendmail -bs -- '" --target_file=$install_dir/config/mail.php +ynh_replace --match="'/usr/sbin/sendmail -bs'" --replace="'/usr/sbin/sendmail -bs -- '" --file=$install_dir/config/mail.php #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Restoring PHP-FPM configuration..." --weight=1 +ynh_script_progression "Restoring PHP-FPM configuration..." -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf" #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 +ynh_script_progression "Restoring the NGINX web server configuration..." -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 +ynh_script_progression "Restoring the PostgreSQL database..." -ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name +ynh_psql_db_shell < "./db.sql"" #================================================= # RESTORE VARIOUS FILES #================================================= -ynh_script_progression --message="Restoring various files..." --weight=1 +ynh_script_progression "Restoring various files..." -ynh_restore_file --origin_path="/etc/cron.d/$app" +ynh_restore "/etc/cron.d/$app" mkdir -p "/var/log/$app/" touch "/var/log/$app/${app}-horizon.log" -chown -R $app: "/var/log/$app/" +#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app: "/var/log/$app/" #================================================= # RESTORE SUPERVISOR CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the supervisor configuration..." --weight=1 +ynh_script_progression "Restoring the supervisor configuration..." -ynh_restore_file --origin_path="/etc/supervisor/conf.d/${app}-horizon.conf" +ynh_restore "/etc/supervisor/conf.d/${app}-horizon.conf" supervisorctl reread && supervisorctl update #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 +ynh_script_progression "Restoring the logrotate configuration..." -ynh_restore_file --origin_path="/etc/logrotate.d/$app" +ynh_restore "/etc/logrotate.d/$app" #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression "Integrating service in YunoHost..." yunohost service add "supervisor" --description="Supervisor daemon for $app" --log="/var/log/$app/${app}-horizon.log" #================================================= # START SUPERVISOR SERVICE #================================================= -ynh_script_progression --message="Starting a supervisor service..." --weight=1 +ynh_script_progression "Starting a supervisor service..." -ynh_supervisor_action --service_name="${app}-horizon" --action="reload" --log_path="systemd" --line_match="success: ${app}-horizon" +ynh_supervisor_action --service="${app}-horizon" --action="reload" --log_path="systemd" --wait_until="success: ${app}-horizon" -#================================================= -# GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 +ynh_script_progression "Reloading NGINX web server and PHP-FPM..." -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemctl --service=php$php_version-fpm --action=reload +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 76ef052e..efb06035 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,166 +1,153 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= +ynh_app_setting_set_default --key=php_upload_max_filesize --value=100M -upgrade_type=$(ynh_check_app_version_changed) - -#================================================= -# STANDARD UPGRADE STEPS #================================================= # STOP SUPERVISOR SERVICE #================================================= -ynh_script_progression --message="Stopping a supervisor service..." --weight=1 +ynh_script_progression "Stopping a supervisor service..." -ynh_supervisor_action --service_name="${app}-horizon" --action="stop" --log_path="systemd" --line_match="stopped: ${app}-horizon" +ynh_supervisor_action --service="${app}-horizon" --action="stop" --log_path="systemd" --wait_until="stopped: ${app}-horizon" #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +ynh_script_progression "Ensuring downward compatibility..." # If fpm_footprint doesn't exist, create it if [ -z "${fpm_footprint:-}" ]; then fpm_footprint=low - ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint +#REMOVEME? Everything about fpm_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_footprint --value=$fpm_footprint fi # If fpm_free_footprint doesn't exist, create it if [ -z "${fpm_free_footprint:-}" ]; then fpm_free_footprint=0 - ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint +#REMOVEME? Everything about fpm_free_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_free_footprint --value=$fpm_free_footprint fi # If fpm_usage doesn't exist, create it if [ -z "${fpm_usage:-}" ]; then fpm_usage=low - ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage +#REMOVEME? Everything about fpm_usage is removed in helpers2.1... | ynh_app_setting_set --key=fpm_usage --value=$fpm_usage fi # If app_key doesn't exist, retrieve it if [ -z "${app_key:-}" ]; then - ynh_script_progression --message="Retrieving app_key..." + ynh_script_progression "Retrieving app_key..." app_key=$(grep -oP "APP_KEY=\Kbase64.*" "$install_dir/.env") - ynh_app_setting_set --app="$app" --key=app_key --value="$app_key" + ynh_app_setting_set --key=app_key --value="$app_key" fi -if dpkg --compare-versions "0.9.0~ynh3" gt "$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version" || echo 1.0)" ; then - ynh_script_progression --message="Ensuring upgrade compatibility to 0.9.0~ynh3..." +if dpkg --compare-versions "0.9.0~ynh3" gt "$(ynh_read_manifest --key="version" || echo 1.0)" ; then + ynh_script_progression "Ensuring upgrade compatibility to 0.9.0~ynh3..." - ynh_script_progression --message="Configuring a systemd service..." - ynh_add_systemd_config --service="${app}-horizon" --template=horizon.conf + ynh_script_progression "Configuring $app's systemd service..." + ynh_config_add_systemd --service="${app}-horizon" --template=horizon.conf fi -if dpkg --compare-versions "0.10.9~ynh2" gt "$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version" || echo 1.0)" ; then - ynh_script_progression --message="Ensuring upgrade compatibility to 0.10.9~ynh2..." +if dpkg --compare-versions "0.10.9~ynh2" gt "$(ynh_read_manifest --key="version" || echo 1.0)" ; then + ynh_script_progression "Ensuring upgrade compatibility to 0.10.9~ynh2..." - ynh_script_progression --message="Stopping and removing the systemd service..." - ynh_remove_systemd_config --service="${app}-horizon" + ynh_script_progression "Stopping and removing the systemd service..." + ynh_config_remove_systemd"${app}-horizon" - ynh_script_progression --message="Creating log file..." + ynh_script_progression "Creating log file..." mkdir -p "/var/log/$app/" touch "/var/log/$app/${app}-horizon.log" - chown -R $app: "/var/log/$app/" + #REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app: "/var/log/$app/" - ynh_script_progression --message="Configuring a supervisor service..." + ynh_script_progression "Configuring a supervisor service..." ynh_add_supervisor_config --service="${app}-horizon" --template=horizon.conf - ynh_script_progression --message="Starting a supervisor service..." - ynh_supervisor_action --service_name="${app}-horizon" --action="start" --log_path="systemd" --line_match="success: ${app}-horizon" + ynh_script_progression "Starting a supervisor service..." + ynh_supervisor_action --service="${app}-horizon" --action="start" --log_path="systemd" --wait_until="success: ${app}-horizon" fi -if dpkg --compare-versions "0.10.9~ynh3" gt "$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version" || echo 1.0)" ; then - ynh_script_progression --message="Ensuring upgrade compatibility to 0.10.9~ynh3..." +if dpkg --compare-versions "0.10.9~ynh3" gt "$(ynh_read_manifest --key="version" || echo 1.0)" ; then + ynh_script_progression "Ensuring upgrade compatibility to 0.10.9~ynh3..." - if ynh_exec_warn_less yunohost service status ${app}-horizon >/dev/null + if ynh_hide_warnings yunohost service status ${app}-horizon >/dev/null then - ynh_script_progression --message="Removing ${app}-horizon service..." + ynh_script_progression "Removing ${app}-horizon service..." yunohost service remove "${app}-horizon" fi - ynh_script_progression --message="Integrating service in YunoHost..." + ynh_script_progression "Integrating service in YunoHost..." yunohost service add "supervisor" --description="Supervisor daemon for $app" --log="/var/log/$app/${app}-horizon.log" fi # Fix old email configs -if ynh_compare_current_package_version --comparison lt --version "0.11.8~ynh5" ; then - ynh_replace_special_string --match_string="MAIL_DRIVER=[^\\n]*" --replace_string="MAIL_DRIVER=sendmail" --target_file="$install_dir/.env" # two \\ because it's in a "" - ynh_replace_special_string --match_string="MAIL_HOST=[^\\n]*" --replace_string="MAIL_HOST=127.0.0.1" --target_file="$install_dir/.env" # two \\ because it's in a "" - ynh_replace_special_string --match_string="MAIL_USERNAME=[^\\n]*" --replace_string="MAIL_USERNAME=$app" --target_file="$install_dir/.env" # two \\ because it's in a "" - ynh_replace_special_string --match_string="MAIL_PASSWORD=[^\\n]*" --replace_string="MAIL_PASSWORD=$mail_pwd" --target_file="$install_dir/.env" # two \\ because it's in a "" - ynh_replace_special_string --match_string="MAIL_FROM_ADDRESS=pixelfed" --replace_string=`MAIL_FROM_ADDRESS="$app"` --target_file="$install_dir/.env" +if ynh_app_upgrading_from_version_before 0.11.8~ynh5 ; then + ynh_replace_regex --match="MAIL_DRIVER=[^\\n]*" --replace="MAIL_DRIVER=sendmail" --file="$install_dir/.env" # two \\ because it's in a "" + ynh_replace_regex --match="MAIL_HOST=[^\\n]*" --replace="MAIL_HOST=127.0.0.1" --file="$install_dir/.env" # two \\ because it's in a "" + ynh_replace_regex --match="MAIL_USERNAME=[^\\n]*" --replace="MAIL_USERNAME=$app" --file="$install_dir/.env" # two \\ because it's in a "" + ynh_replace_regex --match="MAIL_PASSWORD=[^\\n]*" --replace="MAIL_PASSWORD=$mail_pwd" --file="$install_dir/.env" # two \\ because it's in a "" + ynh_replace_regex --match="MAIL_FROM_ADDRESS=pixelfed" --replace=`MAIL_FROM_ADDRESS="$app"` --file="$install_dir/.env" fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -if [ "$upgrade_type" == "UPGRADE_APP" ] +# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed +if ynh_app_upstream_version_changed then - ynh_script_progression --message="Upgrading source files..." --weight=1 + ynh_script_progression "Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" --keep=".env" fi -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir" # Pixelfed app should be able to edit its settings from the admin panel -chmod 600 "$install_dir"/.env +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 600 "$install_dir"/.env #================================================= # PATCHING SOURCE #================================================= -ynh_script_progression --message="Patching source files..." --weight=1 +ynh_script_progression "Patching source files..." # Prevent privilege escalation by injecting commands in an email name # This described in more detail on the manpage https://www.postfix.org/sendmail.1.html under security -ynh_replace_string --match_string="'/usr/sbin/sendmail -bs'" --replace_string="'/usr/sbin/sendmail -bs -- '" --target_file=$install_dir/config/mail.php +ynh_replace --match="'/usr/sbin/sendmail -bs'" --replace="'/usr/sbin/sendmail -bs -- '" --file=$install_dir/config/mail.php #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 +ynh_script_progression "Upgrading PHP-FPM configuration..." # Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --group=www-data +ynh_config_add_phpfpm # FIXMEhelpers2.1 : --group=www-data to be replaced with php_group=www-data to be added in _common.sh #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 +ynh_script_progression "Upgrading NGINX web server configuration..." # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx -#================================================= -# SPECIFIC UPGRADE #================================================= # UPDATE COMPOSER DEPENDENCIES #================================================= -ynh_script_progression --message="Updating composer..." --weight=1 +ynh_script_progression "Updating composer..." -ynh_exec_warn_less ynh_composer_exec --workdir="$install_dir" --commands="self-update --2" +ynh_composer_exec self-update --2 -ynh_exec_warn_less ynh_composer_exec --workdir="$install_dir" --commands="update" +ynh_composer_exec update #================================================= # PATCH PERMISSIONS for v0.11.5 versions and higher #================================================= -ynh_script_progression --message="Patching permissions (for version 0.11.5 and newer)..." --weight=1 +ynh_script_progression "Patching permissions (for version 0.11.5 and newer)..." # Default configuration doesn't work -ynh_replace_string --match_string="'private' => 0700," --replace_string="'private' => 0750," --target_file=$install_dir/config/filesystems.php +ynh_replace --match="'private' => 0700," --replace="'private' => 0750," --file=$install_dir/config/filesystems.php # Repair permissions for files created after v0.11.5 and before this patch if [ -d "$install_dir/public/storage/m/_v2/" ]; then @@ -173,78 +160,76 @@ fi #================================================= # DEPLOYMENT #================================================= -ynh_script_progression --message="Deploying..." +ynh_script_progression "Deploying..." pushd "$install_dir" - php$phpversion artisan horizon:install - php$phpversion artisan horizon:publish - php$phpversion artisan passport:keys --force - php$phpversion artisan config:clear - php$phpversion artisan config:cache - php$phpversion artisan route:clear - php$phpversion artisan route:cache - php$phpversion artisan view:clear - php$phpversion artisan view:cache - php$phpversion artisan storage:link - php$phpversion artisan migrate --force - php$phpversion artisan update - php$phpversion artisan horizon:purge - php$phpversion artisan import:cities 2>/dev/null - php$phpversion artisan instance:actor - php$phpversion artisan passport:client --personal <<< "\\n" + php$php_version artisan horizon:install + php$php_version artisan horizon:publish + php$php_version artisan passport:keys --force + php$php_version artisan config:clear + php$php_version artisan config:cache + php$php_version artisan route:clear + php$php_version artisan route:cache + php$php_version artisan view:clear + php$php_version artisan view:cache + php$php_version artisan storage:link + php$php_version artisan migrate --force + php$php_version artisan update + php$php_version artisan horizon:purge + php$php_version artisan import:cities 2>/dev/null + php$php_version artisan instance:actor + php$php_version artisan passport:client --personal <<< "\\n" popd #================================================= # CREATE LOG FILE #================================================= -ynh_script_progression --message="Creating log file..." --weight=1 +ynh_script_progression "Creating log file..." mkdir -p "/var/log/$app/" touch "/var/log/$app/${app}-horizon.log" -chown -R $app: "/var/log/$app/" -chmod -R 600 "/var/log/$app/" +#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app: "/var/log/$app/" +#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R 600 "/var/log/$app/" #================================================= # UPGRADE THE CRON FILE #================================================= -ynh_script_progression --message="Upgrading cron file..." --weight=1 +ynh_script_progression "Upgrading cron file..." -ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +ynh_config_add --template="cron" --destination="/etc/cron.d/$app" #================================================= # SETUP SUPERVISOR #================================================= -ynh_script_progression --message="Upgrading supervisor configuration..." --weight=1 +ynh_script_progression "Upgrading supervisor configuration..." # Create a dedicated supervisor config ynh_add_supervisor_config --service="${app}-horizon" --template=horizon.conf -#================================================= -# GENERIC FINALIZATION #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 +ynh_script_progression "Upgrading logrotate configuration..." # Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append +ynh_config_add_logrotate #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression "Integrating service in YunoHost..." yunohost service add "supervisor" --description="Supervisor daemon for $app" --log="/var/log/$app/${app}-horizon.log" #================================================= # START SUPERVISOR SERVICE #================================================= -ynh_script_progression --message="Starting a supervisor service..." --weight=1 +ynh_script_progression "Starting a supervisor service..." -ynh_supervisor_action --service_name="${app}-horizon" --action="start" --log_path="systemd" --line_match="success: ${app}-horizon" +ynh_supervisor_action --service="${app}-horizon" --action="start" --log_path="systemd" --wait_until="success: ${app}-horizon" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed"