1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/emailpoubelle_ynh.git synced 2024-09-03 18:26:29 +02:00

[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot 2024-08-30 22:51:53 +02:00 committed by Alexandre Aubin
parent b4ed21be5e
commit 396d2488d8
11 changed files with 94 additions and 159 deletions

View file

@ -1 +1 @@
0 */2 * * * www-data /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/www/index.php > /dev/null 2>&1
0 */2 * * * www-data /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/www/index.php > /dev/null 2>&1

View file

@ -1,4 +0,0 @@
; Additional php.ini defines, specific to this pool of workers.
php_admin_value[upload_max_filesize] = 50M
php_admin_value[post_max_size] = 50M

View file

@ -12,7 +12,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

@ -15,7 +15,8 @@ demo = "https://poubelle.zici.fr"
code = "https://framagit.org/kepon/emailPoubellePhp"
[integration]
yunohost = ">= 11.1.19"
yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all"
multi_instance = false
ldap = false
@ -51,6 +52,7 @@ ram.runtime = "50M"
[resources.system_user]
[resources.install_dir]
group = "www-data:r-x"
[resources.permissions]
main.url = "/"

View file

@ -1,19 +1,7 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
lang="fr_FR.UTF-8 en_US.UTF-8 it_IT.UTF-8"
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -1,37 +1,28 @@
#!/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 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"
#=================================================
# SPECIFIC BACKUP
@ -39,19 +30,19 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/etc/cron.d/$app"
ynh_backup "/etc/cron.d/$app"
ynh_backup --src_path="/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle"
ynh_backup "/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle"
#=================================================
# 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,26 +1,20 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# 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
#=================================================
ynh_add_config --template="../conf/conf-dist.php" --destination="$install_dir/conf.php"
ynh_config_add --template="conf-dist.php" --destination="$install_dir/conf.php"
chmod 400 "$install_dir/conf.php"
chown $app:$app "$install_dir/conf.php"
@ -29,4 +23,4 @@ chown $app:$app "$install_dir/conf.php"
# 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
@ -14,18 +8,16 @@ source /usr/share/yunohost/helpers
#=================================================
password=$YNH_APP_ARG_PASSWORD
ynh_app_setting_set --app=$app --key=password --value=$password
ynh_app_setting_set --key=password --value=$password
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=15
ynh_script_progression "Installing dependencies..."
#install locale (nginx will restart at the end of the install)
for i in $lang ; do
ynh_replace_string --match_string="# $i" --replace_string="$i" --target_file="/etc/locale.gen"
ynh_replace --match="# $i" --replace="$i" --file="/etc/locale.gen"
done
locale-gen
@ -33,42 +25,41 @@ locale-gen
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=5
ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
ynh_add_config --template="../conf/index_source.php" --destination="$install_dir/www/index.php"
ynh_secure_remove --file="$install_dir/www/admin.php"
ynh_config_add --template="index_source.php" --destination="$install_dir/www/index.php"
ynh_safe_rm "$install_dir/www/admin.php"
ln -s $install_dir/lib $install_dir/www/lib
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 -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"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..."
ynh_script_progression "Configuring PHP-FPM..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low
ynh_config_add_phpfpm
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..."
ynh_script_progression "Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
#=================================================
# SPECIFIC SETUP
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
ynh_script_progression "Adding $app's configuration..."
ynh_add_config --template="../conf/conf-dist.php" --destination="$install_dir/conf.php"
ynh_config_add --template="conf-dist.php" --destination="$install_dir/conf.php"
chmod 400 "$install_dir/conf.php"
chown $app:$app "$install_dir/conf.php"
@ -78,24 +69,25 @@ chown $app:$app "$install_dir/conf.php"
cp -R ../sources/hooks/conf_regen/98-postfix_emailpoubelle /usr/share/yunohost/hooks/conf_regen/
yunohost tools regen-conf postfix
# Create the virtual aliases file
# Create the virtual aliases file
touch $install_dir/var/virtual
postmap $install_dir/var/virtual
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 | chown -R $app:www-data "$install_dir"
# Create an alias for deleted junk adresses
cp /etc/aliases /etc/aliases.emailpoubelle.bak #backup it
cp /etc/aliases /etc/aliases.emailpoubelle.bak #backup it
echo "devnull:/dev/null" | tee -a /etc/aliases
newaliases
ynh_systemd_action --service_name=postfix --action=reload
ynh_systemctl --service=postfix --action=reload
# Adding cronjob for removing expired email addresses
ynh_add_config --template="../conf/emailpoubelle.cron" --destination="/etc/cron.d/$app"
chown root:root /etc/cron.d/$app
chmod 644 /etc/cron.d/$app
ynh_config_add --template="emailpoubelle.cron" --destination="/etc/cron.d/$app"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root:root /etc/cron.d/$app
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 644 /etc/cron.d/$app
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last
ynh_script_progression "Installation of $app completed"

View file

@ -1,49 +1,43 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..."
ynh_script_progression "Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
ynh_remove_nginx_config
ynh_config_remove_nginx
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing PHP-FPM configuration..."
ynh_script_progression "Removing PHP-FPM configuration..."
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
ynh_config_remove_phpfpm
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
ynh_script_progression "Removing various files..."
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"
ynh_safe_rm "/etc/cron.d/$app"
ynh_replace_string --match_string="devnull:/dev/null" --replace_string="" --target_file="/etc/aliases"
ynh_replace --match="devnull:/dev/null" --replace="" --file="/etc/aliases"
newaliases
ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle"
ynh_safe_rm "/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle"
yunohost tools regen-conf postfix
ynh_systemd_action --service_name=postfix --action=reload
ynh_systemctl --service=postfix --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed"
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,78 +7,76 @@ 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"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
ynh_restore "$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"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=15
ynh_script_progression "Reinstalling dependencies..."
#Check & regen local
for i in $lang ; do
ynh_replace_string --match_string="# $i" --replace_string="$i" --target_file="/etc/locale.gen"
ynh_replace --match="# $i" --replace="$i" --file="/etc/locale.gen"
done
locale-gen
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
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"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_script_progression "Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# 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 VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..." --weight=10
ynh_script_progression "Restoring various files..."
ynh_restore_file --origin_path="/etc/cron.d/$app"
ynh_restore "/etc/cron.d/$app"
ynh_restore_file --origin_path="/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle"
ynh_restore "/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle"
yunohost tools regen-conf postfix
#create an alias for deleted junk adresses
if ! grep -q "devnull:/dev/null" /etc/aliases ; then
cp /etc/aliases /etc/aliases.emailpoubelle.bak #backup it
cp /etc/aliases /etc/aliases.emailpoubelle.bak #backup it
echo "devnull:/dev/null" | tee -a /etc/aliases
newaliases
fi
ynh_systemd_action --service_name=postfix --action=reload
ynh_systemctl --service=postfix --action=reload
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
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,64 +1,50 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
if ynh_app_upstream_version_changed
then
ynh_script_progression --message="Upgrading source files..."
ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --keep="conf.php www/index.php"
ynh_add_config --template="../conf/index_source.php" --destination="$install_dir/www/index.php"
ynh_secure_remove --file="$install_dir/www/admin.php"
ynh_config_add --template="index_source.php" --destination="$install_dir/www/index.php"
ynh_safe_rm "$install_dir/www/admin.php"
ln -s $install_dir/lib $install_dir/www/lib
fi
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 -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"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
ynh_script_progression "Upgrading PHP-FPM configuration..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low
ynh_config_add_phpfpm
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
ynh_script_progression "Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
#=================================================
# SPECIFIC UPGRADE
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
ynh_script_progression "Updating configuration..."
password=$(ynh_app_setting_get --app=$app --key=password)
ynh_add_config --template="../conf/conf-dist.php" --destination="$install_dir/conf.php"
password=$(ynh_app_setting_get --key=password)
ynh_config_add --template="conf-dist.php" --destination="$install_dir/conf.php"
chmod 400 "$install_dir/conf.php"
chown $app:$app "$install_dir/conf.php"
@ -66,15 +52,15 @@ chown $app:$app "$install_dir/conf.php"
cp -R ../sources/hooks/conf_regen/98-postfix_emailpoubelle /usr/share/yunohost/hooks/conf_regen/
mv /etc/postfix/main.cf /etc/postfix/main.cf.emailpoubelle.bak
yunohost tools regen-conf postfix -f
ynh_systemd_action --service_name=postfix --action=reload
ynh_systemctl --service=postfix --action=reload
# Adding cronjob for removing expired email addresses
ynh_add_config --template="../conf/emailpoubelle.cron" --destination="/etc/cron.d/$app"
chown root:root /etc/cron.d/$app
chmod 644 /etc/cron.d/$app
ynh_config_add --template="emailpoubelle.cron" --destination="/etc/cron.d/$app"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root:root /etc/cron.d/$app
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 644 /etc/cron.d/$app
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed"
ynh_script_progression "Upgrade of $app completed"