~优化安装脚本及安装流程
~合并https://github.com/juewuy/ShellClash/pull/309
This commit is contained in:
juewuy 2023-01-23 16:14:53 +08:00
parent bcf7b347b2
commit 7772e82631
3 changed files with 20 additions and 20 deletions

View File

@ -210,25 +210,25 @@ if [ "$USER" != "root" -a -z "$systype" ];then
fi
#检查更新
url_cdn="https://raw.fastgit.org/juewuy/ShellClash"
url_cdn="https://fastly.jsdelivr.net/gh/juewuy/ShellClash"
[ -z "$url" ] && url=$url_cdn
# echo -----------------------------------------------
# $echo "\033[33m请选择想要安装的版本\033[0m"
# $echo " 1 \033[36mShellclash稳定版\033[0m"
# $echo " 2 \033[32mShellclash公测版\033[0m(推荐)"
# echo -----------------------------------------------
# read -p "请输入相应数字 > " num
# if [ -z $num ];then
# echo 安装已取消! && exit 1;
# elif [ "$num" = "1" ];then
# webget /tmp/clashrelease $url_cdn/master/bin/release_version echoon rediroff 2>/tmp/clashrelease
# if [ "$result" = "200" ];then
# release_new=$(cat /tmp/clashrelease | head -1)
# url_dl="$url_cdn/$release_new"
# else
# $echo "\033[33m无法获取稳定版安装地址将尝试安装公测版\033[0m"
# fi
# fi
echo -----------------------------------------------
$echo "\033[33m请选择想要安装的版本\033[0m"
$echo " 1 \033[32mShellclash公测版\033[0m"
$echo " 2 \033[36mShellclash稳定版\033[0m"
echo -----------------------------------------------
read -p "请输入相应数字 > " num
if [ -z $num ];then
echo 安装已取消! && exit 1;
elif [ "$num" = "2" ];then
webget /tmp/clashrelease $url_cdn@master/bin/release_version echoon rediroff 2>/tmp/clashrelease
if [ "$result" = "200" ];then
release_new=$(cat /tmp/clashrelease | head -1)
url_dl="$url_cdn@$release_new"
else
$echo "\033[33m无法获取稳定版安装地址将尝试安装公测版\033[0m"
fi
fi
[ -z "$url_dl" ] && url_dl=$url
webget /tmp/clashversion "$url_dl/bin/version" echooff
[ "$result" = "200" ] && versionsh=$(cat /tmp/clashversion | grep "versionsh" | awk -F "=" '{print $2}')

View File

@ -345,7 +345,7 @@ gettar(){
echo -e "\033[33m文件解压失败\033[0m"
error_down
else
setconfig versionsh_l $release_new
source $clashdir/init.sh >/dev/null
echo -e "\033[32m脚本更新成功\033[0m"
fi
fi

View File

@ -145,7 +145,7 @@ mv -f /tmp/SC_tmp/* $clashdir 2>/dev/null
#初始化
[ -f "$clashdir/mark" ] || echo '#ShellClash配置文件不明勿动' > $clashdir/mark
#本地安装跳过新手引导
setconfig userguide 1
[ -z "$url" ] && setconfig userguide 1
#判断系统类型写入不同的启动文件
if [ -f /etc/rc.common ];then
#设为init.d方式启动