| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# debian/modulestest: a postbuild script to build zaptel modules |
| 4 |
# example usage: |
| 5 |
# |
| 6 |
# svn-buildpackage --svn-postbuild='debian/modulestest -r' --svn-ignore-new |
| 7 |
|
| 8 |
# At least one of the following two must be set to a sensible value: |
| 9 |
# If both are empty, the script does nothing useful) |
| 10 |
# |
| 11 |
# kernel versions: Comma-separated. Use those if you have their |
| 12 |
# kernel-headers/linux-headers packages installed |
| 13 |
# |
| 14 |
|
| 15 |
# Full pathes to trees: |
| 16 |
# Use this to provide a full path to a custom kernel tree: |
| 17 |
#KERNEL_SOURCES=$HOME/Proj/Debs/Kernel/SwSusp/linux-2.6.15-rc5 |
| 18 |
KERNEL_HEADERS= |
| 19 |
KERNEL_SOURCES= |
| 20 |
# run module-asustant with environment params that will generate |
| 21 |
# .changes files even without signing |
| 22 |
MODASS="env SIGNCHANGES=1 DEBSIGNCOMMAND=not_an_executable m-a" |
| 23 |
me=`basename $0` |
| 24 |
|
| 25 |
# workaround for silly bash parsing issue in our build scripts: |
| 26 |
if [ "$#" -lt 1 ]; then |
| 27 |
set -- $MODULESTEST_ARGS |
| 28 |
fi |
| 29 |
|
| 30 |
while getopts ah:rs:t arg |
| 31 |
do |
| 32 |
case "$arg" in |
| 33 |
a) # All of the kernel-headers packages installed: |
| 34 |
KERNEL_HEADERS=`COLUMNS=160 dpkg -l 'kernel-headers-2.[46].*-*-*' | awk '/^.i/{print $2}' | sed -e 's/^kernel-headers-//'| xargs| tr ' ' ,` |
| 35 |
;; |
| 36 |
h) KERNEL_HEADERS=$OPTARG;; |
| 37 |
s) KERNEL_SOURCES=$OPTARG;; |
| 38 |
r) KERNEL_HEADERS=`uname -r`;; |
| 39 |
t) # TODO: make this test per-distro or something |
| 40 |
KERNEL_HEADERS=2.4.27-2-386,2.6.8-2-686-smp |
| 41 |
;; |
| 42 |
esac |
| 43 |
done |
| 44 |
shift $(( $OPTIND-1 )) |
| 45 |
|
| 46 |
echo "Building for: Headers: $KERNEL_HEADERS, Sources: $KERNEL_SOURCES" |
| 47 |
|
| 48 |
if [ "$KERNEL_HEADERS" != '' ]; then hdrs_sw="-l $KERNEL_HEADERS"; fi |
| 49 |
if [ "$KERNEL_SOURCES" != '' ]; then srcs_sw="-k $KERNEL_SOURCES"; fi |
| 50 |
|
| 51 |
# must be absolute for m-a ta accept TARBALL: |
| 52 |
# Also note that $PWD is ugly and is about to be deleted. We need |
| 53 |
# $PWD/.. |
| 54 |
TOP_DIR=`dirname $PWD` |
| 55 |
MODS_DIR=$TOP_DIR/modules |
| 56 |
TAR_BALL=$MODS_DIR/usr/src/zaptel.tar.bz2 |
| 57 |
DEB=$TOP_DIR/$PACKAGE-source_${TAG_VERSION}_all.deb |
| 58 |
LOG_FILE=$TOP_DIR/$PACKAGE-modules-build-$TAG_VERSION.log |
| 59 |
|
| 60 |
rm -f $LOG_FILE |
| 61 |
dpkg -x $DEB $MODS_DIR |
| 62 |
|
| 63 |
if [ "$hdrs_sw" != '' ]; then |
| 64 |
TARBALL=$TAR_BALL $MODASS -u $TOP_DIR -t -i -f $hdrs_sw build $PACKAGE >>$LOG_FILE |
| 65 |
fi |
| 66 |
if [ "$srcs_sw" != '' ]; then |
| 67 |
TARBALL=$TAR_BALL $MODASS -u $TOP_DIR -t -i -f $srcs_sw build $PACKAGE >>$LOG_FILE |
| 68 |
fi |
| 69 |
|
| 70 |
ls -l $TOP_DIR/$PACKAGE-modules-*_$TAG_VERSION+*.deb |
| 71 |
echo "$me: Log file: $LOG_FILE" |