]>
Commit | Line | Data |
---|---|---|
48c46ee3 | 1 | #!/bin/sh -f |
959ef981 | 2 | # SPDX-License-Identifier: GPL-2.0 |
48c46ee3 | 3 | # Copyright (c) 2004 Silicon Graphics, Inc. All Rights Reserved. |
dfc130f3 | 4 | # |
d9eab45c | 5 | |
48c46ee3 | 6 | OPTS="" |
30626ef6 | 7 | USAGE="Usage: xfs_freeze [-V] [-f | -u] <mountpoint>" |
48c46ee3 NS |
8 | DIRNAME=`dirname $0` |
9 | VERSION=false | |
10 | FREEZE=false | |
11 | THAW=false | |
d9eab45c | 12 | |
48c46ee3 NS |
13 | while getopts "fuV" c |
14 | do | |
15 | case $c in | |
16 | f) FREEZE=true;; | |
17 | u) THAW=true;; | |
18 | V) VERSION=true;; | |
19 | \?) echo $USAGE 1>&2 | |
20 | exit 2 | |
21 | ;; | |
22 | esac | |
23 | done | |
24 | if $VERSION ; then | |
25 | $DIRNAME/xfs_io -p xfs_freeze -V | |
26 | exit 0 | |
27 | fi | |
d9eab45c | 28 | |
48c46ee3 NS |
29 | shift `expr $OPTIND - 1` |
30 | if [ "$1" = "" ]; then | |
31 | echo $USAGE 1>&2 | |
32 | exit 2 | |
33 | fi | |
d9eab45c | 34 | |
48c46ee3 | 35 | if $FREEZE ; then |
cd67dabb | 36 | $DIRNAME/xfs_io -F -r -p xfs_freeze -x -c "freeze" "$1" |
48c46ee3 NS |
37 | status=$? |
38 | [ $status -ne 0 ] && exit $status | |
39 | elif $THAW ; then | |
cd67dabb | 40 | $DIRNAME/xfs_io -F -r -p xfs_freeze -x -c "thaw" "$1" |
48c46ee3 NS |
41 | status=$? |
42 | [ $status -ne 0 ] && exit $status | |
43 | else | |
44 | echo $USAGE 1>&2 | |
45 | exit 2 | |
46 | fi | |
47 | exit 0 |