Whamcloud - gitweb
LU-9289 nodemap: fix fileset string length issue
[fs/lustre-release.git] / lustre-dkms_pre-build.sh
1 #!/bin/bash
2 # $1 : $module
3 # $2 : $module_version
4 # $3 : $kernelver
5 # $4 : $kernel_source_dir
6 # $5 : $arch
7 # $6 : $source_tree
8 # $7 : $dkms_tree
9
10 if [ $1 = "lustre-client" ] ; then
11         SERVER="--disable-server"
12         KERNEL_STUFF=""
13 else
14         SPL_VERSION=$(dkms status -m spl -k $3 -a $5 | awk -F', ' '{print $2; exit 0}' | grep -v ': added$')
15         if [ -z $SPL_VERSION ] ; then
16                 echo "spl-dkms package must already be installed and built under DKMS control"
17                 exit 1
18         fi
19         ZFS_VERSION=$(dkms status -m zfs -k $3 -a $5 | awk -F', ' '{print $2; exit 0}' | grep -v ': added$')
20         if [ -z $ZFS_VERSION ] ; then
21                 echo "zfs-dkms package must already be installed and built under DKMS control"
22                 exit 1
23         fi
24
25         SERVER="--enable-server --disable-ldiskfs --with-linux=$4 --with-linux-obj=$4 \
26                --with-spl=$6/spl-${SPL_VERSION} \
27                --with-spl-obj=$7/spl/${SPL_VERSION}/$3/$5 \
28                --with-zfs=$6/zfs-${ZFS_VERSION} \
29                --with-zfs-obj=$7/zfs/${ZFS_VERSION}/$3/$5"
30
31         KERNEL_STUFF="--with-linux=$4 --with-linux-obj=$4"
32 fi
33
34 PACKAGE_CONFIG="/etc/sysconfig/lustre"
35 DKMS_CONFIG_OPTS=$(
36     [[ -r ${PACKAGE_CONFIG} ]] \
37     && source ${PACKAGE_CONFIG} \
38     && shopt -q -s extglob \
39     && \
40     {
41       if [[ ${LUSTRE_DKMS_DISABLE_CDEBUG,,} == @(y|yes) ]]
42       then
43         echo --disable-libcfs-cdebug
44       fi
45       if [[ ${LUSTRE_DKMS_DISABLE_TRACE,,} == @(y|yes) ]]
46       then
47         echo --disable-libcfs-trace
48       fi
49       if [[ ${LUSTRE_DKMS_DISABLE_ASSERT,,} == @(y|yes) ]]
50       then
51         echo --disable-libcfs-assert
52       fi
53     }
54   )
55
56 rpm -qa | grep krb5-devel >/dev/null
57 if [ $? == 0 ] ; then
58         GSS="--enable-gss"
59 else
60         GSS="--disable-gss"
61 fi
62
63 # run a configure pass to clean "--enable-dist" only effect and also to
64 # ensure local/on-target environment to be taken into account for
65 # dkms.mkconf script customizations and before next build/MAKE step
66 ./configure --prefix=/usr --enable-modules --disable-iokit --disable-snmp \
67         --disable-doc --disable-utils --disable-tests --disable-maintainer-mode \
68         $KERNEL_STUFF $GSS $SERVER $DKMS_CONFIG_OPTS \
69         --disable-manpages --disable-dlc
70
71 if [ $? != 0 ] ; then
72         echo "configure error, check $7/$1/$2/build/config.log"
73         exit 1
74 fi
75
76 # now re-create dkms.conf based on configure result, to set accurate Lustre
77 # modules names that will be built and their future install locations, for
78 # next DKMS module install step
79 lustre/scripts/dkms.mkconf -n $1 -v $2 -f $6/$1-$2/dkms.conf