mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-06 11:24:07 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
/etc/init.d/docker-lan boot 2>/dev/null
|
||||
|
||||
uci_find_section()
|
||||
{
|
||||
local config="$1"
|
||||
local type="$2"
|
||||
local key="$3"
|
||||
local value="$4"
|
||||
local section
|
||||
|
||||
uci show $config | grep -E '^'$config'\.[^\.]+\.'$key'='"'$value'"'$' | sed 's/\.'$key'='"'$value'"'$//' | while read section; do
|
||||
[ "$type" = "`uci get "$section"`" ] && echo $section
|
||||
done
|
||||
}
|
||||
|
||||
section=`uci_find_section network device name br-lan | head -n1`
|
||||
if [ -n "$section" ]; then
|
||||
uci get "$section.ports" | grep -wq docker-lan-op || uci add_list "$section.ports=docker-lan-op"
|
||||
else
|
||||
ifnames="`uci get network.lan.device`"
|
||||
if [ -n "$ifnames" ]; then
|
||||
echo "$ifnames" | grep -wq docker-lan-op || {
|
||||
ifnames="$ifnames docker-lan-op"
|
||||
uci set network.lan.device="$ifnames"
|
||||
uci set network.lan.type='bridge'
|
||||
}
|
||||
else
|
||||
echo "uci get lan ports failed!" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
uci commit network
|
||||
|
||||
/etc/init.d/network reload
|
||||
|
||||
exit 0
|
||||
Reference in new issue
Block a user