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

[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot 2024-08-31 03:55:25 +02:00 committed by Alexandre Aubin
parent 81df5a1c45
commit 52b1319d36
10 changed files with 65 additions and 82 deletions

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; try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.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; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;

View file

@ -19,7 +19,8 @@ admindoc = "https://wiki.webtrees.net"
code = "https://github.com/fisharebest/webtrees" code = "https://github.com/fisharebest/webtrees"
[integration] [integration]
yunohost = ">= 11.2" yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true
ldap = false ldap = false
@ -70,6 +71,7 @@ ram.runtime = "50M"
[resources.system_user] [resources.system_user]
[resources.install_dir] [resources.install_dir]
group = "www-data:r-x"
[resources.permissions] [resources.permissions]
main.url = "/" main.url = "/"

View file

@ -1,17 +1,5 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# COMMON VARIABLES # COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#================================================= #=================================================

View file

@ -7,31 +7,28 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= ynh_print_info "Declaring files to be backed up..."
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$install_dir" ynh_backup "$install_dir"
#================================================= #=================================================
# SYSTEM CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
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 # BACKUP THE MYSQL DATABASE
#================================================= #=================================================
ynh_print_info "Backing up the MySQL database..." ynh_print_info "Backing up the MySQL database..."
ynh_mysql_dump_db "$db_name" > db.sql ynh_mysql_dump_db > db.sql
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -10,12 +10,12 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # 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
#================================================= #=================================================
# END OF SCRIPT # 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

@ -11,54 +11,53 @@ source /usr/share/yunohost/helpers
# INITIALIZE AND STORE SETTINGS # INITIALIZE AND STORE SETTINGS
#================================================= #=================================================
admin_password=$(ynh_string_random 24) admin_password=$(ynh_string_random --length=24)
admin_password_hashed=$(mkpasswd -m md5crypt --stdin <<< "$admin_password") admin_password_hashed=$(mkpasswd -m md5crypt --stdin <<< "$admin_password")
ynh_app_setting_set --app="$app" --key="admin_password" --value="$admin_password" ynh_app_setting_set --key="admin_password" --value="$admin_password"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
chmod -R 700 "$install_dir/data" chmod -R 700 "$install_dir/data"
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 | 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 | chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
# APP INITIAL CONFIGURATION # APP INITIAL CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding $app's configuration files..." --weight=1 ynh_script_progression "Adding $app's configuration files..."
# Adding the details of the database to the config file # Adding the details of the database to the config file
ynh_add_config --template="config.ini.php" --destination="$install_dir/data/config.ini.php" ynh_config_add --template="config.ini.php" --destination="$install_dir/data/config.ini.php"
# Load initial SQL into the new database # Load initial SQL into the new database
ynh_add_config --template="sql/webtrees.sql" --destination="$install_dir/webtrees.sql" ynh_config_add --template="sql/webtrees.sql" --destination="$install_dir/webtrees.sql"
ynh_add_config --template="sql/admin.sql" --destination="$install_dir/admin.sql" ynh_config_add --template="sql/admin.sql" --destination="$install_dir/admin.sql"
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < "$install_dir/webtrees.sql" ynh_mysql_db_shell < "$install_dir/webtrees.sql"
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < "$install_dir/admin.sql" ynh_mysql_db_shell < "$install_dir/admin.sql"
ynh_secure_remove --file="$install_dir/webtrees.sql" ynh_safe_rm "$install_dir/webtrees.sql"
ynh_secure_remove --file="$install_dir/admin.sql" ynh_safe_rm "$install_dir/admin.sql"
#================================================= #=================================================
# SYSTEM CONFIGURATION # 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 NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_config_add_nginx
# Create a dedicated PHP-FPM config # Create a dedicated PHP-FPM config
ynh_add_fpm_config ynh_config_add_phpfpm
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" ynh_script_progression "Installation of $app completed"

View file

@ -10,16 +10,16 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # 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 # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_config_remove_nginx
# Remove the dedicated PHP-FPM config # Remove the dedicated PHP-FPM config
ynh_remove_fpm_config ynh_config_remove_phpfpm
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" ynh_script_progression "Removal of $app completed"

View file

@ -10,39 +10,38 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # 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"
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"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # 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 # 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"
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # 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_systemctl --service="php${php_version}-fpm" --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemctl --service=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for $app" --last ynh_script_progression "Restoration completed for $app"

View file

@ -10,58 +10,60 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 ynh_script_progression "Ensuring downward compatibility..."
# Migrate manifest questions # Migrate manifest questions
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=admin_username --value="$username"
if [ -z "${admin_username:-}" ]; then if [ -z "${admin_username:-}" ]; then
admin_username="$username" admin_username="$username"
ynh_app_setting_set --app="$app" --key="admin_username" --value="$admin_username" ynh_app_setting_set --key="admin_username" --value="$admin_username"
fi fi
if [ -n "${username:-}" ]; then if [ -n "${username:-}" ]; then
ynh_app_setting_delete --app="$app" --key="username" ynh_app_setting_delete --key="username"
fi fi
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=admin_name --value="$name"
if [ -z "${admin_name:-}" ]; then if [ -z "${admin_name:-}" ]; then
admin_name="$name" admin_name="$name"
ynh_app_setting_set --app="$app" --key="admin_name" --value="$admin_name" ynh_app_setting_set --key="admin_name" --value="$admin_name"
fi fi
if [ -n "${name:-}" ]; then if [ -n "${name:-}" ]; then
ynh_app_setting_delete --app="$app" --key="name" ynh_app_setting_delete --key="name"
fi fi
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=admin_email --value="$email"
if [ -z "${admin_email:-}" ]; then if [ -z "${admin_email:-}" ]; then
admin_email="$email" admin_email="$email"
ynh_app_setting_set --app="$app" --key="admin_email" --value="$admin_email" ynh_app_setting_set --key="admin_email" --value="$admin_email"
fi fi
if [ -n "${email:-}" ]; then if [ -n "${email:-}" ]; then
ynh_app_setting_delete --app="$app" --key="email" ynh_app_setting_delete --key="email"
fi fi
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="data modules_v4" ynh_setup_source --dest_dir="$install_dir" --full_replace --keep="data modules_v4"
chmod -R 700 "$install_dir/data" chmod -R 700 "$install_dir/data"
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 | 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 | chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 ynh_script_progression "Upgrading system configurations related to $app..."
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_config_add_nginx
# Create a dedicated PHP-FPM config # Create a dedicated PHP-FPM config
ynh_add_fpm_config ynh_config_add_phpfpm
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --last ynh_script_progression "Upgrade of $app completed"