#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= scanner_extractor="taglib" enable_downloads="true" enable_animation="true" enable_transcoding="false" welcome_message="" enable_sharing="false" #================================================= # STORE SETTINGS FROM MANIFEST #================================================= ynh_script_progression --message="Storing installation settings..." --weight=2 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 #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= 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" --source_id=$YNH_ARCH chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Configuring NGINX web server..." --weight=3 # Create a dedicated NGINX config ynh_add_nginx_config #================================================= # SPECIFIC SETUP #================================================= # YUNOHOST MULTIMEDIA INTEGRATION #================================================= ynh_script_progression --message="Adding multimedia directories..." --weight=2 ynh_multimedia_build_main_dir #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 config_path="/var/lib/$app" ynh_app_setting_set --app=$app --key=config_path --value=$config_path mkdir -p "$config_path" # Main config File ynh_add_config --template="../conf/navidrome.toml" --destination="$config_path/navidrome.toml" chmod 600 "$config_path/navidrome.toml" chown -R $app:$app "$config_path" #================================================= # SETUP SYSTEMD #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config #================================================= # GENERIC FINALIZATION #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Web-based music collection server and streamer" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=2 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Version:" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Installation of $app completed" --last