]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
UBUNTU: [Debian] module-inclusion -- commonise copy code and simplify
authorAndy Whitcroft <apw@canonical.com>
Thu, 26 Mar 2015 13:58:39 +0000 (13:58 +0000)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 20 Feb 2017 03:57:58 +0000 (20:57 -0700)
Signed-off-by: Andy Whitcroft <apw@canonical.com>
debian/scripts/module-inclusion

index deb07a8133a50e09b07ad7c83d9e4165aa69bbba..55752a7f091d14951186c758217b0a622118ccf3 100755 (executable)
@@ -5,7 +5,7 @@
 # The includsion list format must be a bash regular expression.
 #
 # usage: $0 ROOT INCLUSION_LIST
-# example: $0 debian/build/build-virtual \
+# example: $0 \
 #       debian/build/build-virtual-ALL debian/build/build-virtual \
 #      debian.master/control.d/virtual.inclusion-list
 master=0
@@ -23,38 +23,44 @@ ILIST=$3
 #
 mkdir -p ${NROOT}
 
-# Copy over the framework...
-if  [ "$master" -eq 1 ]; then
-       (cd ${ROOT}; find . ! -name "*.ko" -type f) | \
-       while read f
-       do
-               mkdir -p ${NROOT}/`dirname $f`
-               mv ${ROOT}/$f ${NROOT}/$f
-       done
-fi
+{
+       # Copy over the framework into the master package.
+       if  [ "$master" -eq 1 ]; then
+               (cd ${ROOT}; find . ! -name "*.ko" -type f)
+       fi
 
-cat ${ILIST} |while read i
+       # Copy over modules by name or pattern.
+       while read i
+       do
+               #
+               # 'find' blurts a warning if it cannot find any ko files.
+               #
+               case "$i" in
+               *\**)
+                       (cd ${ROOT}; eval find "${i}" -name "*.ko" || true)
+                       ;;
+               *)
+                       echo "$i"
+                       ;;
+               esac
+       done <"${ILIST}"
+# Copy over the listed modules.
+} | \
+while read i
 do
-       #
-       # 'find' blurts a warning if it cannot find any ko files.
-       #
-       if echo "$i" | grep '\*' > /dev/null
-       then
-               (cd ${ROOT}; eval find "${i}" -name "*.ko") |while read f
-               do
-                       mkdir -p ${NROOT}/`dirname $f`
-                       mv ${ROOT}/$f ${NROOT}/$f
-               done
+       # If this is already moved over, all is good.
+       if [ -f "${NROOT}/$i" ]; then
+               :
+
+       # If present in the source, moved it over.
+       elif [ -f "${ROOT}/$i" ]; then
+               mkdir -p "${NROOT}/`dirname $i`"
+               mv "${ROOT}/$i" "${NROOT}/$i"
+
+       # Otherwise, it is missing.
        else
-               if [ -f "${ROOT}/$i" ]
-               then
-                       mkdir -p ${NROOT}/`dirname $i`
-                       mv ${ROOT}/$i ${NROOT}/$i
-               else
-                       echo Warning: Could not find ${ROOT}/$i
-               fi
+               echo "Warning: Could not find ${ROOT}/$i" 1>&2
        fi
-
 done
 
 exit 0