diff --git a/README.md b/README.md index 18e1652..255074c 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,9 @@ opkg update && opkg install curl ```Shell #By github -export url='https://raw.githubusercontent.com/juewuy/ShellClash/master' && sh -c "$(curl -s $url/install_n.sh)" && source /etc/profile &> /dev/null +export url='https://raw.githubusercontent.com/juewuy/ShellClash/master' && sh -c "$(curl -kfsSl $url/install_n.sh)" && source /etc/profile &> /dev/null #By jsdelivrCDN -export url='https://cdn.jsdelivr.net/gh/juewuy/ShellClash@master' && sh -c "$(curl -s $url/install_n.sh)" && source /etc/profile &> /dev/null +export url='https://cdn.jsdelivr.net/gh/juewuy/ShellClash@master' && sh -c "$(curl -kfsSl $url/install_n.sh)" && source /etc/profile &> /dev/null ``` ##### ~Use wget:
@@ -50,6 +50,20 @@ export url='https://cdn.jsdelivr.net/gh/juewuy/ShellClash@master' && sh -c "$(cu export url='https://cdn.jsdelivr.net/gh/juewuy/ShellClash@master' && wget -q --no-check-certificate -O /tmp/install.sh $url/install_n.sh && sh /tmp/install.sh && source /etc/profile &> /dev/null ``` +~**Use a low version of wget (prompt not to support https) local installation**:
First clone the project to the local under the window (or [click to download the project source code zip package](https://github.com/juewuy/ShellClash/archive/refs/heads/master.zip) to the local and decompress it) + +```sh +sh git clone https://github.com/juewuy/ShellClash.git +``` + + Then open /project address/ShellClash/bin/hfs/hfs.exe Click menu-add directory from disk-{find the directory where ShellClash source code is located}-add as real directory Click on the menu-IP address-{choose the actual IP address of your LAN} Click ShellClash-click to copy to clipboard Then use the following command to install in SSH + +```sh +sh export url='Paste the copied address here' && wget -q -O /tmp/install.sh $url/install_n.sh && sh /tmp/install.sh && source /etc/profile &> /dev/null +``` + + Later, when updating the version, you need to update the local version library and open the hfs service, and then update in the SSH menu, and then you can build a local server through hfs to realize the function of uploading and updating the yaml configuration file + ~**After installation by non-root users**, please execute the following additional commands to read environment variables:
```shell @@ -61,6 +75,7 @@ source ~/.bashrc &> /dev/null ```Shell clash #normal mode clash -h #help +clash -u #uninstall clash -t #test mode ``` @@ -96,9 +111,11 @@ ubus/iproute-doc minimal The host address of the machine cannot be obtained nor ### [See blog for details](https://juewuy.github.io) -## Donate this project +## Donate: -### [Go to page](https://juewuy.github.io/yOF4Yf06Q/) +​ Alipay WeChat + +##### ## Friendly promotion: diff --git a/README_CN.md b/README_CN.md index b342fbf..3382024 100644 --- a/README_CN.md +++ b/README_CN.md @@ -48,9 +48,9 @@ opkg update && opkg install curl ```Shell #github直连 -export url='https://raw.githubusercontent.com/juewuy/ShellClash/master' && sh -c "$(curl -s $url/install_n.sh)" && source /etc/profile &> /dev/null +export url='https://raw.githubusercontent.com/juewuy/ShellClash/master' && sh -c "$(curl -kfsSl $url/install_n.sh)" && source /etc/profile &> /dev/null #jsdelivrCDN源 -export url='https://cdn.jsdelivr.net/gh/juewuy/ShellClash@master' && sh -c "$(curl -s $url/install_n.sh)" && source /etc/profile &> /dev/null +export url='https://cdn.jsdelivr.net/gh/juewuy/ShellClash@master' && sh -c "$(curl -kfsSl $url/install_n.sh)" && source /etc/profile &> /dev/null ``` ~**使用wget安装**:
@@ -95,6 +95,7 @@ source ~/.bashrc &> /dev/null ```Shell clash #正常模式运行 clash -h #脚本帮助及说明 +clash -u #卸载脚本 clash -t #测试模式运行 ``` @@ -130,9 +131,11 @@ ubus/iproute-doc 极低 缺少时无法正常获取本机host地址 ### [详见博客](https://juewuy.github.io) -## 捐赠此项目: +## 请喝杯茶: -### [前往页面](https://juewuy.github.io/yOF4Yf06Q/) +​ 支付宝 微信 + +##### 友情推广: -- diff --git a/install.sh b/install.sh index e962625..db06332 100644 --- a/install.sh +++ b/install.sh @@ -2,7 +2,7 @@ # Copyright (C) Juewuy echo='echo -e' && [ -n "$(echo -e|grep e)" ] && echo=echo -[ -z "$1" ] && test=0 || test=$1 +#[ -z "$1" ] && test=0 || test=$1 echo "***********************************************" echo "** 欢迎使用 **" @@ -28,33 +28,46 @@ webget(){ [ -z "$4" ] && redirect='-L' || redirect='' result=$(curl -w %{http_code} --connect-timeout 5 $progress $redirect -ko $1 $2) else - [ "$3" = "echooff" ] && progress='-q' || progress='-q --show-progress' + if wget --version > /dev/null 2>&1;then + [ "$3" = "echooff" ] && progress='-q' || progress='-q --show-progress' + [ "$4" = "rediroff" ] && redirect='--max-redirect=0' || redirect='' + certificate='--no-check-certificate' + timeout='--timeout=3' + fi [ "$3" = "echoon" ] && progress='' - [ -z "$4" ] && redirect='' || redirect='--max-redirect=0' - wget -Y on $progress $redirect --no-check-certificate --timeout=5 -O $1 $2 + [ "$3" = "echooff" ] && progress='-q' + wget $progress $redirect $certificate $timeout -O $1 $2 [ $? -eq 0 ] && result="200" fi } #检查更新 -url="https://cdn.jsdelivr.net/gh/juewuy/ShellClash" -if [ "$test" -gt 0 ];then - url="https://cdn.jsdelivr.net/gh/juewuy/ShellClash@master" - [ "$test" -eq 2 ] && url="https://raw.githubusercontent.com/juewuy/ShellClash/master" - [ "$test" -eq 3 ] && url="http://192.168.123.90:8080/ShellClash" -else - webget /tmp/clashrelease $url@master/bin/release_version echoon rediroff 2>/tmp/clashrelease - [ "$result" = "200" ] && release_new=$(cat /tmp/clashrelease | head -1) - [ -z "$release_new" ] && release_new=master - url=$url@$release_new +[ -z "$url" ] && url="https://cdn.jsdelivr.net/gh/juewuy/ShellClash" +#选择版本 +echo ----------------------------------------------- +$echo "\033[33m请选择想要安装的版本:\033[0m" +$echo " 1 \033[32mShellclash正式版\033[0m" +$echo " 2 \033[31mShellclash测试版\033[0m" +echo ----------------------------------------------- +read -p "请输入相应数字 > " num +if [ -z $num ];then + echo 安装已取消 + exit; +elif [ "$num" = "1" ];then + webget /tmp/clashrelease $url/bin/release_version echoon rediroff 2>/tmp/clashrelease + if [ "$result" = "200" ];then + release_new=$(cat /tmp/clashrelease | head -1) + url2="https://cdn.jsdelivr.net/gh/juewuy/ShellClash@$release_new" + else + echo "无法切换版本,尝试安装测试版!" + fi fi -webget /tmp/clashversion $url/bin/version echooff +[ -z "$url2" ] && url2=url +webget /tmp/clashversion "$url2/bin/version" echooff [ "$result" = "200" ] && versionsh=$(cat /tmp/clashversion | grep "versionsh" | awk -F "=" '{print $2}') [ -z "$release_new" ] && release_new=$versionsh rm -rf /tmp/clashversion rm -rf /tmp/clashrelease -[ -z "$release_new" ] && echo "无法连接服务器!" && exit - -tarurl=$url/bin/clashfm.tar.gz +tarurl=$url2/bin/clashfm.tar.gz gettar(){ webget /tmp/clashfm.tar.gz $tarurl @@ -92,6 +105,9 @@ gettar(){ chmod 777 $clashdir/start.sh sed -i '/versionsh_l=*/'d $clashdir/mark echo versionsh_l=$release_new >> $clashdir/mark + #设置更新地址 + sed -i '/update_url=*/'d $clashdir/mark + echo update_url=$url >> $clashdir/mark #设置环境变量 [ -w /opt/etc/profile ] && profile=/opt/etc/profile [ -w /jffs/configs/profile.add ] && profile=/jffs/configs/profile.add @@ -155,7 +171,7 @@ else echo ----------------------------------------------- echo '可用路径 剩余空间:' df -h | awk '{print $6,$4}'| sed 1d - echo '路径是必须带 / 的格式,写入虚拟内存(/tmp,/sys,..)的文件会在重启后消失!!!' + echo '路径是必须带 / 的格式,注意写入虚拟内存(/tmp,/opt,/sys...)的文件会在重启后消失!!!' read -p "请输入自定义路径 > " dir if [ -z "$dir" ];then $echo "\033[31m路径错误!请重新设置!\033[0m" diff --git a/install_n.sh b/install_n.sh index e68c5f4..db06332 100644 --- a/install_n.sh +++ b/install_n.sh @@ -56,17 +56,18 @@ elif [ "$num" = "1" ];then webget /tmp/clashrelease $url/bin/release_version echoon rediroff 2>/tmp/clashrelease if [ "$result" = "200" ];then release_new=$(cat /tmp/clashrelease | head -1) - url="https://cdn.jsdelivr.net/gh/juewuy/ShellClash@$release_new" + url2="https://cdn.jsdelivr.net/gh/juewuy/ShellClash@$release_new" else echo "无法切换版本,尝试安装测试版!" fi fi -webget /tmp/clashversion "$url/bin/version" echooff +[ -z "$url2" ] && url2=url +webget /tmp/clashversion "$url2/bin/version" echooff [ "$result" = "200" ] && versionsh=$(cat /tmp/clashversion | grep "versionsh" | awk -F "=" '{print $2}') [ -z "$release_new" ] && release_new=$versionsh rm -rf /tmp/clashversion rm -rf /tmp/clashrelease -tarurl=$url/bin/clashfm.tar.gz +tarurl=$url2/bin/clashfm.tar.gz gettar(){ webget /tmp/clashfm.tar.gz $tarurl diff --git a/scripts/clash.sh b/scripts/clash.sh index 5de4ba7..4a99395 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -309,9 +309,13 @@ setdns(){ $clashdir/start.sh webget /tmp/ssl_test https://www.baidu.com echooff rediron skipceroff if [ "$?" = "1" ];then echo ----------------------------------------------- - echo -e "\033[31m当前设备缺少本地根证书,请先安装证书!\033[0m" - source $clashdir/getdate.sh - setcrt + if openssl version >/dev/null 2>&1;then + echo -e "\033[31m当前设备缺少本地根证书,请先安装证书!\033[0m" + source $clashdir/getdate.sh + setcrt + else + echo -e "\033[31m当前设备未安装OpenSSL,无法启用加密DNS,Linux系统请自行搜索安装方式!\033[0m" + fi else dns_nameserver='https://223.5.5.5/dns-query, https://doh.pub/dns-query, tls://dns.rubyfish.cn:853' dns_fallback='tls://1.0.0.1:853, tls://8.8.4.4:853, https://doh.opendns.com/dns-query' @@ -762,7 +766,7 @@ clashadv(){ echo -e " 2 启用ipv6支持: \033[36m$ipv6_support\033[0m ————实验性功能,可能不稳定" echo -e " 3 Redir模式udp转发: \033[36m$tproxy_mod\033[0m ————依赖iptables-mod-tproxy" echo -e " 4 启用小闪存模式: \033[36m$mini_clash\033[0m ————不保存核心及数据库文件" - echo -e " 5 允许公网访问: \033[36m$public_support\033[0m ————防火墙放行clash相关端口" + echo -e " 5 允许公网访问: \033[36m$public_support\033[0m ————需要路由拨号+公网IP" echo -e " 6 配置内置DNS服务 \033[36m$dns_no\033[0m" echo -e " 7 使用自定义配置" echo -e " 8 手动指定相关端口、秘钥及本机host"