refactor: 抽取插件包变量PACKAGES

This commit is contained in:
Olia Lisa
2026-07-24 12:25:15 +08:00
parent 8fa54c5ae3
commit 3f83643cb2
4 changed files with 144 additions and 125 deletions
+29 -22
View File
@@ -45,11 +45,16 @@ build() {
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
BUILDER_DIR="$1"
# ────────────────────────────────────────────
# =============================================================
# lan口ip
# ────────────────────────────────────────────
# =============================================================
LAN_IP=${2}
# =============================================================
# 插件包列表
# =============================================================
PACKAGES=${3}
# =============================================================
# 固件输出目录
# =============================================================
@@ -61,25 +66,6 @@ build() {
# =============================================================
EXTRA_IMAGE_NAME="newifi3"
# =============================================================
# 插件包列表(按需增删)
# =============================================================
PKG_LIST=(
vim
nano-full
openssh-sftp-server
luci-i18n-vlmcsd-zh-cn
luci-i18n-argon-config-zh-cn
luci-i18n-arpbind-zh-cn
luci-i18n-package-manager-zh-cn
# 代理插件
luci-i18n-homeproxy-zh-cn
sing-box
)
PACKAGES=$(printf "%s " "${PKG_LIST[@]}")
# =============================================================
# 颜色输出
# =============================================================
@@ -164,6 +150,27 @@ version=$(ask_input "请输入 ImmortalWrt 版本" "$default_version")
default_lan_ip="192.168.1.1"
lan_ip=$(input_lan_ip "$default_lan_ip")
# =============================================================
# 插件包列表
# - 前面加 - 表示从固件中移除该包,例如 -dnsmasq
# - 每行一个,方便增删注释
# =============================================================
pkg_list=(
vim
nano-full
openssh-sftp-server
luci-i18n-vlmcsd-zh-cn
luci-i18n-argon-config-zh-cn
luci-i18n-arpbind-zh-cn
luci-i18n-package-manager-zh-cn
# 代理插件
luci-i18n-homeproxy-zh-cn
sing-box
)
packages=$(printf "%s " "${pkg_list[@]}") # 动态拼接成字符串
# 进入项目根目
project_dir="$(cd "$(dirname "$0")" && pwd)"
cd "$project_dir"
@@ -175,4 +182,4 @@ install_dependencies
builder_dir="$(download_imagebuilder "$version")"
# 构建固件
build "$builder_dir" $lan_ip
build "$builder_dir" "$lan_ip" "$packages"