#!/bin/bash
echo "Setting up the CD manifests"
chmod +w cd/casper/filesystem.manifest
chroot source dpkg-query -W --showformat '${Package} ${Version}\n' > cd/casper/filesystem.manifest
cp cd/casper/filesystem.manifest cd/casper/filesystem.manifest-desktop
sed -ie '/ubiquity/d' cd/casper/filesystem.manifest-desktop
echo "Making sure that the two manifests are different from each other"
diff cd/casper/filesystem.manifest cd/casper/filesystem.manifest-desktop
echo "Remove the old filesystem.squashfs"
rm cd/casper/filesystem.squashfs
echo "Making new filesystem.squashfs - takes a looooooong time"
mksquashfs source cd/casper/filesystem.squashfs
echo "Removing old md5sum and creating new one"
rm cd/md5sum.txt
echo "Finally create the iso image."
echo "You currently have the following versions of the image:"
echo
ls -w 1 ubuntu-6.06.1-EprintsServer-Version-*
echo
echo -n "Do you want to continue?"
echo
while [ "y" != "$answer" ] && [ "n" != "$answer" ];
do
echo 'Enter y for "Yes" or n for "No" '
read answer
done
if [ "$answer" == "n" ]
then
echo "Ending Script"
exit 0
else
echo -n "What version of the image is this? "
read vnum
echo "Creating oubuntu-6.06.1-EprintsServer-Version-"$vnum".iso"
cd cd && find . -type f -print0 |xargs -0 md5sum > md5sum.txt
mkisofs -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../ubuntu-6.06.1-EprintsServer-Version-"$vnum".iso .
fi