mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-12 08:21:40 +00:00
~检查更新流程优化
~padavan自启优化 ~部分界面文本优化 ~bug fix
This commit is contained in:
@@ -12,9 +12,9 @@ clash_check() { #clash启动前检查
|
||||
core_exchange meta '当前内核不支持非root用户启用本机代理'
|
||||
check_core
|
||||
#预下载GeoIP数据库并排除存在自定义数据库链接的情况
|
||||
[ -n "$(grep -oEi 'geoip:' "$CRASHDIR"/yamls/*.yaml)" ] && [ -z "$(grep -oEi 'geoip:|mmdb:' "$CRASHDIR"/yamls/*.yaml)" ] && check_geo Country.mmdb cn_mini.mmdb
|
||||
[ -n "$(grep -oEi 'geoip:' "$CRASHDIR"/yamls/config.yaml)" ] && check_geo Country.mmdb cn_mini.mmdb
|
||||
#预下载GeoSite数据库并排除存在自定义数据库链接的情况
|
||||
[ -n "$(grep -oEi 'geosite:' "$CRASHDIR"/yamls/*.yaml)" ] && [ -z "$(grep -oEi 'geosite:' "$CRASHDIR"/yamls/*.yaml)" ] && check_geo GeoSite.dat geosite.dat
|
||||
[ -n "$(grep -oEi 'geosite:' "$CRASHDIR"/yamls/config.yaml)" ] && check_geo GeoSite.dat geosite.dat
|
||||
#预下载cn.mrs数据库
|
||||
[ "$dns_mod" = "mix" ] || [ "$dns_mod" = "route" ] && ! grep -Eq '^[[:space:]]*cn:' "$CRASHDIR"/yamls/*.yaml && check_geo ruleset/cn.mrs mrs_geosite_cn.mrs
|
||||
return 0
|
||||
|
||||
@@ -89,19 +89,18 @@ hosts:
|
||||
EOF
|
||||
if [ "$crashcore" = "meta" ]; then
|
||||
echo " 'services.googleapis.cn': services.googleapis.com" >>"$TMPDIR"/hosts.yaml
|
||||
else
|
||||
#加载本机hosts
|
||||
sys_hosts=/etc/hosts
|
||||
[ -f /data/etc/custom_hosts ] && sys_hosts=/data/etc/custom_hosts
|
||||
while read line; do
|
||||
[ -n "$(echo "$line" | grep -oE "([0-9]{1,3}[\.]){3}")" ] &&
|
||||
[ -z "$(echo "$line" | grep -oE '^#')" ] &&
|
||||
hosts_ip=$(echo $line | awk '{print $1}') &&
|
||||
hosts_domain=$(echo $line | awk '{print $2}') &&
|
||||
[ -z "$(cat "$TMPDIR"/hosts.yaml | grep -oE "$hosts_domain")" ] &&
|
||||
echo " '$hosts_domain': $hosts_ip" >>"$TMPDIR"/hosts.yaml
|
||||
done <$sys_hosts
|
||||
fi
|
||||
#加载本机hosts
|
||||
sys_hosts=/etc/hosts
|
||||
[ -f /data/etc/custom_hosts ] && sys_hosts='/etc/hosts /data/etc/custom_hosts'
|
||||
cat $sys_hosts | while read line; do
|
||||
[ -n "$(echo "$line" | grep -oE "([0-9]{1,3}[\.]){3}")" ] &&
|
||||
[ -z "$(echo "$line" | grep -oE '^#')" ] &&
|
||||
hosts_ip=$(echo $line | awk '{print $1}') &&
|
||||
hosts_domain=$(echo $line | awk '{print $2}') &&
|
||||
[ -z "$(cat "$TMPDIR"/hosts.yaml | grep -oE "$hosts_domain")" ] &&
|
||||
echo " '$hosts_domain': $hosts_ip" >>"$TMPDIR"/hosts.yaml
|
||||
done
|
||||
fi
|
||||
#分割配置文件
|
||||
yaml_char='proxies proxy-groups proxy-providers rules rule-providers sub-rules listeners'
|
||||
|
||||
@@ -14,7 +14,7 @@ if [ -d "/etc/storage/clash" -o -d "/etc/storage/ShellCrash" ]; then
|
||||
sleep 3 && i=$((i + 1))
|
||||
done
|
||||
[ -w "$profile" ] || profile=/etc_ro/profile
|
||||
mount -t tmpfs -o remount,rw,size=45M tmpfs /tmp #增加/tmp空间以适配新的内核压缩方式
|
||||
[ "$zip_type" = 'upx' ] || mount -t tmpfs -o remount,rw,size=45M tmpfs /tmp #增加/tmp空间以适配新的内核压缩方式
|
||||
sed -i '' "$profile" #将软链接转化为一般文件
|
||||
elif [ -d "/jffs" ]; then
|
||||
sleep 60
|
||||
|
||||
@@ -99,7 +99,8 @@ EOF
|
||||
#生成dns.json
|
||||
[ "$ipv6_dns" != "未开启" ] && strategy='prefer_ipv4' || strategy='ipv4_only'
|
||||
#获取detour出口
|
||||
auto_detour=$(grep -E '"type": "urltest"' -A 1 "$TMPDIR"/jsons/outbounds.json | grep '"tag":' | head -n 1 | sed 's/^[[:space:]]*"tag": //;s/,$//')
|
||||
auto_detour=$(grep -E '"type": "urltest"' -A 1 "$TMPDIR"/jsons/outbounds.json | grep '自动' | head -n 1 | sed 's/^[[:space:]]*"tag": //;s/,$//')
|
||||
[ -z "$auto_detour" ] && auto_detour=$(grep -E '"type": "urltest"' -A 1 "$TMPDIR"/jsons/outbounds.json | grep '"tag":' | head -n 1 | sed 's/^[[:space:]]*"tag": //;s/,$//')
|
||||
[ -z "$auto_detour" ] && auto_detour=$(grep -E '"type": "selector"' -A 1 "$TMPDIR"/jsons/outbounds.json | grep '"tag":' | head -n 1 | sed 's/^[[:space:]]*"tag": //;s/,$//')
|
||||
[ -z "$auto_detour" ] && auto_detour='"DIRECT"'
|
||||
#根据dns模式生成
|
||||
|
||||
Reference in New Issue
Block a user