Hey guys,
I've seen a lot of threads asking how to edit ISO images on Linux. I asked a few questions on it but I never got or saw any easy answers. Everybody just said there are tools on winbloze, blah, blah, blah. The problem is that you can't modify a loopback filesystem (they are r/o) so you have to know what mkisofs command to use and that seems to be a mystery.
Why don't we just use the same mkisofs command as they did to build the ISO in the first place? Because I never heard how to get it.
I'm working on a Solaris compatibility problem with Sun and (actually they're working and I'm just trying) and the guy Moinak gave me an easy way to extract the mkisofs command. It's a real Simpsons DOH! it's so simple.
Code:
cat original-iso-image.iso | strings | grep mkisofs > remaster.sh # extract mkisofs command from original ISO image
This will scan the ISO image and copy the mkisofs command string (and it a bit of other rubbish possibly) into the remaster.sh file. You don't have to save the ouput but it's a bit easier than trying to remember it. It was my semi-brilliant idea to save the output and make a shell script from it
Then just edit the remaster.sh and delete all the rubbish that's not part of the mkisofs command (it will be very obvious, not to worry), change the pathspec in the mkisofs command (the name of the directory mkisofs supposed to use to build the ISO from, it's the last parameter on the command) to be your directory you want to build the ISO from. Change "-o filename" to be "-o /tmp/mynewiso.iso" or whatever you please. Add a #!/bin/bash as the first line and you've now got a shell script to build an ISO automagically.
It's actually quicker to do all this than it is to explain it. If it seems complicated or confusing just try it and you'll see it's quite simple.
Here's the process for editing/remastering your own ISO:
Code:
01. cat original-iso-image.iso | strings | grep mkisofs > remaster.sh # extract mkisofs command from image
02. edit remaster.sh:
a. add "#!/bin/bash" on first line.
b. clean up mkisofs command, delete extraneous text.
c. change pathspec (last file name on mkisofs command) to /tmp/ISO.
d. Change "-o filename" to name of ISO image you want to create, ex.
slackware-remaster-disk1.iso
e. save changes to remaster.sh
03. mount original-iso-image.iso -o loop /mnt/loop
04. mkdir /tmp/ISO
05. copy everything from /mnt/loop to /tmp/ISO
06. umount /mnt/loop
07. add/remove desired files from /tmp/ISO
08. cd /tmp
09. remaster.sh
10. Now you can check your work by mount -o loop /tmp/mynewiso.iso /mnt/loop
and you should be able to see all your files as you wanted.
11. burn the CD using cdrecord, xcdroast, K3B, or whichever tool you prefer
12. enjoy (everyone always seems to insist on adding this step)
If you're good with Perl or Bash you can probably automate this even more. If I did it a lot I would write my own scripts but it's not very often I do it.
Sorry if all this has been said before. I wasn't able to find it in my searches.
Cheers,
Rand