From 8144e88c9e431247b151a3cceb338cf0dee8abe7 Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Wed, 24 Jan 2024 01:32:32 +0700 Subject: [PATCH] LU-17461 dkms: improve /etc/sysconfig/lustre 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 Change-Id: Id8dd17c867d9aeb1ec27632729433ba128dcfd0a --- lustre-dkms_pre-build.sh | 49 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/lustre-dkms_pre-build.sh b/lustre-dkms_pre-build.sh index 330e498..1607827 100755 --- a/lustre-dkms_pre-build.sh +++ b/lustre-dkms_pre-build.sh @@ -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 -- 1.8.3.1