]>
Commit | Line | Data |
---|---|---|
2bd0ea18 NS |
1 | #!/bin/sh -f |
2 | # | |
0d3e0b37 | 3 | # Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. |
dfc130f3 | 4 | # |
2bd0ea18 | 5 | |
4af916f8 BN |
6 | status=0 |
7 | DB_OPTS="" | |
8 | REPAIR_OPTS="" | |
22bc10ed | 9 | USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-U uuid] device" |
2bd0ea18 | 10 | |
22bc10ed | 11 | while getopts "efjlpuc:L:U:V" c |
2bd0ea18 NS |
12 | do |
13 | case $c in | |
4af916f8 BN |
14 | c) REPAIR_OPTS=$REPAIR_OPTS" -c lazycount="$OPTARG;; |
15 | e) DB_OPTS=$DB_OPTS" -c 'version extflg'";; | |
16 | f) DB_OPTS=$DB_OPTS" -f";; | |
17 | j) DB_OPTS=$DB_OPTS" -c 'version log2'";; | |
18 | l) DB_OPTS=$DB_OPTS" -r -c label";; | |
19 | L) DB_OPTS=$DB_OPTS" -c 'label "$OPTARG"'";; | |
22bc10ed | 20 | p) DB_OPTS=$DB_OPTS" -c 'version projid32bit'";; |
4af916f8 BN |
21 | u) DB_OPTS=$DB_OPTS" -r -c uuid";; |
22 | U) DB_OPTS=$DB_OPTS" -c 'uuid "$OPTARG"'";; | |
138aab65 CH |
23 | V) xfs_db -p xfs_admin -V |
24 | status=$? | |
25 | exit $status | |
26 | ;; | |
2bd0ea18 NS |
27 | \?) echo $USAGE 1>&2 |
28 | exit 2 | |
29 | ;; | |
30 | esac | |
31 | done | |
32 | set -- extra $@ | |
33 | shift $OPTIND | |
34 | case $# in | |
4af916f8 BN |
35 | 1) if [ -n "$DB_OPTS" ] |
36 | then | |
37 | eval xfs_db -x -p xfs_admin $DB_OPTS $1 | |
38 | status=$? | |
39 | fi | |
40 | if [ -n "$REPAIR_OPTS" ] | |
41 | then | |
42 | # Hide normal repair output which is sent to stderr | |
43 | # assuming the filesystem is fine when a user is | |
44 | # running xfs_admin. | |
45 | # Ideally, we need to improve the output behaviour | |
46 | # of repair for this purpose (say a "quiet" mode). | |
47 | eval xfs_repair $REPAIR_OPTS $1 2> /dev/null | |
48 | status=`expr $? + $status` | |
49 | if [ $status -ne 0 ] | |
50 | then | |
51 | echo "Conversion failed, is the filesystem unmounted?" | |
52 | fi | |
53 | fi | |
2bd0ea18 NS |
54 | ;; |
55 | *) echo $USAGE 1>&2 | |
56 | exit 2 | |
57 | ;; | |
58 | esac | |
59 | exit $status |