1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/transmission_ynh.git synced 2024-09-04 01:46:12 +02:00

[fix] Retrieve app settings at upgrade and harden set options

This commit is contained in:
Jérôme Lebleu 2016-05-17 22:13:59 +02:00
parent 3aa6ca6cea
commit dc45c47e85
5 changed files with 13 additions and 15 deletions

View file

@ -1,7 +1,7 @@
#!/bin/bash
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e
# Exit on command errors and treat unset variables as an error
set -eu
# Source YNH helpers
. /usr/share/yunohost/helpers
@ -22,4 +22,4 @@ ynh_backup "/usr/share/transmission" "sources"
# Copy configuration files
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx.conf"
ynh_backup "/etc/transmission-daemon/settings.json" "conf/transmission.json"
ynh_backup "/etc/transmission-daemon/settings.json" "conf/transmission.json"

View file

@ -1,7 +1,7 @@
#!/bin/bash
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e
# Exit on command errors and treat unset variables as an error
set -eu
# Get app instance name
app=$YNH_APP_INSTANCE_NAME

View file

@ -22,6 +22,5 @@ sudo apt-get remove -y -qq transmission-daemon
# sudo rm -rf /usr/share/transmission
# sudo rm -rf /etc/transmission-daemon/settings.json
# Reload nginx and ssowatconf
# Reload nginx
sudo service nginx reload
sudo yunohost app ssowatconf

View file

@ -1,7 +1,7 @@
#!/bin/bash
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e
# Exit on command errors and treat unset variables as an error
set -eu
# Source YNH helpers
. /usr/share/yunohost/helpers

View file

@ -1,13 +1,14 @@
#!/bin/bash
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e
# Exit on command errors and treat unset variables as an error
set -eu
# Get app instance name
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN
path=$YNH_APP_ARG_PATH
domain=$(sudo yunohost app setting "$app" domain)
path=$(sudo yunohost app setting "$app" path)
# Remove trailing "/" for next commands
path=${path%/}
@ -38,8 +39,6 @@ if ! grep 'toolbar-downloads' /usr/share/transmission/web/index.html --quiet; th
sudo sed -i "s@<div id=\"toolbar-inspector\" title=\"Toggle Inspector\"></div>@<div id=\"toolbar-inspector\" title=\"Toggle Inspector\"></div><div id=\"toolbar-separator\"></div><a href=\"../../downloads/\" id=\"toolbar-downloads\" title=\"Downloads\" target=\"_blank\"></a>@g" /usr/share/transmission/web/index.html
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/$app.conf