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
+27 -21
View File
@@ -46,7 +46,12 @@ build() {
# ────────────────────────────────────────────
# lan口ip
# ────────────────────────────────────────────
LAN_IP=${2}
LAN_IP="${2}"
# =============================================================
# 插件包列表
# =============================================================
PACKAGES="${3}"
# =============================================================
# 固件输出目录
@@ -59,25 +64,6 @@ build() {
# =============================================================
EXTRA_IMAGE_NAME="hc5962"
# =============================================================
# 插件包列表(按需增删)
# =============================================================
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[@]}")
# =============================================================
# 颜色输出
# =============================================================
@@ -162,6 +148,26 @@ 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"
@@ -170,4 +176,4 @@ install_dependencies
builder_dir="$(download_imagebuilder "$version")"
build $builder_dir $lan_ip
build "$builder_dir" "$lan_ip" "$packages"