Creating a Live GIS DISC from scratch

=How to make a Live GIS Disc from scratch= This document describes step by step how to generate an iso-image from an existing Ubuntu/Xubuntu installation.

Instead of entering each single step by hand, you can also download scripts here, that execute the commands. Please note, that you probably have to adjust the scripts a bit to get them to work on your system.

This document and the scripts are based on:
 * http://ubuntuforums.org/showthread.php?t=688872
 * https://help.ubuntu.com/community/LiveCDCustomizationFromScratch

Steps to create the Live DVD
1. Install the current version of the Live DVD on your system or virtual machine or, in case you want to start from scratch, install a clean Ubuntu/Xubuntu.

2. Remove any applications your don't want to have on your Live DVD.

3. Install and configure all applications, data, examples, documentation you want to have on your Live DVD

4. Configure the system as you wish. (Please note, that existing user won't be used on the Live DVD. However, you can copy later everything you want in the Live DVD's user's home-directory from your current user's home.)

5. Adjust script iso.sh to your needs and execute it in your home-directory. Especially, add everything to the CONFIG variable, you want to have in the standard user's home-directory. Or run the following commands: export WORK=$HOME/work export CD=$HOME/cd export FORMAT=squashfs export FS_DIR=casper sudo mkdir -p ${CD}/${FS_DIR} ${CD}/boot/grub ${WORK}/rootfs sudo apt-get update sudo apt-get install mkisofs grub squashfs-tools sudo apt-get install linux-ubuntu-modules-$(uname -r) sudo apt-get clean sudo rsync -av --one-file-system --exclude=/proc/* --exclude=/dev/* \ --exclude=/sys/* --exclude=/tmp/* --exclude=/home/* \ --exclude=/lost+found --exclude=/mnt/* --exclude=/var/www/tmp/* \ / ${WORK}/rootfs sudo cp -av /boot/* ${WORK}/rootfs/boot CONFIG='.config .bashrc' cd $HOME && for i in $CONFIG do   sudo cp -rpv --parents $i ${WORK}/rootfs/etc/skel done sudo cp $HOME/scripts/inchroot.sh $WORK//rootfs/tmp/ sudo mount -o bind /dev/ ${WORK}/rootfs/dev sudo mount -t proc proc ${WORK}/rootfs/proc sudo chroot ${WORK}/rootfs /bin/bash You should be now in a chroot-environment. 6. Adjust and execute now the sript 'inchroot.sh', which should be located in '/tmp' of the chroot environment. Or execute the following commands:

LANG= apt-get update apt-get install casper xresprobe depmod -a $(uname -r) update-initramfs -u -k $(uname -r) for i in /etc/hosts /etc/hostname /etc/resolv.conf /etc/timezone /etc/fstab /etc/mtab /etc/shadow /etc/shadow- /etc/gshadow /etc/gshadow- /etc/gdm/gdm-cdd.conf /etc/gdm/gdm.conf-custom /etc/X11/xorg.conf /boot/grub/menu.lst /boot/grub/device.map do   rm $i done 2>/dev/null apt-get clean rm -r /tmp/* /root/* 2>/dev/null rm /boot/*.bak 2>/dev/null for i in `cat /etc/passwd | awk -F":" '{print $1}'` do   uid=`cat /etc/passwd | grep "^${i}:" | awk -F":" '{print $3}'` [ "$uid" -gt "999" -a "$uid" -ne "65534"  ] && userdel --force ${i} 2>/dev/null done find /var/run /var/log /var/mail /var/spool /var/lock \ /var/backups /var/tmp -type f -exec rm {} \; [ -f "/etc/gdm/factory-gdm.conf" ] && \ cp -f /etc/gdm/factory-gdm.conf /etc/gdm/gdm.conf 2>/dev/null for i in dpkg.log lastlog mail.log syslog auth.log daemon.log faillog lpr.log mail.warn user.log boot debug mail.err messages wtmp bootstrap.log dmesg kern.log mail.info do   touch /var/log/${i} done
 * 1) apt-get ubiquity #optinal. Installs ubiquity

7. Exit the chroot environment by entering 'exit'.

8. Adjust and execute the script 'iso2.sh'. Or enter the following commands:

cd $HOME export WORK=$HOME/work export CD=$HOME/cd export FORMAT=squashfs export FS_DIR=casper export IMAGE_VERSION=1.0Beta1 sudo cp -vp ${WORK}/rootfs/boot/vmlinuz-$(uname -r) ${CD}/casper/vmlinuz sudo cp -vp ${WORK}/rootfs/boot/initrd.img-$(uname -r) ${CD}/casper/initrd.gz #do sudo umount ${WORK}/rootfs/proc sudo umount ${WORK}/rootfs/sys sudo umount ${WORK}/rootfs/dev sudo mksquashfs ${WORK}/rootfs ${CD}/${FS_DIR}/filesystem.${FORMAT} -noappend -no-duplicates sudo cp -rf /mnt/ralph/save/add2cd/* ${CD}/ sudo rm -rf ${CD}/boot cd $CD && find. -type f -print0 | xargs -0 sudo md5sum | sudo tee ${CD}/md5sum.txt sudo mkisofs -r -V "Arramagong_v$IMAGE_VERSION" -cache-inodes \ -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \ -boot-load-size 4 -boot-info-table -o $HOME/Arramagong_v$IMAGE_VERSION.iso. 9. Run the script "test.sh", or enter the following commands:
 * 1) The following steps are only required, if ubiquity will be installed.
 * 2) sudo chroot ${WORK}/rootfs dpkg-query -W --showformat='${Package} ${Version}\n' | sudo tee ${CD}/${FS_DIR}/filesystem.manifest
 * 3) sudo cp -v ${CD}/${FS_DIR}/filesystem.manifest ${CD}/${FS_DIR}/filesystem.manifest-desktop
 * 4) REMOVE='ubiquity casper user-setup discover1 xresprobe os-prober libdebian-installer4'
 * 5) for i in $REMOVE
 * 1) 	sudo sed -i "/${i}/d" ${CD}/${FS_DIR}/filesystem.manifest-desktop
 * 2) done

cd $HOME export WORK=$HOME/work export CD=$HOME/cd export FORMAT=squashfs export FS_DIR=casper export IMAGE_VERSION=1.0Beta1 sudo mkdir /tmp/livecd sudo mount -o loop ~/Arramagong_v$IMAGE_VERSION.iso /tmp/livecd cd /tmp/livecd sudo md5sum -c md5sum.txt If the sript finds any errors, adjust and run the script 'repair.sh' or the following commands: cd $HOME export WORK=$HOME/work export CD=$HOME/cd export FORMAT=squashfs export FS_DIR=casper export IMAGE_VERSION=1.0Beta1 sudo rm cd/md5sum.txt cd $CD && find. -type f -print0 | xargs -0 sudo md5sum | sudo tee ${CD}/md5sum.txt sudo mkisofs -r -V "Arramagong_v$IMAGE_VERSION" -cache-inodes \ -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \ -boot-load-size 4 -boot-info-table -o $HOME/Arramagong_v$IMAGE_VERSION.iso.