From 6dc83b6b8ca7bf138152a027261da523d2544ccb Mon Sep 17 00:00:00 2001 From: EkkoG Date: Fri, 10 May 2024 17:32:01 +0800 Subject: [PATCH] Add all devive to lan --- build.sh | 2 +- .../files/etc/uci-defaults/99-add-all-device-to-lan | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 modules/add-all-device-to-lan/files/etc/uci-defaults/99-add-all-device-to-lan diff --git a/build.sh b/build.sh index 06ac177..dd84cb6 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -default_modules="add-feed-key add-feed ib argon base network opkg-mirror prefer-ipv6-settings statistics system tools" +default_modules="add-all-device-to-lan add-feed-key add-feed ib argon base network opkg-mirror prefer-ipv6-settings statistics system tools" echo "Default modules: $default_modules" diff --git a/modules/add-all-device-to-lan/files/etc/uci-defaults/99-add-all-device-to-lan b/modules/add-all-device-to-lan/files/etc/uci-defaults/99-add-all-device-to-lan new file mode 100755 index 0000000..de5b864 --- /dev/null +++ b/modules/add-all-device-to-lan/files/etc/uci-defaults/99-add-all-device-to-lan @@ -0,0 +1,12 @@ +wan_device=$(uci get network.wan.device) +all_devices=$(ip link show | grep -o "eth[0-9]\+") +all_devices=$(echo $all_devices | sed "s/$wan_device//g") + +uci delete network.@device[0].ports + +for device in $all_devices; do + uci add_list network.@device[0].ports=$device +done + +uci commit network +/etc/init.d/network restart \ No newline at end of file