• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3opkg install /ipks/*
4ip link set eth0 mtu 1460
5
6rule_name=$(uci add network rule)
7
8# Extract configs from /proc/cmdline
9bridged_wifi_tap=false
10words=$(cat /proc/cmdline)
11while
12    word=${words%%" "*}
13    if [ "$word" = "bridged_wifi_tap=true" ]; then
14        bridged_wifi_tap=true
15    elif echo "$word" | grep "^wan_gateway="; then
16        uci set network.wan.gateway=${word#*"="}
17    elif echo "$word" | grep "^wan_ipaddr="; then
18        uci set network.wan.ipaddr=${word#*"="}
19    elif echo "$word" | grep "^wan_broadcast="; then
20        uci set network.wan.broadcast=${word#*"="}
21    fi
22    next=${words#*" "}
23    [ "$words" != "$next" ]
24do
25    words=$next
26done
27
28if $bridged_wifi_tap; then
29    uci set network.wan.netmask="255.255.255.0"
30else
31    uci set network.wan.netmask="255.255.255.252"
32fi
33
34uci commit
35
36# Regarding hostapd issue of OpenWRT 22.03.X versions, reboot it.
37reboot
38