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

Apply last example_ynh (#62)

This commit is contained in:
yalh76 2021-08-06 13:54:47 +02:00 committed by GitHub
parent 9b28632c2f
commit ef4b78862b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 34 deletions

View file

@ -32,7 +32,7 @@
{
"name": "domain",
"type": "domain",
"example": "domain.org"
"example": "example.com"
},
{
"name": "path",

View file

@ -6,6 +6,7 @@
# 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
@ -14,7 +15,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -40,12 +41,6 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE APP CONFIG DIR
#=================================================
ynh_backup --src_path="/var/lib/$app"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
@ -60,8 +55,14 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/var/lib/$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for Navidrome. (YunoHost will then actually copy those files to the archive)."
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -135,4 +135,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for Navidrome" --last
ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -82,11 +82,11 @@ ynh_script_progression --message="Setting up source files..." --weight=4
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir=$final_path --source_id="$architecture"
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# NGINX CONFIGURATION
@ -96,6 +96,8 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=3
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
#=================================================
@ -104,9 +106,9 @@ ynh_script_progression --message="Adding multimedia directories..." --weight=2
ynh_multimedia_build_main_dir
#=================================================
# MODIFY A CONFIG FILE
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Modifying a config file..." --weight=1
ynh_script_progression --message="Adding a configuration file..." --weight=1
config_path="/var/lib/$app"
mkdir -p "$config_path"
@ -115,7 +117,7 @@ mkdir -p "$config_path"
ynh_add_config --template="../conf/navidrome.toml" --destination="$config_path/navidrome.toml"
chmod 600 "$config_path/navidrome.toml"
chown -R $app "$config_path"
chown -R $app:$app "$config_path"
#=================================================
# SETUP SYSTEMD

View file

@ -29,7 +29,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# 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
then
ynh_script_progression --message="Removing $app service..." --weight=1
ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app
fi
@ -52,19 +52,11 @@ ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing Navidrome main directory..." --weight=6
ynh_script_progression --message="Removing app main directory..." --weight=6
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE APP CONFIG DIR
#=================================================
ynh_script_progression --message="Removing Navidrome config directory..." --weight=6
# Remove the config directory securely
ynh_secure_remove --file="/var/lib/$app"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
@ -73,6 +65,16 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..." --weight=6
# Remove the config directory securely
ynh_secure_remove --file="/var/lib/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -87,4 +89,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of Navidrome completed" --last
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -6,6 +6,7 @@
# 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
@ -22,7 +23,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=1
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -45,7 +46,7 @@ test ! -d $final_path \
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -60,13 +61,13 @@ ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring Navidrome main directory..." --weight=4
ynh_script_progression --message="Restoring the app main directory..." --weight=4
ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# SPECIFIC RESTORATION
@ -123,4 +124,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for Navidrome" --last
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -84,12 +84,12 @@ then
ynh_secure_remove --file=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir=$final_path --source_id="$architecture"
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# NGINX CONFIGURATION
@ -117,7 +117,7 @@ config_path="/var/lib/$app"
#ynh_add_config --template="../conf/navidrome.toml" --destination="$config_path/navidrome.toml"
chmod 600 "$config_path/navidrome.toml"
chown -R $app "$config_path"
chown -R $app:$app "$config_path"
#=================================================
# SETUP SYSTEMD