Skip to content

Instantly share code, notes, and snippets.

@KevinWang15
Created November 8, 2017 04:47
Show Gist options
  • Save KevinWang15/891b5134decd96b282cb4f307f6b4f43 to your computer and use it in GitHub Desktop.
Save KevinWang15/891b5134decd96b282cb4f307f6b4f43 to your computer and use it in GitHub Desktop.
tr 2.84 install script
#!/usr/bin/env bash
# 以root权限运行,只支持Ubuntu 14和16
echo 请设置web用户名和密码,如果输错了,按Ctrl+C结束本脚本并重来
echo 输入web用户名:
read webuser
echo 输入web密码:
read webpass
apt-get update
apt-get install -y wget build-essential automake autoconf libssl-dev libtool pkg-config intltool libcurl4-openssl-dev libglib2.0-dev libevent-dev libminiupnpc-dev libgtk-3-dev libappindicator3-dev
wget https://github.com/transmission/transmission/archive/2.84.tar.gz
tar -xzvf 2.84.tar.gz
cd transmission-2.84/
rm m4/glib-gettext.m4
./autogen.sh
make
sudo make install
mkdir /root/trDownloads
service transmission-daemon stop
killall transmission-daemon
sleep 3
/usr/local/bin/transmission-daemon
sleep 3
service transmission-daemon stop
killall transmission-daemon
sleep 3
sudo sed -i 's/"dht-enabled.*/"dht-enabled": false,/g' ~/.config/transmission-daemon/settings.json
sudo sed -i 's/"download-dir.*/"download-dir": "\/root\/trDownloads",/g' ~/.config/transmission-daemon/settings.json
sudo sed -i 's/"rpc-username.*/"rpc-username": "'$webuser'",/g' ~/.config/transmission-daemon/settings.json
sudo sed -i 's/"rpc-password.*/"rpc-password": "'$webpass'",/g' ~/.config/transmission-daemon/settings.json
sudo sed -i 's/"rpc-whitelist-enabled.*/"rpc-whitelist-enabled": false,/g' ~/.config/transmission-daemon/settings.json
sudo sed -i 's/"rpc-authentication-required.*/"rpc-authentication-required": true,/g' ~/.config/transmission-daemon/settings.json
sudo sed -i 's/"download-queue-enabled.*/"download-queue-enabled": false,/g' ~/.config/transmission-daemon/settings.json
#tr-control-easy-install.sh
rootFolder=""
webFolder=""
orgindex="index.original.html"
index="index.html"
tmpFolder="/tmp/tr-web-control"
packname="transmission-control-full.tar.gz"
host="https://github.com/ronggang/transmission-web-control/raw/master/release/"
downloadurl="$host$packname"
if [ ! -d "$tmpFolder" ]; then
mkdir -p "$tmpFolder"fi
folderIsExist=0
rootFolder="/usr/local/share/transmission/"
if [ -d "$rootFolder/web" ]; then
webFolder="$rootFolder/web"
folderIsExist=1
fi
if [ $folderIsExist = 1 ]; then
mkdir "$tmpFolder"
cd "$tmpFolder"
echo "Downloading Transmission Web Control..."
wget "$downloadurl"
echo "Installing..."
tar -xzf "$packname" -C "$tmpFolder"
rm "$packname"
if [ ! -f "$webFolder/$orgindex" -a -f "$webFolder/$index" ]; then
mv "$webFolder/$index" "$webFolder/$orgindex"
fi
cp -r web "$rootFolder"
find "$rootFolder" -type d -exec chmod o+rx {} \;
find "$rootFolder" -type f -exec chmod o+r {} \;
fi
rm -rf "$tmpFolder"
service transmission-daemon stop
killall transmission-daemon
sleep 3
/usr/local/bin/transmission-daemon
echo 安装完成,在 :9091 上运行
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment