commit 6893d04b9642fa4463c29d9ab6f482577ba4ccb1
Author: Daniel Kobras <d.kobras@science-computing.de>
Date:   Thu Nov 8 14:03:46 2012 +0100

    LU-2302 scripts: make lfs_migrate compatible with 1.8
    
    Earlier versions of lfs setstripe/getstripe use option -s instead
    of -S. Make sure lfs_migrate can be used with any version.
    
    Signed-off-by: Daniel Kobras <d.kobras@science-computing.de>
    Change-Id: Ic3caaeaf3d6c764afbd75cd7a8a7279462d21d47

diff --git a/lustre/scripts/lfs_migrate b/lustre/scripts/lfs_migrate
index c285510..2007d6b 100755
--- a/lustre/scripts/lfs_migrate
+++ b/lustre/scripts/lfs_migrate
@@ -17,6 +17,7 @@ set -e
 RSYNC=${RSYNC:-rsync}
 ECHO=echo
 LFS=${LFS:-lfs}
+LFS_SIZE_OPT="-s"
 
 usage() {
     cat -- <<USAGE 1>&2
@@ -90,6 +91,8 @@ $RSYNC --help 2>&1 | grep -q acls && RSYNC_OPTS="$RSYNC_OPTS -A"
 # If rsync copies lustre xattrs in the future, then we can skip lfs (bug 22189)
 strings $(which $RSYNC) 2>&1 | grep -q lustre && LFS=:
 
+$LFS getstripe --help 2>&1 | grep -q stripe-size && LFS_SIZE_OPT="-S"
+
 # rsync creates its temporary files with lenient permissions, even if
 # permissions on the original files are more strict. Tighten umask here
 # to avoid the brief window where unprivileged users might be able to
@@ -138,7 +141,8 @@ lfs_migrate() {
 			[ "$OPT_STRIPE_COUNT" ] && COUNT=$OPT_STRIPE_COUNT ||
 				COUNT=$($LFS getstripe -c "$OLDNAME" \
 					2> /dev/null)
-			SIZE=$($LFS getstripe -S "$OLDNAME" 2> /dev/null)
+			SIZE=$($LFS getstripe $LFS_SIZE_OPT "$OLDNAME" \
+			       2> /dev/null)
 
 			[ -z "$COUNT" -o -z "$SIZE" ] && UNLINK=""
 		fi
@@ -148,7 +152,8 @@ lfs_migrate() {
 			continue
 		fi
 
-		[ "$UNLINK" ] && $LFS setstripe -c${COUNT} -S${SIZE} "$NEWNAME"
+		[ "$UNLINK" ] && $LFS setstripe -c${COUNT} \
+		                      ${LFS_SIZE_OPT}${SIZE} "$NEWNAME"
 
 		# we use --inplace, since we created our own temp file already
 		if ! $RSYNC -a --inplace $RSYNC_OPTS "$OLDNAME" "$NEWNAME";then
