#!/bin/bash

if [ -z "$1" -o ! -d "$1" ]; then
	echo "usage: $0 <dir>"
	exit 1
fi

DEST=$1/RedHat/instimage
SRC=../../../RedHat/instimage
DEST1=$1/misc
SRC1=../../../misc

for n in $SRC $DEST $SRC1 $DEST1; do
	if [ ! -d $n ]; then
		echo "$n does not exist"
		exit 1
	fi
done

rm -rf $DEST $DEST1
mkdir -p $DEST $DEST1

(cd $SRC; tar cSpf - . | (cd $DEST; tar xvSpf -))

(cd $SRC1; tar cSpf - . | (cd $DEST1; tar xvSpf -))

