test/relative-root.sh
author J. Ali Harlow <ali@juiblex.co.uk>
Fri Jul 08 15:54:49 2016 +0100 (2016-07-08)
changeset 482 6a8a57779674
permissions -rwxr-xr-x
Release 0.6.3.101
     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 /tmp; $razor list-files) | grep -F -x "$1" > /dev/null
    10     if [ $? -ne 0 ]; then
    11 	echo $1: Not in database >&2
    12 	(cd /tmp; $razor list-files) >&2
    13 	exit 1
    14     fi
    15     if [ ! -e "$tmpdir$1" ]; then 
    16 	echo $1: Not in filesystem >&2
    17 	ls -R "$tmpdir" >&2
    18 	exit 1
    19     fi
    20 }
    21 tmpdir=`mktemp --directory --tmpdir=/tmp` || exit 1
    22 export RAZOR_ROOT="`echo $tmpdir | sed -e 's&/tmp/&file:&'`"
    23 (cd /tmp; $razor init) || exit 1
    24 export YUM_URL="file:`pwd`/base"
    25 (cd /tmp; $razor import-yum) || exit 1
    26 (cd /tmp; $razor install zap) || exit 1
    27 (cd /tmp; $razor install --relocate /usr=/opt --relocate /etc=/opt/etc zsh) || exit 1
    28 check_file /etc/zsh.conf
    29 check_file /usr/bin/zap
    30 check_file /opt/bin/zip
    31 check_file /opt/bin/zsh
    32 rm -rf "$tmpdir"