mirror of
https://github.com/YunoHost-Apps/z-push_ynh.git
synced 2024-09-03 18:05:58 +02:00
Apply last example_ynh
This commit is contained in:
parent
937cdd00a0
commit
a734ac22aa
9 changed files with 94 additions and 106 deletions
|
@ -28,8 +28,8 @@ Z-Push is an Exchange ActiveSync fronted written in PHP which lets you synchroni
|
||||||
|
|
||||||
#### Supported architectures
|
#### Supported architectures
|
||||||
|
|
||||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/z-push/)
|
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/z-push/)
|
||||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/z-push/)
|
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/z-push/)
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
|
|
|
@ -1,33 +1,32 @@
|
||||||
;; Test complet
|
;; Test complet
|
||||||
auto_remove=1
|
; Manifest
|
||||||
; Manifest
|
domain="domain.tld" (DOMAIN)
|
||||||
domain="domain.tld" (DOMAIN)
|
path="/Microsoft-Server-ActiveSync" (PATH)
|
||||||
path="/Microsoft-Server-ActiveSync" (PATH)
|
; Checks
|
||||||
; Checks
|
pkg_linter=1
|
||||||
pkg_linter=1
|
setup_sub_dir=1
|
||||||
setup_sub_dir=1
|
setup_root=0
|
||||||
setup_root=0
|
setup_nourl=0
|
||||||
setup_nourl=0
|
setup_private=0
|
||||||
setup_private=0
|
setup_public=1
|
||||||
setup_public=1
|
upgrade=1
|
||||||
upgrade=1
|
# 2.5.1~ynh3
|
||||||
# 2.5.1~ynh3
|
upgrade=1 from_commit=9e8a72669814237122dfc6f901c9377895c193db
|
||||||
upgrade=1 from_commit=9e8a72669814237122dfc6f901c9377895c193db
|
# 2.5.2~ynh1
|
||||||
# 2.5.2~ynh1
|
upgrade=1 from_commit=a857788c1fb369baa5f0608da12013b003cceed3
|
||||||
upgrade=1 from_commit=a857788c1fb369baa5f0608da12013b003cceed3
|
# 2.6.1~ynh1
|
||||||
# 2.6.1~ynh1
|
upgrade=1 from_commit=a05896f0e4f2b015dcf643c644ac6c98c2f6695b
|
||||||
upgrade=1 from_commit=a05896f0e4f2b015dcf643c644ac6c98c2f6695b
|
backup_restore=1
|
||||||
backup_restore=1
|
multi_instance=1
|
||||||
multi_instance=1
|
port_already_use=0
|
||||||
port_already_use=0
|
change_url=0
|
||||||
change_url=0
|
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=yalh@yahoo.com
|
Email=yalh@yahoo.com
|
||||||
Notification=all
|
Notification=all
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
; commit=9e8a72669814237122dfc6f901c9377895c193db
|
; commit=9e8a72669814237122dfc6f901c9377895c193db
|
||||||
name=2.5.1~ynh3
|
name=2.5.1~ynh3
|
||||||
; commit=a857788c1fb369baa5f0608da12013b003cceed3
|
; commit=a857788c1fb369baa5f0608da12013b003cceed3
|
||||||
name=2.5.2~ynh1
|
name=2.5.2~ynh1
|
||||||
; commit=a05896f0e4f2b015dcf643c644ac6c98c2f6695b
|
; commit=a05896f0e4f2b015dcf643c644ac6c98c2f6695b
|
||||||
name=2.6.1~ynh1
|
name=2.6.1~ynh1
|
||||||
|
|
|
@ -13,7 +13,7 @@ location /Microsoft-Server-ActiveSync/ {
|
||||||
|
|
||||||
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
|
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
|
||||||
client_max_body_size 50M;
|
client_max_body_size 50M;
|
||||||
|
|
||||||
try_files $uri $uri/ index.php;
|
try_files $uri $uri/ index.php;
|
||||||
rewrite ^(.*)$ /Microsoft-Server-ActiveSync/index.php last;
|
rewrite ^(.*)$ /Microsoft-Server-ActiveSync/index.php last;
|
||||||
location ~ [^/]\.php(/|$) {
|
location ~ [^/]\.php(/|$) {
|
||||||
|
|
|
@ -33,10 +33,6 @@
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
|
||||||
"en": "Choose a domain for Z-Push",
|
|
||||||
"fr": "Choisissez un domaine pour Z-Push"
|
|
||||||
},
|
|
||||||
"example": "example.com"
|
"example": "example.com"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -45,10 +45,10 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$final_path"
|
||||||
|
|
||||||
# Backup statedir
|
# Backup statedir
|
||||||
ynh_backup --src_path="$statedir"
|
ynh_backup --src_path="$statedir" --is_big
|
||||||
|
|
||||||
# Backup logs
|
# Backup logs
|
||||||
ynh_backup --src_path="$final_logpath"
|
ynh_backup --src_path="$final_logpath" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
|
|
|
@ -63,6 +63,14 @@ ynh_script_progression --message="Installing dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring system user..."
|
||||||
|
|
||||||
|
# Create a system user
|
||||||
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -76,28 +84,24 @@ ynh_setup_source --dest_dir="$final_path/tmp"
|
||||||
cp -a "$final_path/tmp/src/." "$final_path/."
|
cp -a "$final_path/tmp/src/." "$final_path/."
|
||||||
ynh_secure_remove "$final_path/tmp"
|
ynh_secure_remove "$final_path/tmp"
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R root:$app "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring NGINX web server..."
|
ynh_script_progression --message="Configuring NGINX web server..."
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring system user..."
|
|
||||||
|
|
||||||
# Create a system user
|
|
||||||
ynh_system_user_create --username=$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring PHP-FPM..."
|
ynh_script_progression --message="Configuring PHP-FPM..."
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
|
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
|
@ -109,15 +113,19 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
ynh_script_progression --message="Creating statedir and final_logpath..."
|
ynh_script_progression --message="Creating statedir and final_logpath..."
|
||||||
|
|
||||||
mkdir -p $statedir
|
mkdir -p $statedir
|
||||||
chown -R $app: $statedir
|
chmod 750 "$statedir"
|
||||||
|
chmod -R o-rwx "$statedir"
|
||||||
|
chown -R root:$app "$statedir"
|
||||||
|
|
||||||
mkdir -p $final_logpath
|
mkdir -p $final_logpath
|
||||||
chown -R $app: $final_logpath
|
chmod 750 "$final_logpath"
|
||||||
|
chmod -R o-rwx "$final_logpath"
|
||||||
|
chown -R root:$app "$final_logpath"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Modifying a config file..."
|
ynh_script_progression --message="Adding a config file..."
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
ynh_replace_string --match_string="__TIMEZONE__" --replace_string=$(cat /etc/timezone) --target_file="../conf/config.php"
|
ynh_replace_string --match_string="__TIMEZONE__" --replace_string=$(cat /etc/timezone) --target_file="../conf/config.php"
|
||||||
|
@ -208,14 +216,6 @@ ln -s /usr/share/awl/inc/XML* /var/www/$app/include/
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Securing files and directories..."
|
|
||||||
|
|
||||||
# Set permissions to app files
|
|
||||||
chown -R $app: $final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -44,7 +44,7 @@ ynh_secure_remove --file="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -52,7 +52,7 @@ ynh_remove_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing PHP-FPM configuration..."
|
ynh_script_progression --message="Removing PHP-FPM configuration..."
|
||||||
|
|
||||||
# Remove the dedicated php-fpm config
|
# Remove the dedicated PHP-FPM config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -49,23 +49,10 @@ test ! -d $final_path \
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the NGINX configuration..."
|
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the app main directory..."
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
|
||||||
|
|
||||||
# Restore statedir
|
|
||||||
ynh_restore_file --origin_path="$statedir"
|
|
||||||
|
|
||||||
# Restore logs, data & permissions
|
|
||||||
ynh_restore_file --origin_path="$final_logpath"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -75,14 +62,27 @@ ynh_script_progression --message="Recreating the dedicated system user..."
|
||||||
ynh_system_user_create --username=$app
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE USER RIGHTS
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring user rights..."
|
ynh_script_progression --message="Restoring the app main directory..."
|
||||||
|
|
||||||
# Restore permissions on app files
|
ynh_restore_file --origin_path="$final_path"
|
||||||
chown -R $app: $final_path
|
|
||||||
chown -R $app: $statedir
|
# Restore statedir
|
||||||
chown -R $app: $final_logpath
|
ynh_restore_file --origin_path="$statedir" --not_mandatory
|
||||||
|
|
||||||
|
# Restore logs, data & permissions
|
||||||
|
ynh_restore_file --origin_path="$final_logpath" --not_mandatory
|
||||||
|
|
||||||
|
mkdir -p $statedir
|
||||||
|
chmod 750 "$statedir"
|
||||||
|
chmod -R o-rwx "$statedir"
|
||||||
|
chown -R root:$app "$statedir"
|
||||||
|
|
||||||
|
mkdir -p $final_logpath
|
||||||
|
chmod 750 "$final_logpath"
|
||||||
|
chmod -R o-rwx "$final_logpath"
|
||||||
|
chown -R root:$app "$final_logpath"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
|
|
|
@ -63,7 +63,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# restore it if the upgrade fails
|
# Restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
|
@ -71,6 +71,14 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||||
|
|
||||||
|
# Create a dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -86,12 +94,16 @@ then
|
||||||
ynh_secure_remove --file="$final_path/tmp"
|
ynh_secure_remove --file="$final_path/tmp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R root:$app "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -101,29 +113,21 @@ ynh_script_progression --message="Upgrading dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
|
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
|
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Modifying a config file..."
|
ynh_script_progression --message="Updating a config file..."
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
ynh_replace_string --match_string="__TIMEZONE__" --replace_string="$(cat /etc/timezone)" --target_file="../conf/config.php"
|
ynh_replace_string --match_string="__TIMEZONE__" --replace_string="$(cat /etc/timezone)" --target_file="../conf/config.php"
|
||||||
|
@ -214,17 +218,6 @@ $final_path/z-push-admin.php -a fixstates
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Securing files and directories..."
|
|
||||||
|
|
||||||
# Set permissions on app files
|
|
||||||
chown -R $app: $final_path
|
|
||||||
|
|
||||||
chown -R $app: $statedir
|
|
||||||
chown -R $app: $final_logpath
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue