1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/autobrr_ynh.git synced 2024-09-03 18:15:56 +02:00
This commit is contained in:
Éric Gaspar 2024-09-01 18:07:46 +02:00
parent aec1e1fa5f
commit 5f7463fd13
7 changed files with 5 additions and 34 deletions

View file

@ -1,5 +1,5 @@
[Unit]
Description=autobrr
Description=Autobrr: automation for torrents
After=syslog.target network-online.target
[Service]

View file

@ -15,7 +15,7 @@ website = "https://autobrr.com/"
code = "https://github.com/autobrr/autobrr"
[integration]
yunohost = ">= 11.2.18"
yunohost = ">= 11.2.29"
helpers_version = "2.1"
architectures = "all"
multi_instance = true

View file

@ -1,6 +1,5 @@
#!/bin/bash
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -16,7 +15,6 @@ ynh_backup "$install_dir"
# BACKUP THE DATA DIR
#=================================================
# Only relevant if there is a "data_dir" resource for this app
ynh_backup "$data_dir"
#=================================================
@ -25,10 +23,6 @@ ynh_backup "$data_dir"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup "/etc/systemd/system/$app.service"
#=================================================

View file

@ -3,18 +3,14 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
#=================================================
# 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"
mkdir -p $data_dir/.config/autobrr
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
chmod +x "$install_dir/autobrr"
#=================================================
@ -22,10 +18,8 @@ chmod +x "$install_dir/autobrr"
#=================================================
ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated NGINX config using the conf/nginx.conf template
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd
yunohost service add $app --description="Automation for torrents and usenet" --log="/var/log/$app/$app.log"
@ -40,15 +34,11 @@ ynh_script_progression "Adding $app's configuration..."
key=$(ynh_string_random)
ynh_config_add --template="config.toml" --destination="$data_dir/.config/autobrr/config.toml"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$data_dir/.config/autobrr/config.toml"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$data_dir/.config/autobrr/config.toml"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
# Start a systemd service
ynh_systemctl --service=$app --action="start"
#=================================================

View file

@ -5,13 +5,9 @@ source /usr/share/yunohost/helpers
#=================================================
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
# REMOVE SYSTEMD SERVICE
#=================================================
ynh_script_progression "Removing system configurations related to $app..."
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_hide_warnings yunohost service status $app >/dev/null
then
ynh_script_progression "Removing $app service integration..."

View file

@ -27,7 +27,7 @@ chown -R $app:www-data "$data_dir"
#=================================================
ynh_script_progression "Restoring the PostgreSQL database..."
ynh_psql_db_shell < "./db.sql""
ynh_psql_db_shell < "./db.sql"
#=================================================
# RESTORE SYSTEM CONFIGURATIONS

View file

@ -10,22 +10,13 @@ ynh_script_progression "Stopping $app's systemd service..."
ynh_systemctl --service=$app --action="stop"
#=================================================
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Upgrading source files..."
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
if ynh_app_upstream_version_changed
then
ynh_script_progression "Upgrading source files..."
ynh_setup_source --dest_dir="$install_dir" --full_replace
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace
fi
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
chmod +x "$install_dir/autobrr"
#=================================================