Continue to address the issue of function self-invocation

This commit is contained in:
Sofia
2026-01-07 12:30:14 +08:00
committed by GitHub
parent 2e85085cf7
commit 364fd54ced

View File

@@ -389,90 +389,101 @@ setziptype(){
esac esac
setconfig zip_type "$zip_type" setconfig zip_type "$zip_type"
} }
setcore(){ #内核选择菜单
#获取核心及版本信息 # 内核选择菜单
[ -z "$crashcore" ] && crashcore="unknow" setcore() {
[ -z "$zip_type" ] && zip_type="tar.gz" while true; do
echo "$crashcore" | grep -q 'singbox' && core_old=singbox || core_old=clash # 获取核心及版本信息
[ -n "$custcorelink" ] && custcore="$(echo $custcorelink | sed 's#.*github.com##; s#/releases/download/#@#; s#-linux.*$##')" [ -z "$crashcore" ] && crashcore="unknow"
### [ -z "$zip_type" ] && zip_type="tar.gz"
echo "-----------------------------------------------" echo "$crashcore" | grep -q 'singbox' && core_old=singbox || core_old=clash
[ -z "$cpucore" ] && check_cpucore [ -n "$custcorelink" ] && custcore="$(echo $custcorelink | sed 's#.*github.com##; s#/releases/download/#@#; s#-linux.*$##')"
echo -e "当前内核:\033[42;30m $crashcore \033[47;30m$core_v\033[0m" ###
echo -e "当前系统处理器架构:\033[32m $cpucore \033[0m" echo "-----------------------------------------------"
echo -e "\033[33m请选择需要使用的核心版本\033[0m" [ -z "$cpucore" ] && check_cpucore
echo -e "\033[36m如需本地上传请将.upx .gz .tar.gz文件上传至 /tmp 目录后重新运行crash命令\033[0m" echo -e "当前内核:\033[42;30m $crashcore \033[47;30m$core_v\033[0m"
echo "-----------------------------------------------" echo -e "当前系统处理器架构:\033[32m $cpucore \033[0m"
echo -e "1 \033[43;30m Mihomo \033[0m \033[32m(原meta内核)支持全面\033[0m" echo -e "\033[33m请选择需要使用的核心版本\033[0m"
echo -e " >>\033[32m$meta_v \033[33m占用略高\033[0m" echo -e "\033[36m如需本地上传请将.upx .gz .tar.gz文件上传至 /tmp 目录后重新运行crash命令\033[0m"
echo -e " 说明文档: \033[36;4mhttps://wiki.metacubex.one\033[0m" echo "-----------------------------------------------"
echo -e "2 \033[43;30m SingBoxR \033[0m \033[32m支持全面\033[0m" echo -e "1 \033[43;30m Mihomo \033[0m \033[32m(原meta内核)支持全面\033[0m"
echo -e " >>\033[32m$singboxr_v \033[33m使用reF1nd增强分支\033[0m" echo -e " >>\033[32m$meta_v \033[33m占用略高\033[0m"
echo -e " 说明文档: \033[36;4mhttps://sing-boxr.dustinwin.us.kg\033[0m" echo -e " 说明文档: \033[36;4mhttps://wiki.metacubex.one\033[0m"
[ "$zip_type" = 'upx' ] && { echo -e "2 \033[43;30m SingBoxR \033[0m \033[32m支持全面\033[0m"
echo -e "3 \033[43;30m SingBox \033[0m \033[32m占用较低\033[0m" echo -e " >>\033[32m$singboxr_v \033[33m使用reF1nd增强分支\033[0m"
echo -e " >>\033[32m$singbox_v \033[33m不支持providers\033[0m" echo -e " 说明文档: \033[36;4mhttps://sing-boxr.dustinwin.us.kg\033[0m"
echo -e " 说明文档: \033[36;4mhttps://sing-box.sagernet.org\033[0m" [ "$zip_type" = 'upx' ] && {
} echo -e "3 \033[43;30m SingBox \033[0m \033[32m占用较低\033[0m"
[ "$zip_type" = 'upx' ] && { echo -e " >>\033[32m$singbox_v \033[33m不支持providers\033[0m"
echo -e "4 \033[43;30m Clash \033[0m \033[32m占用低\033[0m" echo -e " 说明文档: \033[36;4mhttps://sing-box.sagernet.org\033[0m"
echo -e " >>\033[32m$clash_v \033[33m不安全,已停止维护\033[0m" }
echo -e " 说明文档: \033[36;4mhttps://lancellc.gitbook.io\033[0m" [ "$zip_type" = 'upx' ] && {
} echo -e "4 \033[43;30m Clash \033[0m \033[32m占用低\033[0m"
echo "-----------------------------------------------" echo -e " >>\033[32m$clash_v \033[33m不安全,已停止维护\033[0m"
echo -e "5 切换版本分支及压缩方式: \033[32m$zip_type\033[0m" echo -e " 说明文档: \033[36;4mhttps://lancellc.gitbook.io\033[0m"
echo -e "6 \033[36m使用自定义内核\033[0m $custcore" }
echo -e "7 \033[32m更新当前内核\033[0m" echo "-----------------------------------------------"
echo "-----------------------------------------------" echo -e "5 切换版本分支及压缩方式: \033[32m$zip_type\033[0m"
echo "9 手动指定处理器架构" echo -e "6 \033[36m使用自定义内核\033[0m $custcore"
echo "-----------------------------------------------" echo -e "7 \033[32m更新当前内核\033[0m"
echo "0 返回上级菜单" echo "-----------------------------------------------"
read -p "请输入对应数字 > " num echo "9 手动指定处理器架构"
case "$num" in echo "-----------------------------------------------"
0) echo "0 返回上级菜单"
;; read -p "请输入对应数字 > " num
1) case "$num" in
[ -d "/jffs" ] && { "" | 0)
echo -e "\033[31mMeta内核使用的GeoSite.dat数据库在华硕设备存在被系统误删的问题可能无法使用!\033[0m" break
sleep 3 ;;
} 1)
crashcore=meta [ -d "/jffs" ] && {
custcorelink='' echo -e "\033[31mMeta内核使用的GeoSite.dat数据库在华硕设备存在被系统误删的问题可能无法使用!\033[0m"
getcore sleep 3
;; }
2) crashcore=meta
crashcore=singboxr custcorelink=''
custcorelink='' getcore
getcore break
;; ;;
3) 2)
crashcore=singbox crashcore=singboxr
custcorelink='' custcorelink=''
getcore getcore
;; break
4) ;;
crashcore=clash 3)
custcorelink='' crashcore=singbox
getcore custcorelink=''
;; getcore
5) break
setziptype ;;
setcore 4)
;; crashcore=clash
6) custcorelink=''
setcustcore getcore
setcore break
;; ;;
7) 5)
getcore setziptype
;; ;;
9) 6)
setcpucore setcustcore
;; ;;
*) 7)
errornum getcore
;; break
esac ;;
9)
setcpucore
break
;;
*)
errornum
sleep 1
break
;;
esac
done
} }
#数据库 #数据库