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

47 lines
1.4 KiB
Bash

#!/bin/bash
# Retrieve arguments
domain=$1
path=$2
sudo yunohost app checkurl $domain$path -a transmission
if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Remove trailing "/" for next commands
path=${path%/}
# Check port availability
sudo yunohost app checkport 9091
if [[ ! $? -eq 0 ]]; then
exit 1
fi
sudo yunohost app checkport 51413
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
# 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}
sudo chown -R www-data /home/yunohost.transmission/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
# 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
echo $?