From b141d6e1607173a33d083f1cff472a92831064bb Mon Sep 17 00:00:00 2001 From: Ned Bass Date: Fri, 14 Sep 2012 17:00:29 -0700 Subject: [PATCH] LU-1935 scripts: don't generate lustre init script An "overriding commands for target `lustre'" build warning resulted from the addition of lustre to the genscripts Makefile variable. In fact the genscripts processing is superfluous for the lustre script, so we could just fix the warning by removing it. However, generating the script from a .in file seems unnecessarily complicated, so this change goes a step further by making the script static. It now detects at run-time whether to use the ldiskfsprogs or the e2fsprogs utilities, instead of using autoconf macros to encode it at build time. Signed-off-by: Ned Bass Change-Id: Ie000a87adabbc2a001ed9ff2f5750041a5abea5b Reviewed-on: http://review.whamcloud.com/4015 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev --- lustre/autoconf/lustre-core.m4 | 1 - lustre/conf/lustre | 14 ++++++++++++++ lustre/scripts/Makefile.am | 4 ++-- lustre/scripts/{lustre.in => lustre} | 32 ++++++++++++++++++++++++-------- 4 files changed, 40 insertions(+), 11 deletions(-) rename lustre/scripts/{lustre.in => lustre} (96%) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 0539fee..b319312 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2530,7 +2530,6 @@ lustre/ptlrpc/gss/autoMakefile lustre/quota/Makefile lustre/quota/autoMakefile lustre/scripts/Makefile -lustre/scripts/lustre lustre/tests/Makefile lustre/tests/mpi/Makefile lustre/utils/Makefile diff --git a/lustre/conf/lustre b/lustre/conf/lustre index 3f894c3..a428f68 100644 --- a/lustre/conf/lustre +++ b/lustre/conf/lustre @@ -36,6 +36,20 @@ # #FSCK_ARGS="-p" +# By default the init script will check ldiskfs filesystems using +# /sbin/fsck.ldiskfs if it exists, otherwise it will use /sbin/fsck. +# Set the PFSCK variable here to override that behavior. The value must +# be an absolute path. +# +#PFSCK=/sbin/fsck + +# By default the init script will test ldiskfs feature flags using +# /sbin/tunefs.ldiskfs if it exists, otherwise it will use +# /sbin/tune2fs. Set the TUNE2FS variable here to override that +# behavior. The value must be an absolute path. +# +#TUNE2FS=/sbin/tune2fs + # Uncomment to insert server mount options - see mount.lustre(8) #MOUNT_OPTIONS="-o abort_recov" diff --git a/lustre/scripts/Makefile.am b/lustre/scripts/Makefile.am index 19fc744..04f9ee2 100644 --- a/lustre/scripts/Makefile.am +++ b/lustre/scripts/Makefile.am @@ -38,7 +38,7 @@ sbinscripts = lc_servip lustre_up14 lustre_rmmod lhbadm ldev # These are scripts that are generated from .in files genscripts = lustre_config lc_modprobe lc_net lc_hb lc_cluman lustre_createcsv \ - lc_md lc_lvm lustre_start lustre + lc_md lc_lvm lustre_start initdir = $(sysconfdir)/init.d init_SCRIPTS = lustre lnet @@ -52,7 +52,7 @@ bin_SCRIPTS = lustre_req_history lfs_migrate EXTRA_DIST = license-status maketags.sh version_tag.pl version_tag-git.pl \ version_tag-cvs.pl version_tag-none.pl lc_common \ $(addsuffix .in,$(genscripts)) lc_mon $(sbinscripts) \ - $(bin_SCRIPTS) make_META.pl lustre.in lnet lhbadm \ + $(bin_SCRIPTS) make_META.pl lustre lnet lhbadm \ haconfig ldev Lustre scriptlibdir = @libexecdir@/@PACKAGE@ diff --git a/lustre/scripts/lustre.in b/lustre/scripts/lustre similarity index 96% rename from lustre/scripts/lustre.in rename to lustre/scripts/lustre index ea8ac39..55c6601 100644 --- a/lustre/scripts/lustre.in +++ b/lustre/scripts/lustre @@ -8,6 +8,8 @@ # probe: true # config: /etc/sysconfig/lustre +PATH=/sbin:/usr/sbin:/bin:/usr/bin + # Source function library. . /etc/rc.d/init.d/functions @@ -41,6 +43,20 @@ ZPOOL_LAYOUT_MAP=${ZPOOL_LAYOUT_MAP:-""} MOUNT_DELAY=${MOUNT_DELAY:-2} LOAD_ZFS=${LOAD_ZFS:-""} +if [ -z "$TUNE2FS" ] ; then + TUNE2FS=`which tunefs.ldiskfs 2>/dev/null` + if [ -z "$TUNE2FS" ] ; then + TUNE2FS=`which tune2fs 2>/dev/null` + fi +fi + +if [ -z "$PFSCK" ] ; then + PFSCK=`which pfsck.ldiskfs 2>/dev/null` + if [ -z "$PFSCK" ] ; then + PFSCK=`which fsck 2>/dev/null` + fi +fi + shopt -s nullglob start_zfs_services () @@ -180,15 +196,15 @@ fsck_test () devices=`echo $devices |xargs -n 1|grep '^/'|xargs` if [ -n "${FSCK_ARGS}" -a -n "$devices" ]; then - if [ -x /sbin/@PFSCK@ ] ; then - echo "@PFSCK@ $devices -- ${FSCK_ARGS}" - /sbin/@PFSCK@ $devices -- ${FSCK_ARGS} + if [ -x $PFSCK ] ; then + echo "$PFSCK $devices -- ${FSCK_ARGS}" + $PFSCK $devices -- ${FSCK_ARGS} if [ $? -ne 0 -a $? -ne 1 ] ; then - echo "FAILED: @PFSCK@ -- ${FSCK_ARGS}: $?" + echo "FAILED: $PFSCK -- ${FSCK_ARGS}: $?" return 1 fi else - echo "/sbin/@PFSCK@ not found" + echo "$PFSCK not found" return 1 fi fi @@ -203,7 +219,7 @@ test_feature_flag() local result=1 local feature - for feature in `/sbin/@TUNE2FS@ -l $dev 2>/dev/null \ + for feature in `$TUNE2FS -l $dev 2>/dev/null \ | grep features: | sed -e 's/^.*: //'`; do if [ "$feature" == "$flag" ]; then result=0 @@ -222,13 +238,13 @@ mmp_test () local result=0 if [ "$REQUIRE_MMP_FEATURE" == "yes" ]; then - if [ -x /sbin/@TUNE2FS@ ]; then + if [ -x $TUNE2FS ]; then if ! test_feature_flag $dev "mmp"; then echo "mmp feature flag is not set on $dev" result=1 fi else - echo "/sbin/@TUNE2FS@ not found" + echo "$TUNE2FS not found" result=1 fi fi -- 1.8.3.1