#!/bin/bash


##### make the initrd #########
# make the fs
dd if=/dev/zero of=temp/initrd.img bs=1k count=6200

mkfs.ext2 -F temp/initrd.img

# mount the initrd
sudo mount -o loop temp/initrd.img temp/temproot

# copy root to the initrd
sudo cp -r root/* temp/temproot/

# unmount
sudo umount temp/initrd.img

# gzip the initrd
gzip temp/initrd.img

# copy initrd to isolinux dir
mv -f temp/initrd.img.gz isolinux/initrd.img

###############################

##### make the iso ############
# clean up first
rm -rf temp/cdbuild/*
# copy files
cp -r isolinux temp/cdbuild/
cp -r addons temp/cdbuild/

#make the iso
mkisofs -R -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o the_hacked_installer.iso -publisher 'Adarsh Amirtham' temp/cdbuild/
