Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This AtoMiC (Automated Media Center) Transmission BT webUI installer script will automatically install Transmission with web interface on Ubuntu variants and set the correct initial configuration to avoid permission denied error, no data found error, and unable to save resume file error. For full description check: http://www.htpcbeginner.com/at…
#!/bin/bash
# Script Name: AtoMiC Transmission WebUI installer
# Author: htpcBeginner.com
# Publisher: http://www.htpcBeginner.com
# Version: 1.0 (June 21, 2014) - Initial Release
# Version: 2.0 (March 14, 2015) - Improved code and user friendliness
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# DO NOT EDIT ANYTHING UNLESS YOU KNOW WHAT YOU ARE DOING.
YELLOW='\e[93m'
RED='\e[91m'
ENDCOLOR='\033[0m'
CYAN='\e[96m'
GREEN='\e[92m'
SCRIPTPATH=$(pwd)
clear
echo
echo -e $RED
echo -e " ┬ ┬┬ ┬┬ ┬ ┬ ┬┌┬┐┌─┐┌─┐┌┐ ┌─┐┌─┐┬┌┐┌┌┐┌┌─┐┬─┐ ┌─┐┌─┐┌┬┐"
echo -e " │││││││││ ├─┤ │ ├─┘│ ├┴┐├┤ │ ┬│││││││├┤ ├┬┘ │ │ ││││"
echo -e " └┴┘└┴┘└┴┘o┴ ┴ ┴ ┴ └─┘└─┘└─┘└─┘┴┘└┘┘└┘└─┘┴└─o└─┘└─┘┴ ┴"
echo -e $CYAN
echo -e " __ __ "
echo -e " /\ |_ _ |\/|./ (_ _ _. _ |_ "
echo -e " /--\|_(_)| ||\__ __)(_| ||_)|_ "
echo -e " | "
echo -e $GREEN'AtoMiC Transmission WebUI Installer Script'$ENDCOLOR
echo
echo -e $YELLOW'--->Transmission installation will start soon. Please read the following carefully.'$ENDCOLOR
echo -e '1. The script has been confirmed to work on Ubuntu variants, Mint, and Ubuntu Server.'
echo -e '2. While several testing runs identified no known issues, www.htpcBeginner.com or the authors cannot be held accountable for any problems that might occur due to the script.'
echo -e '3. If you did not run this script with sudo, you maybe asked for your root password during installation.'
echo -e '4. By proceeding you authorize this script to install any relevant packages required to install and configure Transmission.'
echo -e '5. Best used on a clean system (with no previous Transmission install) or after complete removal of previous Transmission installation.'
echo -e '6. The script installs only Transmission WebUI and not the desktop GUI.'
echo
read -p 'Type y/Y and press [ENTER] to AGREE and continue with the installation or any other key to exit: '
RESP=${REPLY,,}
if [ "$RESP" != "y" ]
then
echo -e $RED'So you chickened out. May be you will try again later.'$ENDCOLOR
echo
exit 0
fi
echo
echo -n 'Type the username of the user you want to run Transmission as and press [ENTER]. Typically, this is your system login name (IMPORTANT! Ensure correct spelling and case): '
read UNAME
if [ ! -d "/home/$UNAME" ] || [ -z "$UNAME" ]; then
echo -e $RED'Bummer! You may not have entered your username correctly. Exiting now. Please rerun script.'$ENDCOLOR
echo
exit 0
fi
UGROUP=($(id -gn $UNAME))
echo
echo -e $YELLOW'--->Refreshing packages list...'$ENDCOLOR
sudo apt-get update
echo
sleep 1
echo -e $YELLOW"--->Installing prerequisites..."$ENDCOLOR
sudo apt-get -y install python-software-properties
echo
sleep 1
echo -e $YELLOW"--->Adding Transmission repository..."$ENDCOLOR
GREPOUT=$(grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep transmissionbt)
if [ "$GREPOUT" == "" ]; then
sudo add-apt-repository -y ppa:transmissionbt/ppa
else
echo "Transmission PPA repository already exists..."
fi
echo
sleep 1
echo -e $YELLOW"--->Refreshing packages list again..."$ENDCOLOR
sudo apt-get update
echo
sleep 1
echo -e $YELLOW"--->Installing Transmission commandline, and web interface..."$ENDCOLOR
sudo apt-get -y install transmission-cli transmission-common transmission-daemon
echo
sleep 1
echo -e $YELLOW"--->Stopping Transmission temporarily..."$ENDCOLOR
sudo /etc/init.d/transmission-daemon stop > /dev/null 2>&1
sleep 2
sudo service transmission-daemon stop > /dev/null 2>&1
sleep 2
sudo killall transmission-daemon > /dev/null 2>&1
sleep 2
echo
sleep 1
echo -e $YELLOW"--->Creating download directories..."$ENDCOLOR
if [ ! -d "/home/$UNAME/.config" ]; then
mkdir /home/$UNAME/.config
fi
if [ ! -d "/home/$UNAME/.config/transmission" ]; then
mkdir /home/$UNAME/.config/transmission
fi
if [ ! -d "/home/$UNAME/Downloads" ]; then
mkdir /home/$UNAME/Downloads
fi
if [ ! -d "/home/$UNAME/Downloads/transmission" ]; then
mkdir /home/$UNAME/Downloads/transmission
fi
if [ ! -d "/home/$UNAME/Downloads/transmission/incomplete" ]; then
mkdir /home/$UNAME/Downloads/transmission/incomplete
fi
echo -e 'Following directories created...'
echo -e $CYAN'/home/'$UNAME'/.config/transmission'$ENDCOLOR ' - Transmission Settings'
echo -e $CYAN'/home/'$UNAME'/Downloads'$ENDCOLOR ' - Watched Folder'
echo -e $CYAN'/home/'$UNAME'/Downloads/transmission'$ENDCOLOR ' - Completed Downloads'
echo -e $CYAN'/home/'$UNAME'/Downloads/transmission/incomplete'$ENDCOLOR ' - Incomplete Downloads'
sleep 1
echo
echo -e $YELLOW"--->Making some configuration changes..."$ENDCOLOR
sudo sed -i 's/USER=debian-transmission/USER='$UNAME'/g' /etc/init.d/transmission-daemon || { echo $RED'Replacing daemon username in init failed.'$ENDCOLOR ; exit 1; }
sudo sed -i 's|/var/lib/transmission-daemon/info|/home/'$UNAME'/.config/transmission|g' /etc/default/transmission-daemon || { echo $RED'Replacing config directory in defualt failed.'$ENDCOLOR ; exit 1; }
sleep 1
echo
echo -e $YELLOW"--->Copying settings file and setting permissions..."$ENDCOLOR
cp $SCRIPTPATH/transmission-initial-settings.json /home/$UNAME/.config/transmission/settings.json || { echo $RED'Initial settings move failed.'$ENDCOLOR ; exit 1; }
cd /home/$UNAME/.config/transmission
sudo usermod -a -G debian-transmission $UNAME || { echo $RED'Adding debian-transmission group to user failed.'$ENDCOLOR ; exit 1; }
sudo chown $UNAME:debian-transmission settings.json || { echo $RED'Chown settings.json failed'$ENDCOLOR ; exit 1; }
sudo rm /var/lib/transmission-daemon/info/settings.json > /dev/null 2>&1
sudo ln -s /home/$UNAME/.config/transmission/settings.json /var/lib/transmission-daemon/info/settings.json || { echo $RED'Creating settings.json symbolic link failed.'$ENDCOLOR ; exit 1; }
sudo chown -R $UNAME: /home/$UNAME/Downloads/transmission
sudo chown -R $UNAME:debian-transmission /home/$UNAME/.config/transmission
sudo chmod -R 775 /home/$UNAME/Downloads/transmission
sudo chmod -R 775 /home/$UNAME/.config/transmission
sudo chmod -R 775 /var/lib/transmission-daemon
sudo chmod g+s /home/$UNAME/.config/transmission
sudo chmod g+s /home/$UNAME/Downloads/transmission
echo
sleep 1
echo -e $YELLOW"--->Setting up Transmission User, WebUI User and Password..."$ENDCOLOR
sed -i 's|USER_NAME|'$UNAME'|g' /home/$UNAME/.config/transmission/settings.json || { echo $RED'Replacing username in settings-json failed.'$ENDCOLOR ; exit 1; }
echo -n 'Set a username for Transmission WebUI and press [ENTER]: '
read TUNAME
if [ -z "$TUNAME" ]
then
echo -e ' No username entered so setting default username: '$CYAN'transmission'$ENDCOLOR
TUNAME=transmission
else
echo -e ' WebUI username set to:'$CYAN $TUNAME $ENDCOLOR
fi
sed -i 's|WEBUI_USERNAME|'$TUNAME'|g' /home/$UNAME/.config/transmission/settings.json || { echo $RED'Setting new username in settings.json failed.'$ENDCOLOR ; exit 1; }
echo -n 'Set a password for Transmission WebUI and press [ENTER]: '
read TPASS
if [ -z "$TPASS" ]
then
echo -e ' No password entered so setting default password: '$CYAN'transmission'$ENDCOLOR
TPASS=transmission
else
echo -e ' WebUI password set to: '$CYAN$TPASS$ENDCOLOR
fi
sed -i 's|WEBUI_PASSWORD|'$TPASS'|g' /home/$UNAME/.config/transmission/settings.json || { echo $RED'Setting new password in settings.json failed.'$ENDCOLOR ; exit 1; }
sed -i 's|USER_NAME|'$UNAME'|g' /home/$UNAME/.config/transmission/settings.json || { echo $RED'Replacing username in settings-json failed.'$ENDCOLOR ; exit 1; }
echo
sleep 1
echo -e $YELLOW"--->Setting setuid and setgid..."$ENDCOLOR
sudo sed -i 's/setuid debian-transmission/setuid '$UNAME'/g' /etc/init/transmission-daemon.conf || { echo $RED'Replacing setuid failed.'$ENDCOLOR ; exit 1; }
sudo sed -i 's/setgid debian-transmission/setgid '$UGROUP'/g' /etc/init/transmission-daemon.conf || { echo $RED'Replacing setgid failed.'$ENDCOLOR ; exit 1; }
echo
sleep 1
echo -e $YELLOW"--->Enabling autostart during boot..."$ENDCOLOR
sudo update-rc.d transmission-daemon defaults
echo
sleep 1
echo -e $YELLOW"--->Starting Transmission..."$ENDCOLOR
sudo /etc/init.d/transmission-daemon start >/dev/null 2>&1
kill -s SIGHUP `pidof transmission-daemon` >/dev/null 2>&1
echo
sleep 1
echo
echo -e $GREEN'--->All done. '$ENDCOLOR
echo -e $YELLOW'--->Please read the instructions below clearly. When you are done reboot your system using '$RED'sudo reboot'$YELLOW' command.'$ENDCOLOR
echo -e 'Note down the the Transmission directories created above. Transmission should autostart on reboot. If not run '$CYAN'sudo /etc/init.d/transmission-daemon start'$ENDCOLOR'. Then open '$CYAN'http://localhost:9091'$ENDCOLOR' in your browser.'
echo -e 'If you everything works, you may delete'$CYAN $SCRIPTPATH $ENDCOLOR'folder and reboot.'
echo
echo -e $YELLOW'If this script worked for you, please visit '$CYAN'http://www.htpcBeginner.com'$YELLOW' and like/follow us.'$ENDCOLOR
echo -e $YELLOW'Thank you for using the AtoMiC Sick Beard install script from www.htpcBeginner.com.'$ENDCOLOR
echo
sleep 5
URL=http://www.htpcbeginner.com/atomic-thanks
[[ -x $BROWSER ]] && exec "$BROWSER" "$URL"
path=$(which xdg-open || which gnome-open) && exec "$path" "$URL" >/dev/null 2>&1
{
"alt-speed-down": 50,
"alt-speed-enabled": false,
"alt-speed-time-begin": 540,
"alt-speed-time-day": 127,
"alt-speed-time-enabled": false,
"alt-speed-time-end": 1020,
"alt-speed-up": 50,
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
"blocklist-enabled": false,
"blocklist-url": "http://www.example.com/blocklist",
"cache-size-mb": 4,
"dht-enabled": true,
"download-dir": "/home/USER_NAME/Downloads/transmission",
"download-limit": 100,
"download-limit-enabled": 0,
"download-queue-enabled": true,
"download-queue-size": 5,
"encryption": 1,
"idle-seeding-limit": 30,
"idle-seeding-limit-enabled": false,
"incomplete-dir": "/home/USER_NAME/Downloads/transmission/incomplete",
"incomplete-dir-enabled": true,
"lpd-enabled": false,
"max-peers-global": 200,
"message-level": 2,
"peer-congestion-algorithm": "",
"peer-id-ttl-hours": 6,
"peer-limit-global": 200,
"peer-limit-per-torrent": 50,
"peer-port": 51413,
"peer-port-random-high": 65535,
"peer-port-random-low": 49152,
"peer-port-random-on-start": false,
"peer-socket-tos": "default",
"pex-enabled": true,
"port-forwarding-enabled": false,
"preallocation": 1,
"prefetch-enabled": 1,
"queue-stalled-enabled": true,
"queue-stalled-minutes": 30,
"ratio-limit": 2,
"ratio-limit-enabled": false,
"rename-partial-files": true,
"rpc-authentication-required": true,
"rpc-bind-address": "0.0.0.0",
"rpc-enabled": true,
"rpc-password": "WEBUI_PASSWORD",
"rpc-port": 9091,
"rpc-url": "/transmission/",
"rpc-username": "WEBUI_USERNAME",
"rpc-whitelist": "*.*.*.*",
"rpc-whitelist-enabled": true,
"scrape-paused-torrents-enabled": true,
"script-torrent-done-enabled": false,
"script-torrent-done-filename": "",
"seed-queue-enabled": false,
"seed-queue-size": 10,
"speed-limit-down": 100,
"speed-limit-down-enabled": false,
"speed-limit-up": 100,
"speed-limit-up-enabled": false,
"start-added-torrents": true,
"trash-original-torrent-files": false,
"umask": 11,
"upload-limit": 100,
"upload-limit-enabled": 0,
"upload-slots-per-torrent": 14,
"utp-enabled": true,
"watch-dir": "/home/USER_NAME/Downloads",
"watch-dir-enabled": true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.