mirror of
https://github.com/YunoHost-Apps/simple-torrent_ynh.git
synced 2024-09-03 20:26:18 +02:00
v2
This commit is contained in:
parent
f6ab0e3021
commit
598123ed5b
11 changed files with 44 additions and 190 deletions
|
@ -1,27 +0,0 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
is_public=1
|
||||
admin="john"
|
||||
password="pass"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
upgrade=1 from_commit=bbce7cfa6cb8916671a4fec9e8a73095f74a0c9d
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=bbce7cfa6cb8916671a4fec9e8a73095f74a0c9d
|
||||
name= Upgrade to 1.3.7 (#63)
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=4533&
|
||||
|
|
@ -41,7 +41,7 @@ EnableUpload: true
|
|||
EnableSeeding: true
|
||||
# EnableSeeding Whether upload even after there's nothing further for us. By default uploading is not altruistic, we'll only upload to encourage the peer to reciprocate.
|
||||
|
||||
IncomingPort: __PEER_PORT__
|
||||
IncomingPort: __PORT_PEER__
|
||||
# IncomingPort The port SimpleTorrent listens to.
|
||||
|
||||
DoneCmd: ""
|
||||
|
|
|
@ -16,22 +16,20 @@ admindoc = "https://github.com/boypt/simple-torrent/wiki"
|
|||
code = "https://github.com/boypt/simple-torrent"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.1.0"
|
||||
yunohost = ">= 11.1.7"
|
||||
architectures = ["amd64","i386", "arm64"]
|
||||
multi_instance = true
|
||||
ldap = "false" # FIXME: replace with true, false, or "not_relevant"
|
||||
sso = "?" # FIXME: replace with true, false, or "not_relevant"
|
||||
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
|
||||
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||
ldap = "false"
|
||||
sso = false
|
||||
disk = "50M"
|
||||
ram.build = "50M"
|
||||
ram.runtime = "50M"
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "domain"
|
||||
|
||||
[install.path]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "path"
|
||||
default = "/simple-torrent"
|
||||
|
||||
|
@ -48,5 +46,10 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
|
|||
|
||||
[resources.data_dir]
|
||||
|
||||
[resources.ports]
|
||||
main.default = 3000
|
||||
peer.default = 50007
|
||||
peer.exposed = "Both"
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
|
|
|
@ -19,16 +19,6 @@ old_path=$YNH_APP_OLD_PATH
|
|||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
new_path=$YNH_APP_NEW_PATH
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
|
|
|
@ -9,23 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..." --weight=0
|
||||
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=3000)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
peer_port=$(ynh_find_port --port=50007)
|
||||
# Open this port
|
||||
ynh_script_progression --message="Configuring firewall..." --weight=1
|
||||
ynh_exec_warn_less yunohost firewall allow Both $peer_port
|
||||
ynh_app_setting_set --app=$app --key=peer_port --value=$peer_port
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -39,19 +22,21 @@ pushd "$install_dir"
|
|||
mv $YNH_ARCH $app
|
||||
popd
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
chmod +x $install_dir/$app
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=3
|
||||
ynh_script_progression --message="Adding system configurations related to $app ..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
ynh_add_systemd_config
|
||||
|
||||
yunohost service add $app --description="Self-hosted remote torrent client" --needs_exposed_ports="$port_peer" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
|
@ -71,19 +56,8 @@ ynh_script_progression --message="Modifying a config file..." --weight=1
|
|||
|
||||
ynh_add_config --template="../conf/config.default.yml" --destination="$install_dir/config.yml"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="Self-hosted remote torrent client" --needs_exposed_ports="$peer_port" --log="/var/log/$app/$app.log"
|
||||
chmod 400 "$install_dir/config.yml"
|
||||
chown $app:$app "$install_dir/config.yml"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
@ -93,13 +67,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2
|
|||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -10,9 +10,11 @@ source _common.sh
|
|||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
# REMOVE SYSTEMD SERVICE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=5
|
||||
|
||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
then
|
||||
|
@ -20,43 +22,12 @@ then
|
|||
yunohost service remove $app
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DATA DIR
|
||||
#=================================================
|
||||
|
||||
# Remove the data directory if --purge option is used
|
||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Removing app data directory..." --weight=1
|
||||
#REMOVEME? ynh_secure_remove --file="$data_dir"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $peer_port$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port $peer_port..." --weight=1
|
||||
ynh_exec_warn_less yunohost firewall disallow Both $peer_port
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -9,29 +9,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading settings..." --weight=1
|
||||
|
||||
peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# OPEN PORTS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring firewall..." --weight=3
|
||||
|
||||
ynh_exec_warn_less yunohost firewall allow Both $peer_port
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -58,34 +35,24 @@ chmod -R o-rwx $data_dir
|
|||
chown -R $app:www-data $data_dir
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the systemd configuration..." --weight=5
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="Self-hosted remote torrent client" --needs_exposed_ports="$peer_port" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -9,14 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=2
|
||||
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
@ -49,19 +41,21 @@ then
|
|||
popd
|
||||
fi
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
chmod +x $install_dir/$app
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
|
||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
ynh_add_systemd_config
|
||||
|
||||
yunohost service add $app --description="Self-hosted remote torrent client" --needs_exposed_ports="$peer_port" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
|
@ -78,20 +72,6 @@ mkdir -p /home/yunohost.app/$app/{torrents,downloads}
|
|||
chown -R $app:www-data /home/yunohost.app/$app
|
||||
chmod 755 /home/yunohost.app/$app/{torrents,downloads}
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=2
|
||||
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="Self-hosted remote torrent client" --needs_exposed_ports="$peer_port" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
|
@ -99,13 +79,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
10
tests.toml
Normal file
10
tests.toml
Normal file
|
@ -0,0 +1,10 @@
|
|||
test_format = 1.0
|
||||
|
||||
[default]
|
||||
|
||||
# -------------------------------
|
||||
# Commits to test upgrade from
|
||||
# -------------------------------
|
||||
|
||||
test_upgrade_from.bbce7cfa.name = "Upgrade from 1.3.7"
|
||||
|
Loading…
Add table
Reference in a new issue