diff --git a/scripts/install b/scripts/install index b864552..b118002 100644 --- a/scripts/install +++ b/scripts/install @@ -1,11 +1,11 @@ -#!/bin/bash +#!/bin/bash # Retrieve arguments domain=$1 path=$2 sudo yunohost app checkurl $domain$path -a transmission -if [[ ! $? -eq 0 ]]; then +if [[ ! $? -eq 0 ]]; then exit 1 fi @@ -15,18 +15,18 @@ path=${path%/} # Check port availability sudo yunohost app checkport 9091 if [[ ! $? -eq 0 ]]; then - exit 1 + exit 1 fi sudo yunohost app checkport 51413 -if [[ ! $? -eq 0 ]]; then - exit 1 +if [[ ! $? -eq 0 ]]; then + exit 1 fi # Open port in firewall sudo yunohost firewall allow TCP 51413 > /dev/null 2>&1 # Install official debian package -sudo apt-get install transmission-daemon -y -qq +sudo apt-get install transmission-daemon -y -qq # Make directories and set rights sudo mkdir -p /home/yunohost.transmission/{progress,completed} @@ -43,6 +43,11 @@ sudo service transmission-daemon reload # Monitor service sudo yunohost service add transmission-daemon +# Patch sources to add a download button +sudo cp ../sources/toolbar-downloads.png /usr/share/transmission/web/style/transmission/images/toolbar-downloads.png +sudo bash -c 'cat ../sources/ynh_common.css >> /usr/share/transmission/web/style/transmission/common.css' +sudo sed -i "s@
@
@g" /usr/share/transmission/web/index.html + # 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 diff --git a/scripts/upgrade b/scripts/upgrade index 12a5fd3..96b1ccc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash # Retrieve arguments domain=$(sudo yunohost app setting transmission domain) @@ -11,7 +11,7 @@ path=${path%/} sudo yunohost firewall allow TCP 51413 > /dev/null 2>&1 # Upgrade official debian package -sudo apt-get install transmission-daemon -y -qq +sudo apt-get install transmission-daemon -y -qq # Make directories and set rights sudo mkdir -p /home/yunohost.transmission/{progress,completed} @@ -24,6 +24,16 @@ sed -i "s@PATHTOCHANGE@$path@g" ../conf/settings.json sudo cp ../conf/settings.json /etc/transmission-daemon/settings.json sudo service transmission-daemon reload +# Patch sources to add a download button +if ! grep 'toolbar-downloads' /usr/share/transmission/web/index.html --quiet; then + + sudo cp ../sources/toolbar-downloads.png /usr/share/transmission/web/style/transmission/images/toolbar-downloads.png + sudo bash -c 'cat ../sources/ynh_common.css >> /usr/share/transmission/web/style/transmission/common.css' + sudo sed -i "s@
@
@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/transmission.conf diff --git a/sources/toolbar-downloads.png b/sources/toolbar-downloads.png new file mode 100644 index 0000000..e60479f Binary files /dev/null and b/sources/toolbar-downloads.png differ diff --git a/sources/ynh_common.css b/sources/ynh_common.css new file mode 100644 index 0000000..ebcf246 --- /dev/null +++ b/sources/ynh_common.css @@ -0,0 +1,9 @@ + + /* Inserted by Yunohost install script */ + div#toolbar > * { + background-position: center center; + background-repeat: no-repeat; + } + div#toolbar > #toolbar-downloads { + background-image: url("images/toolbar-downloads.png"); + }