|
| 1 | +#!/bin/bash |
| 2 | +# Log file for debugging |
| 3 | +# 目前暂不支持第三方软件apk 待后续开发 仓库内可以集成 |
| 4 | +source shell/custom-packages.sh |
| 5 | +#echo "第三方软件包: $CUSTOM_PACKAGES" |
| 6 | +LOGFILE="/tmp/uci-defaults-log.txt" |
| 7 | +echo "Starting 99-custom.sh at $(date)" >> $LOGFILE |
| 8 | +echo "编译固件大小为: $PROFILE MB" |
| 9 | +echo "Include Docker: $INCLUDE_DOCKER" |
| 10 | + |
| 11 | +echo "Create pppoe-settings" |
| 12 | +mkdir -p /home/build/immortalwrt/files/etc/config |
| 13 | + |
| 14 | +# 创建pppoe配置文件 yml传入环境变量ENABLE_PPPOE等 写入配置文件 供99-custom.sh读取 |
| 15 | +cat << EOF > /home/build/immortalwrt/files/etc/config/pppoe-settings |
| 16 | +enable_pppoe=${ENABLE_PPPOE} |
| 17 | +pppoe_account=${PPPOE_ACCOUNT} |
| 18 | +pppoe_password=${PPPOE_PASSWORD} |
| 19 | +EOF |
| 20 | + |
| 21 | +echo "cat pppoe-settings" |
| 22 | +cat /home/build/immortalwrt/files/etc/config/pppoe-settings |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +# 输出调试信息 |
| 27 | +echo "$(date '+%Y-%m-%d %H:%M:%S') - 开始构建固件..." |
| 28 | + |
| 29 | +# ============= imm仓库内的插件============== |
| 30 | +# 定义所需安装的包列表 下列插件你都可以自行删减 |
| 31 | +PACKAGES="" |
| 32 | +PACKAGES="$PACKAGES curl" |
| 33 | +PACKAGES="$PACKAGES luci-i18n-diskman-zh-cn" |
| 34 | +PACKAGES="$PACKAGES luci-i18n-firewall-zh-cn" |
| 35 | +PACKAGES="$PACKAGES luci-theme-argon" |
| 36 | +PACKAGES="$PACKAGES luci-app-argon-config" |
| 37 | +PACKAGES="$PACKAGES luci-i18n-argon-config-zh-cn" |
| 38 | +#24.10 |
| 39 | +PACKAGES="$PACKAGES luci-i18n-package-manager-zh-cn" |
| 40 | +PACKAGES="$PACKAGES luci-i18n-ttyd-zh-cn" |
| 41 | +PACKAGES="$PACKAGES xray-core hysteria luci-i18n-passwall-zh-cn" |
| 42 | +PACKAGES="$PACKAGES luci-app-openclash" |
| 43 | +PACKAGES="$PACKAGES luci-i18n-homeproxy-zh-cn" |
| 44 | +PACKAGES="$PACKAGES openssh-sftp-server" |
| 45 | + |
| 46 | +# 文件管理器 |
| 47 | +PACKAGES="$PACKAGES luci-i18n-filemanager-zh-cn" |
| 48 | +# ======== shell/custom-packages.sh ======= |
| 49 | +# 合并imm仓库以外的第三方插件 暂时注释 |
| 50 | +#PACKAGES="$PACKAGES $CUSTOM_PACKAGES" |
| 51 | + |
| 52 | + |
| 53 | +# 判断是否需要编译 Docker 插件 |
| 54 | +if [ "$INCLUDE_DOCKER" = "yes" ]; then |
| 55 | + PACKAGES="$PACKAGES luci-i18n-dockerman-zh-cn" |
| 56 | + echo "Adding package: luci-i18n-dockerman-zh-cn" |
| 57 | +fi |
| 58 | + |
| 59 | +# 若构建openclash 则添加内核 |
| 60 | +if echo "$PACKAGES" | grep -q "luci-app-openclash"; then |
| 61 | + echo "✅ 已选择 luci-app-openclash,添加 openclash core" |
| 62 | + mkdir -p files/etc/openclash/core |
| 63 | + # Download clash_meta |
| 64 | + META_URL="https://raw.githubusercontent.com/vernesong/OpenClash/core/master/meta/clash-linux-amd64.tar.gz" |
| 65 | + wget -qO- $META_URL | tar xOvz > files/etc/openclash/core/clash_meta |
| 66 | + chmod +x files/etc/openclash/core/clash_meta |
| 67 | + # Download GeoIP and GeoSite |
| 68 | + wget -q https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat -O files/etc/openclash/GeoIP.dat |
| 69 | + wget -q https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat -O files/etc/openclash/GeoSite.dat |
| 70 | +else |
| 71 | + echo "⚪️ 未选择 luci-app-openclash" |
| 72 | +fi |
| 73 | + |
| 74 | +# 构建镜像 |
| 75 | +echo "$(date '+%Y-%m-%d %H:%M:%S') - Building image with the following packages:" |
| 76 | +echo "$PACKAGES" |
| 77 | + |
| 78 | +make image PROFILE="generic" PACKAGES="$PACKAGES" FILES="/home/build/immortalwrt/files" ROOTFS_PARTSIZE=$PROFILE |
| 79 | + |
| 80 | +if [ $? -ne 0 ]; then |
| 81 | + echo "$(date '+%Y-%m-%d %H:%M:%S') - Error: Build failed!" |
| 82 | + exit 1 |
| 83 | +fi |
| 84 | + |
| 85 | +echo "$(date '+%Y-%m-%d %H:%M:%S') - Build completed successfully." |
0 commit comments