~优化手动上传内核及配置文件读取,修复bug
~NTP地址替换为阿里云纯IP,以适配部分老旧设备
This commit is contained in:
juewuy
2023-02-03 21:20:06 +08:00
parent ef1fd70a32
commit 7c07c51993
6 changed files with 20 additions and 11 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -3,4 +3,4 @@ clashpre_v=2022.11.25
clash_v=v1.7.1 clash_v=v1.7.1
meta_v=v1.13.2 meta_v=v1.13.2
GeoIP_v=20230128 GeoIP_v=20230128
versionsh=1.7.0e versionsh=1.7.0f

View File

@@ -98,11 +98,12 @@ ckstatus(){
#检查执行权限 #检查执行权限
[ ! -x $clashdir/start.sh ] && chmod +x $clashdir/start.sh [ ! -x $clashdir/start.sh ] && chmod +x $clashdir/start.sh
#检查/tmp内核文件 #检查/tmp内核文件
for file in `ls -F /tmp | grep -v [/\$] | grep -iE '^clash$|^clash-linux*'` ; do for file in `ls -F /tmp | grep -v [/\$] | grep -v '\ ' | grep -iE '^clash$|^clash-linux*'` ; do
file=/tmp/$file
chmod +x $file chmod +x $file
tmp_version=$($file -v 2>/dev/null) tmp_version=$($file -v 2>/dev/null)
if [ -n "$tmp_version" ];then if [ -n "$tmp_version" ];then
echo -e "\033[32m发现可用的内核文件\033[0m" echo -e "发现可用的内核文件 \033[36m$file\033[0m "
read -p "是否加载?(1/0) > " res read -p "是否加载?(1/0) > " res
[ "$res" = 1 ] && { [ "$res" = 1 ] && {
echo -e " 1 Clash内核" echo -e " 1 Clash内核"
@@ -114,7 +115,7 @@ ckstatus(){
3) clashcore=clash.meta ;; 3) clashcore=clash.meta ;;
*) clashcore=clash ;; *) clashcore=clash ;;
esac esac
mv -f $file $bindir/clash mv -f $file $bindir/clash && echo -e "\033[32m内核加载完成\033[0m " && sleep 1
setconfig clashcore $clashcore setconfig clashcore $clashcore
} }
else else
@@ -127,13 +128,21 @@ ckstatus(){
done done
#检查/tmp配置文件 #检查/tmp配置文件
[ -x $bindir/clash ] && \ [ -x $bindir/clash ] && \
for file in `ls -F /tmp | grep -v [/\$] | grep -iE '.yaml$|.yml$'` ; do for file in `ls -F /tmp | grep -v [/\$] | grep -v '\ ' | grep -iE '.yaml$|.yml$'` ; do
file=/tmp/$file
$bindir/clash -t -d $bindir -f $file &>/dev/null && { $bindir/clash -t -d $bindir -f $file &>/dev/null && {
echo -e "\033[32m发现可用的YAML配置文件\033[0m" echo -e "发现可用的YAML配置文件 \033[36m$file\033[0m "
echo $file
read -p "加载为config.yaml配置文件/或者移除该文件?(1/0) > " res read -p "加载为config.yaml配置文件/或者移除该文件?(1/0) > " res
[ "$res" = 1 ] && mv -f $file $clashdir/config.yaml [ "$res" = 1 ] && {
[ "$res" = 0 ] && rm -rf $file mv -f $file $clashdir/config.yaml
echo -e "\033[32m配置文件加载完成\033[0m "
sleep 1
}
[ "$res" = 0 ] && {
rm -rf $file
echo -e "\033[32m配置文件已移除\033[0m "
sleep 1
}
echo ----------------------------------------------- echo -----------------------------------------------
} }
done done

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# Copyright (C) Juewuy # Copyright (C) Juewuy
version=1.7.0e version=1.7.0f
setdir(){ setdir(){
dir_avail(){ dir_avail(){

View File

@@ -1234,7 +1234,7 @@ afstart(){
[ "$local_proxy" = "已开启" ] && [ "$local_type" = "nftables增强模式" ] && [ "$redir_mod" = "纯净模式" ] && start_nft [ "$local_proxy" = "已开启" ] && [ "$local_type" = "nftables增强模式" ] && [ "$redir_mod" = "纯净模式" ] && start_nft
ckcmd iptables && start_wan ckcmd iptables && start_wan
#同步本机时间 #同步本机时间
ckcmd ntpd && ntpd -n -q -p ntp.aliyun.com ckcmd ntpd && ntpd -n -q -p 203.107.6.88
#标记启动时间 #标记启动时间
mark_time mark_time
#加载定时任务 #加载定时任务