compat-wireless: copy driver files only if present
authorLuis R. Rodriguez <mcgrof@qca.qualcomm.com>
Tue, 13 Dec 2011 19:33:32 +0000 (11:33 -0800)
committerLuis R. Rodriguez <mcgrof@qca.qualcomm.com>
Tue, 13 Dec 2011 19:33:32 +0000 (11:33 -0800)
This modifies admin-update.sh to only copy files over
from a driver target directory if files are found. This
should avoid a bunch of complaints of copying files
from directories that are just placeholders for other
folders, as happens with drivers/net/wireless/brcm80211/
which has folders a Makefile, Kconfig but no files there
itself:

brcmfmac/
brcmsmac/
brcmutil/
include
Kconfig
Makefile

Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
scripts/admin-update.sh

index 3e63e51b42a23e762b8110cb26bff80d2c35df1d..1aad4fa2710e6a234c88f175fef29a022bd9da0b 100755 (executable)
@@ -350,9 +350,18 @@ done
 # Drivers in their own directory
 for i in $DRIVERS; do
        mkdir -p $i
-       echo "Copying $GIT_TREE/$i/*.[ch]"
-       cp $GIT_TREE/$i/*.[ch] $i/
-       cp $GIT_TREE/$i/Makefile $i/
+
+       # -print -quit will just print once, so we don't burden
+       # this script with searching for further files if one is
+       # found
+       FILES_FOUND=$(find $GIT_TREE/$i/ -maxdepth 1 -type f -name \*.[ch] -print -quit | wc -l)
+       if [ $FILES_FOUND -eq 1 ]; then
+               echo "Copying $GIT_TREE/$i/*.[ch]"
+               cp $GIT_TREE/$i/*.[ch] $i/
+       fi
+       if [ -f $GIT_TREE/$i/Makefile ]; then
+               cp $GIT_TREE/$i/Makefile $i/
+       fi
        if [ -f $GIT_TREE/$i/Kconfig ]; then
                cp $GIT_TREE/$i/Kconfig $i/
        fi