1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/horde_ynh.git synced 2024-09-03 19:16:08 +02:00

[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot 2024-08-30 23:31:52 +02:00 committed by Alexandre Aubin
parent 33931b1dfc
commit 45609e4a86
9 changed files with 79 additions and 146 deletions

View file

@ -16,7 +16,7 @@ location __PATH__/ {
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;
fastcgi_index index.php;
include fastcgi_params;

View file

@ -17,7 +17,8 @@ admindoc = "https://wiki.horde.org"
code = "https://github.com/horde/base"
[integration]
yunohost = ">= 11.2"
yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all"
multi_instance = true
ldap = false
@ -82,6 +83,7 @@ ram.runtime = "50M"
[resources.system_user]
[resources.install_dir]
group = "www-data:r-x"
[resources.data_dir]

View file

@ -1,15 +1,11 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
# PHP APP SPECIFIC
#=================================================
#=================================================
# PERSONAL HELPERS
#=================================================
patch_app() {
local old_dir=$(pwd)
(cd "$install_dir/horde" && patch -p1 < $YNH_CWD/../sources/sso_auth.patch) || echo "Unable to apply patches"
@ -17,17 +13,17 @@ patch_app() {
}
config_horde() {
ynh_add_config --template="horde_conf.php" --destination="$install_dir/horde/config/conf.php"
ynh_add_config --template="/horde_imp_conf.php" --destination="$install_dir/horde/imp/config/conf.php"
ynh_add_config --template="horde_registry.php" --destination="$install_dir/horde/config/registry.local.php"
ynh_add_config --template="gollem_backends.php" --destination="$install_dir/horde/gollem/config/backends.local.php"
ynh_add_config --template="ingo_backends.php" --destination="$install_dir/horde/ingo/config/backends.local.php"
ynh_config_add --template="horde_conf.php" --destination="$install_dir/horde/config/conf.php"
ynh_config_add --template="/horde_imp_conf.php" --destination="$install_dir/horde/imp/config/conf.php"
ynh_config_add --template="horde_registry.php" --destination="$install_dir/horde/config/registry.local.php"
ynh_config_add --template="gollem_backends.php" --destination="$install_dir/horde/gollem/config/backends.local.php"
ynh_config_add --template="ingo_backends.php" --destination="$install_dir/horde/ingo/config/backends.local.php"
}
config_nginx() {
ynh_add_nginx_config
ynh_config_add_nginx
[[ $service_autodiscovery ]] && add_nginx_autodiscovery
ynh_store_file_checksum --file "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
}
add_nginx_autodiscovery() {
@ -60,16 +56,8 @@ add_nginx_autodiscovery() {
}
set_permission() {
chown -R www-data:$app $install_dir
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R www-data:$app $install_dir
chown -R www-data:$app $data_dir
chmod u=rwX,g=rwX,o= -R $install_dir
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod u=rwX,g=rwX,o= -R $install_dir
chmod u=rwX,g=rwX,o= -R $data_dir
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -1,53 +1,44 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
ynh_print_info "Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$install_dir"
ynh_backup "$install_dir"
#=================================================
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$data_dir" --is_big
ynh_backup "$data_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Backing up the MySQL database..."
ynh_print_info "Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
ynh_mysql_dump_db > db.sql
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -1,29 +1,21 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
ynh_script_progression "Updating NGINX web server configuration..."
ynh_change_url_nginx_config
ynh_config_change_url_nginx
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# UPDATE HORDE CONFIG
#=================================================
ynh_script_progression --message="Configuring application..." --weight=3
ynh_script_progression "Configuring application..."
config_horde
@ -31,4 +23,4 @@ config_horde
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last
ynh_script_progression "Change of URL completed for $app"

View file

@ -1,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
@ -16,7 +10,7 @@ source /usr/share/yunohost/helpers
# Set list of optionnal app to install
optionnal_apps_list=""
ynh_script_progression --message="Configuring options and language..."
ynh_script_progression "Configuring options and language..."
if [[ $whups_install == 1 ]]
then
@ -35,8 +29,6 @@ then
optionnal_apps_list="$optionnal_apps_list horde/wicked"
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# Enable all necessary locales
@ -44,7 +36,8 @@ if [[ "$language" != "en" ]]
then
locale_lang=$(egrep -i "(${language})_\1\.UTF-8" /etc/locale.gen | egrep -o "[a-z]{2}_[A-Z]{2}\.UTF-8")
for l in $locale_lang; do
ynh_replace_string "^#\s$l" "$l" /etc/locale.gen
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
ynh_replace "^#\s$l" "$l" /etc/locale.gen
done
locale-gen
fi
@ -52,22 +45,21 @@ fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
mkdir $install_dir/data
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
ynh_config_add_phpfpm
# Create a dedicated NGINX config
config_nginx
@ -75,7 +67,7 @@ config_nginx
#=================================================
# INSTALL SOURCE FILES
#=================================================
ynh_script_progression --message="Installing sources files..." --weight=7
ynh_script_progression "Installing sources files..."
# Set execution for expect scripts
chmod +x ../conf/init_horde_install.exp
@ -99,42 +91,40 @@ $pear_cmd install -a -B horde/webmail $optionnal_apps_list
PHP_PEAR_SYSCONF_DIR=$install_dir ../conf/config_horde.exp "$install_dir" "$db_name" "$db_user" "$db_pwd" "$admin"
secret_key=$(grep 'secret_key' "$install_dir/horde/config/conf.php" | cut -d"'" -f4)
ynh_app_setting_set --app=$app --key=secret_key --value="$secret_key"
ynh_app_setting_set --key=secret_key --value="$secret_key"
#=================================================
# PATCH APPLICATION
#=================================================
ynh_script_progression --message="Patching application..." --weight=7
ynh_script_progression "Patching application..."
patch_app
#=================================================
# CONFIGURE HORDE
#=================================================
ynh_script_progression --message="Configuring application..." --weight=3
ynh_script_progression "Configuring application..."
config_horde
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Protecting directory..." --weight=1
ynh_script_progression "Protecting directory..."
set_permission
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
ynh_script_progression "Configuring log rotation..."
ynh_use_logrotate --logfile="$install_dir/horde" --nonappend --specific_user www-data/horde
ynh_use_logrotate --logfile="$install_dir/horde/services" --specific_user www-data/horde
ynh_use_logrotate --logfile="$install_dir/horde/services/portal" --specific_user www-data/horde
ynh_config_add_logrotate "$install_dir/horde" www-data/horde
ynh_config_add_logrotate "$install_dir/horde/services" www-data/horde
ynh_config_add_logrotate "$install_dir/horde/services/portal" www-data/horde
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last
ynh_script_progression "Installation of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
@ -14,19 +8,19 @@ source /usr/share/yunohost/helpers
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
ynh_script_progression "Removing logrotate configuration..."
# Remove the app-specific logrotate config
ynh_remove_logrotate
ynh_config_remove_logrotate
# Remove the dedicated NGINX config
ynh_remove_nginx_config
ynh_config_remove_nginx
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
ynh_config_remove_phpfpm
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last
ynh_script_progression "Removal of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -13,16 +7,16 @@ source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_script_progression "Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir"
ynh_restore "$install_dir"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..." --weight=1
ynh_script_progression "Restoring the data directory..."
ynh_restore_file --origin_path="$data_dir" --not_mandatory
ynh_restore "$data_dir"
# (Same as for install dir)
chown -R $app:www-data "$data_dir"
@ -30,47 +24,45 @@ chown -R $app:www-data "$data_dir"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
ynh_script_progression "Restoring the MySQL database..."
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
ynh_mysql_db_shell < ./db.sql
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
ynh_script_progression "Restoring the PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..." --weight=1
ynh_script_progression "Restoring various files..."
set_permission
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
ynh_script_progression "Restoring the logrotate configuration..."
ynh_use_logrotate --logfile="$install_dir/horde" --nonappend --specific_user www-data/horde
ynh_use_logrotate --logfile="$install_dir/horde/services" --specific_user www-data/horde
ynh_use_logrotate --logfile="$install_dir/horde/services/portal" --specific_user www-data/horde
ynh_config_add_logrotate "$install_dir/horde" www-data/horde
ynh_config_add_logrotate "$install_dir/horde/services" www-data/horde
ynh_config_add_logrotate "$install_dir/horde/services/portal" www-data/horde
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_script_progression "Reloading NGINX web server and PHP-FPM..."
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemctl --service=php$php_version-fpm --action=reload
ynh_systemctl --service=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last
ynh_script_progression "Restoration completed for $app"

View file

@ -1,37 +1,23 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
ynh_script_progression "Upgrading PHP-FPM configuration..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
ynh_config_add_phpfpm
# Create a dedicated NGINX config
config_nginx
#=================================================
# SPECIFIC UPGRADE
#=================================================
# UPGRADE SOURCE FILE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=6
ynh_script_progression "Upgrading source files..."
pear_cmd="$install_dir/pear/pear -c $install_dir/pear.conf"
$pear_cmd channel-update pear.horde.org
@ -40,37 +26,35 @@ $pear_cmd upgrade -R $install_dir -a -B -c pear.horde.org || true
#=================================================
# PATCH APPLICATION
#=================================================
ynh_script_progression --message="Patching application..." --weight=7
ynh_script_progression "Patching application..."
patch_app
#=================================================
# CONFIGURE HORDE
#=================================================
ynh_script_progression --message="Configuring application..." --weight=3
ynh_script_progression "Configuring application..."
config_horde
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Protecting directory..."
ynh_script_progression "Protecting directory..."
set_permission
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
ynh_script_progression "Upgrading logrotate configuration..."
ynh_use_logrotate --logfile="$install_dir/horde" --nonappend --specific_user www-data/horde
ynh_use_logrotate --logfile="$install_dir/horde/services" --specific_user www-data/horde
ynh_use_logrotate --logfile="$install_dir/horde/services/portal" --specific_user www-data/horde
ynh_config_add_logrotate "$install_dir/horde" www-data/horde
ynh_config_add_logrotate "$install_dir/horde/services" www-data/horde
ynh_config_add_logrotate "$install_dir/horde/services/portal" www-data/horde
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last
ynh_script_progression "Upgrade of $app completed"