. $DIR/function.sh
[ `id -u` -eq 0 ] || die "You must be root to run $0"
+running_any $STRONGSWANHOSTS && die "Please stop test environment before running $0"
check_commands debootstrap mkfs.ext3 partprobe qemu-img qemu-nbd sfdisk
[ `id -u` -eq 0 ] || die "You must be root to run $0"
[ -f $ROOTIMG ] || die "Root image $ROOTIMG not found"
[ -f $HOSTDIR ] || die "Hosts directory $HOSTSDIR not found"
+running_any $STRONGSWANHOSTS && die "Please stop test environment before running $0"
check_commands partprobe qemu-img qemu-nbd
[ `id -u` -eq 0 ] || die "You must be root to run $0"
[ -f "$BASEIMG" ] || die "Base image $BASEIMG not found"
+running_any $STRONGSWANHOSTS && die "Please stop test environment before running $0"
check_commands partprobe qemu-img qemu-nbd
[ `id -u` -eq 0 ] || die "You must be root to run $0"
[ -f "$BASEIMG" ] || die "Base image $BASEIMG not found"
[ -f "$ROOTIMG" ] || die "Root image $ROOTIMG not found"
+running_any $STRONGSWANHOSTS && die "Please stop test environment before running $0"
[ -f $SWANDIR/src/libstrongswan/asn1/oid.txt ] || die "strongSwan not found in $SWANDIR"
done
}
+# check if any of the given virtual guests are running
+# $* - names of guests to check
+running_any()
+{
+ command -v virsh >/dev/null || return 1
+ for host in $*
+ do
+ virsh list --name | grep "^$host$" >/dev/null && return 0
+ done
+ return 1
+}
+
#############################################
# search and replace strings throughout a
# whole directory