From e3f20e605cd6748a1d21cf7b92b77d9aa8a104a5 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Thu, 31 May 2018 14:09:54 -0500 Subject: [PATCH] fsck: fix more bashisms command -v is a bashism, so we need to get rid of it. The shell returns an error code of 127 if it couldn't invoke xfs_repair, so teach repair2fsck_code to deal with this. Signed-off-by: Darrick J. Wong Reviewed-by: Allison Henderson Reviewed-by: Carlos Maiolino Signed-off-by: Eric Sandeen --- fsck/xfs_fsck.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/fsck/xfs_fsck.sh b/fsck/xfs_fsck.sh index 1916c07e2..6af0f224d 100755 --- a/fsck/xfs_fsck.sh +++ b/fsck/xfs_fsck.sh @@ -20,6 +20,10 @@ repair2fsck_code() { ;; 4) return 1 # The fs has been fixed ;; + 127) + echo "$NAME error: xfs_repair was not found!" 1>&2 + return 4 + ;; *) echo "$NAME error: An unknown return code from xfs_repair '$1'" 1>&2 return 4 # something went wrong with xfs_repair esac @@ -59,13 +63,7 @@ if [ -n "$PS1" -o -t 0 ]; then fi if $FORCE; then - XFS_REPAIR=`command -v xfs_repair` - if [ ! -x "$XFS_REPAIR" ] ; then - echo "$NAME error: xfs_repair was not found!" 1>&2 - exit 4 - fi - - $XFS_REPAIR -e $DEV + xfs_repair -e $DEV repair2fsck_code $? exit $? fi -- 2.47.2