]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
fsck: fix more bashisms
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 31 May 2018 19:09:54 +0000 (14:09 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 31 May 2018 19:09:54 +0000 (14:09 -0500)
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 <darrick.wong@oracle.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
fsck/xfs_fsck.sh

index 1916c07e252d75ee5e0f655a520c019f533ef205..6af0f224db7282c0d0c2787c8322bf1227fed6dc 100755 (executable)
@@ -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