Unverified Commit a2558b4f authored by wukongdaily's avatar wukongdaily Committed by GitHub
Browse files

x86-64机型新增用户预设pppoe拨号功能

parent d33b0c7e
......@@ -16,6 +16,20 @@ on:
options:
- 'yes'
- 'no'
enable_pppoe:
description: "是否配置PPPoE拨号信息?"
required: true
default: 'no'
type: choice
options:
- 'yes'
- 'no'
pppoe_account:
description: "宽带账号 (若启用PPPoE)"
required: false
pppoe_password:
description: "宽带密码 (若启用PPPoE)"
required: false
jobs:
build:
......@@ -28,6 +42,15 @@ jobs:
- name: Set executable permissions
run: chmod +x ${{ github.workspace }}/x86-64/build.sh
- name: Validate PPPoE Inputs
run: |
if [[ "${{ inputs.enable_pppoe }}" == "yes" ]]; then
if [[ -z "${{ inputs.pppoe_account }}" || -z "${{ inputs.pppoe_password }}" ]]; then
echo "Error: PPPoE account and password must be provided when PPPoE is enabled!"
exit 1
fi
fi
- name: Build ImmortalWrt-x86-64-eif
run: |
profiles="${{ github.event.inputs.profile }}"
......@@ -46,6 +69,9 @@ jobs:
-v "${{ github.workspace }}/x86-64/build.sh:/home/build/immortalwrt/build.sh" \
-e PROFILE=$profile \
-e INCLUDE_DOCKER=$include_docker \
-e ENABLE_PPPOE=${{ inputs.enable_pppoe }} \
-e PPPOE_ACCOUNT=${{ inputs.pppoe_account }} \
-e PPPOE_PASSWORD=${{ inputs.pppoe_password }} \
immortalwrt/imagebuilder:x86-64-openwrt-23.05.4 /bin/bash /home/build/immortalwrt/build.sh
done
......
......@@ -16,6 +16,20 @@ on:
options:
- 'yes'
- 'no'
enable_pppoe:
description: "是否配置PPPoE拨号信息?"
required: true
default: 'no'
type: choice
options:
- 'yes'
- 'no'
pppoe_account:
description: "宽带账号 (若启用PPPoE)"
required: false
pppoe_password:
description: "宽带密码 (若启用PPPoE)"
required: false
jobs:
build:
......@@ -28,6 +42,16 @@ jobs:
- name: Set executable permissions
run: chmod +x ${{ github.workspace }}/x86-64/build.sh
- name: Validate PPPoE Inputs
run: |
if [[ "${{ inputs.enable_pppoe }}" == "yes" ]]; then
if [[ -z "${{ inputs.pppoe_account }}" || -z "${{ inputs.pppoe_password }}" ]]; then
echo "Error: PPPoE account and password must be provided when PPPoE is enabled!"
exit 1
fi
fi
- name: Build ImmortalWrt-x86-64-eif
run: |
profiles="${{ github.event.inputs.profile }}"
......@@ -45,6 +69,9 @@ jobs:
-v "${{ github.workspace }}/x86-64/24.10/build.sh:/home/build/immortalwrt/build.sh" \
-e PROFILE=$profile \
-e INCLUDE_DOCKER=$include_docker \
-e ENABLE_PPPOE=${{ inputs.enable_pppoe }} \
-e PPPOE_ACCOUNT=${{ inputs.pppoe_account }} \
-e PPPOE_PASSWORD=${{ inputs.pppoe_password }} \
immortalwrt/imagebuilder:x86-64-openwrt-24.10.0-rc3 /bin/bash /home/build/immortalwrt/build.sh
done
......
#!/bin/sh
# 99-custom.sh 就是immortalwrt固件首次启动时运行的脚本 位于固件内的/etc/uci-defaults/99-custom.sh
# Log file for debugging
LOGFILE="/tmp/uci-defaults-log.txt"
echo "Starting 99-custom.sh at $(date)" >> $LOGFILE
# 设置默认防火墙规则,方便虚拟机首次访问 WebUI
uci set firewall.@zone[1].input='ACCEPT'
......@@ -9,7 +12,7 @@ uci set "dhcp.@domain[-1].name=time.android.com"
uci set "dhcp.@domain[-1].ip=203.107.6.88"
# 根据网卡数量配置网络
# 计算网卡数量
count=0
for iface in /sys/class/net/*; do
iface_name=$(basename "$iface")
......@@ -19,11 +22,38 @@ for iface in /sys/class/net/*; do
fi
done
# 检查配置文件pppoe-settings是否存在 该文件由build.sh动态生成
SETTINGS_FILE="/etc/config/pppoe-settings"
if [ ! -f "$SETTINGS_FILE" ]; then
echo "PPPoE settings file not found. Skipping." >> $LOGFILE
else
# 读取pppoe信息($enable_pppoe、$pppoe_account、$pppoe_password)
. "$SETTINGS_FILE"
fi
# 网络设置
if [ "$count" -eq 1 ]; then
# 单网口设备 类似于NAS模式 动态获取ip模式 具体ip地址取决于上一级路由器给它分配的ip 也方便后续你使用web页面设置旁路由
# 单网口设备 不支持修改ip 不要在此处修改ip
uci set network.lan.proto='dhcp'
elif [ "$count" -gt 1 ]; then
# 多网口设备 支持修改为别的ip地址
uci set network.lan.ipaddr='192.168.100.1'
echo "set 192.168.100.1 at $(date)" >> $LOGFILE
# 判断是否启用 PPPoE
echo "print enable_pppoe value=== $enable_pppoe" >> $LOGFILE
if [ "$enable_pppoe" = "yes" ]; then
echo "PPPoE is enabled at $(date)" >> $LOGFILE
# 设置宽带拨号信息
uci set network.wan.proto='pppoe'
uci set network.wan.username=$pppoe_account
uci set network.wan.password=$pppoe_password
uci set network.wan.peerdns='1'
uci set network.wan.auto='1'
echo "PPPoE configuration completed successfully." >> $LOGFILE
else
echo "PPPoE is not enabled. Skipping configuration." >> $LOGFILE
fi
fi
# 设置所有网口可访问网页终端
......
#!/bin/bash
# Log file for debugging
LOGFILE="/tmp/uci-defaults-log.txt"
echo "Starting 99-custom.sh at $(date)" >> $LOGFILE
echo "编译固件大小为: $PROFILE MB"
echo "Include Docker: $INCLUDE_DOCKER"
echo "Create pppoe-settings"
mkdir -p /home/build/immortalwrt/files/etc/config
# 创建pppoe配置文件 yml传入环境变量ENABLE_PPPOE等 写入配置文件 供99-custom.sh读取
cat << EOF > /home/build/immortalwrt/files/etc/config/pppoe-settings
enable_pppoe=${ENABLE_PPPOE}
pppoe_account=${PPPOE_ACCOUNT}
pppoe_password=${PPPOE_PASSWORD}
EOF
echo "cat pppoe-settings"
cat /home/build/immortalwrt/files/etc/config/pppoe-settings
# 输出调试信息
echo "$(date '+%Y-%m-%d %H:%M:%S') - 开始编译..."
......
#!/bin/bash
# Log file for debugging
LOGFILE="/tmp/uci-defaults-log.txt"
echo "Starting 99-custom.sh at $(date)" >> $LOGFILE
echo "编译固件大小为: $PROFILE MB"
echo "Include Docker: $INCLUDE_DOCKER"
echo "Create pppoe-settings"
mkdir -p /home/build/immortalwrt/files/etc/config
# 创建pppoe配置文件 yml传入环境变量ENABLE_PPPOE等 写入配置文件 供99-custom.sh读取
cat << EOF > /home/build/immortalwrt/files/etc/config/pppoe-settings
enable_pppoe=${ENABLE_PPPOE}
pppoe_account=${PPPOE_ACCOUNT}
pppoe_password=${PPPOE_PASSWORD}
EOF
echo "cat pppoe-settings"
cat /home/build/immortalwrt/files/etc/config/pppoe-settings
# 输出调试信息
echo "$(date '+%Y-%m-%d %H:%M:%S') - 开始编译..."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment