mirror of
https://github.com/YunoHost-Apps/prowlarr_ynh.git
synced 2024-09-03 20:16:07 +02:00
68 lines
2.4 KiB
Bash
Executable file
68 lines
2.4 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# STOP SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Stopping $app's systemd service..." --weight=1
|
|
|
|
ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd"
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading source files..." --weight=3
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
ynh_setup_source --dest_dir="$install_dir" --full_replace=1
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R "$app:" "$install_dir"
|
|
|
|
#=================================================
|
|
# UPDATE A CONFIG FILE
|
|
#=================================================
|
|
ynh_script_progression --message="Updating the configuration file..." --weight=1
|
|
|
|
# Add newline at end of file if required
|
|
sed -i -e '$a\' "$data_dir/config.xml"
|
|
|
|
ynh_add_config --template="config.xml" --destination="$data_dir/config.xml"
|
|
|
|
chmod 400 "$data_dir/config.xml"
|
|
chown "$app:$app" "$data_dir/config.xml"
|
|
|
|
#=================================================
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
# Create a dedicated systemd config
|
|
ynh_add_systemd_config
|
|
yunohost service add "$app" --description="Prowlarr daemon" --log="$data_dir/logs/prowlarr.txt"
|
|
|
|
# Use logrotate to manage app-specific logfile(s)
|
|
ynh_use_logrotate --non-append
|
|
ynh_use_logrotate --non-append --logfile="$data_dir/logs"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
|
|
|
|
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|