Updated the install script to fix #39

This commit is contained in:
Alex Wang 2017-04-12 13:11:43 -04:00
parent ad01081eba
commit 6542f218f6
4 changed files with 80 additions and 64 deletions

6
.gitignore vendored
View File

@ -1,2 +1,4 @@
_SYNCAPP/metadata.xml
src/tr-web-control/sftp-config.json
*.tmp
*.bkp
*.vscode
node_modules

View File

@ -18,7 +18,8 @@
- 添加了http的安装方法
- 更新了install.sh的英文注释
- 更新了easyui到1.5.1和jquery到1.12.4 By -- @balonik
- 修复问题#20#21#23#39#40#43#44 By -- @balonik
- 修复问题#20#21#23#39#40#43#44, #53 By -- @balonik
- 替换了一些中文注释为英文注释.
### 功能介绍
- 在线查看Transmission当前工作情况
@ -92,7 +93,8 @@ I will do my best to fix the issues in this repo.
- Added http install script
- Added install.sh with English comments
- Updated easyui to 1.5.1 and jquery to 1.12.4 By -- @balonik
- Fixed issue #20, #21, #23, #39, #40, #43, #44 By -- @balonik
- Fixed issue #20, #21, #23, #39, #40, #43, #44 #53 By -- @balonik
- Replaced some Chinese comments to English
### Features
- Add torrent files or URLs

View File

@ -8,46 +8,50 @@ packname="transmission-control-full.tar.gz"
host="https://github.com/ronggang/transmission-web-control/raw/master/release/"
downloadurl="$host$packname"
if [ ! -d "$tmpFolder" ]; then
cd /tmp
mkdir tr-web-control
mkdir -p "$tmpFolder"
fi
cd "$tmpFolder"
# find web ui folder
folderIsExist=0
echo "Searching Transmission Web Folder..."
rootFolder="usr/share/transmission"
echo "Looking for folder: $rootFolder/web"
if [ -d "$rootFolder/web" ]; then
webFolder="$rootFolder/web"
folderIsExist=1
echo "Folder found. Using it."
else
echo "Folder not found. Will search the entire /. This will take a while..."
rootFolder=`find / -name 'web' -type d 2>/dev/null| grep 'transmission/web' | sed 's/\/web$//g'`
# thanks yumin9822 for this piece of code
rootFolder=`find / -name 'web' -type d | grep 'transmission/web' | head -n 1 | sed 's/web.*$//g'`
echo "Folder: ""$rootFolder""..."
if [ -d "$rootFolder""web/" ]; then
webFolder="$rootFolder""web/"
folderIsExist=1
if [ -d "$rootFolder/web" ]; then
webFolder="$rootFolder/web"
folderIsExist=1
fi
fi
# if the folder does not existthen do download and installation
if [ $folderIsExist = 1 ]; then
echo "Downloading Transmission Web Control ..."
wget "$downloadurl"
echo "Installing..."
tar -xzf "$packname"
rm "$packname"
# if did not install beforethen change the original system file name
if [ ! -f "$webFolder/$orgindex" -a -f "$webFolder/$index" ]; then
mv "$webFolder/$index" "$webFolder/$orgindex"
fi
# copy the files to folder
cp -r web "$rootFolder"
find "$rootFolder" -type d -exec chmod o+rx {} \;
find "$rootFolder" -type f -exec chmod o+r {} \;
echo "Done."
cd "$temFolder"
echo "Downloading Transmission Web Control..."
wget "$downloadurl"
echo "Installing..."
mkdir web
tar -xzf "$packname" -C "$tmpFolder/web"
rm "$packname"
# if did not install beforethen change the original system file name
if [ ! -f "$webFolder/$orgindex" -a -f "$webFolder/$index" ]; then
mv "$webFolder/$index" "$webFolder/$orgindex"
fi
# copy the files to folder
cp -r web "$rootFolder"
find "$rootFolder" -type d -exec chmod o+rx {} \;
find "$rootFolder" -type f -exec chmod o+r {} \;
echo "Done."
else
echo "##############################################"
echo "#"
echo "# ERROR : Transmisson WEB UI Folder is missing."
echo "#"
echo "##############################################"
echo "##############################################"
echo "#"
echo "# ERROR : Transmisson WEB UI Folder is missing."
echo "#"
echo "##############################################"
fi
rm -rf "$tmpFolder"

View File

@ -1,49 +1,57 @@
#! /bin/sh
#!/bin/sh
rootFolder=""
webFolder=""
orgindex="index.original.html"
index="index.html"
tmpFolder="/tmp/tr-web-control/"
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
cd /tmp
mkdir tr-web-control
mkdir -p "$tmpFolder"
fi
cd "$tmpFolder"
# 找出web ui 目录
folderIsExist=0
echo "Searching Transmission Web Folder..."
rootFolder="usr/share/transmission"
echo "Looking for folder: $rootFolder/web"
if [ -d "$rootFolder/web" ]; then
webFolder="$rootFolder/web"
folderIsExist=1
echo "Folder found. Using it."
else
echo "Folder not found. Will search the entire /. This will take a while..."
rootFolder=`find / -name 'web' -type d 2>/dev/null| grep 'transmission/web' | sed 's/\/web$//g'`
# 感谢 yumin9822 提供的代码
rootFolder=`find / -name 'web' -type d | grep 'transmission/web' | head -n 1 | sed 's/web.*$//g'`
echo "Folder: ""$rootFolder""..."
if [ -d "$rootFolder""web/" ]; then
webFolder="$rootFolder""web/"
folderIsExist=1
if [ -d "$rootFolder/web" ]; then
webFolder="$rootFolder/web"
folderIsExist=1
fi
fi
# 如果目录存在,则进行下载和更新动作
if [ $folderIsExist = 1 ]; then
echo "Downloading Transmission Web Control..."
wget "$downloadurl"
echo "Installing..."
tar -xzf "$packname"
rm "$packname"
# 如果之前没有安装过,则先将原系统的文件改为
if [ ! -f "$webFolder/$orgindex" -a -f "$webFolder/$index" ]; then
mv "$webFolder/$index" "$webFolder/$orgindex"
fi
# 复制文件到
cp -r web "$rootFolder"
echo "Done."
cd "$temFolder"
echo "Downloading Transmission Web Control..."
wget "$downloadurl"
echo "Installing..."
mkdir web
tar -xzf "$packname" -C "$tmpFolder/web"
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 {} \;
echo "Done."
else
echo "##############################################"
echo "#"
echo "# ERROR : Transmisson WEB UI Folder is missing."
echo "#"
echo "##############################################"
echo "##############################################"
echo "#"
echo "# ERROR : Transmisson WEB UI Folder is missing."
echo "#"
echo "##############################################"
fi
rm -rf "$tmpFolder"