apt-get install mkisofs
mkdir /tmp/custom_iso
cd /tmp/custom_iso/
mount -t iso9660 -o loop ~/original.iso /mnt/
cd /mnt
mnt is read-only, thus we need to copy the files in it in order to modify the files.
tar cf - . | (cd /tmp/custom_iso; tar xfp -)
You can now modify the files for making a preseed for example!
If not, go back to your /tmp/custom_iso folder
cd /tmp/custom_iso
Copy this line, modify it and paste it in order to create the .iso
mkisofs -o output.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V "Ubuntu Custom ISO Preseed" .
Install isohybrid:
sudo apt install syslinux-utils
Then simply type the following to make it bootable:
sudo isohybrid output.iso
use xorriso
to create an ISO from directory:
xorriso -as mkisofs -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -o /dest/iso /tmp/ubnt-custom/
Follow https://brew.sh/
In order to install mkisofs, you need to get the cdrtools package for macOS:
brew install cdrtools
Make two folders: iso and custom.
ro_iso
is going to be where the files of the iso will be mounted, read only.
custom
will be where you will be able to modify the files
mkdir ro_iso && mkdir custom
hdiutil attach -nomount ubuntu.iso
List the disks and get the disk image name usually /dev/disk2
:
diskutil list
We will use /dev/disk2
.
Now you can mount the disk into the read-only folder:
mount -t cd9660 /dev/disk2 ro_iso
We now need to copy the files in the custom
folder in order to modify the files:
tar cf - . | (cd $HOME/yourfolder/custom; tar xfp -)
You can now begin editing the files.
If not yet, go back to your custom
folder.
Copy this line, modify it and paste it in order to create the .iso
sudo mkisofs -o output.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V "Ubuntu Custom ISO Preseed" .
Use the isohybrid.pl
file of this gist like the following:
sudo perl isohybrid.pl output.iso
Don't forget to do it, or you will can't be able to delete the ro_iso
folder
umount /dev/disk2
hdiutil detach /dev/disk2
You now have a bootable USB iso file :)