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

24.10 x86 新增在UI上设置路由器管理地址

parent 02701e19
......@@ -3,6 +3,10 @@ name: build-x86-64-immortalwrt-24.10.2
on:
workflow_dispatch:
inputs:
custom_router_ip:
description: "请设置路由器的管理地址(仅对多网口路由器有效) 格式:192.168.x.1 10.x.x.1"
required: true
default: "192.168.100.1"
profile:
description: '请输入要编译固件大小 单位(MB)'
required: true
......@@ -42,7 +46,13 @@ jobs:
- name: Set executable permissions
run: chmod +x ${{ github.workspace }}/x86-64/build24.sh
- name: Save Custom Router IP into OpenWrt files
run: |
mkdir -p "${{ github.workspace }}/custom"
echo "${{ github.event.inputs.custom_router_ip }}" > "${{ github.workspace }}/custom/custom_router_ip.txt"
echo "您设置的路由器管理地址是:${{ github.event.inputs.custom_router_ip }}"
# 后续步骤会将该文件映射到路由器/etc/config/custom_router_ip.txt 以便用于开机脚本99-custom.sh读取用户设置的ip
- name: Validate PPPoE Inputs
run: |
if [[ "${{ inputs.enable_pppoe }}" == "yes" ]]; then
......@@ -54,42 +64,48 @@ jobs:
- name: Build ImmortalWrt-x86-64-efi
run: |
profiles="${{ github.event.inputs.profile }}"
profile="${{ github.event.inputs.profile }}"
include_docker="${{ github.event.inputs.include_docker }}"
IFS=',' read -r -a profile_array <<< "$profiles"
echo "Building for profile: $profile"
docker run --rm -i \
--user root \
-v "${{ github.workspace }}/bin:/home/build/immortalwrt/bin" \
-v "${{ github.workspace }}/files:/home/build/immortalwrt/files" \
-v "${{ github.workspace }}/custom:/home/build/immortalwrt/files/etc/config" \
-v "${{ github.workspace }}/x86-64/imm.config:/home/build/immortalwrt/.config" \
-v "${{ github.workspace }}/shell:/home/build/immortalwrt/shell" \
-v "${{ github.workspace }}/x86-64/build24.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.2 /bin/bash /home/build/immortalwrt/build.sh
for profile in "${profile_array[@]}"; do
echo "Building for profile: $profile"
docker run --rm -i \
--user root \
-v "${{ github.workspace }}/bin:/home/build/immortalwrt/bin" \
-v "${{ github.workspace }}/files:/home/build/immortalwrt/files" \
-v "${{ github.workspace }}/x86-64/imm.config:/home/build/immortalwrt/.config" \
-v "${{ github.workspace }}/shell:/home/build/immortalwrt/shell" \
-v "${{ github.workspace }}/x86-64/build24.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.2 /bin/bash /home/build/immortalwrt/build.sh
done
- name: Create info
run: |
cat > router-info.md <<EOF
# 📡 路由器后台信息
- 🏠 **后台地址**: ${{ github.event.inputs.custom_router_ip }}
- 👤 **用户名**: root
- 🔑 **密码**: 无
EOF
if [ "${{ github.event.inputs.include_docker }}" == "yes" ]; then
extra_content="#### 默认带docker"
echo -e "\n $extra_content" >> ${{ github.workspace }}/info.md
echo -e "\n $extra_content" >> ${{ github.workspace }}/router-info.md
else
echo -e "NO docker"
fi
- name: Upload ImmortWrt as release assets
uses: softprops/action-gh-release@v2.2.1
with:
tag_name: Autobuild-x86-64
body_path: ${{ github.workspace }}/info.md
body_path: ${{ github.workspace }}/router-info.md
files: |
${{ github.workspace }}/bin/targets/x86/64/*squashfs-combined-efi.img.gz
token: ${{ secrets.GITHUB_TOKEN }}
......
#!/bin/sh
# 99-custom.sh 就是immortalwrt固件首次启动时运行的脚本 位于固件内的/etc/uci-defaults/99-custom.sh
# Log file for debugging
LOGFILE="/tmp/uci-defaults-log.txt"
LOGFILE="/etc/config/uci-defaults-log.txt"
echo "Starting 99-custom.sh at $(date)" >>$LOGFILE
# 设置默认防火墙规则,方便虚拟机首次访问 WebUI
uci set firewall.@zone[1].input='ACCEPT'
......@@ -74,13 +74,18 @@ elif [ "$count" -gt 1 ]; then
fi
# LAN口设置静态IP
uci set network.lan.proto='static'
# 多网口设备 支持修改为别的ip地址,别的地址应该是网关地址,形如192.168.xx.1 项目说明里都强调过。
# 大家不能胡乱修改哦 比如有人修改为192.168.100.55 这是错误的理解 这个项目不能提前设置旁路地址
# 旁路的设置分2类情况,情况一是单网口的设备,默认是DHCP模式,ip应该在上一级路由器里查看。之后进入web页在设置旁路。
# 情况二旁路由如果是多网口设备,也应当用网关访问网页后,在自行在web网页里设置。总之大家不能直接在代码里修改旁路网关。千万不要徒增bug啦。
uci set network.lan.ipaddr='192.168.100.1'
# 多网口设备 支持修改为别的管理后台地址 在Github Action 的UI上自行输入即可 默认192.168.100.1
uci set network.lan.netmask='255.255.255.0'
echo "set 192.168.100.1 at $(date)" >>$LOGFILE
# 设置路由器管理后台地址
IP_VALUE_FILE="/etc/config/custom_router_ip.txt"
if [ -f "$IP_VALUE_FILE" ]; then
CUSTOM_IP=$(cat "$IP_VALUE_FILE")
# 设置路由器的管理后台地址
uci set network.lan.ipaddr=$CUSTOM_IP
echo "custom router ip is $CUSTOM_IP" >> $LOGFILE
fi
# 判断是否启用 PPPoE
echo "print enable_pppoe value=== $enable_pppoe" >>$LOGFILE
if [ "$enable_pppoe" = "yes" ]; then
......
......@@ -18,6 +18,7 @@ else
. "$SETTINGS_FILE"
fi
# 设置路由器管理后台地址
IP_VALUE_FILE="/etc/config/custom_router_ip.txt"
if [ -f "$IP_VALUE_FILE" ]; then
CUSTOM_IP=$(cat "$IP_VALUE_FILE")
......
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