swconfig: fix vlan/port configs being applied to all switches
[openwrt.git] / package / base-files / files / etc / functions.sh
index acea617..e4b3bad 100755 (executable)
@@ -299,13 +299,17 @@ pi_include() {
        elif [ -f "$1" ]; then
                . "$1"
        elif [ -d "/tmp/overlay/$1" ]; then
        elif [ -f "$1" ]; then
                . "$1"
        elif [ -d "/tmp/overlay/$1" ]; then
-               for src_script in /tmp/overlay/$1/*.sh; do
-                       . "$src_script"
-               done
+               if [ -n "$(ls /tmp/overlay/$1/*.sh 2>/dev/null)" ]; then
+                       for src_script in /tmp/overlay/$1/*.sh; do
+                               . "$src_script"
+                       done
+               fi
        elif [ -d "$1" ]; then
        elif [ -d "$1" ]; then
-               for src_script in $1/*.sh; do
-                       . "$src_script"
-               done
+               if [ -n "$(ls $1/*.sh 2>/dev/null)" ]; then
+                       for src_script in $1/*.sh; do
+                               . "$src_script"
+                       done
+               fi
        else
                echo "WARNING: $1 not found"
                return 1
        else
                echo "WARNING: $1 not found"
                return 1
This page took 0.026994 seconds and 4 git commands to generate.