1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
#!/bin/bash
set -e
$PREPARE_CLEAN > /dev/null
$INCLUDE_FUNCS
# We test the softroot feature, with the additional handicap
# that we try to use it on a simulated snapshot.
#
# Szenario:
# / is versioned; a snapshot is taken and mounted in some
# directory. From there a commit gets done.
# The WAA and CONF should be the 6666* ones (for /), so
# that revert/diff etc. for / work immediately after the commit.
logfile=$LOGDIR/051.softroot
SRDIR=$WC/softroot
# /bin/ and /sbin/ might be symlinks!
DIR=/etc
FILE=$DIR/hosts
if [[ ! -e $FILE ]]
then
$WARN "Cannot test without $FILE"
exit
fi
# First we define / as base directory, and put some entries
# in the repository.
# We have FSVS_WAA and _CONF defined, so let's go!
cd /
echo $REPURL | $BINq urls load
# We take only this single entry from the root directory.
echo './**' | $BINq ignore load
# make sure there's no old data
rm `$PATH2SPOOL . dir` 2> /dev/null || true
$BINq add $FILE
# Now something is in / that could be committed.
# Populate the softroot - for real snapshots that would require
# LVM and a matching filesystem, so we cheat here.
mkdir -p $SRDIR/$DIR
cp -a $FILE $SRDIR/$DIR/
# We commit via the "snapshot"
# To do this, we fake the FSVS_WAA and FSVS_CONF directories to
# appear (to a strcmp) to be within the softroot, so they don't
# get appended again.
FSVS_WAA=$SRDIR/../../../../../../$FSVS_WAA \
FSVS_CONF=$SRDIR/../../../../../../$FSVS_CONF \
$BINdflt commit -m "x" -o softroot=$SRDIR $SRDIR > $logfile
# Now owner and group will be different ... "cp -a" can't copy
# them for normal users. So we look for text changes only.
if [[ `$BINdflt st -C -o filter=text | wc -l` == 0 ]]
then
$SUCCESS "Commit on softroot"
else
$ERROR_NB "unexpected status output"
$BINdflt st -C -o filter=text
$ERROR_NB "Full output:"
$BINdflt st -C
$ERROR "Status output after commit on softroot"
fi
|