From 6542f218f6eb0c66ae7323199e8c899785969b42 Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Wed, 12 Apr 2017 13:11:43 -0400 Subject: [PATCH] Updated the install script to fix #39 --- .gitignore | 6 ++- README.md | 6 ++- release/tr-control-easy-install-en.sh | 66 ++++++++++++++------------- release/tr-control-easy-install.sh | 66 +++++++++++++++------------ 4 files changed, 80 insertions(+), 64 deletions(-) diff --git a/.gitignore b/.gitignore index c39277d..17bff7a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ -_SYNCAPP/metadata.xml -src/tr-web-control/sftp-config.json +*.tmp +*.bkp +*.vscode +node_modules diff --git a/README.md b/README.md index ae27f8c..6cb45d9 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/release/tr-control-easy-install-en.sh b/release/tr-control-easy-install-en.sh index b16ab98..0eeb0c2 100644 --- a/release/tr-control-easy-install-en.sh +++ b/release/tr-control-easy-install-en.sh @@ -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 exist,then 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 before,then 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 before,then 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" diff --git a/release/tr-control-easy-install.sh b/release/tr-control-easy-install.sh index 7a9e2b4..c51415b 100644 --- a/release/tr-control-easy-install.sh +++ b/release/tr-control-easy-install.sh @@ -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"