61 lines
1.1 KiB
Bash
Executable File
61 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
#
|
|
# Build a new directory of modules based on an inclusion list.
|
|
# The includsion list format must be a bash regular expression.
|
|
#
|
|
# usage: $0 ROOT INCLUSION_LIST
|
|
# example: $0 debian/build/build-virtual \
|
|
# debian/build/build-virtual-ALL debian/build/build-virtual \
|
|
# debian.master/control.d/virtual.inclusion-list
|
|
master=0
|
|
if [ "$1" = "--master" ]; then
|
|
master=1
|
|
shift
|
|
fi
|
|
|
|
ROOT=$1
|
|
NROOT=$2
|
|
ILIST=$3
|
|
|
|
#
|
|
# Prep a destination directory.
|
|
#
|
|
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
|
|
|
|
cat ${ILIST} |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
|
|
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
|
|
fi
|
|
|
|
done
|
|
|
|
exit 0
|