]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - io/xfs_freeze.sh
mkfs: use cvtnum from libfrog
[thirdparty/xfsprogs-dev.git] / io / xfs_freeze.sh
CommitLineData
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 6OPTS=""
30626ef6 7USAGE="Usage: xfs_freeze [-V] [-f | -u] <mountpoint>"
48c46ee3
NS
8DIRNAME=`dirname $0`
9VERSION=false
10FREEZE=false
11THAW=false
d9eab45c 12
48c46ee3
NS
13while getopts "fuV" c
14do
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
23done
24if $VERSION ; then
25 $DIRNAME/xfs_io -p xfs_freeze -V
26 exit 0
27fi
d9eab45c 28
48c46ee3
NS
29shift `expr $OPTIND - 1`
30if [ "$1" = "" ]; then
31 echo $USAGE 1>&2
32 exit 2
33fi
d9eab45c 34
48c46ee3 35if $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
39elif $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
43else
44 echo $USAGE 1>&2
45 exit 2
46fi
47exit 0