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

完善glinet的pppoe拨号信息

parent d4002640
......@@ -59,20 +59,12 @@ jobs:
fi
fi
- name: Validate Inputs and Set Environment
env:
ENABLE_PPPOE: ${{ inputs.enable_pppoe }}
PPPOE_ACCOUNT: ${{ inputs.pppoe_account }}
PPPOE_PASSWORD: ${{ inputs.pppoe_password }}
run: |
echo "ENABLE_PPPOE=$ENABLE_PPPOE"
echo "PPPOE_ACCOUNT=$PPPOE_ACCOUNT"
echo "PPPOE_PASSWORD=$PPPOE_PASSWORD"
- name: Build Gl-iNet ImmortalWrt 23.05.4
run: |
profiles="${{ github.event.inputs.profile }}"
include_docker="${{ github.event.inputs.include_docker }}"
if [ "$profiles" = "glinet_gl-b2200" ]; then
tag=ipq40xx-generic-openwrt-23.05.4
echo "platform=ipq40xx/generic" >> $GITHUB_ENV
......@@ -93,6 +85,9 @@ jobs:
-v "${{ github.workspace }}/mediatek-filogic/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:$tag /bin/bash /home/build/immortalwrt/build.sh
done
......
#!/bin/sh
# 该脚本为immortalwrt首次启动时 运行的脚本 即 /etc/uci-defaults/99-custom.sh
# 设置默认防火墙规则,方便虚拟机首次访问 WebUI
uci set firewall.@zone[1].input='ACCEPT'
......@@ -8,37 +8,31 @@ uci add dhcp domain
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")
# 检查是否为物理网卡(排除回环设备和无线设备)
if [ -e "$iface/device" ] && echo "$iface_name" | grep -Eq '^eth|^en'; then
count=$((count + 1))
fi
done
# 网络设置
if [ "$count" -eq 1 ]; then
# 单网口设备 NAS模式
uci set network.lan.proto='dhcp'
elif [ "$count" -gt 1 ]; then
# 多网口设备
uci set network.lan.ipaddr='192.168.8.1'
# 判断是否启用 PPPoE
if [[ "$ENABLE_PPPOE" == "yes" ]]; then
echo "PPPoE is enabled."
# 设置拨号信息
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."
else
echo "PPPoE is not enabled. Skipping configuration."
fi
fi
# 检查配置文件是否存在
SETTINGS_FILE="/etc/config/pppoe-settings"
if [ ! -f "$SETTINGS_FILE" ]; then
echo "PPPoE settings file not found. Skipping." >> $LOGFILE
else
# 读取pppoe信息(由build.sh写入)
. "$SETTINGS_FILE"
fi
# 无需判断网卡数量 因为glinet是多网口
uci set network.lan.ipaddr='192.168.8.1'
echo "set 192.168.8.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
# 设置所有网口可访问网页终端
uci delete ttyd.@ttyd[0].interface
......
#!/bin/bash
# 该文件实际为imagebuilder容器内的build.sh
# yml 传入的路由器型号 PROFILE
echo "Building for profile: $PROFILE"
echo "Include Docker: $INCLUDE_DOCKER"
echo "Create pppoe-settings"
mkdir -p /home/build/immortalwrt/files/etc/config
# 创建pppoe配置文件 yml传入pppoe变量————>pppoe-settings文件
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') - Starting build process..."
......
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