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

23.04.5 x86 新增用户设置路由器管理地址功能

parent edeca3ec
......@@ -3,6 +3,10 @@ name: build-x86-64-immortalwrt-23.05.4
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,6 +46,14 @@ jobs:
- name: Set executable permissions
run: chmod +x ${{ github.workspace }}/x86-64/build23.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
......@@ -65,6 +77,7 @@ jobs:
--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/build23.sh:/home/build/immortalwrt/build.sh" \
......@@ -78,9 +91,16 @@ jobs:
- 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
......
......@@ -86,7 +86,7 @@ jobs:
- name: Create info
run: |
cat > router-info.md <<EOF
# 📡 路由器后台信息
## 📡 路由器后台信息
- 🏠 **后台地址**: ${{ github.event.inputs.custom_router_ip }}
- 👤 **用户名**: root
......
......@@ -74,15 +74,18 @@ elif [ "$count" -gt 1 ]; then
fi
# LAN口设置静态IP
uci set network.lan.proto='static'
# 多网口设备 支持修改为别的管理后台地址 在Github Action 的UI上自行输入即可 默认192.168.100.1
# 多网口设备 支持修改为别的管理后台地址 在Github Action 的UI上自行输入即可
uci set network.lan.netmask='255.255.255.0'
# 设置路由器管理后台地址
IP_VALUE_FILE="/etc/config/custom_router_ip.txt"
if [ -f "$IP_VALUE_FILE" ]; then
CUSTOM_IP=$(cat "$IP_VALUE_FILE")
# 设置路由器的管理后台地址
# 用户在UI上设置路由器后台管理地址
uci set network.lan.ipaddr=$CUSTOM_IP
echo "custom router ip is $CUSTOM_IP" >> $LOGFILE
else
uci set network.lan.ipaddr='192.168.100.1'
echo "default router ip is 192.168.100.1" >> $LOGFILE
fi
......
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