first commit

This commit is contained in:
eric_G 2026-09-05 18:23:10 +02:00
commit 29217d93f5
21 changed files with 1177 additions and 0 deletions

31
scripts/backup Executable file
View file

@ -0,0 +1,31 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
ynh_print_info "Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup "$install_dir"
#=================================================
# BACKUP SYSTEM CONFIGURATION
#=================================================
# Backup the PHP-FPM configuration
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
# Backup the NGINX configuration
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

22
scripts/change_url Normal file
View file

@ -0,0 +1,22 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression "Updating NGINX web server configuration..."
# this will most likely adjust NGINX config correctly
ynh_config_change_url_nginx
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Change of URL completed for $app"

50
scripts/install Executable file
View file

@ -0,0 +1,50 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# INITIALIZE AND STORE SETTINGS
#=================================================
ynh_app_setting_set --key=php_upload_max_filesize --value=250M
ynh_app_setting_set --key=php_post_max_size --value=260M
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from manifest.toml
ynh_setup_source --dest_dir="$install_dir"
mkdir $install_dir/data $install_dir/public/media $install_dir/storage
chown -R $app:$app $install_dir/data $install_dir/public/media $install_dir/storage
chmod -R u+rwX $install_dir/data $install_dir/public/media $install_dir/storage
#=================================================
# APP INITIAL CONFIGURATION
#=================================================
ynh_script_progression "Adding $app's configuration files..."
ynh_config_add --template=".env" --destination="$install_dir/.env"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Adding system configurations related to $app..."
# Create a PHP-FPM config (with conf/extra_php-fpm.conf being appended to it)
ynh_config_add_phpfpm
# Create a dedicated NGINX config using the conf/nginx.conf template
ynh_config_add_nginx
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Installation of $app completed"

22
scripts/remove Executable file
View file

@ -0,0 +1,22 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# REMOVE SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Removing system configurations related to $app..."
ynh_config_remove_nginx
ynh_config_remove_phpfpm
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Removal of $app completed"

38
scripts/restore Executable file
View file

@ -0,0 +1,38 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression "Restoring the app main directory..."
ynh_restore "$install_dir"
#=================================================
# RESTORE SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Restoring system configurations related to $app..."
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression "Reloading NGINX web server and $app's service..."
ynh_systemctl --service="php$php_version-fpm" --action=reload
ynh_systemctl --service=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Restoration completed for $app"

44
scripts/upgrade Executable file
View file

@ -0,0 +1,44 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression "Ensuring downward compatibility..."
ynh_app_setting_set_default --key=php_upload_max_filesize --value=250M
ynh_app_setting_set_default --key=php_post_max_size --value=260M
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Upgrading source files..."
ynh_setup_source --dest_dir="$install_dir" --full_replace --keep=".env"
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression "Updating $app's configuration files..."
ynh_config_add --template=".env" --destination="$install_dir/.env"
#=================================================
# REAPPLY SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Upgrading system configurations related to $app..."
ynh_config_add_phpfpm
ynh_config_add_nginx
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"