1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mailman3_ynh.git synced 2024-09-03 19:36:17 +02:00

packaging v2

This commit is contained in:
Salamandar 2024-05-16 13:23:03 +02:00
parent 6e7e8724d0
commit bcc3451494
11 changed files with 191 additions and 313 deletions

View file

@ -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.

View file

@ -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/

View file

@ -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"
}
]
}
}

64
manifest.toml Normal file
View file

@ -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"

View file

@ -4,9 +4,6 @@
# COMMON VARIABLES
#=================================================
# dependencies used by the app
pkg_dependencies="postgresql lynx mailman3-full"
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -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

View file

@ -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
#=================================================

View file

@ -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
#=================================================

View file

@ -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
#=================================================

View file

@ -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

11
tests.toml Normal file
View file

@ -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"