backport to buster
[hcoop/debian/openafs.git] / debian / openafs-modules-dkms.dkms
1 # DKMS configuration for the OpenAFS kernel module. -*- sh -*-
2
3 # For i386 and amd64, extract the architecture from the kernel version string.
4 # The version string will look like 3.2.0-4-686-pae or 3.2.0-4-amd64. This
5 # allows building amd64 kernel modules on the i386 architecture. Further
6 # cases like this can be added later if other architectures have similar
7 # issues.
8 ARCH=`echo "$kernelver" | cut -d- -f 3`
9 case "$ARCH" in
10 amd64) AFS_SYSNAME="amd64_linuxXX" ;;
11 486 | 686) AFS_SYSNAME="i386_linuxXX" ;;
12 *) AFS_SYSNAME="UNKNOWN" ;;
13 esac
14
15 # The kernel version should be part of the SYSNAME. We really only support
16 # 2.6 and later, but be complete.
17 case "$kernelver" in
18 2.2.*) AFS_SYSKVERS=22 ;;
19 2.4.*) AFS_SYSKVERS=24 ;;
20 2.6.* | 3.*) AFS_SYSKVERS=26 ;;
21 *) AFS_SYSKVERS=26 ;;
22 esac
23 AFS_SYSNAME=`echo "$AFS_SYSNAME" | sed "s/XX\$/$AFS_SYSKVERS/"`
24
25 # The version is replaced at build time by dh_dkms invoked in debian/rules.
26 PACKAGE_NAME="openafs"
27 PACKAGE_VERSION="#MODULE_VERSION#"
28
29 # General DKMS settings.
30 BUILT_MODULE_NAME[0]="$PACKAGE_NAME"
31 DEST_MODULE_LOCATION[0]="/updates/dkms/"
32 AUTOINSTALL=yes
33
34 # Tell configure the sysname if we were able to determine it.
35 if [ "${AFS_SYSNAME}" = 'UNKNOWN' ] ; then
36 CONFIGURE_SYSNAME=
37 else
38 CONFIGURE_SYSNAME="--with-afs-sysname=${AFS_SYSNAME}"
39 fi
40
41 # Set the build and clean rules.
42 MAKE[0]="(./configure --disable-linux-syscall-probing ${CONFIGURE_SYSNAME} \
43 --with-linux-kernel-packaging \
44 --with-linux-kernel-headers=${kernel_source_dir} \
45 && make \
46 && mv src/libafs/MODLOAD-*/openafs.ko .)"
47 CLEAN="rm -f openafs.ko && make clean"