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

完善glinet的pppoe拨号信息

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