mirror of
https://github.com/YunoHost-Apps/silverbullet_ynh.git
synced 2024-09-03 20:26:18 +02:00
[autopatch] Automatic patch attempt for helpers 2.1
This commit is contained in:
parent
f68add019a
commit
fe37108ad4
11 changed files with 69 additions and 90 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
*~
|
*~
|
||||||
*.sw[op]
|
*.sw[op]
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -18,7 +18,8 @@ demo = "https://play.silverbullet.md/"
|
||||||
code = "https://github.com/silverbulletmd/silverbullet"
|
code = "https://github.com/silverbulletmd/silverbullet"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.2"
|
yunohost = ">= 11.2.18"
|
||||||
|
helpers_version = "2.1"
|
||||||
architectures = [ "amd64", "arm64" ]
|
architectures = [ "amd64", "arm64" ]
|
||||||
multi_instance = true
|
multi_instance = true
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PERSONAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# EXPERIMENTAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# FUTURE OFFICIAL HELPERS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -8,36 +8,33 @@
|
||||||
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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE DATA DIR
|
# BACKUP THE DATA DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
### Only relevant if there is a "data_dir" resource for this app
|
### Only relevant if there is a "data_dir" resource for this app
|
||||||
ynh_backup --src_path="$data_dir"
|
ynh_backup "$data_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SYSTEM CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Backup the nginx configuration
|
# Backup 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"
|
||||||
|
|
||||||
# Backup the systemd service unit
|
# Backup the systemd service unit
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup "/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# 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)."
|
||||||
|
|
|
@ -14,17 +14,17 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping $app's systemd service..." --weight=1
|
ynh_script_progression "Stopping $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="stop"
|
ynh_systemctl --service="$app" --action="stop"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# 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..."
|
||||||
|
|
||||||
# this will most likely adjust NGINX config correctly
|
# this will most likely adjust NGINX config correctly
|
||||||
ynh_change_url_nginx_config
|
ynh_config_change_url_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC MODIFICATIONS
|
# SPECIFIC MODIFICATIONS
|
||||||
|
@ -35,12 +35,12 @@ ynh_change_url_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start"
|
ynh_systemctl --service="$app" --action="start"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# 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"
|
||||||
|
|
|
@ -14,26 +14,25 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
ynh_script_progression "Setting up source files..."
|
||||||
|
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$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..."
|
||||||
|
|
||||||
ynh_add_config --template="default.env" --destination="$install_dir/default.env"
|
ynh_config_add --template="default.env" --destination="$install_dir/default.env"
|
||||||
|
|
||||||
chmod 400 "$install_dir/default.env"
|
#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/default.env"
|
||||||
chown "$app:$app" "$install_dir/default.env"
|
#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/default.env"
|
||||||
|
|
||||||
ynh_add_config --template="custom.env" --destination="$data_dir/custom.env"
|
ynh_config_add --template="custom.env" --destination="$data_dir/custom.env"
|
||||||
|
|
||||||
chmod 600 "$data_dir/custom.env"
|
#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 600 "$data_dir/custom.env"
|
||||||
chown "$app:$app" "$data_dir/custom.env"
|
#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" "$data_dir/custom.env"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SET PERMISSION FOR THE USER
|
# SET PERMISSION FOR THE USER
|
||||||
|
@ -43,22 +42,22 @@ ynh_permission_update --permission="main" --add="$admin"
|
||||||
#=================================================
|
#=================================================
|
||||||
# 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..."
|
||||||
|
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
|
|
||||||
ynh_add_systemd_config
|
ynh_config_add_systemd
|
||||||
|
|
||||||
yunohost service add "$app" --description="The hacker's notebook"
|
yunohost service add "$app" --description="The hacker's notebook"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start"
|
ynh_systemctl --service="$app" --action="start"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installation of $app completed" --last
|
ynh_script_progression "Installation of $app completed"
|
||||||
|
|
|
@ -10,24 +10,24 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SYSTEM CONFIGURATIONS
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
ynh_script_progression "Removing system configurations related to $app..."
|
||||||
|
|
||||||
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
|
if ynh_hide_warnings yunohost service status "$app" >/dev/null; then
|
||||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
ynh_script_progression "Removing $app service integration..."
|
||||||
yunohost service remove "$app"
|
yunohost service remove "$app"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_remove_systemd_config
|
ynh_config_remove_systemd
|
||||||
|
|
||||||
ynh_remove_nginx_config
|
ynh_config_remove_nginx
|
||||||
|
|
||||||
# Remove other various files specific to the app... such as :
|
# Remove other various files specific to the app... such as :
|
||||||
|
|
||||||
ynh_secure_remove --file="$data_dir/custom.env"
|
ynh_safe_rm "$data_dir/custom.env"
|
||||||
ynh_secure_remove --file="$install_dir/default.env"
|
ynh_safe_rm "$install_dir/default.env"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed" --last
|
ynh_script_progression "Removal of $app completed"
|
||||||
|
|
|
@ -11,32 +11,31 @@ 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"
|
||||||
|
|
||||||
### $install_dir will automatically be initialized with some decent
|
### $install_dir will automatically be initialized with some decent
|
||||||
### permissions by default ... however, you may need to recursively reapply
|
### permissions by default ... however, you may need to recursively reapply
|
||||||
### ownership to all files such as after the ynh_setup_source step
|
### ownership to all files such as after the ynh_setup_source step
|
||||||
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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATA DIRECTORY
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
ynh_script_progression "Restoring the data directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
ynh_restore "$data_dir"
|
||||||
|
|
||||||
chown -R "$app:www-data" "$data_dir"
|
chown -R "$app:www-data" "$data_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEM CONFIGURATIONS
|
# RESTORE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
ynh_script_progression "Restoring system configurations related to $app..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore "/etc/systemd/system/$app.service"
|
||||||
systemctl enable "$app.service" --quiet
|
systemctl enable "$app.service" --quiet
|
||||||
|
|
||||||
yunohost service add "$app" --description="The hacker's notebook"
|
yunohost service add "$app" --description="The hacker's notebook"
|
||||||
|
@ -46,14 +45,14 @@ ynh_permission_update --permission="main" --add="$admin"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
ynh_script_progression "Reloading NGINX web server and $app's service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start"
|
ynh_systemctl --service="$app" --action="start"
|
||||||
|
|
||||||
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"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -11,34 +10,33 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping $app's systemd service..." --weight=1
|
ynh_script_progression "Stopping $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="stop"
|
ynh_systemctl --service="$app" --action="stop"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression "Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from manifest.toml
|
# Download, check integrity, uncompress and patch the source from manifest.toml
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating $app's configuration files..." --weight=1
|
ynh_script_progression "Updating $app's configuration files..."
|
||||||
|
|
||||||
ynh_add_config --template="default.env" --destination="$install_dir/default.env"
|
ynh_config_add --template="default.env" --destination="$install_dir/default.env"
|
||||||
|
|
||||||
chmod 400 "$install_dir/default.env"
|
#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/default.env"
|
||||||
chown "$app:$app" "$install_dir/default.env"
|
#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/default.env"
|
||||||
|
|
||||||
ynh_add_config --template="custom.env" --destination="$data_dir/custom.env"
|
ynh_config_add --template="custom.env" --destination="$data_dir/custom.env"
|
||||||
|
|
||||||
chmod 600 "$data_dir/custom.env"
|
#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 600 "$data_dir/custom.env"
|
||||||
chown "$app:$app" "$data_dir/custom.env"
|
#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" "$data_dir/custom.env"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SET PERMISSION FOR THE USER
|
# SET PERMISSION FOR THE USER
|
||||||
|
@ -48,23 +46,23 @@ ynh_permission_update --permission="main" --add="$admin"
|
||||||
#=================================================
|
#=================================================
|
||||||
# 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..."
|
||||||
|
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
|
|
||||||
ynh_add_systemd_config
|
ynh_config_add_systemd
|
||||||
|
|
||||||
yunohost service add "$app" --description="The hacker's notebook"
|
yunohost service add "$app" --description="The hacker's notebook"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start"
|
ynh_systemctl --service="$app" --action="start"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
ynh_script_progression "Upgrade of $app completed"
|
||||||
|
|
2
sources/extra_files/app/.gitignore
vendored
2
sources/extra_files/app/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
*~
|
|
||||||
*.sw[op]
|
|
2
sources/patches/.gitignore
vendored
2
sources/patches/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
*~
|
|
||||||
*.sw[op]
|
|
Loading…
Reference in a new issue