mirror of
https://github.com/YunoHost-Apps/navidrome_ynh.git
synced 2024-09-03 19:46:30 +02:00
cleaning
This commit is contained in:
parent
4fde4251ed
commit
1ac1411245
5 changed files with 8 additions and 66 deletions
|
@ -1,6 +1,5 @@
|
||||||
#!/bin/bash
|
#!/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 ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -13,23 +12,13 @@ ynh_print_info "Declaring files to be backed up..."
|
||||||
ynh_backup "$install_dir"
|
ynh_backup "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC BACKUP
|
|
||||||
#=================================================
|
|
||||||
# BACKUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup "/etc/systemd/system/$app.service"
|
ynh_backup "/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup "/var/lib/$app"
|
ynh_backup "/var/lib/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -33,22 +33,17 @@ ynh_app_setting_set --key=config_path --value=$config_path
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression "Setting up source files..."
|
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"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
|
|
||||||
mkdir -p "$config_path"
|
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
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression "Configuring NGINX web server..."
|
ynh_script_progression "Configuring NGINX web server..."
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_config_add_nginx
|
ynh_config_add_nginx
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
|
||||||
ynh_config_add_systemd
|
ynh_config_add_systemd
|
||||||
|
|
||||||
yunohost service add $app --description="Web-based music collection server and streamer" --log="/var/log/$app/$app.log"
|
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..."
|
ynh_script_progression "Adding $app's configuration..."
|
||||||
|
|
||||||
# Main config File
|
|
||||||
ynh_config_add --template="navidrome.toml" --destination="$config_path/navidrome.toml"
|
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"
|
chown -R $app:$app "$config_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -9,20 +9,16 @@ source /usr/share/yunohost/helpers
|
||||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
# 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
|
if ynh_hide_warnings yunohost service status $app >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression "Removing $app service integration..."
|
ynh_script_progression "Removing $app service integration..."
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
|
||||||
ynh_config_remove_systemd
|
ynh_config_remove_systemd
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
|
||||||
ynh_config_remove_nginx
|
ynh_config_remove_nginx
|
||||||
|
|
||||||
# Remove the config directory securely
|
|
||||||
ynh_safe_rm "/var/lib/$app"
|
ynh_safe_rm "/var/lib/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#!/bin/bash
|
#!/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 ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -11,8 +10,6 @@ ynh_script_progression "Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore "$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
|
# RESTORE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -15,67 +15,34 @@ ynh_systemctl --service=$app --action="stop" --log_path=systemd
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression "Ensuring downward compatibility..."
|
ynh_script_progression "Ensuring downward compatibility..."
|
||||||
|
|
||||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=language --value="en"
|
ynh_app_setting_set_default --key=language --value="en"
|
||||||
if [ -z "${language:-}" ]; then
|
|
||||||
language="en"
|
|
||||||
ynh_app_setting_set --key=language --value=$language
|
|
||||||
fi
|
|
||||||
|
|
||||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=enable_animation --value="true"
|
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
|
|
||||||
|
|
||||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=enable_downloads --value="true"
|
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
|
|
||||||
|
|
||||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=scanner_extractor --value="taglib"
|
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
|
|
||||||
|
|
||||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=enable_transcoding --value="false"
|
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
|
|
||||||
|
|
||||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=welcome_message --value=""
|
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
|
|
||||||
|
|
||||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=enable_sharing --value="false"
|
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
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression "Upgrading source files..."
|
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
|
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
|
# REAPPLY SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression "Upgrading system configurations related to $app..."
|
ynh_script_progression "Upgrading system configurations related to $app..."
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_config_add_nginx
|
ynh_config_add_nginx
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
|
||||||
ynh_config_add_systemd
|
ynh_config_add_systemd
|
||||||
|
|
||||||
yunohost service add $app --description="Web-based music collection server and streamer" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Web-based music collection server and streamer" --log="/var/log/$app/$app.log"
|
||||||
|
|
Loading…
Add table
Reference in a new issue