mirror of
https://github.com/YunoHost-Apps/lidarr_ynh.git
synced 2024-09-03 19:35:58 +02:00
79 lines
2.6 KiB
Bash
Executable file
79 lines
2.6 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
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"
|
|
|
|
#=================================================
|
|
# NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression "Configuring NGINX web server..."
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_config_add_nginx
|
|
|
|
#=================================================
|
|
# SPECIFIC SETUP
|
|
#=================================================
|
|
# SETUP SYSTEMD
|
|
#=================================================
|
|
ynh_script_progression "Configuring $app's systemd service..."
|
|
|
|
# Create a dedicated systemd config
|
|
ynh_config_add_systemd
|
|
|
|
#=================================================
|
|
# ADD A CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression "Configuring Lidarr..."
|
|
|
|
api_key=$(ynh_string_random --length=32)
|
|
ynh_app_setting_set --key=api_key --value=$api_key
|
|
|
|
ynh_config_add --template="config.xml" --destination="$data_dir/config.xml"
|
|
|
|
#=================================================
|
|
# YUNOHOST MULTIMEDIA INTEGRATION
|
|
#=================================================
|
|
ynh_script_progression "Adding multimedia directories..."
|
|
|
|
# Build YunoHost multimedia directories
|
|
ynh_multimedia_build_main_dir
|
|
# Enable writing into these directories
|
|
ynh_multimedia_addaccess $app
|
|
|
|
#=================================================
|
|
# SETUP LOGROTATE
|
|
#=================================================
|
|
ynh_script_progression "Configuring log rotation..."
|
|
|
|
# Use logrotate to manage application logfile(s)
|
|
ynh_config_add_logrotate "$data_dir/logs"
|
|
|
|
#=================================================
|
|
# INTEGRATE SERVICE IN YUNOHOST
|
|
#=================================================
|
|
ynh_script_progression "Integrating service in YunoHost..."
|
|
|
|
yunohost service add $app --description="Lidarr daemon" --log="$data_dir/logs/lidarr.txt"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression "Starting $app's systemd service..."
|
|
|
|
# Start a systemd service
|
|
ynh_systemctl --service=$app --action="start" --log_path="systemd" --wait_until="Application started"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression "Installation of $app completed"
|