test/archive.sh
author J. Ali Harlow <ali@juiblex.co.uk>
Thu Jul 07 11:04:10 2016 +0100 (2016-07-07)
changeset 478 8e4bf84a7bb8
permissions -rwxr-xr-x
Port KTM driver to URI-based API
     1 #!/bin/sh
     2 if [ $# -gt 0 ]; then
     3     razor="$1"
     4 else
     5     razor=`pwd`/../src/razor
     6 fi
     7 check_file()
     8 {
     9     (cd $scratchdir; $razor list-files) | grep -F -x "$1" > /dev/null
    10     if [ $? -ne 0 ]; then
    11 	echo $1: Not in database >&2
    12 	(cd $scratchdir; $razor list-files) >&2
    13 	exit 1
    14     fi
    15     if [ ! -e "$tmproot$1" ]; then 
    16 	echo $1: Not in filesystem >&2
    17 	ls -R "$tmproot" >&2
    18 	exit 1
    19     fi
    20 }
    21 tmproot=`mktemp -dt` || exit 1
    22 export RAZOR_ROOT="file:$tmproot"
    23 scratchdir=`mktemp -dt` || exit 1
    24 (cd $scratchdir; $razor init) || exit 1
    25 export YUM_URL="file:`pwd`/base.zip"
    26 (cd $scratchdir; $razor import-yum) || exit 1
    27 (cd $scratchdir; $razor install zap) || exit 1
    28 check_file /usr/bin/zap
    29 rm -rf "$scratchdir" "$tmproot"