4 # Copyright (C) 2007 Karel Zak <kzak@redhat.com>
6 # This file is part of util-linux-ng.
8 # This file is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This file is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 TS_TOPDIR="$(dirname $0)/../.."
21 . $TS_TOPDIR/functions.sh
25 DIR_SRC="$TS_OUTDIR/mnt-move-src"
26 DIR_A="$TS_OUTDIR/mnt-move-A"
27 DIR_B="$TS_OUTDIR/mnt-move-B"
29 [ -d $DIR_SRC ] || mkdir $DIR_SRC
30 [ -d $DIR_A ] || mkdir $DIR_A
31 [ -d $DIR_B ] || mkdir $DIR_B
34 $TS_CMD_MOUNT --bind $DIR_SRC $DIR_A
37 egrep -q "^$DIR_SRC $DIR_A" /etc/mtab
38 [ "$?" == "0" ] || ts_die "Cannot found binded $DIR_SRC in /etc/mtab"
41 $TS_CMD_MOUNT --move $DIR_A $DIR_B
44 egrep -q "^$DIR_SRC $DIR_B" /etc/mtab
45 if [ "$?" != "0" ]; then
46 $TS_CMD_UMOUNT $DIR_SRC
47 ts_die "Cannot found moved $DIR_SRC in /etc/mtab"
51 $TS_CMD_UMOUNT $DIR_SRC
52 rmdir $DIR_SRC $DIR_A $DIR_B