1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/keeweb_ynh.git synced 2024-09-03 19:26:33 +02:00

[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot 2024-08-31 00:58:47 +02:00 committed by Alexandre Aubin
parent 68359608e1
commit a8d8ac3418
9 changed files with 50 additions and 110 deletions

2
.gitignore vendored
View file

@ -45,3 +45,5 @@ $RECYCLE.BIN/
Network Trash Folder
Temporary Items
.apdisk
*~
*.sw[op]

View file

@ -17,7 +17,8 @@ admindoc = "https://github.com/keeweb/keeweb/wiki"
code = "https://github.com/keeweb/keeweb"
[integration]
yunohost = ">= 11.2"
yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all"
multi_instance = true
@ -47,6 +48,7 @@ ram.runtime = "50M"
[resources.system_user]
[resources.install_dir]
group = "www-data:r-x"
[resources.permissions]
main.url = "/"

View file

@ -1,6 +1 @@
#!/bin/bash
#=================================================
# EXPERIMENTAL HELPERS
#=================================================

View file

@ -1,33 +1,24 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
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 OF THE MAIN DIR OF THE APP
#=================================================
ynh_backup --src_path="$install_dir"
ynh_backup "$install_dir"
#=================================================
# BACKUP OF 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"
#=================================================
# 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,25 +1,17 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..."
ynh_script_progression "Updating NGINX web server configuration..."
ynh_change_url_nginx_config
ynh_config_change_url_nginx
#=================================================
# 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,32 +1,24 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# INSTALL SOURCES
#=================================================
ynh_script_progression --message="Setting up source files..."
ynh_script_progression "Setting up source files..."
# To avoid a complete rebuild, I downloaded the gh-pages as explained here: https://github.com/keeweb/keeweb#self-hosting
# and put all files in "../sources/extra_files/app/", like that I can assure the version install in YunoHost is the version described in the manifest
# and put all files in "../sources/", like that I can assure the version install in YunoHost is the version described in the manifest
mkdir -p "$install_dir"
cp -r ../sources/extra_files/app/* "$install_dir"
cp -r ../sources/* "$install_dir"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..."
ynh_script_progression "Configuring NGINX web server..."
ynh_add_nginx_config
ynh_config_add_nginx
#=================================================
# SPECIFIC SETUP
@ -34,28 +26,26 @@ ynh_add_nginx_config
# USE THE CONFIG FILE
#=================================================
ynh_replace_string "(no-config)" "config.json" "$install_dir/index.html"
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
ynh_replace "(no-config)" "config.json" "$install_dir/index.html"
#=================================================
# COPY THE CONFIG FILE
#=================================================
ynh_script_progression --message="Adding a configuration file..."
ynh_script_progression "Adding $app's configuration..."
ynh_add_config --template="config.json" --destination="$install_dir/config.json"
ynh_config_add --template="config.json" --destination="$install_dir/config.json"
#=================================================
# GENERIC FINALISATION
#=================================================
# SECURING FILES AND DIRECTORIES
#=================================================
# Les fichiers appartiennent à root
chmod 750 "$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 750 "$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"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last
ynh_script_progression "Installation of $app completed"

View file

@ -1,24 +1,18 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# 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
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last
ynh_script_progression "Removal of $app completed"

View file

@ -1,43 +1,34 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# RESTORE OF THE MAIN DIR OF THE APP
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_script_progression "Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir"
chmod 750 "$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 750 "$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 OF THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_script_progression "Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX
#=================================================
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=nginx --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,68 +1,51 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# INSTALL SOURCES
#=================================================
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
mkdir -p "$install_dir"
cp -r ../sources/extra_files/app/* "$install_dir"
cp -r ../sources/* "$install_dir"
fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_add_nginx_config
ynh_config_add_nginx
#=================================================
# SPECIFIC UPGRADE
#=================================================
# USE THE CONFIG FILE
#=================================================
ynh_replace_string "(no-config)" "config.json" "$install_dir/index.html"
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
ynh_replace "(no-config)" "config.json" "$install_dir/index.html"
#=================================================
# COPY THE CONFIG FILE
#=================================================
# Copie ou modification d'un fichier de config
ynh_add_config --template="config.json" --destination="$install_dir/config.json"
ynh_config_add --template="config.json" --destination="$install_dir/config.json"
#=================================================
# GENERIC FINALISATION
#=================================================
# SECURING FILES AND DIRECTORIES
#=================================================
chmod 750 "$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 750 "$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"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last
ynh_script_progression "Upgrade of $app completed"