mirror of
https://github.com/YunoHost-Apps/autobrr_ynh.git
synced 2024-09-03 18:15:56 +02:00
cleaning
This commit is contained in:
parent
aec1e1fa5f
commit
5f7463fd13
7 changed files with 5 additions and 34 deletions
|
@ -1,5 +1,5 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=autobrr
|
Description=Autobrr: automation for torrents
|
||||||
After=syslog.target network-online.target
|
After=syslog.target network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
|
|
@ -15,7 +15,7 @@ website = "https://autobrr.com/"
|
||||||
code = "https://github.com/autobrr/autobrr"
|
code = "https://github.com/autobrr/autobrr"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.2.18"
|
yunohost = ">= 11.2.29"
|
||||||
helpers_version = "2.1"
|
helpers_version = "2.1"
|
||||||
architectures = "all"
|
architectures = "all"
|
||||||
multi_instance = true
|
multi_instance = true
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#!/bin/bash
|
#!/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 ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -16,7 +15,6 @@ ynh_backup "$install_dir"
|
||||||
# BACKUP THE DATA DIR
|
# BACKUP THE DATA DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Only relevant if there is a "data_dir" resource for this app
|
|
||||||
ynh_backup "$data_dir"
|
ynh_backup "$data_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -25,10 +23,6 @@ ynh_backup "$data_dir"
|
||||||
|
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup "/etc/systemd/system/$app.service"
|
ynh_backup "/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -3,18 +3,14 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression "Setting up source files..."
|
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"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
mkdir -p $data_dir/.config/autobrr
|
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"
|
chmod +x "$install_dir/autobrr"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -22,10 +18,8 @@ chmod +x "$install_dir/autobrr"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression "Adding system configurations related to $app..."
|
ynh_script_progression "Adding system configurations related to $app..."
|
||||||
|
|
||||||
# Create a dedicated NGINX config using the conf/nginx.conf template
|
|
||||||
ynh_config_add_nginx
|
ynh_config_add_nginx
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
|
||||||
ynh_config_add_systemd
|
ynh_config_add_systemd
|
||||||
|
|
||||||
yunohost service add $app --description="Automation for torrents and usenet" --log="/var/log/$app/$app.log"
|
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)
|
key=$(ynh_string_random)
|
||||||
ynh_config_add --template="config.toml" --destination="$data_dir/.config/autobrr/config.toml"
|
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
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression "Starting $app's systemd service..."
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
# Start a systemd service
|
|
||||||
ynh_systemctl --service=$app --action="start"
|
ynh_systemctl --service=$app --action="start"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -5,13 +5,9 @@ source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SYSTEM CONFIGURATIONS
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
|
||||||
# REMOVE SYSTEMD SERVICE
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression "Removing system configurations related to $app..."
|
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
|
if ynh_hide_warnings yunohost service status $app >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression "Removing $app service integration..."
|
ynh_script_progression "Removing $app service integration..."
|
||||||
|
|
|
@ -27,7 +27,7 @@ chown -R $app:www-data "$data_dir"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression "Restoring the PostgreSQL database..."
|
ynh_script_progression "Restoring the PostgreSQL database..."
|
||||||
|
|
||||||
ynh_psql_db_shell < "./db.sql""
|
ynh_psql_db_shell < "./db.sql"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEM CONFIGURATIONS
|
# RESTORE SYSTEM CONFIGURATIONS
|
||||||
|
|
|
@ -10,22 +10,13 @@ ynh_script_progression "Stopping $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemctl --service=$app --action="stop"
|
ynh_systemctl --service=$app --action="stop"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# 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
|
ynh_setup_source --dest_dir="$install_dir" --full_replace
|
||||||
if ynh_app_upstream_version_changed
|
|
||||||
then
|
|
||||||
ynh_script_progression "Upgrading source files..."
|
|
||||||
|
|
||||||
# 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"
|
chmod +x "$install_dir/autobrr"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue