# DKMS configuration for the OpenAFS kernel module. -*- sh -*-
-# look for arch in kernel version, this looks
-# like: 3.2.0-4-686-pae or 3.2.0-4-amd64
-ARCH=`echo $kernelver|awk -F"-" '{printf("%s",$3)}'`
+# For i386 and amd64, extract the architecture from the kernel version string.
+# The version string will look like 3.2.0-4-686-pae or 3.2.0-4-amd64. This
+# allows building amd64 kernel modules on the i386 architecture. Further
+# cases like this can be added later if other architectures have similar
+# issues.
+ARCH=`echo "$kernelver" | cut -d- -f 3`
case "$ARCH" in
- amd64) AFS_SYSNAME="amd64_linuxXX" ;;
- 486 | 686) AFS_SYSNAME="i386_linuxXX" ;;
- *) AFS_SYSNAME="NOTHING" ;;
+ amd64) AFS_SYSNAME="amd64_linuxXX" ;;
+ 486 | 686) AFS_SYSNAME="i386_linuxXX" ;;
+ *) AFS_SYSNAME="UNKNOWN" ;;
esac
-# the kernel version should be part of the SYSNAME
+# The kernel version should be part of the SYSNAME. We really only support
+# 2.6 and later, but be complete.
case "$kernelver" in
- 2.2.*) AFS_SYSKVERS=22 ;;
- 2.4.*) AFS_SYSKVERS=24 ;;
+ 2.2.*) AFS_SYSKVERS=22 ;;
+ 2.4.*) AFS_SYSKVERS=24 ;;
2.6.* | 3.*) AFS_SYSKVERS=26 ;;
- *) AFS_SYSKVERS=00;;
+ *) AFS_SYSKVERS=26 ;;
esac
-_AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
-AFS_SYSNAME="$_AFS_SYSNAME"
+AFS_SYSNAME=`echo "$AFS_SYSNAME" | sed "s/XX\$/$AFS_SYSKVERS/"`
# The version is replaced at build time by dh_dkms invoked in debian/rules.
PACKAGE_NAME="openafs"
PACKAGE_VERSION="#MODULE_VERSION#"
+# General DKMS settings.
BUILT_MODULE_NAME[0]="$PACKAGE_NAME"
DEST_MODULE_LOCATION[0]="/updates/dkms/"
AUTOINSTALL=yes
-if [ "${AFS_SYSNAME}" == "NOTHING" ]; then
- # we have no special SYSNAME so let configure make the magic
- MAKE[0]="(./configure --disable-linux-syscall-probing \
- --with-linux-kernel-packaging \
- --with-linux-kernel-headers=${kernel_source_dir} \
- && make \
- && mv src/libafs/MODLOAD-*/openafs.ko .)"
+# Tell configure the sysname if we were able to determine it.
+if [ "${AFS_SYSNAME}" = 'UNKNOWN' ] ; then
+ CONFIGURE_SYSNAME=
else
- # we already know who we are so go on
- MAKE[0]="(./configure --disable-linux-syscall-probing \
- --with-afs-sysname=${AFS_SYSNAME} \
- --with-linux-kernel-packaging \
- --with-linux-kernel-headers=${kernel_source_dir} \
- && make \
- && mv src/libafs/MODLOAD-*/openafs.ko .)"
+ CONFIGURE_SYSNAME="--with-afs-sysname=${AFS_SYSNAME}"
fi
+
+# Set the build and clean rules.
+MAKE[0]="(./configure --disable-linux-syscall-probing ${CONFIGURE_SYSNAME} \
+ --with-linux-kernel-packaging \
+ --with-linux-kernel-headers=${kernel_source_dir} \
+ && make \
+ && mv src/libafs/MODLOAD-*/openafs.ko .)"
CLEAN="rm -f openafs.ko && make clean"