#!/bin/sh

set -e

ISO_IMG=/tmp/test.iso
MNT_PNT=/tmp/test_iso

echo '~~~ Create an iso image from the source tree'
genisoimage -jcharset ascii -r -o $ISO_IMG . 2>&1

echo '~~~ Mount the iso image'
fuseiso -p $ISO_IMG $MNT_PNT

echo '~~~ Check the iso image against the source tree'
find . -type f -ls -exec cmp {} $MNT_PNT/{} \;

echo '~~~ Unmount and remove the iso image'
fusermount -u $MNT_PNT
rm $ISO_IMG
