1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/selfoss_ynh.git synced 2024-09-03 20:16:21 +02:00
This commit is contained in:
Éric Gaspar 2024-08-31 10:31:29 +02:00
parent d3759f12b9
commit 677ac040d3
6 changed files with 3 additions and 79 deletions

View file

@ -17,7 +17,7 @@ userdoc = "https://selfoss.aditu.de/"
code = "https://github.com/fossar/selfoss" code = "https://github.com/fossar/selfoss"
[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

@ -18,16 +18,8 @@ ynh_backup "$install_dir"
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 A CRON FILE
#=================================================
ynh_backup "/etc/cron.d/$app" ynh_backup "/etc/cron.d/$app"
#================================================= #=================================================

View file

@ -3,28 +3,13 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#REMOVEME? Everything about fpm_footprint is removed in helpers2.1... | fpm_footprint="low"
#REMOVEME? Everything about fpm_free_footprint is removed in helpers2.1... | fpm_free_footprint=0
#REMOVEME? Everything about fpm_usage is removed in helpers2.1... | fpm_usage="low"
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
#REMOVEME? Everything about fpm_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_footprint --value=$fpm_footprint
#REMOVEME? Everything about fpm_free_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_free_footprint --value=$fpm_free_footprint
#REMOVEME? Everything about fpm_usage is removed in helpers2.1... | ynh_app_setting_set --key=fpm_usage --value=$fpm_usage
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
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"
chmod g+w $install_dir/data/cache $install_dir/data/favicons $install_dir/data/logs $install_dir/data/thumbnails $install_dir/data/sqlite $install_dir/public chmod g+w $install_dir/data/cache $install_dir/data/favicons $install_dir/data/logs $install_dir/data/thumbnails $install_dir/data/sqlite $install_dir/public
#================================================= #=================================================
@ -32,10 +17,8 @@ chmod g+w $install_dir/data/cache $install_dir/data/favicons $install_dir/data/l
#================================================= #=================================================
ynh_script_progression "Configuring PHP-FPM..." ynh_script_progression "Configuring PHP-FPM..."
# 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
#================================================= #=================================================
@ -45,17 +28,12 @@ ynh_script_progression "Adding $app's configuration..."
ynh_config_add --template="config.ini" --destination="$install_dir/config.ini" ynh_config_add --template="config.ini" --destination="$install_dir/config.ini"
#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 400 "$install_dir/config.ini"
#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 $app:$app "$install_dir/config.ini"
#================================================= #=================================================
# SETUP A CRON # SETUP A CRON
#================================================= #=================================================
ynh_script_progression "Setuping a cron..." ynh_script_progression "Setuping a cron..."
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 PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
@ -23,8 +20,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

@ -3,44 +3,13 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression "Ensuring downward compatibility..."
# If fpm_footprint doesn't exist, create it
if [ -z "${fpm_footprint:-}" ]; then
fpm_footprint=low
#REMOVEME? Everything about fpm_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_footprint --value=$fpm_footprint
fi
# If fpm_free_footprint doesn't exist, create it
if [ -z "${fpm_free_footprint:-}" ]; then
fpm_free_footprint=0
#REMOVEME? Everything about fpm_free_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_free_footprint --value=$fpm_free_footprint
fi
# If fpm_usage doesn't exist, create it
if [ -z "${fpm_usage:-}" ]; then
fpm_usage=low
#REMOVEME? Everything about fpm_usage is removed in helpers2.1... | ynh_app_setting_set --key=fpm_usage --value=$fpm_usage
fi
#================================================= #=================================================
# 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 ynh_setup_source --dest_dir="$install_dir" --keep="data"
if ynh_app_upstream_version_changed
then
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="data"
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"
chmod g+w $install_dir/data/cache $install_dir/data/favicons $install_dir/data/logs $install_dir/data/thumbnails $install_dir/data/sqlite $install_dir/public chmod g+w $install_dir/data/cache $install_dir/data/favicons $install_dir/data/logs $install_dir/data/thumbnails $install_dir/data/sqlite $install_dir/public
#================================================= #=================================================
@ -48,10 +17,8 @@ chmod g+w $install_dir/data/cache $install_dir/data/favicons $install_dir/data/l
#================================================= #=================================================
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
#================================================= #=================================================
@ -61,17 +28,12 @@ ynh_script_progression "Updating configuration..."
ynh_config_add --template="config.ini" --destination="$install_dir/config.ini" ynh_config_add --template="config.ini" --destination="$install_dir/config.ini"
#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 400 "$install_dir/config.ini"
#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 $app:$app "$install_dir/config.ini"
#================================================= #=================================================
# SETUP A CRON # SETUP A CRON
#================================================= #=================================================
ynh_script_progression "Setuping a cron..." ynh_script_progression "Setuping a cron..."
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