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
|
#!/bin/bash
|
||||||
|
|
||||||
# Retrieve arguments
|
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
||||||
domain=$1
|
set -e
|
||||||
path=$2
|
|
||||||
|
|
||||||
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
|
if [[ ! $? -eq 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -50,6 +56,5 @@ sudo sed -i "s@<div id=\"toolbar-inspector\" title=\"Toggle Inspector\"></div>@<
|
||||||
|
|
||||||
# Configure Nginx and reload
|
# Configure Nginx and reload
|
||||||
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
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
|
sudo service nginx reload
|
||||||
echo $?
|
|
||||||
|
|
|
@ -1,14 +1,25 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sudo service transmission-daemon stop
|
# Retreive app settings
|
||||||
sudo yunohost firewall disallow TCP 51413
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
sudo yunohost service remove transmission-daemon
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
domain=$(sudo yunohost app setting transmission 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
|
sudo rm -rf /home/yunohost.transmission
|
||||||
|
|
||||||
|
# Remove Debian package
|
||||||
sudo apt-get remove -y -qq transmission-daemon
|
sudo apt-get remove -y -qq transmission-daemon
|
||||||
|
|
||||||
|
# Reload nginx and ssowatconf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
sudo yunohost app ssowatconf
|
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
|
# Retrieve arguments
|
||||||
domain=$(sudo yunohost app setting transmission domain)
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path=$(sudo yunohost app setting transmission path)
|
path=$YNH_APP_ARG_PATH
|
||||||
|
|
||||||
# Remove trailing "/" for next commands
|
# Remove trailing "/" for next commands
|
||||||
path=${path%/}
|
path=${path%/}
|
||||||
|
@ -37,5 +42,5 @@ fi
|
||||||
|
|
||||||
# Configure Nginx and reload
|
# Configure Nginx and reload
|
||||||
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
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
|
sudo service nginx reload
|
||||||
|
|
Loading…
Reference in a new issue