#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= ynh_script_progression --message="Loading installation settings..." --weight=1 detect_and_read_radarr_and_sonarr_settings #================================================= # CHECK VERSION #================================================= upgrade_type=$(ynh_check_app_version_changed) #================================================= # STANDARD UPGRADE STEPS #================================================= # STOP SYSTEMD SERVICE #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=2 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" --full_replace=1 fi chmod -R o-rwx "$install_dir" chown -R $app: "$install_dir" # Prepare log path log_path="/var/log/$app" mkdir -p "$log_path" chmod 750 "$log_path" chmod -R o-rwx "$log_path" chown -R $app: "$log_path" #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config env_path="$install_dir/venv/bin:$PATH" # Create a dedicated systemd config ynh_add_systemd_config # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append yunohost service add $app --description="Subtitle downloader for Radarr and Sonarr" --log="/var/log/$app/$app.log" #================================================= # SPECIFIC UPGRADE #================================================= # UPGRADING BAZARR #================================================= #REMOVEME? ynh_script_progression --message="Upgrading Bazarr and its dependencies..." --weight=5 pushd $install_dir # Initialize virtual environment ynh_exec_as $app python${python_major_version} -m venv venv ynh_exec_as $app $install_dir/venv/bin/pip install -r "$install_dir/requirements.txt" popd #================================================= # UPDATE A CONFIG FILE #================================================= #FIXME: Find a way not to override all settings while upgrading the config file. #ynh_script_progression --message="Updating a configuration file..." --weight=1 #ynh_add_config --template="config.ini" --destination="$install_dir/data/config/config.ini" #chmod 660 "$install_dir/data/config/config.ini" #chown $app: "$install_dir/data/config/config.ini" #================================================= # YUNOHOST MULTIMEDIA INTEGRATION #================================================= ynh_script_progression --message="Adding multimedia directories..." --weight=1 # Build YunoHost multimedia directories ynh_multimedia_build_main_dir # Enable writing into these directories ynh_multimedia_addaccess $app #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Upgrade of $app completed" --last