From 4319cbd4134c4711e8c3d262aa13aba1ec634629 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Fri, 30 Aug 2024 22:56:15 +0200 Subject: [PATCH] [autopatch] Automatic patch attempt for helpers 2.1 --- conf/extra_php-fpm.conf | 4 --- conf/nginx.conf | 2 +- conf/systemd.service | 4 +-- manifest.toml | 4 ++- scripts/_common.sh | 10 +------ scripts/backup | 37 +++++++++-------------- scripts/change_url | 18 ++++-------- scripts/install | 49 +++++++++++++------------------ scripts/remove | 27 +++++++---------- scripts/restore | 52 ++++++++++++++------------------- scripts/upgrade | 65 ++++++++++++++++++----------------------- 11 files changed, 110 insertions(+), 162 deletions(-) delete mode 100644 conf/extra_php-fpm.conf diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf deleted file mode 100644 index 700c37c..0000000 --- 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] = 50M -php_admin_value[post_max_size] = 50M diff --git a/conf/nginx.conf b/conf/nginx.conf index 398d4cf..49c18a5 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -33,7 +33,7 @@ location __PATH__/ { location ~* \.php$ { fastcgi_split_path_info ^(.+?\.php)(/.*)$; try_files $uri =404; - 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; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; diff --git a/conf/systemd.service b/conf/systemd.service index 7ab5b56..0416cac 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -10,8 +10,8 @@ WorkingDirectory=__INSTALL_DIR__/ Type=simple StandardOutput=append:/var/log/__APP__/daemon.log StandardError=inherit -ExecStart=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php start -ExecStop=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php stop +ExecStart=/usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/bin/daemon.php start +ExecStop=/usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/bin/daemon.php stop PIDFile=__INSTALL_DIR__/daemon.pid PrivateTmp=true InaccessibleDirectories=/home /root /boot /opt /mnt /media diff --git a/manifest.toml b/manifest.toml index 1a0448d..582eb56 100644 --- a/manifest.toml +++ b/manifest.toml @@ -20,7 +20,8 @@ userdoc = "https://wiki.friendi.ca/" code = "https://github.com/friendica/friendica" [integration] -yunohost = ">= 11.2" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = "all" multi_instance = true ldap = true @@ -60,6 +61,7 @@ ram.runtime = "50M" [resources.system_user] [resources.install_dir] +group = "www-data:r-x" [resources.permissions] main.url = "/" diff --git a/scripts/_common.sh b/scripts/_common.sh index c3aba20..3d7f008 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,13 +1,5 @@ #!/bin/bash #================================================= -# COMMON VARIABLES -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 1c91c7d..fb96c07 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,55 +1,46 @@ #!/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..." -(cd "$install_dir" && ynh_exec_as "$app" "php$phpversion" bin/console.php maintenance 1) +(cd "$install_dir" && ynh_exec_as_app "php$php_version" bin/console.php maintenance 1) -trap '(cd $install_dir && ynh_exec_as $app php$phpversion bin/console.php maintenance 0)' EXIT +trap '(cd $install_dir && ynh_exec_as_app php$php_version bin/console.php maintenance 0)' EXIT #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf" -ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" -ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" +ynh_backup "/etc/fail2ban/jail.d/$app.conf" +ynh_backup "/etc/fail2ban/filter.d/$app.conf" -ynh_backup --src_path="/etc/logrotate.d/$app" +ynh_backup "/etc/logrotate.d/$app" -ynh_backup --src_path="/var/log/$app" -ynh_backup --src_path="/etc/systemd/system/$app-daemon.service" +ynh_backup "/var/log/$app" +ynh_backup "/etc/systemd/system/$app-daemon.service" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_print_info --message="Backing up the MySQL database..." +ynh_print_info "Backing up the MySQL database..." -ynh_mysql_dump_db --database="$db_name" > db.sql +ynh_mysql_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 c277451..21715a3 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,32 +1,26 @@ #!/bin/bash -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3 +ynh_script_progression "Updating NGINX web server configuration..." -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # MODIFY URL IN FRIENDICA CONF #================================================= -ynh_print_info --message="Updating the Friendica config..." +ynh_print_info "Updating the Friendica config..." -ynh_replace_string --match_string="'url' => 'https://.*'," --replace_string="'url' => 'https://$domain'," --target_file="$install_dir/config/local.config.php" -ynh_store_file_checksum --file="$install_dir/config/local.config.php" +ynh_replace --match="'url' => 'https://.*'," --replace="'url' => 'https://$domain'," --file="$install_dir/config/local.config.php" +ynh_store_file_checksum "$install_dir/config/local.config.php" #================================================= # 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 9693a9e..dcdfca5 100644 --- a/scripts/install +++ b/scripts/install @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers @@ -19,14 +13,14 @@ timezone=$(cat /etc/timezone) #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=1 +ynh_script_progression "Storing installation settings..." -ynh_app_setting_set --app="$app" --key=email --value="$email" +ynh_app_setting_set --key=email --value="$email" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=5 +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" @@ -35,65 +29,64 @@ ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons" mkdir -p "$install_dir/view/smarty3" chmod -R 775 "$install_dir/view/smarty3" -chmod -R o-rwx "$install_dir" -chown -R "$app:www-data" "$install_dir" - -ynh_add_config --template="local-sample.config.php" --destination="$install_dir/config/local.config.php" +#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" +ynh_config_add --template="local-sample.config.php" --destination="$install_dir/config/local.config.php" #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 +ynh_script_progression "Adding system configurations related to $app..." # Create a dedicated PHP-FPM configy -ynh_add_fpm_config +ynh_config_add_phpfpm -ynh_add_systemd_config --service="$app-daemon" +ynh_config_add_systemd --service="$app-daemon" # Create a dedicated nginx config -ynh_add_nginx_config +ynh_config_add_nginx yunohost service add "$app-daemon" --description="Friendica daemon" --log="/var/log/$app/daemon.log" # Use logrotate to manage application logfile(s) -ynh_use_logrotate +ynh_config_add_logrotate # Create a dedicated Fail2Ban config -ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"\".*$" +ynh_config_add_fail2ban --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"\".*$" #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding the LDAP Auth addon configuration file..." --weight=1 +ynh_script_progression "Adding the LDAP Auth addon configuration file..." # LDAP addon config -ynh_add_config --template="addon.config.php" --destination="$install_dir/config/addon.config.php" +ynh_config_add --template="addon.config.php" --destination="$install_dir/config/addon.config.php" #================================================= # INSTALL FRIENDICA #================================================= -ynh_script_progression --message="Install Friendica..." --weight=1 +ynh_script_progression "Install Friendica..." pushd "$install_dir" # Import Composer dependencies - ynh_exec_as "$app" "php$phpversion" bin/composer.phar install --no-dev --quiet + ynh_exec_as_app "php$php_version" bin/composer.phar install --no-dev --quiet # Install application - ynh_exec_as "$app" "php$phpversion" bin/console.php -f "$install_dir/config/local.config.php" + ynh_exec_as_app "php$php_version" bin/console.php -f "$install_dir/config/local.config.php" # Enable LDAP Auth addon - ynh_exec_as "$app" "php$phpversion" bin/console.php addon enable ldapauth + ynh_exec_as_app "php$php_version" bin/console.php addon enable ldapauth popd #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." -ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="/var/log/$app/daemon.log" +ynh_systemctl --service="$app-daemon" --action="start" --log_path="/var/log/$app/daemon.log" #================================================= # 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 4ac1569..d8b986e 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,32 +10,33 @@ 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 "$app" >/dev/null +if ynh_hide_warnings yunohost service status "$app" >/dev/null then - ynh_script_progression --message="Removing $app service integration..." --weight=1 + ynh_script_progression "Removing $app service integration..." yunohost service remove "$app-daemon" fi #================================================= -# REMOVE SYSTEMD SERVICE +# REMOVE SYSTEMD SERVICE + #================================================= -ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 +ynh_script_progression "Removing system configurations related to $app..." # Remove the dedicated nginx config -ynh_remove_nginx_config +ynh_config_remove_nginx # Remove the dedicated PHP-FPM config -ynh_remove_fpm_config +ynh_config_remove_phpfpm # Remove the app-specific logrotate config -ynh_remove_logrotate +ynh_config_remove_logrotate -ynh_remove_fail2ban_config +ynh_config_remove_fail2ban -ynh_remove_systemd_config --service="$app-daemon" +ynh_config_remove_systemd"$app-daemon" #================================================= # 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 ecc27d9..28b6ba2 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,69 +7,67 @@ source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 +ynh_script_progression "Restoring the app main directory..." -ynh_restore_file --origin_path="$install_dir" +ynh_restore "$install_dir" -if [ -f "$install_dir/daemon.pid" ]; then ynh_secure_remove --file="$install_dir/daemon.pid"; fi +if [ -f "$install_dir/daemon.pid" ]; then ynh_safe_rm "$install_dir/daemon.pid"; 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" chmod -R 775 "$install_dir/view/smarty3" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=1 +ynh_script_progression "Restoring the MySQL database..." -ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql +ynh_mysql_db_shell < ./db.sql #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 +ynh_script_progression "Restoring system configurations related to $app..." -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf" -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file --origin_path="/etc/systemd/system/$app-daemon.service" +ynh_restore "/etc/systemd/system/$app-daemon.service" systemctl enable "$app-daemon.service" --quiet yunohost service add "$app-daemon" --description="Friendica daemon" --log="/var/log/$app/daemon.log" -ynh_restore_file --origin_path="/var/log/$app" +ynh_restore "/var/log/$app" -ynh_restore_file --origin_path="/etc/logrotate.d/$app" +ynh_restore "/etc/logrotate.d/$app" -ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" -ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" -ynh_systemd_action --action=restart --service_name=fail2ban +ynh_restore "/etc/fail2ban/jail.d/$app.conf" +ynh_restore "/etc/fail2ban/filter.d/$app.conf" +ynh_systemctl --action=restart --service=fail2ban -#================================================= -# GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 +ynh_script_progression "Reloading NGINX web server and $app's service..." -ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload +ynh_systemctl --service="php$php_version-fpm" --action=reload -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemctl --service=nginx --action=reload -ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="/var/log/$app/daemon.log" +ynh_systemctl --service="$app-daemon" --action="start" --log_path="/var/log/$app/daemon.log" #============== # FINALIZATION #============== # exit maintenance mode since the app was backed up while in maintenance mode -(cd "$install_dir" && ynh_exec_as "$app" "php$phpversion" bin/console.php maintenance 0) +(cd "$install_dir" && ynh_exec_as_app "php$php_version" bin/console.php maintenance 0) #================================================= # 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 cda53dd..74c87c0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,25 +1,19 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --service_name="$app-daemon" --action="stop" --log_path="/var/log/$app/daemon.log" +ynh_systemctl --service="$app-daemon" --action="stop" --log_path="/var/log/$app/daemon.log" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -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="config/local.config.php" @@ -27,62 +21,61 @@ ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons" # clear the smarty cache # cf: https://github.com/friendica/friendica/issues/11212#issuecomment-1046051750 -ynh_secure_remove --file="$install_dir/view/smarty3/compiled" +ynh_safe_rm "$install_dir/view/smarty3/compiled" mkdir "$install_dir/view/smarty3/compiled" chmod -R 775 "$install_dir/view/smarty3" -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" #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 +ynh_script_progression "Upgrading system configurations related to $app..." # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx # Create a dedicated PHP-FPM config -ynh_add_fpm_config +ynh_config_add_phpfpm -ynh_use_logrotate --non-append +ynh_config_add_logrotate if [ -f "/etc/cron.d/$app" ]; then - ynh_print_info --message="Removing the legacy cron..." - ynh_secure_remove --file="/etc/cron.d/$app" + ynh_print_info "Removing the legacy cron..." + ynh_safe_rm "/etc/cron.d/$app" fi -ynh_add_systemd_config --service="$app-daemon" +ynh_config_add_systemd --service="$app-daemon" yunohost service add "$app-daemon" --description="Friendica daemon" --log="/var/log/$app/daemon.log" # Create a dedicated Fail2Ban config -ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"\".*$" +ynh_config_add_fail2ban --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"\".*$" #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a configuration file..." --weight=1 +ynh_script_progression "Updating configuration..." # fix the url if necessary (there should be no trailing slash) if [ -f "$install_dir/config/local.config.php" ] && ! grep -q -e "'url' => 'https://$domain'," "$install_dir/config/local.config.php"; then - ynh_print_info --message="Patching the Friendica config file: fix the domain setting..." - ynh_replace_string --match_string="'url' => 'https://.*'," --replace_string="'url' => 'https://$domain'," --target_file="$install_dir/config/local.config.php" - ynh_store_file_checksum --file="$install_dir/config/local.config.php" + ynh_print_info "Patching the Friendica config file: fix the domain setting..." + ynh_replace --match="'url' => 'https://.*'," --replace="'url' => 'https://$domain'," --file="$install_dir/config/local.config.php" + ynh_store_file_checksum "$install_dir/config/local.config.php" fi # add the path to the pidfile if missing if [ -f "$install_dir/config/local.config.php" ] && ! grep -q -e "pidfile" "$install_dir/config/local.config.php"; then - ynh_print_info --message="Patching the Friendica config file: add the PID file path for the daemon..." - ynh_replace_string --match_string="'basepath' => '$install_dir'," --replace_string="'basepath' => '$install_dir',\n 'pidfile' => '$install_dir/daemon.pid'," --target_file="$install_dir/config/local.config.php" - ynh_store_file_checksum --file="$install_dir/config/local.config.php" + ynh_print_info "Patching the Friendica config file: add the PID file path for the daemon..." + ynh_replace --match="'basepath' => '$install_dir'," --replace="'basepath' => '$install_dir',\n 'pidfile' => '$install_dir/daemon.pid'," --file="$install_dir/config/local.config.php" + ynh_store_file_checksum "$install_dir/config/local.config.php" fi # add log path to the config if [ -f "$install_dir/config/local.config.php" ] && ! grep -q -e "logfile" "$install_dir/config/local.config.php"; then - ynh_print_info --message="Patching the Friendica config file: add the path for the Friendica logfile..." - ynh_replace_string --match_string="'basepath' => '$install_dir'," --replace_string="'basepath' => '$install_dir',\n 'logfile' => '/var/log/friendica/friendica.log',\n 'loglevel' => 'notice'," --target_file="$install_dir/config/local.config.php" - ynh_store_file_checksum --file="$install_dir/config/local.config.php" + ynh_print_info "Patching the Friendica config file: add the path for the Friendica logfile..." + ynh_replace --match="'basepath' => '$install_dir'," --replace="'basepath' => '$install_dir',\n 'logfile' => '/var/log/friendica/friendica.log',\n 'loglevel' => 'notice'," --file="$install_dir/config/local.config.php" + ynh_store_file_checksum "$install_dir/config/local.config.php" fi #================================================= @@ -91,19 +84,19 @@ fi # Run Composer pushd "$install_dir" - ynh_exec_as "$app" "php$phpversion" bin/composer.phar install --no-dev --quiet - ynh_exec_as "$app" "php$phpversion" bin/console.php dbstructure update + ynh_exec_as_app "php$php_version" bin/composer.phar install --no-dev --quiet + ynh_exec_as_app "php$php_version" bin/console.php dbstructure update popd #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." -ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="/var/log/$app/daemon.log" +ynh_systemctl --service="$app-daemon" --action="start" --log_path="/var/log/$app/daemon.log" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed"