~检查更新流程优化

~padavan自启优化
~部分界面文本优化
~bug fix
This commit is contained in:
juewuy
2026-01-06 14:51:18 +08:00
parent 93ac1b1da9
commit 3772593f66
6 changed files with 30 additions and 23 deletions

View File

@@ -108,7 +108,8 @@ task_add(){ #任务添加
}
task_del(){ #任务删除
#删除定时任务
croncmd -l > "$TMPDIR"/cron && sed -i "/$1/d" "$TMPDIR"/cron && croncmd "$TMPDIR"/cron
croncmd -l > "$TMPDIR"/cron
sed -i "/$1/d" "$TMPDIR"/cron && croncmd "$TMPDIR"/cron
rm -f "$TMPDIR"/cron
#删除条件任务
sed -i "/$1/d" "$CRASHDIR"/task/cron 2>/dev/null
@@ -125,6 +126,9 @@ task_type(){ #任务条件选择菜单
echo -e " 2 定时任务\033[32m每日执行\033[0m"
echo -e " 3 定时任务\033[32m每小时执行\033[0m"
echo -e " 4 定时任务\033[32m每分钟执行\033[0m"
echo "-----------------------------------------------"
echo -e "\033[31m注意\033[0m逻辑水平不及格的请勿使用下方触发条件"
echo "-----------------------------------------------"
echo -e " 5 服务\033[33m启动前执行\033[0m"
echo -e " 6 服务\033[33m启动后执行\033[0m"
echo -e " 7 服务\033[33m运行时每分钟执行\033[0m"

View File

@@ -18,8 +18,7 @@ error_down(){
upgrade() {
while true; do
echo "-----------------------------------------------"
echo -ne "\033[32m正在检查更新\033[0m\r"
checkupdate
[ -z "$version_new" ] && checkupdate
[ -z "$core_v" ] && core_v=$crashcore
core_v_new=$(eval echo \$"$crashcore"_v)
echo -e "\033[30;47m欢迎使用更新功能\033[0m"
@@ -107,6 +106,7 @@ upgrade() {
#检查更新
checkupdate(){
echo -ne "\033[32m正在检查更新\033[0m\r"
get_bin "$TMPDIR"/version_new version echooff
[ "$?" = "0" ] && {
version_new=$(cat "$TMPDIR"/version_new)
@@ -641,9 +641,9 @@ setgeo() {
echo "-----------------------------------------------"
echo -e " 3 Mihomo精简版GeoIP_cn数据库(约0.1mb) \033[33m$cn_mini_v\033[0m"
echo -e " 4 Mihomo完整版GeoSite数据库(约5mb) \033[33m$geosite_v\033[0m"
echo -e " 5 Mihomo-mrs数据库常用包(约1mb) \033[33m$mrs_v\033[0m"
echo "-----------------------------------------------"
echo -e " 6 Singbox-srs数据库常用包(约0.8mb) \033[33m$srs_v\033[0m"
echo -e " 5 Mihomo-mrs数据库常用包(约1mb,非必要勿用)"
echo -e " 6 Singbox-srs数据库常用包(约0.8mb,非必要勿用)"
echo "-----------------------------------------------"
echo -e " 8 \033[32m自定义数据库文件\033[0m"
echo -e " 9 \033[31m清理数据库文件\033[0m"
@@ -917,6 +917,7 @@ saveserver() {
setconfig update_url "'$update_url'"
setconfig url_id $url_id
setconfig release_type $release_type
version_new=''
echo "-----------------------------------------------"
echo -e "\033[32m源地址切换成功\033[0m"
}
@@ -960,11 +961,13 @@ setserver() {
elif [ "$url_id_new" -ge 200 ];then
update_url=$(grep -E "^1|$release_name" "$CRASHDIR"/configs/servers.list | sed -n ""$num"p" | awk '{print $3}')
url_id=''
continue
saveserver
break
else
url_id=$url_id_new
update_url=''
continue
saveserver
break
fi
unset url_id_new
;;

View File

@@ -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

View File

@@ -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'

View File

@@ -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

View File

@@ -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模式生成