Add PATH=/bin:/usr/bin:/sbin:/usr/sbin to fsck.btrfs
[platform/upstream/btrfs-progs.git] / fsck.btrfs
1 #!/bin/sh -f
2 #
3 # Copyright (c) 2013 SUSE
4 #
5 # copied from fsck.xfs
6 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
7 #
8
9 # fsck.btrfs is a type of utility that should exist for any filesystem and is
10 # called during system setup when the corresponding /etc/fstab entries contain
11 # non-zero value for fs_passno. (See fstab(5) for more.)
12 #
13 # Traditional filesystems need to run their respective fsck utility in case the
14 # filesystem was not unmounted cleanly and the log needs to be replayed before
15 # mount. This is not needed for BTRFS. You should set fs_passno to 0.
16 #
17 # If you wish to check the consistency of a BTRFS filesystem or repair a
18 # damaged filesystem, see btrfs(8) subcommand 'check'. By default the
19 # filesystem consistency is checked, the repair mode is enabled via --repair
20 # option (use with care!).
21
22 PATH=/bin:/usr/bin:/sbin:/usr/sbin
23
24 AUTO=false
25 while getopts ":aApy" c
26 do
27         case $c in
28         a|A|p|y)        AUTO=true;;
29         esac
30 done
31 shift $(($OPTIND - 1))
32 eval DEV=\${$#}
33 if [ ! -e $DEV ]; then
34         echo "$0: $DEV does not exist"
35         exit 8
36 fi
37 if ! $AUTO; then
38         echo "If you wish to check the consistency of a BTRFS filesystem or"
39         echo "repair a damaged filesystem, see btrfs(8) subcommand 'check'."
40 fi
41 exit 0