1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/z-push_ynh.git synced 2024-09-03 18:05:58 +02:00
This commit is contained in:
Éric Gaspar 2023-11-02 22:01:27 +01:00
parent 63d13bce35
commit b53d7b879e
8 changed files with 17 additions and 422 deletions

View file

@ -1,31 +0,0 @@
;; Test complet
; Manifest
domain="domain.tld"
path="/Microsoft-Server-ActiveSync"
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=0
setup_nourl=0
setup_private=0
setup_public=1
upgrade=1
# 2.5.1~ynh3
# upgrade=1 from_commit=9e8a72669814237122dfc6f901c9377895c193db
# 2.5.2~ynh1
# upgrade=1 from_commit=a857788c1fb369baa5f0608da12013b003cceed3
# 2.6.1~ynh1
# upgrade=1 from_commit=a05896f0e4f2b015dcf643c644ac6c98c2f6695b
# 2.6.1~ynh2
upgrade=1 from_commit=8e99ec37fb90d1ac4f8eb2c838e6d2e1f5b0c905
# 2.6.1~ynh3
upgrade=1 from_commit=f101d8cb5701c46db0d6cf5aaa02b1e7f8e0dec2
# 2.6.4~ynh1
upgrade=1 from_commit=065dc9bf0076090cb6457ef54c87ef0200d72103
backup_restore=1
multi_instance=1
port_already_use=0
change_url=0
;;; Options
Email=yalh@yahoo.com
Notification=all

View file

@ -1,45 +0,0 @@
{
"name": "Z-Push",
"id": "z-push",
"packaging_format": 1,
"description": {
"en": "ActiveSync frontend that helps you synchronize emails, calendar and contacts",
"fr": "Frontend ActiveSync qui permet de synchroniser emails, calendrier et contacts"
},
"version": "2.7.1~ynh1",
"url": "https://z-push.org",
"upstream": {
"license": "AGPL-3.0-or-later",
"website": "http://z-push.org",
"admindoc": "https://wiki.z-hub.io/display/ZP/Documentation",
"code": "https://github.com/Z-Hub/Z-Push"
},
"license": "AGPL-3.0-or-later",
"maintainer": {
"name": "yalh76"
},
"previous_maintainer": [
{
"name": "beudbeud"
},
{
"name": "polytan02"
}
],
"requirements": {
"yunohost": ">= 11.0.9"
},
"multi_instance": true,
"services": [
"nginx",
"php7.4-fpm"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
}
]
}
}

View file

@ -10,29 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading 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? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
#REMOVEME? final_logpath=$(ynh_app_setting_get --app=$app --key=final_logpath)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================

View file

@ -9,77 +9,23 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
true
}
# 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
path="/Microsoft-Server-ActiveSync"
#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
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# INSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=1
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=1
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=1
#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=1
# Create a system user
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
# Download, check integrity, uncompress and patch the source from app.src
mkdir -p "$install_dir/tmp"
ynh_setup_source --dest_dir="$install_dir/tmp"
cp -af "$install_dir/tmp/src/." "$install_dir/."
#REMOVEME? ynh_secure_remove "$install_dir/tmp"
ynh_secure_remove "$install_dir/tmp"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
@ -89,40 +35,18 @@ chown -R $app:www-data "$install_dir"
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low
#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
ynh_add_fpm_config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..." --weight=1
#REMOVEME? data_dir=/home/yunohost.app/$app
#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir
mkdir -p $data_dir
chmod 750 "$data_dir"
chmod -R o-rwx "$data_dir"
chown -R $app:www-data "$data_dir"
#=================================================
# CREATE FINAL LOG PATH
#=================================================
ynh_script_progression --message="Creating a final log path..." --weight=1
final_logpath="/var/log/$app"
#REMOVEME? ynh_app_setting_set --app=$app --key=final_logpath --value=$final_logpath
ynh_app_setting_set --app=$app --key=final_logpath --value=$final_logpath
mkdir -p $final_logpath
@ -148,8 +72,8 @@ ynh_replace_string --match_string="__DATA_DIR__" --replace_string=$data_dir --ta
# Enable caldav carddav support
if yunohost app list | grep -q 'id: baikal' ; then
echo "Detected Baikal"
#REMOVEME? bailkaldomain=$(ynh_app_setting_get --app="baikal" --key=domain)
#REMOVEME? bailkalpath=$(ynh_app_setting_get --app="baikal" --key=path)
bailkaldomain=$(ynh_app_setting_get --app="baikal" --key=domain)
bailkalpath=$(ynh_app_setting_get --app="baikal" --key=path)
bailkalpath=${bailkalpath%/}
# Configuration of backend
@ -176,8 +100,8 @@ if yunohost app list | grep -q 'id: baikal' ; then
elif yunohost app list | grep -q 'id: nextcloud' ; then
echo "Detected NextCloud"
#REMOVEME? nextclouddomain=$(ynh_app_setting_get --app="nextcloud" --key=domain)
#REMOVEME? nextcloudpath=$(ynh_app_setting_get --app="nextcloud" --key=path)
nextclouddomain=$(ynh_app_setting_get --app="nextcloud" --key=domain)
nextcloudpath=$(ynh_app_setting_get --app="nextcloud" --key=path)
nextcloudpath=${nextcloudpath%/}
# Configuration of backend
@ -237,19 +161,9 @@ ynh_use_logrotate
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
domain_regex=$(echo "$domain" | sed 's@-@.@g')
#domain_regex=$(echo "$domain" | sed 's@-@.@g')
#REMOVEME? ynh_permission_create --permission="autodiscover" --url="re:$domain_regex/[Aa]uto[Dd]iscover/.*" --allowed="visitors" --show_tile="false" --protected="true"
#=================================================
# 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
#=================================================

View file

@ -9,18 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# 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? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
#REMOVEME? final_logpath=$(ynh_app_setting_get --app=$app --key=final_logpath)
#=================================================
# STANDARD REMOVE
#=================================================
@ -31,68 +19,14 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# 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 DATA DIR
#=================================================
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..." --weight=1
#REMOVEME? ynh_secure_remove --file="$data_dir"
fi
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
#REMOVEME? ynh_remove_app_dependencies
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..." --weight=1
ynh_secure_remove --file="$final_logpath"
#=================================================
# 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
#=================================================

View file

@ -10,48 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
true
}
# 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? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
#REMOVEME? final_logpath=$(ynh_app_setting_get --app=$app --key=final_logpath)
#=================================================
# 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=1
# Create the dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -59,7 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
@ -70,22 +27,8 @@ ynh_script_progression --message="Restoring the data directory..." --weight=1
ynh_restore_file --origin_path="$data_dir" --not_mandatory
mkdir -p $data_dir
chmod 750 "$data_dir"
chmod -R o-rwx "$data_dir"
chown -R $app:www-data "$data_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
#=================================================
@ -93,22 +36,8 @@ ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weig
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=low --footprint=low
#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================

View file

@ -9,77 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# 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? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
#REMOVEME? final_logpath=$(ynh_app_setting_get --app=$app --key=final_logpath)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..." --weight=1
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=1
# 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
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# 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
if [ -z "$data_dir" ];
then
data_dir="/home/yunohost.app/$app"
#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir
ynh_app_setting_delete --app=$app --key=statedir
mkdir -p $data_dir
fi
if [ -z "$final_logpath" ];
then
final_logpath="/var/log/$app"
#REMOVEME? ynh_app_setting_set --app=$app --key=final_logpath --value=$final_logpath
mkdir -p $final_logpath
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"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -92,33 +27,19 @@ then
mkdir "$install_dir/tmp"
ynh_setup_source --dest_dir="$install_dir/tmp"
cp -af "$install_dir/tmp/src/." "$install_dir/."
#REMOVEME? ynh_secure_remove --file="$install_dir/tmp"
ynh_secure_remove --file="$install_dir/tmp"
fi
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low
#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
ynh_add_fpm_config
# Create a dedicated NGINX config
ynh_add_nginx_config
@ -143,8 +64,8 @@ ynh_replace_string __DATA_DIR__ $data_dir ../conf/config.php
# Enable caldav carddav support
if yunohost app list | grep -q 'id: baikal' ; then
echo "Detected Baikal"
#REMOVEME? bailkaldomain=$(ynh_app_setting_get --app=baikal --key=domain)
#REMOVEME? bailkalpath=$(ynh_app_setting_get --app=baikal --key=path)
bailkaldomain=$(ynh_app_setting_get --app=baikal --key=domain)
bailkalpath=$(ynh_app_setting_get --app=baikal --key=path)
bailkalpath=${bailkalpath%/}
# Configuration of backend
@ -171,8 +92,8 @@ if yunohost app list | grep -q 'id: baikal' ; then
elif yunohost app list | grep -q 'id: nextcloud' ; then
echo "Detected NextCloud"
#REMOVEME? nextclouddomain=$(ynh_app_setting_get --app=nextcloud --key=domain)
#REMOVEME? nextcloudpath=$(ynh_app_setting_get --app=nextcloud --key=path)
nextclouddomain=$(ynh_app_setting_get --app=nextcloud --key=domain)
nextcloudpath=$(ynh_app_setting_get --app=nextcloud --key=path)
nextcloudpath=${nextcloudpath%/}
# Configuration of backend
@ -227,13 +148,6 @@ ynh_script_progression --message="Upgrading logrotate configuration..." --weight
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
#=================================================
# 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
#=================================================

3
tests.toml Normal file
View file

@ -0,0 +1,3 @@
test_format = 1.0
[default]