Monday, 24 December 2012

Keeping a LiveCD distribution up-to-date

After learning how to put a number of LiveCD distributions in a USB stick (all with persistent modes): http://angel-de-vicente.blogspot.com.es/2012/11/multi-boot-usb-stick.html, I have quickly started using that quite a lot, and it has soon become clear that after a while I need to keep the distributions up-to-date. So, I learnt how to keep the distribution relevant and up-to-date and the persistent file small enough. I mostly followed http://this.is.thoughtcrime.org.nz/multi-boot-bt5-from-usb-with-grub2, but I modified slightly:


angelv@palas:~$ mkdir /tmp/iso /tmp/squash
angelv@palas:~$ sudo mount -o loop /media/angelv/angelv/ubuntustudio-12.10-dvd-amd64.iso /tmp/iso
[sudo] password for angelv: 
mount: warning: /tmp/iso seems to be mounted read-only.
angelv@palas:~$ sudo mount -o loop /tmp/iso/casper/filesystem.squashfs /tmp/squash


angelv@palas:~$ mkdir /tmp/changes
angelv@palas:~$ sudo mount /media/angelv/angelv/persistent/ubuntustudio/casper-rw /tmp/changes

angelv@palas:~$ mkdir /tmp/merged
angelv@palas:~$ sudo mount -t aufs -o br=/tmp/changes=rw:/tmp/squash none /tmp/merged

angelv@palas:~$ sudo mksquashfs /tmp/merged/ ~/ubuntustudio.squashfs
angelv@palas:~$ sudo umount /tmp/merged /tmp/squash /tmp/changes 

angelv@palas:~$ mkdir -p ubuntu_studio_changed/casper
angelv@palas:~$ mv  ubuntustudio.squashfs ubuntu_studio_changed/casper/filesystem.squashfs
angelv@palas:~$ mkdir /tmp/newiso
angelv@palas:~$ sudo mount -t aufs -o br=ubuntu_studio_changed=rw:/tmp/iso none /tmp/newiso
angelv@palas:~$ 

angelv@palas:~$ cd /tmp/newiso/
angelv@palas:/tmp/newiso$ sudo genisoimage -R -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -o /home/angelv/new_ubuntu_studio.iso /tmp/newiso/

angelv@palas:/tmp/newiso$ cd
angelv@palas:~$ sudo umount /tmp/newiso 
angelv@palas:~$ sudo umount /tmp/iso 

angelv@palas:~$ mv new_ubuntu_studio.iso /media/angelv/angelv/ubuntustudio-12.10-dvd-amd64.iso
angelv@palas:~$ dd if=/dev/zero of=casper-rw bs=1M count=3072
angelv@palas:~$ mkfs.ext3 -F casper-rw
angelv@palas:~$ mv casper-rw /media/angelv/angelv/persistent/ubuntustudio/casper-rw

I try it, and I can see that I get the same as I had before, but now the casper-rw file is empty, so I can start a new round of customizations. Installation / removal of software goes all to the casper-rw file, so when we recreate the ISO file to incorporate the casper-rw file, we are also generating a ISO file with all the same software as our persistent-mode version.

No comments: