Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update install-release.sh #350

Merged
merged 4 commits into from
Jan 11, 2017
Merged

Update install-release.sh #350

merged 4 commits into from
Jan 11, 2017

Conversation

ToutyRater
Copy link
Contributor

花了点时间写了个脚本,在 Debian 8、Debian testing、 Ubuntu 14.04 测试无问题。主要变化:

  • 在容易出错的地方加了检测,防止出错后脚本继续执行并给出错误提示
  • 添加卸载选项和只检查是否有新版本而不更新(似乎这个不太用得上)

@codecov-io
Copy link

codecov-io commented Dec 31, 2016

Current coverage is 68.49% (diff: 100%)

Merging #350 into master will increase coverage by 0.98%

@@             master       #350   diff @@
==========================================
  Files           168        168          
  Lines          9341       9231   -110   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           6306       6323    +17   
+ Misses         2415       2282   -133   
- Partials        620        626     +6   

Powered by Codecov. Last update c74ca91...19e7a19

###############################
colorEcho(){
color=$1
text=$2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

text 没有用到

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后来修改时忘记删了

if [[ $SOFTWARE_UPDATED -eq 0 ]]; then
colorEcho ${wblue} "Updating software repo"
$CMD_UPDATE
if [[ $? -ne 0 ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个检查似乎没什么意义,即使更新失败,也可能可以安装软件。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

想了想好像还真是这样,而且一般 update 也不会出错

echo " -h, --help Show help"
echo " -p, --proxy To download through a proxy server, use -p socks5:https://127.0.0.1:1080 or -p http:https://127.0.0.1:3128 etc"
echo " -f, --force Force install"
echo " -v, --version Install a particular version"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'-v' 通常是指 verbose,最好不要用于其它的指令

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我确实不清楚有这样的惯例

echo " -f, --force Force install"
echo " -v, --version Install a particular version"
echo " -l, --local Install from a local file"
echo " -r, --remove Remove installed V2Ray"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove 也不要有短指令,以防误操作。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

也没想到过这样的情况

if pgrep "v2ray" > /dev/null ; then
stopV2ray
fi
rm -rf "/usr/lib/v2ray" "/lib/systemd/system/v2ray.service"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删 service 之前应该要先 disable service,另外还有 sysv 的 service。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

疏忽。这些问题我都改一下

@ToutyRater
Copy link
Contributor Author

针对你提出的问题作了相应修改

stopV2ray
fi
systemctl disable v2ray.service
rm -rf "/usr/lib/v2ray" "/lib/systemd/system/v2ray.service"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里应该是 /usr/bin/ 而不是 /usr/lib,下同。

@v2ray
Copy link
Collaborator

v2ray commented Jan 5, 2017

应该没什么问题,最后一个 commet 改好就 merge。不过最新的 go.sh 实际上不是这个文件,之后我自己同步一下好了。

@ToutyRater
Copy link
Contributor Author

修改完成

@v2ray v2ray merged commit 634f293 into v2ray:master Jan 11, 2017
@v2ray
Copy link
Collaborator

v2ray commented Jan 11, 2017

非常感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants