+#!/bin/sh
+export rundir=/tmp/restore-$(date +%Y%m%d%H%M%S)
+if ! mkdir $rundir; then
+ echo 2> "Cannot create temp dir"
+ exit 1
+fi
+echo $rundir
+
+unset CDPATH
+export mountdir=$(cd $(dirname $0) && pwd)
+echo $mountdir
+
+SKIP=`awk '/^__ARCHIVE_FOLLOWS__/ { print NR + 1; exit 0; }' $0`
+
+# take the archive portion of this file and pipe it to tar
+tail +$SKIP $0 | tar xzf - -C $rundir
+
+exec $rundir/restore-script.sh ${1+"$@"}
+
+__ARCHIVE_FOLLOWS__