1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/navidrome_ynh.git synced 2024-09-03 19:46:30 +02:00
This commit is contained in:
Éric Gaspar 2024-08-31 16:08:52 +02:00
parent 4fde4251ed
commit 1ac1411245
5 changed files with 8 additions and 66 deletions

View file

@ -1,6 +1,5 @@
#!/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 /usr/share/yunohost/helpers
@ -13,23 +12,13 @@ ynh_print_info "Declaring files to be backed up..."
ynh_backup "$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup "/etc/systemd/system/$app.service"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup "/var/lib/$app"
#=================================================

View file

@ -33,22 +33,17 @@ ynh_app_setting_set --key=config_path --value=$config_path
#=================================================
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"
#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 "Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd
yunohost service add $app --description="Web-based music collection server and streamer" --log="/var/log/$app/$app.log"
@ -67,10 +62,8 @@ ynh_multimedia_build_main_dir
#=================================================
ynh_script_progression "Adding $app's configuration..."
# Main config File
ynh_config_add --template="navidrome.toml" --destination="$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"
#=================================================

View file

@ -9,20 +9,16 @@ source /usr/share/yunohost/helpers
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_hide_warnings yunohost service status $app >/dev/null
then
ynh_script_progression "Removing $app service integration..."
yunohost service remove $app
fi
# Remove the dedicated systemd config
ynh_config_remove_systemd
# Remove the dedicated NGINX config
ynh_config_remove_nginx
# Remove the config directory securely
ynh_safe_rm "/var/lib/$app"
#=================================================

View file

@ -1,6 +1,5 @@
#!/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 /usr/share/yunohost/helpers
@ -11,8 +10,6 @@ ynh_script_progression "Restoring the app main directory..."
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
#=================================================

View file

@ -15,67 +15,34 @@ ynh_systemctl --service=$app --action="stop" --log_path=systemd
#=================================================
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 --key=language --value=$language
fi
ynh_app_setting_set_default --key=language --value="en"
# 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 --key=enable_animation --value=$enable_animation
fi
ynh_app_setting_set_default --key=enable_animation --value="true"
# 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 --key=enable_downloads --value=$enable_downloads
fi
ynh_app_setting_set_default --key=enable_downloads --value="true"
# 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 --key=scanner_extractor --value=$scanner_extractor
fi
ynh_app_setting_set_default --key=scanner_extractor --value="taglib"
# 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 --key=enable_transcoding --value=$enable_transcoding
fi
ynh_app_setting_set_default --key=enable_transcoding --value="false"
# 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 --key=welcome_message --value=$welcome_message
fi
ynh_app_setting_set_default --key=welcome_message --value=""
# 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 --key=enable_sharing --value=$enable_sharing
fi
ynh_app_setting_set_default --key=enable_sharing --value="false"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
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
#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 "Upgrading system configurations related to $app..."
# Create a dedicated NGINX config
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd
yunohost service add $app --description="Web-based music collection server and streamer" --log="/var/log/$app/$app.log"