2013-10-29 14:14:27 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Retrieve arguments
|
|
|
|
domain=$1
|
|
|
|
path=$2
|
|
|
|
|
|
|
|
sudo yunohost app checkurl $domain$path -a transmission
|
2013-10-29 14:51:24 +01:00
|
|
|
if [[ ! $? -eq 0 ]]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2013-10-29 14:14:27 +01:00
|
|
|
|
|
|
|
# Remove trailing "/" for next commands
|
|
|
|
path=${path%/}
|
|
|
|
|
|
|
|
# Check port availability
|
|
|
|
sudo yunohost app checkport 9091
|
2013-10-29 14:51:24 +01:00
|
|
|
if [[ ! $? -eq 0 ]]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2013-10-29 14:14:27 +01:00
|
|
|
sudo yunohost app checkport 51413
|
2013-10-29 14:51:24 +01:00
|
|
|
if [[ ! $? -eq 0 ]]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Open port in firewall
|
|
|
|
sudo yunohost firewall allow TCP 51413 > /dev/null 2>&1
|
2013-10-29 14:14:27 +01:00
|
|
|
|
|
|
|
# Install 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 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:14:27 +01:00
|
|
|
sudo cp ../conf/settings.json /etc/transmission-daemon/settings.json
|
|
|
|
sudo service transmission-daemon reload
|
|
|
|
|
|
|
|
# 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:14:27 +01:00
|
|
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/transmission.conf
|
2013-10-29 14:51:24 +01:00
|
|
|
sudo service nginx reload
|
|
|
|
echo $?
|