From bcc3451494dce71dad7d5c3783cc3baf2e3a998d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 16 May 2024 13:23:03 +0200 Subject: [PATCH] packaging v2 --- check_process | 22 ---- doc/{DISCLAIMER.md => DESCRIPTION.md} | 8 +- manifest.json | 53 -------- manifest.toml | 64 +++++++++ scripts/_common.sh | 3 - scripts/backup | 14 +- scripts/install | 182 +++++++------------------- scripts/remove | 79 ++++------- scripts/restore | 34 ++--- scripts/upgrade | 34 ++--- tests.toml | 11 ++ 11 files changed, 191 insertions(+), 313 deletions(-) delete mode 100644 check_process rename doc/{DISCLAIMER.md => DESCRIPTION.md} (83%) delete mode 100644 manifest.json create mode 100644 manifest.toml create mode 100644 tests.toml diff --git a/check_process b/check_process deleted file mode 100644 index 9a38718..0000000 --- a/check_process +++ /dev/null @@ -1,22 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - is_public=1 - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - backup_restore=1 - multi_instance=0 - port_already_use=1 - change_url=0 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=CommitHash - name=Name and date of the commit. diff --git a/doc/DISCLAIMER.md b/doc/DESCRIPTION.md similarity index 83% rename from doc/DISCLAIMER.md rename to doc/DESCRIPTION.md index b1cacf5..6479302 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DESCRIPTION.md @@ -1,10 +1,6 @@ -* Any known limitations, constrains or stuff not working, such as (but not limited to): - * requiring a full dedicated domain - * Other infos that people should be aware of, such as: - * No LDAP support yet (apparently under development) - * Users can also just sign up themselves to manage details - * Users can use mailing lists without signing up? + * Users can also just sign up themselves to manage details + * Users can use mailing lists without signing up? Classical admin is available on the page: https://myyunohost.org/ diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 72ca265..0000000 --- a/manifest.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "Mailman3", - "id": "mailman3", - "packaging_format": 1, - "description": { - "en": "Electronic mailing lists manager", - "fr": "Un gestionnaire de liste de discussion par email" - }, - "version": "1.0~ynh2", - "url": "http://www.list.org/", - "upstream": { - "license": "AGPL-3.0-or-later", - "website": "http://www.list.org/", - "demo": "https://lists.mailman3.org/mailman3/lists/", - "admindoc": "https://docs.mailman3.org/en/latest/", - "userdoc": "http://docs.mailman3.org/en/latest/userguide.html", - "code": "https://gitlab.com/mailman/mailman-suite" - }, - "license": "AGPL-3.0-or-later", - "maintainer": { - "name": "decentral1se", - "email": "lukewm@riseup.net", - "url": "https://decentral1.se/" - }, - "requirements": { - "yunohost": ">= 4.3.0" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "is_public", - "type": "boolean", - "default": true - }, - { - "name": "admin", - "type": "user" - }, - { - "name": "password", - "type": "password" - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..88e0f62 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,64 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + +packaging_format = 2 + +id = "mailman3" +name = "Mailman3" +description.en = "Electronic mailing lists manager" +description.fr = "Un gestionnaire de liste de discussion par email" + +version = "3.3~ynh1" + +maintainers = ["decentral1se"] + +[upstream] +license = "AGPL-3.0-or-later" +website = "http://www.list.org/" +demo = "https://lists.mailman3.org/mailman3/lists/" +admindoc = "https://docs.mailman3.org/en/latest/" +userdoc = "http://docs.mailman3.org/en/latest/userguide.html" +code = "https://gitlab.com/mailman/mailman-suite" +cpe = "cpe:2.3:a:gnu:mailman" +fund = "https://my.fsf.org/civicrm/contribute/transact?reset=1&id=22" + +[integration] +yunohost = ">=11.2" +architectures = "all" +multi_instance = false +ldap = false +sso = false +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, ... + +[install] + [install.domain] + type = "domain" + + [install.init_main_permission] + type = "group" + default = "visitors" + + [install.admin] + type = "user" + + [install.password] + type = "password" + +[resources] + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" + + [resources.ports] + main.default = 8095 + + [resources.apt] + packages = ["postgresql", "lynx", "mailman3-full"] + + # Can' use resource helper because we need 2 dbs with specific names… + # [resources.database] + # type = "postgresql" diff --git a/scripts/_common.sh b/scripts/_common.sh index f8851af..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -pkg_dependencies="postgresql lynx mailman3-full" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 6034411..11779b9 100755 --- a/scripts/backup +++ b/scripts/backup @@ -14,22 +14,22 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { true } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +#REMOVEME? ynh_print_info --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -db_name_app=$(ynh_app_setting_get --app=$app --key=db_name_app) -db_name_web=$(ynh_app_setting_get --app=$app --key=db_name_web) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? db_name_app=$(ynh_app_setting_get --app=$app --key=db_name_app) +#REMOVEME? db_name_web=$(ynh_app_setting_get --app=$app --key=db_name_web) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP diff --git a/scripts/install b/scripts/install index 9635462..b64cde6 100755 --- a/scripts/install +++ b/scripts/install @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -10,128 +8,71 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# MANAGE SCRIPT FAILURE +# SANITY CHECK #================================================= - -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -domain=$YNH_APP_ARG_DOMAIN -path_url="/" -is_public=$YNH_APP_ARG_IS_PUBLIC -admin=$YNH_APP_ARG_ADMIN -password=$YNH_APP_ARG_PASSWORD - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." - test ! -e /usr/share/$app-web || ynh_die --message="Mailman3 is already installed!" - test ! -e /etc/$app || ynh_die --message="Mailman3 is already installed!" -# Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url - #================================================= -# STORE SETTINGS FROM MANIFEST +# INITIALIZE AND STORE SETTINGS #================================================= -ynh_script_progression --message="Storing installation settings..." - -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=admin --value=admin -ynh_app_setting_set --app=$app --key=password --value=password - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding an available port..." - -# Find an available port -port=$(ynh_find_port --port=8095) -ynh_app_setting_set --app=$app --key=port --value=$port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." - -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# CREATE A POSTGRESQL DATABASE -#================================================= -ynh_script_progression --message="Creating a PostgreSQL database..." - -ynh_psql_test_if_first_run # mailman3-app database db_name_app=$(ynh_sanitize_dbid --db_name="${app}_app") db_user_app=$db_name_app db_pwd_app=$(ynh_string_random --length=30) -ynh_app_setting_set --app=$app --key=db_name_app --value=$db_name_app -ynh_app_setting_set --app=$app --key=db_pwd_app --value=$db_pwd_app -ynh_psql_setup_db --db_user=$db_user_app --db_name=$db_name_app --db_pwd=$db_pwd_app +ynh_app_setting_set --app="$app" --key="db_name_app" --value="$db_name_app" +ynh_app_setting_set --app="$app" --key="db_pwd_app" --value="$db_pwd_app" # mailman3-web database db_name_web=$(ynh_sanitize_dbid --db_name="${app}_web") db_user_web=$db_name_web db_pwd_web=$(ynh_string_random --length=30) -ynh_app_setting_set --app=$app --key=db_name_web --value=$db_name_web -ynh_app_setting_set --app=$app --key=db_pwd_web --value=$db_pwd_web -ynh_psql_setup_db --db_user=$db_user_web --db_name=$db_name_web --db_pwd=$db_pwd_web - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." - -# Create a dedicated NGINX config -ynh_add_nginx_config - -#================================================= -# SPECIFIC SETUP -#================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Adding a configuration file..." +ynh_app_setting_set --app="$app" --key="db_name_web" --value="$db_name_web" +ynh_app_setting_set --app="$app" --key="db_pwd_web" --value="$db_pwd_web" # mailman3 core configuration rest_api_admin_user="rest_admin" rest_api_admin_pwd=$(head -n15 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c15) -ynh_app_setting_set --app=$app --key=rest_admin_user --value="$rest_api_admin_user" -ynh_app_setting_set --app=$app --key=rest_admin_pwd --value="$rest_api_admin_pwd" -ynh_add_config --template="../conf/mailman.cfg" --destination="/etc/mailman3/mailman.cfg" - -chmod 400 "/etc/mailman3/mailman.cfg" -chown list:list "/etc/mailman3/mailman.cfg" +ynh_app_setting_set --app="$app" --key=rest_admin_user --value="$rest_api_admin_user" +ynh_app_setting_set --app="$app" --key=rest_admin_pwd --value="$rest_api_admin_pwd" # hyperkitty configuration archiver_key=$(head -n32 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c32) -ynh_app_setting_set --app=$app --key=archiver_key --value="$archiver_key" -ynh_add_config --template="../conf/mailman-hyperkitty.cfg" --destination="/etc/mailman3/mailman-hyperkitty.cfg" - -chmod 400 "/etc/mailman3/mailman-hyperkitty.cfg" -chown list:list "/etc/mailman3/mailman-hyperkitty.cfg" +ynh_app_setting_set --app="$app" --key=archiver_key --value="$archiver_key" # mailman3-web configuration secret_key=$(head -n64 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c64) -ynh_app_setting_set --app=$app --key=secret_key --value="$secret_key" -ynh_add_config --template="../conf/mailman-web.py" --destination="/etc/mailman3/mailman-web.py" +ynh_app_setting_set --app="$app" --key=secret_key --value="$secret_key" +#================================================= +# CREATE A POSTGRESQL DATABASE +#================================================= +ynh_script_progression --message="Creating a PostgreSQL database..." +# Can' use resource helper because we need 2 dbs with specific names… + +ynh_psql_test_if_first_run + +# mailman3-app database +ynh_psql_setup_db --db_user="$db_user_app" --db_name="$db_name_app" --db_pwd="$db_pwd_app" + +# mailman3-web database +ynh_psql_setup_db --db_user="$db_user_web" --db_name="$db_name_web" --db_pwd="$db_pwd_web" + +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding $app's configuration files..." + +ynh_add_config --template="mailman.cfg" --destination="/etc/mailman3/mailman.cfg" +chmod 400 "/etc/mailman3/mailman.cfg" +chown list:list "/etc/mailman3/mailman.cfg" + +ynh_add_config --template="mailman-hyperkitty.cfg" --destination="/etc/mailman3/mailman-hyperkitty.cfg" +chmod 400 "/etc/mailman3/mailman-hyperkitty.cfg" +chown list:list "/etc/mailman3/mailman-hyperkitty.cfg" + +ynh_add_config --template="mailman-web.py" --destination="/etc/mailman3/mailman-web.py" chmod 440 "/etc/mailman3/mailman-web.py" chown list:www-data "/etc/mailman3/mailman-web.py" @@ -139,9 +80,8 @@ chown list:www-data "/etc/mailman3/mailman-web.py" # RUN DATABASE MIGRATIONS #================================================= ynh_script_progression --message="Running database migrations..." - pushd /usr/share/mailman3-web - python3 manage.py migrate || ynh_die --message="Mailman3 migrations failed!" + python3 manage.py migrate || ynh_die --message="Mailman3 migrations failed!" popd #================================================= @@ -172,53 +112,29 @@ sudo -su list mailman aliases ynh_systemd_action --service_name=postfix --action="restart" #================================================= -# SETUP SYSTEMD +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring a systemd service..." +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 + +# Create a dedicated NGINX config +ynh_add_nginx_config # Create a dedicated systemd config -systemctl enable $app.service --quiet -systemctl enable "$app-web".service --quiet +systemctl enable "$app.service" --quiet +systemctl enable "$app-web.service" --quiet -#================================================= -# GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description="Mailman3 daemon" --log="/var/log/$app/mailman.log" +yunohost service add "$app" --description="Mailman3 daemon" --log="/var/log/$app/mailman.log" yunohost service add "$app-web" --description="Mailman3 web daemon" --log="/var/log/$app/web/mailman-web.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." +ynh_script_progression --message="Starting $app's systemd services..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="restart" +ynh_systemd_action --service_name="$app" --action="restart" ynh_systemd_action --service_name="$app-web" --action="restart" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. - ynh_permission_update --permission="main" --add="visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 50c6050..8dd72e9 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -12,75 +10,39 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) -db_name_app=$(ynh_app_setting_get --app=$app --key=db_name_app) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? db_name_app=$(ynh_app_setting_get --app=$app --key=db_name_app) db_user_app=$db_name_app -db_name_web=$(ynh_app_setting_get --app=$app --key=db_name_web) +#REMOVEME? db_name_web=$(ynh_app_setting_get --app=$app --key=db_name_web) db_user_web=$db_name_web #================================================= -# STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEM CONFIGURATIONS #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # 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 -then - ynh_script_progression --message="Removing $app service integration..." - yunohost service remove $app +if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then + yunohost service remove "$app" fi - -# 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 -then - ynh_script_progression --message="Removing $app-web service integration..." - yunohost service remove "$app-web" +if ynh_exec_warn_less yunohost service status "$app-web" >/dev/null; then + yunohost service remove "$app-web" fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." - # Remove the dedicated systemd config -ynh_systemd_action --service_name=$app --action="stop" -systemctl disable $app.service --quiet +ynh_systemd_action --service_name="$app" --action="stop" ynh_systemd_action --service_name="$app-web" --action="stop" -systemctl disable "$app-web".service --quiet - -#================================================= -# REMOVE THE POSTGRESQL DATABASE -#================================================= -ynh_script_progression --message="Removing the PostgreSQL database..." - -# Remove a database if it exists, along with the associated user -ynh_psql_remove_db --db_user=$db_user_app --db_name=$db_name_app -ynh_psql_remove_db --db_user=$db_user_web --db_name=$db_name_web - -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." +systemctl disable "$app.service" --quiet +systemctl disable "$app-web.service" --quiet # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# SPECIFIC REMOVE #================================================= # REMOVE VARIOUS FILES #================================================= @@ -94,10 +56,17 @@ ynh_secure_remove --file="/etc/$app" # Remove hook for postfix conf ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/98-postfix_mailman3" yunohost tools regen-conf postfix -ynh_systemd_action --service_name=postfix --action="restart" +ynh_systemd_action --service_name="postfix" --action="restart" #================================================= -# GENERIC FINALIZATION +# REMOVE THE POSTGRESQL DATABASE +#================================================= +ynh_script_progression --message="Removing the PostgreSQL database..." + +# Remove a database if it exists, along with the associated user +ynh_psql_remove_db --db_user="$db_user_app" --db_name="$db_name_app" +ynh_psql_remove_db --db_user="$db_user_web" --db_name="$db_name_web" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 368276c..206fc6b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,30 +14,30 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -db_name_app=$(ynh_app_setting_get --app=$app --key=db_name_app) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? db_name_app=$(ynh_app_setting_get --app=$app --key=db_name_app) db_user_app=$db_name_app -db_name_web=$(ynh_app_setting_get --app=$app --key=db_name_web) +#REMOVEME? db_name_web=$(ynh_app_setting_get --app=$app --key=db_name_web) db_user_web=$db_name_web #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." test ! -d /usr/share/mailman3-web \ || ynh_die --message="There is already an installation present at /usr/share/mailman3-web?" @@ -56,24 +56,24 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Restoring the PostgreSQL database..." +#REMOVEME? ynh_script_progression --message="Restoring the PostgreSQL database..." -ynh_psql_test_if_first_run +#REMOVEME? ynh_psql_test_if_first_run -db_pwd_app=$(ynh_app_setting_get --app=$app --key=db_pwd_app) -ynh_psql_setup_db --db_user=$db_user_app --db_name=$db_name_app --db_pwd=$db_pwd_app +#REMOVEME? db_pwd_app=$(ynh_app_setting_get --app=$app --key=db_pwd_app) +#REMOVEME? ynh_psql_setup_db --db_user=$db_user_app --db_name=$db_name_app --db_pwd=$db_pwd_app ynh_psql_execute_file_as_root --file="./db_app.sql" --database=$db_name_app -db_pwd_web=$(ynh_app_setting_get --app=$app --key=db_pwd_web) -ynh_psql_setup_db --db_user=$db_user_web --db_name=$db_name_web --db_pwd=$db_pwd_web +#REMOVEME? db_pwd_web=$(ynh_app_setting_get --app=$app --key=db_pwd_web) +#REMOVEME? ynh_psql_setup_db --db_user=$db_user_web --db_name=$db_name_web --db_pwd=$db_pwd_web ynh_psql_execute_file_as_root --file="./db_web.sql" --database=$db_name_web #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 5a40761..13cd43f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,14 +12,14 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -db_name_app=$(ynh_app_setting_get --app=$app --key=db_name_app) -db_name_web=$(ynh_app_setting_get --app=$app --key=db_name_web) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? db_name_app=$(ynh_app_setting_get --app=$app --key=db_name_app) +#REMOVEME? db_name_web=$(ynh_app_setting_get --app=$app --key=db_name_web) #================================================= # CHECK VERSION @@ -31,17 +31,17 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." +#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS @@ -59,8 +59,8 @@ ynh_systemd_action --service_name="$app-web" --action=stop ynh_script_progression --message="Ensuring downward compatibility..." # Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all +#REMOVEME? if ynh_legacy_permissions_exists; then +#REMOVEME? ynh_legacy_permissions_delete_all ynh_app_setting_delete --app=$app --key=is_public fi @@ -76,9 +76,9 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # POSTFIX CONFIGURATION @@ -111,9 +111,9 @@ ynh_systemd_action --service_name="$app-web" --action=start #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..76a3dd2 --- /dev/null +++ b/tests.toml @@ -0,0 +1,11 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + +test_format = 1.0 + +[default] + + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.6e7e8724d042780edea902ae5adf54eed2e0ee66.name = "Latest packagingv1"