btrfs-progs: fsck.btrfs: Fix bashism and bad getopts processing
authorDimitri John Ledkov <dimitri.j.ledkov@intel.com>
Thu, 21 May 2015 12:50:55 +0000 (13:50 +0100)
committerDavid Sterba <dsterba@suse.cz>
Thu, 21 May 2015 14:53:44 +0000 (16:53 +0200)
First fix == bashism, as that is not accepted by e.g. Debian/Ubuntu
dash.

Secondly shift OPTIND, such that last parameter is checked to exist.

Signed-off-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
fsck.btrfs

index f056a7f..e1eff2c 100755 (executable)
@@ -26,12 +26,13 @@ do
        a|A|p|y)        AUTO=true;;
        esac
 done
+shift $(($OPTIND - 1))
 eval DEV=\${$#}
 if [ ! -e $DEV ]; then
        echo "$0: $DEV does not exist"
        exit 8
 fi
-if [ "$AUTO" == "false" ]; then
+if ! $AUTO; then
        echo "If you wish to check the consistency of a BTRFS filesystem or"
        echo "repair a damaged filesystem, see btrfs(8) subcommand 'check'."
 fi