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 2023-10-29 16:57:59 +01:00
parent 76724f6ba6
commit 09c311662c
5 changed files with 16 additions and 33 deletions

View file

@ -1,18 +1,17 @@
[Unit]
Description=Navidrome: Music Server and Streamer
After=remote-fs.target network.target
AssertPathExists=__CONFIG_PATH__
[Service]
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__CONFIG_PATH__/
ExecStart=__INSTALL_DIR__/__APP__ --configfile "__CONFIG_PATH__/navidrome.toml"
WorkingDirectory=__INSTALL_DIR__/
ExecStart=__INSTALL_DIR__/__APP__ --configfile "__INSTALL_DIR__/navidrome.toml"
TimeoutStopSec=20
KillMode=process
Restart=on-failure
ReadWritePaths=__CONFIG_PATH__
ReadWritePaths=__INSTALL_DIR__/
# Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these

View file

@ -13,7 +13,7 @@ services = ["__APP__"]
yes = "true"
no = "false"
help = "Controls whether the player in the UI will animate the album cover"
bind = "EnableCoverAnimation:/var/lib/__APP__/navidrome.toml"
bind = "EnableCoverAnimation:__INSTALL_DIR__/navidrome.toml"
[main.config.enable_downloads]
ask = "Allow music download"
@ -21,7 +21,7 @@ services = ["__APP__"]
yes = "true"
no = "false"
help = "Enable the option in the UI to download music/albums/artists/playlists from the server"
bind = "EnableDownloads:/var/lib/__APP__/navidrome.toml"
bind = "EnableDownloads:__INSTALL_DIR__/navidrome.toml"
[main.config.enable_sharing]
ask = "Enable Sharing feature"
@ -29,7 +29,7 @@ services = ["__APP__"]
yes = "true"
no = "false"
help = "Enable the Sharing feature"
bind = "EnableSharing:/var/lib/__APP__/navidrome.toml"
bind = "EnableSharing:__INSTALL_DIR__/navidrome.toml"
[main.config.scanner_extractor]
ask = "Select metadata extractor"
@ -37,7 +37,7 @@ services = ["__APP__"]
choices = ["taglib", "ffmpeg"]
default = "taglib"
help = "Select metadata extractor implementation"
bind = "Scanner.Extractor:/var/lib/__APP__/navidrome.toml"
bind = "Scanner.Extractor:__INSTALL_DIR__/navidrome.toml"
[main.config.enable_transcoding]
ask = "Enable transcoding"
@ -45,10 +45,10 @@ services = ["__APP__"]
yes = "true"
no = "false"
help = "Enables transcoding configuration in the UI"
bind = "EnableTranscodingConfig:/var/lib/__APP__/navidrome.toml"
bind = "EnableTranscodingConfig:__INSTALL_DIR__/navidrome.toml"
[main.config.welcome_message]
ask = "Welcome message"
type = "string"
help = "Add a welcome message to the login screen"
bind = "UIWelcomeMessage:/var/lib/__APP__/navidrome.toml"
bind = "UIWelcomeMessage:__INSTALL_DIR__/navidrome.toml"

View file

@ -19,7 +19,6 @@ enable_animation="true"
enable_transcoding="false"
welcome_message=""
enable_sharing="false"
config_path="/var/lib/$app"
#=================================================
# STORE SETTINGS FROM MANIFEST
@ -32,7 +31,6 @@ 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
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -42,8 +40,6 @@ ynh_script_progression --message="Setting up source files..." --weight=4
# 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"
@ -75,10 +71,10 @@ ynh_multimedia_build_main_dir
ynh_script_progression --message="Adding a configuration file..." --weight=1
# Main config File
ynh_add_config --template="navidrome.toml" --destination="$config_path/navidrome.toml"
ynh_add_config --template="navidrome.toml" --destination="$install_dir/navidrome.toml"
chmod 600 "$config_path/navidrome.toml"
chown -R $app:$app "$config_path"
chmod 600 "$$install_dir/navidrome.toml"
chown -R $app:$app "$install_dir/navidrome.toml"
#=================================================
# START SYSTEMD SERVICE

View file

@ -20,16 +20,6 @@ ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..." --weight=2
ynh_restore_file --origin_path="/var/lib/$app"
chmod 600 "/var/lib/$app/navidrome.toml"
chown -R $app "/var/lib/$app"
#=================================================
# RESTORE SYSTEMD
#=================================================

View file

@ -76,7 +76,7 @@ then
ynh_secure_remove --file=$install_dir
# 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" --keep="nadidrome.toml"
fi
chmod -R o-rwx "$install_dir"
@ -100,13 +100,11 @@ yunohost service add $app --description="Web-based music collection server and s
#=================================================
ynh_script_progression --message="Updating a configuration file..."
config_path="/var/lib/$app"
# Uncomment when there is new options added upstream
ynh_add_config --template="navidrome.toml" --destination="$config_path/navidrome.toml"
ynh_add_config --template="navidrome.toml" --destination="$install_dir/navidrome.toml"
chmod 600 "$config_path/navidrome.toml"
chown -R $app:$app "$config_path"
chmod 600 "$install_dir/navidrome.toml"
chown -R $app:$app "$install_dir/navidrome.toml"
#=================================================
# START SYSTEMD SERVICE