test/curl.sh
changeset 486 53789690374c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/curl.sh	Fri Jul 08 17:52:27 2016 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +#!/bin/bash
     1.5 +if [ $# -gt 0 ]; then
     1.6 +    razor="$1"
     1.7 +else
     1.8 +    razor=`pwd`/../src/razor
     1.9 +fi
    1.10 +check_file()
    1.11 +{
    1.12 +    $razor list-files | grep -F -x "$1" > /dev/null
    1.13 +    if [ $? -ne 0 ]; then
    1.14 +	echo $1: Not in database >&2
    1.15 +	$razor list-files >&2
    1.16 +	exit 1
    1.17 +    fi
    1.18 +    if [ ! -e "$tmproot$1" ]; then 
    1.19 +	echo $1: Not in filesystem >&2
    1.20 +	ls -R "$tmproot" >&2
    1.21 +	exit 1
    1.22 +    fi
    1.23 +}
    1.24 +tmproot=`mktemp -dt` || exit 1
    1.25 +export RAZOR_ROOT="file:$tmproot"
    1.26 +scratchdir=`mktemp -dt` || exit 1
    1.27 +(cd base && ../tftpd $scratchdir/tftpd.pid $scratchdir/tftpd.port) || exit 1
    1.28 +cd $scratchdir
    1.29 +port=`cat tftpd.port`
    1.30 +pid=`cat tftpd.pid`
    1.31 +export YUM_URL="tftp://localhost:$port/"
    1.32 +if $razor init; then
    1.33 +    :
    1.34 +else
    1.35 +    kill $pid
    1.36 +    exit 1
    1.37 +fi
    1.38 +if $razor import-yum; then
    1.39 +    :
    1.40 +else
    1.41 +    kill $pid
    1.42 +    exit 1
    1.43 +fi
    1.44 +if $razor install zap; then
    1.45 +    :
    1.46 +else
    1.47 +    kill $pid
    1.48 +    exit 1
    1.49 +fi
    1.50 +check_file /usr/bin/zap
    1.51 +rm -rf "$scratchdir" "$tmproot"
    1.52 +kill $pid
    1.53 +exit 0