1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/navidrome_ynh.git synced 2024-09-03 19:46:30 +02:00

[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot 2024-08-31 01:09:54 +02:00 committed by Alexandre Aubin
parent 39b48c74bc
commit 4fde4251ed
8 changed files with 87 additions and 140 deletions

View file

@ -17,7 +17,8 @@ admindoc = "https://www.navidrome.org/docs"
code = "https://github.com/deluan/navidrome"
[integration]
yunohost = ">= 11.2"
yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = ["amd64", "arm64", "armhf"]
multi_instance = false

View file

@ -1,17 +1,5 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================

View file

@ -1,31 +1,22 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
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 THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$install_dir"
ynh_backup "$install_dir"
#=================================================
# 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"
#=================================================
# SPECIFIC BACKUP
@ -33,16 +24,16 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"
ynh_backup "/etc/systemd/system/$app.service"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/var/lib/$app"
ynh_backup "/var/lib/$app"
#=================================================
# 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,54 +1,44 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
ynh_systemctl --service=$app --action="stop" --log_path="systemd"
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
ynh_script_progression "Updating NGINX web server configuration..."
ynh_change_url_nginx_config
ynh_config_change_url_nginx
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..." --weight=1
ynh_script_progression "Updating configuration..."
path_url="$new_path"
ynh_add_config --template="navidrome.toml" --destination="/var/lib/$app/navidrome.toml"
ynh_config_add --template="navidrome.toml" --destination="/var/lib/$app/navidrome.toml"
chmod 600 "/var/lib/$app/navidrome.toml"
chown -R $app:$app "/var/lib/$app/navidrome.toml"
#=================================================
# GENERIC FINALISATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression "Starting $app's systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Version:"
ynh_systemctl --service=$app --action="start" --log_path=systemd --wait_until="Version:"
#=================================================
# 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,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
@ -24,39 +18,38 @@ config_path="/var/lib/$app"
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_script_progression "Storing installation settings..."
ynh_app_setting_set --app=$app --key=enable_downloads --value=$enable_downloads
ynh_app_setting_set --app=$app --key=scanner_extractor --value=$scanner_extractor
ynh_app_setting_set --app=$app --key=enable_animation --value=$enable_animation
ynh_app_setting_set --app=$app --key=enable_transcoding --value=$enable_transcoding
ynh_app_setting_set --app=$app --key=welcome_message --value=$welcome_message
ynh_app_setting_set --app=$app --key=enable_sharing --value=$enable_sharing
ynh_app_setting_set --app=$app --key=config_path --value=$config_path
ynh_app_setting_set --key=enable_downloads --value=$enable_downloads
ynh_app_setting_set --key=scanner_extractor --value=$scanner_extractor
ynh_app_setting_set --key=enable_animation --value=$enable_animation
ynh_app_setting_set --key=enable_transcoding --value=$enable_transcoding
ynh_app_setting_set --key=welcome_message --value=$welcome_message
ynh_app_setting_set --key=enable_sharing --value=$enable_sharing
ynh_app_setting_set --key=config_path --value=$config_path
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=4
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"
mkdir -p "$config_path"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$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:$app "$install_dir"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=3
ynh_script_progression "Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_add_systemd_config
ynh_config_add_systemd
yunohost service add $app --description="Web-based music collection server and streamer" --log="/var/log/$app/$app.log"
@ -65,31 +58,31 @@ yunohost service add $app --description="Web-based music collection server and s
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
#=================================================
ynh_script_progression --message="Adding multimedia directories..." --weight=2
ynh_script_progression "Adding multimedia directories..."
ynh_multimedia_build_main_dir
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_script_progression "Adding $app's configuration..."
# Main config File
ynh_add_config --template="navidrome.toml" --destination="$config_path/navidrome.toml"
ynh_config_add --template="navidrome.toml" --destination="$config_path/navidrome.toml"
chmod 600 "$config_path/navidrome.toml"
#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 "$config_path/navidrome.toml"
chown -R $app:$app "$config_path"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2
ynh_script_progression "Starting $app's systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Version:"
ynh_systemctl --service=$app --action="start" --log_path=systemd --wait_until="Version:"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last
ynh_script_progression "Installation of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
@ -16,23 +10,23 @@ source /usr/share/yunohost/helpers
#=================================================
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
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
fi
# Remove the dedicated systemd config
ynh_remove_systemd_config
ynh_config_remove_systemd
# Remove the dedicated NGINX config
ynh_remove_nginx_config
ynh_config_remove_nginx
# Remove the config directory securely
ynh_secure_remove --file="/var/lib/$app"
ynh_safe_rm "/var/lib/$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last
ynh_script_progression "Removal of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -13,19 +7,18 @@ source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=4
ynh_script_progression "Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$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:$app "$install_dir"
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..." --weight=2
ynh_script_progression "Restoring various files..."
ynh_restore_file --origin_path="/var/lib/$app"
ynh_restore "/var/lib/$app"
chmod 600 "/var/lib/$app/navidrome.toml"
chown -R $app:$app "/var/lib/$app"
@ -33,26 +26,26 @@ chown -R $app:$app "/var/lib/$app"
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=5
ynh_script_progression "Restoring $app's systemd service..."
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
ynh_restore "/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
yunohost service add $app --description="Web-based music collection server and streamer" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression "Starting $app's systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Version:"
ynh_systemctl --service=$app --action="start" --log_path=systemd --wait_until="Version:"
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,95 +1,92 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
ynh_systemctl --service=$app --action="stop" --log_path=systemd
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
ynh_script_progression "Ensuring downward compatibility..."
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=language --value="en"
if [ -z "${language:-}" ]; then
language="en"
ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --key=language --value=$language
fi
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=enable_animation --value="true"
if [ -z "${enable_animation:-}" ]; then
enable_animation="true"
ynh_app_setting_set --app=$app --key=enable_animation --value=$enable_animation
ynh_app_setting_set --key=enable_animation --value=$enable_animation
fi
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=enable_downloads --value="true"
if [ -z "${enable_downloads:-}" ]; then
enable_downloads="true"
ynh_app_setting_set --app=$app --key=enable_downloads --value=$enable_downloads
ynh_app_setting_set --key=enable_downloads --value=$enable_downloads
fi
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=scanner_extractor --value="taglib"
if [ -z "${scanner_extractor:-}" ]; then
scanner_extractor="taglib"
ynh_app_setting_set --app=$app --key=scanner_extractor --value=$scanner_extractor
ynh_app_setting_set --key=scanner_extractor --value=$scanner_extractor
fi
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=enable_transcoding --value="false"
if [ -z "${enable_transcoding:-}" ]; then
enable_transcoding="false"
ynh_app_setting_set --app=$app --key=enable_transcoding --value=$enable_transcoding
ynh_app_setting_set --key=enable_transcoding --value=$enable_transcoding
fi
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=welcome_message --value=""
if [ -z "${welcome_message:-}" ]; then
welcome_message=""
ynh_app_setting_set --app=$app --key=welcome_message --value=$welcome_message
ynh_app_setting_set --key=welcome_message --value=$welcome_message
fi
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=enable_sharing --value="false"
if [ -z "${enable_sharing:-}" ]; then
enable_sharing="false"
ynh_app_setting_set --app=$app --key=enable_sharing --value=$enable_sharing
ynh_app_setting_set --key=enable_sharing --value=$enable_sharing
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=5
ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace=1
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
ynh_setup_source --dest_dir="$install_dir" --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 | 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:$app "$install_dir"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
ynh_script_progression "Upgrading system configurations related to $app..."
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_add_systemd_config
ynh_config_add_systemd
yunohost service add $app --description="Web-based music collection server and streamer" --log="/var/log/$app/$app.log"
#=================================================
# UPDATE A CONFIG FILE
#=================================================
#ynh_script_progression --message="Updating a configuration file..." --weight=2
#ynh_script_progression "Updating configuration..."
# Uncomment when there is new options added upstream
#ynh_add_config --template="navidrome.toml" --destination="/var/lib/$app/navidrome.toml"
#ynh_config_add --template="navidrome.toml" --destination="/var/lib/$app/navidrome.toml"
#chmod 600 "/var/lib/$app/navidrome.toml"
#chown -R $app:$app "/var/lib/$app"
@ -97,12 +94,12 @@ yunohost service add $app --description="Web-based music collection server and s
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression "Starting $app's systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Version:"
ynh_systemctl --service=$app --action="start" --log_path=systemd --wait_until="Version:"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last
ynh_script_progression "Upgrade of $app completed"