From 605bacba5f6ce0098d68d3afa560680ab478bd1d Mon Sep 17 00:00:00 2001 From: OPPEN321 Date: Tue, 23 Sep 2025 18:59:47 +0800 Subject: [PATCH] Create 03-preset_mihimo_core.sh --- scripts/03-preset_mihimo_core.sh | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 scripts/03-preset_mihimo_core.sh diff --git a/scripts/03-preset_mihimo_core.sh b/scripts/03-preset_mihimo_core.sh new file mode 100644 index 0000000..0ca4ad7 --- /dev/null +++ b/scripts/03-preset_mihimo_core.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# 创建 OpenClash 核心目录(若不存在则自动创建) +mkdir -p files/etc/openclash/core + +# 根据 mihomo_core 类型选择下载链接 +case "$mihomo_core" in + "meta") + CLASH_META_URL="https://raw.githubusercontent.com/vernesong/OpenClash/core/master/meta/clash-linux-$core.tar.gz" + ;; + "smart") + CLASH_META_URL="https://raw.githubusercontent.com/vernesong/OpenClash/core/master/smart/clash-linux-$core.tar.gz" + ;; + *) + CLASH_META_URL="https://raw.githubusercontent.com/vernesong/OpenClash/core/master/meta/clash-linux-$core.tar.gz" + ;; +esac + +# 定义 geoip.dat、geosite.dat下载链接 +GEOIP_URL="https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat" +GEOSITE_URL="https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat" + +# 下载并解压 Clash Meta 内核,输出为 clash_meta 可执行文件 +wget -qO- $CLASH_META_URL | tar xOvz > files/etc/openclash/core/clash_meta + +# 下载 GeoIP 数据库(IP 地址归属地信息) +wget -qO- $GEOIP_URL > files/etc/openclash/GeoIP.dat + +# 下载 GeoSite 数据库(常用域名分类信息) +wget -qO- $GEOSITE_URL > files/etc/openclash/GeoSite.dat + +# 赋予 Clash 核心文件可执行权限 +chmod +x files/etc/openclash/core/clash*