Whamcloud - gitweb
LU-17461 dkms: improve /etc/sysconfig/lustre 87/53787/1
authorShaun Tancheff <shaun.tancheff@hpe.com>
Tue, 23 Jan 2024 18:32:32 +0000 (01:32 +0700)
committerShaun Tancheff <shaun.tancheff@hpe.com>
Tue, 23 Jan 2024 18:38:42 +0000 (01:38 +0700)
Expand the features available in /etc/sysconfig/lustre
to enable more flexability to dkms users.

Providing y/n switches for common features:
    LUSTRE_DKMS_ENABLE_GSS=y/n
    LUSTRE_DKMS_ENABLE_GSS_KEYRING=y/n
    LUSTRE_DKMS_ENABLE_CRYPTO=y/n
    LUSTRE_DKMS_ENABLE_IOKIT=y/n

As well as a catch-all to pass to configure:
    LUSTRE_DKMS_CONFIGURE_EXTRA='string passed to configure'

Add suport for dpkg checking for libkrb5-dev to enable or
disable gss by default, if it is not otherwise specifed.

HPE-bug-id: LUS-12097
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: Id8dd17c867d9aeb1ec27632729433ba128dcfd0a

lustre-dkms_pre-build.sh

index 330e498..1607827 100755 (executable)
@@ -86,26 +86,47 @@ DKMS_CONFIG_OPTS=$(
     && shopt -q -s extglob \
     && \
     {
-      if [[ ${LUSTRE_DKMS_DISABLE_CDEBUG,,} == @(y|yes) ]]
-      then
-       echo --disable-libcfs-cdebug
+      if [[ -n ${LUSTRE_DKMS_DISABLE_CDEBUG} ]] ; then
+         [[ ${LUSTRE_DKMS_DISABLE_CDEBUG,,} == @(y|yes) ]] &&
+            echo --disable-libcfs-cdebug || echo --enable-libcfs-cdebug
       fi
-      if [[ ${LUSTRE_DKMS_DISABLE_TRACE,,} == @(y|yes) ]]
-      then
-       echo --disable-libcfs-trace
+      if [[ -n ${LUSTRE_DKMS_DISABLE_TRACE} ]] ; then
+         [[ ${LUSTRE_DKMS_DISABLE_TRACE,,} == @(y|yes) ]] &&
+            echo --disable-libcfs-trace || echo --enable-libcfs-trace
       fi
-      if [[ ${LUSTRE_DKMS_DISABLE_ASSERT,,} == @(y|yes) ]]
-      then
-       echo --disable-libcfs-assert
+      if [[ -n ${LUSTRE_DKMS_DISABLE_ASSERT} ]] ; then
+         [[ ${LUSTRE_DKMS_DISABLE_ASSERT,,} == @(y|yes) ]] &&
+            echo --disable-libcfs-assert || echo --disable-libcfs-assert
       fi
+      if [[ -n ${LUSTRE_DKMS_ENABLE_GSS} ]] ; then
+         [[ ${LUSTRE_DKMS_ENABLE_GSS,,} == @(y|yes) ]] &&
+            echo --enable-gss || echo --disable-gss
+      fi
+      if [[ -n ${LUSTRE_DKMS_ENABLE_GSS_KEYRING} ]] ; then
+         [[ ${LUSTRE_DKMS_ENABLE_GSS_KEYRING,,} == @(y|yes) ]] &&
+            echo --enable-gss-keyring || echo --disable-gss-keyring
+      fi
+      if [[ -n ${LUSTRE_DKMS_ENABLE_CRYPTO} ]] ; then
+         [[ ${LUSTRE_DKMS_ENABLE_CRYPTO,,} == @(y|yes) ]] &&
+            echo --enable-crypto || echo --disable-crypto
+      fi
+      if [[ -n ${LUSTRE_DKMS_ENABLE_IOKIT} ]] ; then
+         [[ ${LUSTRE_DKMS_ENABLE_IOKIT,,} == @(y|yes) ]] &&
+            echo --enable-iokit || echo --disable-iokit
+      fi
+      [[ -n ${LUSTRE_DKMS_CONFIGURE_EXTRA} ]] && echo ${LUSTRE_DKMS_CONFIGURE_EXTRA}
     }
   )
 
-rpm -qa | grep krb5-devel >/dev/null
-if [ $? == 0 ] ; then
-       GSS="--enable-gss"
-else
-       GSS="--disable-gss"
+echo "${DKMS_CONFIG_OPTS} " | grep -E -q -- '--disable-gss[^-]|--enable-gss[^-]'
+if [ $? != 0 ] ; then
+    # User did not force, guess for rpm distros
+    rpm -qa | grep krb5-devel >/dev/null
+    [[ $? == 0 ]] && GSS="--enable-gss" || GSS="--disable-gss"
+
+    # guess for deb distros
+    dpkg -l | grep libkrb5-dev | grep -q ^ii
+    [[ $? == 0 ]] && GSS="--enable-gss" || GSS="--disable-gss"
 fi
 
 # run a configure pass to clean "--enable-dist" only effect and also to