Pentoo: Modifying the LiveCD

Attention:
I should retest the commands, until then there might be some typos.
But the basic procedure should work and I’ve used the commands successfully.

Intro

This post should sum up the steps to modify an ISO image of a LiveCD.
I’m using the public beta Pentoo 2012.0 Defcon Release as example.
The steps for other LiveCDs might be different but the general procedure should be the same.

  • mount the ISO as CD
  • unpack the compressed file system
  • do what has to be done
  • repack the compressed FS
  • generate new ISO

Sounds simple, doesn’t it?

Reasons to do this

In my case, it’s testing the beta ISO.
I like Pentoo and know the 2-3 steps to make the beta useable. I just don’t like doing these steps whenever I boot the ISO, especially eix-sync just takes to long.

Procedure

  • mkdir -p /mnt/cdrom
    mount -o loop /mnt/KVM/ISO/pentoo-x86_64-2012.0_betazero.iso /mnt/cdrom/
  • unsquashfs -d /mnt/squashfs-root /mnt/cdrom/image.squashfs
  • Now do what you want to change, for ex. correct some config files.
    mv /mnt/squashfs-root/root/.local/xfce4/helpers.rc /mnt/squashfs-root/root/.config/xfce4/
    rm -rf /mnt/squashfs-root/root/.local/xfce4/
  • Copy the contents of the ISO image and remove existing squashfs file.
    mkdir /mnt/cdromCopy
    rsync -ar --exclude 'image.squashfs' cdrom/* cdromCopy/
  • Regenerate the squashfs file. The options are not necessary, but should match the ones used for the original Pentoo image.
    mksquashfs /mnt/squashfs-root/ /mnt/cdromCopy/image.squashfs  -comp xz -Xbcj x86 -b 1048576 -Xdict-size 1048576 -no-recovery -noappend

    Go grab yourself some coffee, then write a silly guide like this one … mksquashfs might be done when you are ;-)

  • Regenerate the ISO:
    mkisofs -J -R -l -V "20120814PentooCustom" \
    -o /mnt/KVM/ISO/pentoo-x86_64-2012.0_betazero-custom.iso \
    -b boot/grub/stage2_eltorito \
    -c boot/boot.cat \
    -no-emul-boot -boot-load-size 4 -boot-info-table ./

    Alter -V "20120814PentooCustom" and -o /mnt/KVM/ISO/pentoo-x86_64-2012.0_betazero-custom.iso to what you need.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: