xref: /aosp_15_r20/external/openwrt-prebuilts/shared/uci-defaults/0_default_config (revision d6f4f085b8dbf0b98b41884788f204ed08472bcb)
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
10webrtc_device_id="cvd-1"
11words=$(cat /proc/cmdline)
12while
13    word=${words%%" "*}
14    if [ "$word" = "bridged_wifi_tap=true" ]; then
15        bridged_wifi_tap=true
16    elif echo "$word" | grep "^wan_gateway="; then
17        uci set network.wan.gateway=${word#*"="}
18    elif echo "$word" | grep "^wan_ipaddr="; then
19        uci set network.wan.ipaddr=${word#*"="}
20    elif echo "$word" | grep "^wan_broadcast="; then
21        uci set network.wan.broadcast=${word#*"="}
22    elif echo "$word" | grep "^webrtc_device_id="; then
23        webrtc_device_id=${word#*"="}
24    fi
25    next=${words#*" "}
26    [ "$words" != "$next" ]
27do
28    words=$next
29done
30
31if $bridged_wifi_tap; then
32    uci set network.wan.netmask="255.255.255.0"
33else
34    uci set network.wan.netmask="255.255.255.252"
35fi
36
37# Modify the path of the web service, luci.
38ln -sf $(readlink -f /www/cgi-bin/cgi-backup) /www/cgi-bin/cgi-backup
39ln -sf $(readlink -f /www/cgi-bin/cgi-download) /www/cgi-bin/cgi-download
40ln -sf $(readlink -f /www/cgi-bin/cgi-exec) /www/cgi-bin/cgi-exec
41ln -sf $(readlink -f /www/cgi-bin/cgi-upload) /www/cgi-bin/cgi-upload
42web_base="devices/$webrtc_device_id/openwrt"
43mkdir -p "/www/$web_base/"
44mv /www/cgi-bin "/www/$web_base/"
45mv /www/luci-static "/www/$web_base/"
46mv /www/index.html "/www/$web_base/"
47echo "<meta http-equiv=\"refresh\" content=\"0; url=$web_base/\" />" > /www/index.html
48uci set uhttpd.main.cgi_prefix="/$web_base/cgi-bin"
49uci delete uhttpd.main.lua_prefix
50uci add_list uhttpd.main.lua_prefix="/$web_base/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua"
51uci set uhttpd.main.ubus_prefix="/$web_base/ubus"
52uci set luci.main.mediaurlbase="/$web_base/luci-static/bootstrap"
53uci set luci.main.resourcebase="/$web_base/luci-static/resources"
54uci set luci.main.ubuspath="/$web_base/ubus/"
55uci set luci.themes.Bootstrap="/$web_base/luci-static/bootstrap"
56uci set luci.themes.BootstrapDark="/$web_base/luci-static/bootstrap-dark"
57uci set luci.themes.BootstrapLight="/$web_base/luci-static/bootstrap-light"
58
59uci commit
60
61# Regarding hostapd issue of OpenWRT 22.03.X versions, reboot it.
62reboot
63