#!/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%/} # Open port in firewall sudo yunohost firewall allow TCP 51413 > /dev/null 2>&1 # 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} sudo chmod 755 -R /home/yunohost.transmission sudo chmod 770 -R /home/yunohost.transmission/{progress,completed} # Configure Transmission and reload 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 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 sudo service nginx reload