test/relative-root.sh
changeset 499 c89e5edb8eae
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/relative-root.sh	Thu Jun 07 18:36:20 2018 +0100
     1.3 @@ -0,0 +1,32 @@
     1.4 +#!/bin/sh
     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 +    (cd /tmp; $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 +	(cd /tmp; $razor list-files) >&2
    1.16 +	exit 1
    1.17 +    fi
    1.18 +    if [ ! -e "$tmpdir$1" ]; then 
    1.19 +	echo $1: Not in filesystem >&2
    1.20 +	ls -R "$tmpdir" >&2
    1.21 +	exit 1
    1.22 +    fi
    1.23 +}
    1.24 +tmpdir=`mktemp --directory --tmpdir=/tmp` || exit 1
    1.25 +export RAZOR_ROOT="`echo $tmpdir | sed -e 's&/tmp/&file:&'`"
    1.26 +(cd /tmp; $razor init) || exit 1
    1.27 +export YUM_URL="file:`pwd`/base"
    1.28 +(cd /tmp; $razor import-yum) || exit 1
    1.29 +(cd /tmp; $razor install zap) || exit 1
    1.30 +(cd /tmp; $razor install --relocate /usr=/opt --relocate /etc=/opt/etc zsh) || exit 1
    1.31 +check_file /etc/zsh.conf
    1.32 +check_file /usr/bin/zap
    1.33 +check_file /opt/bin/zip
    1.34 +check_file /opt/bin/zsh
    1.35 +rm -rf "$tmpdir"