2013-10-29 14:26:46 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Retrieve arguments
|
|
|
|
domain=$(sudo yunohost app setting transmission domain)
|
|
|
|
path=$(sudo yunohost app setting transmission path)
|
|
|
|
|
|
|
|
# Remove trailing "/" for next commands
|
|
|
|
path=${path%/}
|
|
|
|
|
2013-10-29 14:51:24 +01:00
|
|
|
# Open port in firewall
|
|
|
|
sudo yunohost firewall allow TCP 51413 > /dev/null 2>&1
|
|
|
|
|
2013-10-29 14:26:46 +01:00
|
|
|
# Upgrade official debian package
|
|
|
|
sudo apt-get install transmission-daemon -y -qq
|
|
|
|
|
|
|
|
# Make directories and set rights
|
|
|
|
sudo mkdir -p /home/yunohost.transmission/{progress,completed}
|
|
|
|
sudo chgrp debian-transmission /home/yunohost.transmission/{progress,completed}
|
2013-12-01 14:06:21 +01:00
|
|
|
sudo chmod 755 -R /home/yunohost.transmission
|
2013-10-29 14:26:46 +01:00
|
|
|
sudo chmod 770 -R /home/yunohost.transmission/{progress,completed}
|
|
|
|
|
|
|
|
# Configure Transmission and reload
|
2013-10-29 14:51:24 +01:00
|
|
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/settings.json
|
2013-10-29 14:26:46 +01:00
|
|
|
sudo cp ../conf/settings.json /etc/transmission-daemon/settings.json
|
|
|
|
sudo service transmission-daemon reload
|
|
|
|
|
2014-11-11 16:25:08 +01:00
|
|
|
# Patch sources to add a download button
|
2014-11-11 16:37:09 +01:00
|
|
|
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'
|
2014-11-11 16:25:08 +01:00
|
|
|
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\"></a>@g" /usr/share/transmission/web/index.html
|
|
|
|
|
2013-10-29 14:26:46 +01:00
|
|
|
# Configure Nginx and reload
|
2013-10-29 14:51:24 +01:00
|
|
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
2013-10-29 14:26:46 +01:00
|
|
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/transmission.conf
|
|
|
|
sudo service nginx reload
|