#!/bin/bash
. "`dirname $0`/bootscriptfunctions.sh"
OSM_NO_ALT_ROOT="true"
source_emulator_functions _snapshot

if [ ! "$1" -o ! "$2" ]
then
	echo "no machine config specified" >&2
	echo "usage: `basename $0` <machine config> <package name>"
	exit 1
fi

if ! check_guest_lock -n $1
then
	panic "Machine config $1 currently in use"
fi

cp -f /var/lib/dpkg/info/$2.md5sums $OSM_ROOT/.image_snapshots/$1/_last_pkg_md5sums

if [ -d $OSM_SNAP_ROOT/$1 ]
then
	snapshot_create -t initial $1
fi
