diff -r 000000000000 -r 889dc38157ac test/relative-root.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/relative-root.sh Mon Mar 05 20:35:27 2018 +0000 @@ -0,0 +1,32 @@ +#!/bin/sh +if [ $# -gt 0 ]; then + razor="$1" +else + razor=`pwd`/../src/razor +fi +check_file() +{ + (cd /tmp; $razor list-files) | grep -F -x "$1" > /dev/null + if [ $? -ne 0 ]; then + echo $1: Not in database >&2 + (cd /tmp; $razor list-files) >&2 + exit 1 + fi + if [ ! -e "$tmpdir$1" ]; then + echo $1: Not in filesystem >&2 + ls -R "$tmpdir" >&2 + exit 1 + fi +} +tmpdir=`mktemp --directory --tmpdir=/tmp` || exit 1 +export RAZOR_ROOT="`echo $tmpdir | sed -e 's&/tmp/&file:&'`" +(cd /tmp; $razor init) || exit 1 +export YUM_URL="file:`pwd`/base" +(cd /tmp; $razor import-yum) || exit 1 +(cd /tmp; $razor install zap) || exit 1 +(cd /tmp; $razor install --relocate /usr=/opt --relocate /etc=/opt/etc zsh) || exit 1 +check_file /etc/zsh.conf +check_file /usr/bin/zap +check_file /opt/bin/zip +check_file /opt/bin/zsh +rm -rf "$tmpdir"