Whamcloud - gitweb
LU-1935 scripts: don't generate lustre init script
authorNed Bass <bass6@llnl.gov>
Sat, 15 Sep 2012 00:00:29 +0000 (17:00 -0700)
committerOleg Drokin <green@whamcloud.com>
Thu, 4 Oct 2012 18:06:07 +0000 (14:06 -0400)
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 <bass6@llnl.gov>
Change-Id: Ie000a87adabbc2a001ed9ff2f5750041a5abea5b
Reviewed-on: http://review.whamcloud.com/4015
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/conf/lustre
lustre/scripts/Makefile.am
lustre/scripts/lustre [moved from lustre/scripts/lustre.in with 96% similarity]

index 0539fee..b319312 100644 (file)
@@ -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
index 3f894c3..a428f68 100644 (file)
 #
 #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"
 
index 19fc744..04f9ee2 100644 (file)
@@ -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@
similarity index 96%
rename from lustre/scripts/lustre.in
rename to lustre/scripts/lustre
index ea8ac39..55c6601 100644 (file)
@@ -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