mirror of
https://github.com/YunoHost-Apps/transmission_ynh.git
synced 2024-09-04 01:46:12 +02:00
[enh] Use env var in existing script (install/remove/upgrade).
This commit is contained in:
parent
9573640c11
commit
da76228184
3 changed files with 36 additions and 15 deletions
|
@ -1,10 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$1
|
||||
path=$2
|
||||
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
||||
set -e
|
||||
|
||||
sudo yunohost app checkurl $domain$path -a transmission
|
||||
# Get app instance name
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path=$YNH_APP_ARG_PATH
|
||||
|
||||
sudo yunohost app checkurl $domain$path -a $app
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
@ -50,6 +56,5 @@ sudo sed -i "s@<div id=\"toolbar-inspector\" title=\"Toggle Inspector\"></div>@<
|
|||
|
||||
# Configure Nginx and reload
|
||||
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/transmission.conf
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
sudo service nginx reload
|
||||
echo $?
|
||||
|
|
|
@ -1,14 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
sudo service transmission-daemon stop
|
||||
sudo yunohost firewall disallow TCP 51413
|
||||
sudo yunohost service remove transmission-daemon
|
||||
domain=$(sudo yunohost app setting transmission domain)
|
||||
# Retreive app settings
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$(sudo yunohost app setting $app domain)
|
||||
|
||||
sudo rm /etc/nginx/conf.d/$domain.d/transmission.conf
|
||||
# Stop service
|
||||
sudo service transmission-daemon stop
|
||||
sudo yunohost service remove transmission-daemon
|
||||
|
||||
# Disallow specific port
|
||||
sudo yunohost firewall disallow TCP 51413
|
||||
|
||||
# Remove nginx configuration
|
||||
sudo rm /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
# Remove data
|
||||
sudo rm -rf /home/yunohost.transmission
|
||||
|
||||
# Remove Debian package
|
||||
sudo apt-get remove -y -qq transmission-daemon
|
||||
|
||||
# Reload nginx and ssowatconf
|
||||
sudo service nginx reload
|
||||
sudo yunohost app ssowatconf
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
||||
set -e
|
||||
|
||||
# Get app instance name
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$(sudo yunohost app setting transmission domain)
|
||||
path=$(sudo yunohost app setting transmission path)
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path=$YNH_APP_ARG_PATH
|
||||
|
||||
# Remove trailing "/" for next commands
|
||||
path=${path%/}
|
||||
|
@ -37,5 +42,5 @@ fi
|
|||
|
||||
# Configure Nginx and reload
|
||||
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/transmission.conf
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
sudo service nginx reload
|
||||
|
|
Loading…
Reference in a new issue