1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/matomo_ynh.git synced 2024-09-03 19:45:56 +02:00
This commit is contained in:
Éric Gaspar 2024-09-02 16:17:58 +02:00
parent f3f79aa737
commit 6067ad1f8c
7 changed files with 16 additions and 54 deletions

View file

@ -17,7 +17,7 @@ admindoc = "https://matomo.org/docs"
code = "https://github.com/matomo-org/matomo" code = "https://github.com/matomo-org/matomo"
[integration] [integration]
yunohost = ">= 11.2.18" yunohost = ">= 11.2.29"
helpers_version = "2.1" helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true

View file

@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
# 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
@ -13,21 +12,13 @@ ynh_print_info "Declaring files to be backed up..."
ynh_backup "$install_dir" ynh_backup "$install_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_backup "/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 "/etc/php/$php_version/fpm/pool.d/$app.conf" ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup "/etc/cron.d/$app" ynh_backup "/etc/cron.d/$app"
#================================================= #=================================================

View file

@ -20,12 +20,12 @@ ynh_config_change_url_nginx
ynh_script_progression "Reconfiguring Matomo..." ynh_script_progression "Reconfiguring Matomo..."
if [[ -f "$install_dir/config/config.ini.php" ]]; then if [[ -f "$install_dir/config/config.ini.php" ]]; then
# config.ini.php is only created during the post-install process... # config.ini.php is only created during the post-install process...
# it is therefore not present when the CI tests are carried out... # it is therefore not present when the CI tests are carried out...
# This condition is only for CI test to go through the upgrade process # This condition is only for CI test to go through the upgrade process
# See https://matomo.org/faq/how-to-install/faq_18/ # See https://matomo.org/faq/how-to-install/faq_18/
ynh_replace --match="$old_domain" --replace="$new_domain" --file="$install_dir/config/config.ini.php" ynh_replace --match="$old_domain" --replace="$new_domain" --file="$install_dir/config/config.ini.php"
fi fi
#================================================= #=================================================
@ -37,8 +37,6 @@ path=$new_path
domain=$new_domain domain=$new_domain
ynh_config_add --template="cron" --destination="/etc/cron.d/$app" ynh_config_add --template="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: "/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 # END OF SCRIPT

View file

@ -14,11 +14,8 @@ email=$(ynh_user_get_info --username=$admin --key=mail)
#================================================= #=================================================
ynh_script_progression "Setting up source files..." 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_setup_source --dest_dir="$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 # PHP-FPM CONFIGURATION
#================================================= #=================================================
@ -31,8 +28,6 @@ ynh_config_add_phpfpm
ynh_config_add_nginx ynh_config_add_nginx
ynh_config_add --template="cron" --destination="/etc/cron.d/$app" ynh_config_add --template="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: "/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 # END OF SCRIPT

View file

@ -8,13 +8,10 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression "Removing NGINX web server configuration..." ynh_script_progression "Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
ynh_config_remove_nginx ynh_config_remove_nginx
# Remove the dedicated PHP-FPM config
ynh_config_remove_phpfpm ynh_config_remove_phpfpm
# Remove a cron file
ynh_safe_rm "/etc/cron.d/$app" ynh_safe_rm "/etc/cron.d/$app"
#================================================= #=================================================

View file

@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
# 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
@ -11,8 +10,6 @@ ynh_script_progression "Restoring the app main directory..."
ynh_restore "$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"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
@ -30,8 +27,6 @@ ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/cron.d/$app" ynh_restore "/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: "/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"
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM

View file

@ -6,42 +6,28 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression "Upgrading source files..."
# 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 [[ ! -f "$install_dir/config/config.ini.php" ]]; then
if ynh_app_upstream_version_changed # config.ini.php is only created during the post-install process...
then # it is therefore not present when the CI tests are carried out...
ynh_script_progression "Upgrading source files..." # This condition is only for CI test to go through the upgrade process
ynh_setup_source --dest_dir="$install_dir"
if [[ ! -f "$install_dir/config/config.ini.php" ]]; then else
# config.ini.php is only created during the post-install process... ynh_setup_source --dest_dir="$install_dir" --keep="config/config.ini.php" --full_replace
# it is therefore not present when the CI tests are carried out... ynh_exec_as_app php${php_version} $install_dir/console core:update -n
# This condition is only for CI test to go through the upgrade process
ynh_setup_source --dest_dir="$install_dir"
else
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --keep="config/config.ini.php" --full_replace
#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"
ynh_exec_as_app php${php_version} $install_dir/console core:update -n
fi
fi fi
#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 # PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression "Upgrading PHP-FPM configuration..." ynh_script_progression "Upgrading PHP-FPM configuration..."
# Create a dedicated PHP-FPM config
ynh_config_add_phpfpm ynh_config_add_phpfpm
# Create a dedicated NGINX config
ynh_config_add_nginx ynh_config_add_nginx
ynh_config_add --template="cron" --destination="/etc/cron.d/$app" ynh_config_add --template="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: "/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 # END OF SCRIPT