From 5bce9d9409ec66fe5f4bcda6561af93dfce8e489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 22 May 2023 08:30:20 +0200 Subject: [PATCH] v2 --- manifest.toml | 25 ++++----- scripts/_common.sh | 18 ------- scripts/backup | 19 ------- scripts/change_url | 86 ------------------------------- scripts/install | 96 +++-------------------------------- scripts/remove | 48 ------------------ scripts/restore | 59 +-------------------- scripts/upgrade | 124 +++++++-------------------------------------- 8 files changed, 40 insertions(+), 435 deletions(-) diff --git a/manifest.toml b/manifest.toml index 953ae21..3e24cf3 100644 --- a/manifest.toml +++ b/manifest.toml @@ -16,34 +16,30 @@ demo = "https://www.dolibarr.org/onlinedemo" admindoc = "https://www.dolibarr.org/documentation-home" userdoc = "https://www.dolibarr.org/#features" code = "https://github.com/Dolibarr/dolibarr" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] -yunohost = ">= 11.0" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +yunohost = ">= 11.1.19" +architectures = "all" multi_instance = true -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = false +sso = false +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" [install.path] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "path" default = "/dolibarr" [install.admin] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "user" [resources] + [resources.system_user] [resources.install_dir] @@ -52,6 +48,11 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.permissions] main.url = "/" + public_space.url = "/public/" + public_space.allowed = "visitors" + + [resources.apt] + packages = "mariadb-server php8.1-imagick php8.1-gd php8.1-mbstring php8.1-soap php8.1-curl php8.1-intl php8.1-opcache php8.1-calendar php8.1-zip php8.1-xml php8.1-fileinfo php8.1-imap" [resources.database] type = "mysql" diff --git a/scripts/_common.sh b/scripts/_common.sh index 21c9a08..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,24 +3,6 @@ #================================================= # COMMON VARIABLES #================================================= -#REMOVEME? YNH_PHP_VERSION="8.1" - -#REMOVEME? php_dependencies="php$YNH_PHP_VERSION-mysql \ - php$YNH_PHP_VERSION-imagick \ - php$YNH_PHP_VERSION-gd \ - php$YNH_PHP_VERSION-mbstring \ - php$YNH_PHP_VERSION-soap \ - php$YNH_PHP_VERSION-curl \ - php$YNH_PHP_VERSION-intl \ - php$YNH_PHP_VERSION-opcache \ - php$YNH_PHP_VERSION-calendar \ - php$YNH_PHP_VERSION-zip \ - php$YNH_PHP_VERSION-xml \ - php$YNH_PHP_VERSION-fileinfo \ - php$YNH_PHP_VERSION-imap" - -# dependencies used by the app (must be on a single line) -#REMOVEME? pkg_dependencies="$php_dependencies" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 0aa665b..3e51850 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,25 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/change_url b/scripts/change_url index 8cecbab..b50f43a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,59 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN -#REMOVEME? old_path=$YNH_APP_OLD_PATH - -#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN -#REMOVEME? new_path=$YNH_APP_NEW_PATH - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. -#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -#REMOVEME? change_domain=0 -#REMOVEME? if [ "$old_domain" != "$new_domain" ] -then - #REMOVEME? change_domain=1 -fi - -#REMOVEME? change_path=0 -#REMOVEME? if [ "$old_path" != "$new_path" ] -then - #REMOVEME? change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -71,30 +18,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- ynh_change_url_nginx_config -#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -#REMOVEME? # Change the path in the nginx config file -if [ $change_path -eq 1 ] -then -#REMOVEME? # Make a backup of the original nginx config file if modified -#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" -#REMOVEME? # Set global variables for nginx helper -#REMOVEME? domain="$old_domain" -#REMOVEME? path="$new_path" -#REMOVEME? # Create a dedicated nginx config -#REMOVEME? ynh_add_nginx_config -fi - -#REMOVEME? # Change the domain for nginx -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location -#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" -#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location -#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - #================================================= # SPECIFIC MODIFICATIONS #================================================= @@ -103,15 +26,6 @@ fi ynh_replace_string --match_string="$old_domain$old_path" --replace_string="$new_domain$new_path" --target_file="$install_dir/htdocs/conf/conf.php" -#================================================= -# GENERIC FINALISATION -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index a606955..08c98be 100644 --- a/scripts/install +++ b/scripts/install @@ -9,75 +9,24 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -#REMOVEME? path=$YNH_APP_ARG_PATH -#REMOVEME? admin=$YNH_APP_ARG_ADMIN -#member=0 -#is_public=0 -#REMOVEME? phpversion=$YNH_PHP_VERSION - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 - -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path +member=0 #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2 +ynh_script_progression --message="Storing installation settings..." --weight=2 -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path -#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin -#ynh_app_setting_set --app=$app --key=is_public --value=$is_public -#ynh_app_setting_set --app=$app --key=member --value=$member +ynh_app_setting_set --app=$app --key=member --value=$member ynh_app_setting_set --app=$app --key=version --value=$(ynh_app_upstream_version "../manifest.json") -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# INSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=1 - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=2 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # CREATE A MYSQL DATABASE #================================================= -#REMOVEME? ynh_script_progression --message="Creating a MySQL database..." --weight=1 - -#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app) -#REMOVEME? db_user=$db_name -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name +ynh_script_progression --message="Creating a MySQL database..." --weight=1 ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8" @@ -86,7 +35,6 @@ ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8" #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 - # Load the last available version source upgrade.d/upgrade.last.sh @@ -99,14 +47,12 @@ SOURCE_FORMAT=tar.bz2 SOURCE_IN_SUBDIR=true EOF -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir - # Download, check integrity, uncompress and patch the source from app.src ynh_script_progression --message="Download source files..." --weight=70 ynh_setup_source --dest_dir="$install_dir" # Create necessary files -#REMOVEME? data_dir=$install_dir/documents +data_dir=$install_dir/documents touch $install_dir/htdocs/conf/conf.php #================================================= @@ -122,8 +68,6 @@ ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage # Create a dedicated php-fpm config ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint -# Used by ynh_add_nginx_config -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # NGINX CONFIGURATION @@ -149,14 +93,6 @@ ynh_add_config --template="../conf/install.forced.php" --destination="$install_d # Set right permissions for curl install chown -R $app: "$install_dir" -# Set the app as temporarily public for cURL call -if ! ynh_permission_has_user --permission "main" --user="visitors"; then -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" -fi - -# Reload NGINX -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - # Installation with curl mkdir -p /var/log/$app/ @@ -216,9 +152,6 @@ else ynh_print_info --message="LDAP user update ended with error" fi -# Remove the public access -#REMOVEME? ynh_permission_update --permission="main" --remove="visitors" - #================================================= # MODIFY A CONFIG FILE #================================================= @@ -239,7 +172,7 @@ ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" #================================================= # SECURE FILES AND DIRECTORIES #================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=1 # Set permissions on app files if [ ! -f "$data_dir/install.lock" ]; then @@ -265,23 +198,6 @@ ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log" -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 - -# Create the public space permission if needed -#REMOVEME? if ! ynh_permission_exists --permission "public_space"; then -#REMOVEME? ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index e245996..89ebac2 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,44 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#================================================= -# STANDARD REMOVE -# REMOVE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Remove metapackage and its dependencies -#REMOVEME? ynh_remove_app_dependencies - -#================================================= -# REMOVE THE MYSQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." --weight=9 - -# Remove a database if it exists, along with the associated user -#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name - -#================================================= -# REMOVE APP MAIN DIR -#================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -89,16 +51,6 @@ ynh_secure_remove --file="/etc/$app" # Remove the log files ynh_secure_remove --file="/var/log/$app" -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index d617b86..f1d9dc2 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,49 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? data_dir=$install_dir/documents/ - -#REMOVEME? fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) -#REMOVEME? fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 - -#REMOVEME? test ! -d $install_dir \ - || ynh_die --message="There is already a directory: $install_dir " - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -60,16 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1 - -# Define and install dependencies -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= @@ -90,10 +37,8 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." --weight=27 +ynh_script_progression --message="Restoring the MySQL database..." --weight=27 -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= @@ -106,7 +51,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # SECURE FILES AND DIRECTORIES #================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=1 # Set permissions on app files chmod 750 "$install_dir" diff --git a/scripts/upgrade b/scripts/upgrade index 0b0c57e..1cdb053 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,23 +12,8 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2 -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? language=$(ynh_app_setting_get --app=$app --key=language) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? current_version=$(ynh_app_setting_get --app=$app --key=version) update_version=$(ynh_app_upstream_version "../manifest.json") -#REMOVEME? data_dir=$install_dir/documents/ - -#REMOVEME? fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) -#REMOVEME? fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION @@ -36,20 +21,6 @@ update_version=$(ynh_app_upstream_version "../manifest.json") upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=11 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -57,18 +28,6 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# If db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -fi - -# If install_dir doesn't exist, create it -if [ -z "$install_dir" ]; then -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir -fi - # If fpm_footprint doesn't exist, create it if [ -z "$fpm_footprint" ]; then fpm_footprint=medium @@ -81,38 +40,11 @@ if [ -z "$fpm_usage" ]; then ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage fi -# Cleaning legacy permissions -#REMOVEME? if ynh_legacy_permissions_exists; then -#REMOVEME? ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -# Create a permission if needed -#REMOVEME? if ! ynh_permission_exists --permission "public_space"; then -#REMOVEME? ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors" -fi - # Delete existing ini configuration file (backward compatibility) if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini fi -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1 - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - #================================================= # NGINX CONFIGURATION #================================================= @@ -125,7 +57,7 @@ ynh_remove_nginx_config ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf" # Wait untils NGINX has fully reloaded -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd" +ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd" # Create a dedicated nginx config ynh_add_nginx_config @@ -150,7 +82,6 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Recreate a dedicated PHP-FPM config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC UPGRADE @@ -220,12 +151,6 @@ EOF # Upgrade with CURL - # Set the app as temporarily public for cURL call - if ! ynh_permission_has_user --permission "main" --user="visitors"; then -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" - fi - - charset=$(mysql -ss -N -e "SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = '$db_name'") if [ "$charset" != "utf8" ] then @@ -240,33 +165,29 @@ EOF ynh_exec_fully_quiet sleep 5 pushd $install_dir/htdocs/install/ - - if php$phpversion upgrade.php $current_version $next_version > /var/log/$app/upgrade.html; then - ynh_print_info --message="Step 1 upgrading ended successfully" - else - ynh_die --message="Step 1 upgrading ended with error" - fi + if php$phpversion upgrade.php $current_version $next_version > /var/log/$app/upgrade.html; then + ynh_print_info --message="Step 1 upgrading ended successfully" + else + ynh_die --message="Step 1 upgrading ended with error" + fi - ynh_exec_fully_quiet sleep 5 + ynh_exec_fully_quiet sleep 5 - if php$phpversion upgrade2.php $current_version $next_version > /var/log/$app/upgrade2.html; then - ynh_print_info --message="Step 2 upgrading ended successfully" - else - ynh_die --message="Step 2 upgrading ended with error" - fi + if php$phpversion upgrade2.php $current_version $next_version > /var/log/$app/upgrade2.html; then + ynh_print_info --message="Step 2 upgrading ended successfully" + else + ynh_die --message="Step 2 upgrading ended with error" + fi - ynh_exec_fully_quiet sleep 5 - - if php$phpversion step5.php $current_version $next_version > /var/log/$app/upgrade3.html; then - ynh_print_info --message="Step 3 upgrading ended successfully" - else - ynh_die --message="Step 3 upgrading ended with error" - fi - + ynh_exec_fully_quiet sleep 5 + if php$phpversion step5.php $current_version $next_version > /var/log/$app/upgrade3.html; then + ynh_print_info --message="Step 3 upgrading ended successfully" + else + ynh_die --message="Step 3 upgrading ended with error" + fi popd -#REMOVEME? ynh_permission_update --permission="main" --remove="visitors" # Get the new current version number current_version=$next_version @@ -305,7 +226,7 @@ ynh_use_logrotate --non-append #================================================= # SECURE FILES AND DIRECTORIES #================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=1 # Set permissions on app files if [ ! -f "$data_dir/install.lock" ]; then @@ -322,13 +243,6 @@ mkdir -p "$data_dir" chown -R $app: "$data_dir" chmod go-w $data_dir -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #=================================================