#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # CREATE DIRECTORIES #================================================= if [ -d "$config_path" ]; then ynh_die --message="There is already a directory: $config_path " fi ynh_app_setting_set --app="$app" --key=config_path --value="$config_path" #================================================= # STANDARD MODIFICATIONS #================================================= # OPEN PORTS #================================================= ynh_script_progression --message="Configuring firewall..." --weight=1 open_jellyfin_discovery_ports #================================================= # INSTALL PACKAGES #================================================= ynh_script_progression --message="Installing packages..." --weight=1 install_jellyfin_packages #================================================= # SYSTEM CONFIGURATION #=================================================รง ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 if grep -q "^render:" /etc/group; then # Add user to render group adduser "$app" render fi ynh_add_nginx_config #================================================= # SPECIFIC SETUP #================================================= # ADD A CONFIGURATION #================================================= ynh_print_info --message="Waiting 30s to let Jellyfin fully start a first time..." sleep 30 ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" --line_match="Stopped Jellyfin Media Server" --timeout=15 ynh_add_config --template="system.xml" --destination="$config_path/system.xml" ynh_add_config --template="network.xml" --destination="$config_path/network.xml" ynh_add_config --template="logging.json" --destination="$config_path/logging.json" #================================================= # INSTALL LDAP PLUGIN #================================================= ynh_script_progression --message="Installing LDAP plugin..." --weight=2 ynh_setup_source --dest_dir="/var/lib/jellyfin/plugins/LDAP Authentication" --source_id=plugin_ldap mkdir -p /var/lib/jellyfin/plugins/configurations/ ynh_add_config --template="LDAP-Auth.xml" --destination="/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml" #================================================= # SECURE FILES AND DIRECTORIES #================================================= ynh_script_progression --message="Securing files and directories..." # Set permissions to app files chown -R "$app:" "$data_path" chown -R "$app:" "$config_path" #================================================= # YUNOHOST MULTIMEDIA INTEGRATION #================================================= ynh_script_progression --message="Adding multimedia directories..." --weight=2 # Build YunoHost multimedia directories ynh_multimedia_build_main_dir # Allow Jellyfin to write into these directories ynh_multimedia_addaccess "$app" #================================================= # GENERIC FINALIZATION #================================================= # SETUP LOGROTATE #================================================= ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) ynh_use_logrotate #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add "$app" --description="Jellyfin media center" # Only the admin can access the admin panel of the app (if the app has an admin panel) ynh_permission_update --permission="admin" --add="$admin" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Started Jellyfin Media Server" --timeout=15 #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Installation of $app completed" --last