## Prepare temporary dir to store dvd files iftest-e tmp &&test-d tmp
then
rm -fr tmp
fi
mkdir tmp
## Extract contents of each disc*.iso to temporary dir for disc in $disc3 $disc2 $disc1 do
mdconfig -a -f $disc -u 66 iftest-e /dev/md66
then
echo Extract $disc ...
mount -t cd9660 /dev/md66 /mnt
tar -cf --C /mnt .| tar -xf --C tmp/
umount /mnt
mdconfig -d -u 66 else
echo Can not create memory disk. exit-1
fi
done
##Merge index to point to the first disc
echo Merge index ...
cd tmp
cat INDEX | sed "s/||2/||1/g"> index
cat index | sed "s/||3/||1/g"> INDEX
cat INDEX | sed "s/|3/|1/g"> index
mv index INDEX
cd ..
## Make dvd iso file
echo Make $dvd ...
mkisofs -R -no-emul-boot -b boot/cdboot -o $dvd tmp
rm -fr tmp