Customize Ubuntu to Roll out your own Distro

1. save this as

sudo apt-get install debootstrap
sudo rm -rf work
mkdir work
sudo cp work/.
sudo cp work/.
cd work
mkdir chroot
sudo cp ../ chroot/.
sudo cp ../portablelinux_0.9.3-0ubuntu1~ppa0~jaunty1_all.deb chroot/.
sudo debootstrap –arch i386 jaunty chroot
sudo cp /etc/resolv.conf chroot/etc/resolv.conf
sudo cp /etc/apt/sources.list chroot/etc/apt/sources.list
echo “entering into chrooted environment”
sudo chroot chroot
echo “run”

2. save this as run

mount /proc
mount /sys
mount -t devpts none /dev/pts
apt-get update
export HOME=/root
export LC_ALL=C
apt-get install –yes ubuntu-standard casper
apt-get install –yes discover1 laptop-detect os-prober
apt-get install –no-install-recommends linux-generic ubiquity
apt-get install –no-install-recommends slim xserver-xorg
apt-get install –yes xfce4 xfce4-goodies ristretto xfce4-taskmanager xfce4-messenger-plugin xfce4-volstatus-icon xfprint4 xfce4-session xfce4-notifyd xfce4-places-plugin xfce4-smartpm-plugin alsa-utils xchat xchm xscreensaver xarchiver catfish
sudo wget –output-document=/etc/apt/sources.list.d/medibuntu.list && sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update
apt-get install –no-install-recommends gedit abiword gnumeric gedit-plugins pidgin gimp skype thunderbird lightning-extension enigmail vim-nox transmission wpasupplicant msttcorefonts amsn planner scribus unrar p7zip-full ntfs-3g openssh-client vino miro evince gdebi system-config-printer-gnome aptitude network-manager-gnome gwibber
apt-get install –yes libdvdcss2 libdvdread4 w32codecs vlc firefox ubufox mozilla-plugin-vlc filezilla brasero parcellite
sudo /usr/share/doc/libdvdread4/

dpkg -i portablelinux_0.9.3-0ubuntu1~ppa0~jaunty1_all.deb
rm -rf portablelinux_0.9.3-0ubuntu1~ppa0~jaunty1_all.deb

cd /tmp
tar xvf Songbird_1.2.0-1146_linux-i686.tar.gz
mv Songbird /opt/songbird
rm Songbird*.tar.gz
/usr/sbin/alternatives –install /usr/bin/Songbird songbird /opt/songbird/songbird 2
chown -Rf nobody.nobody /opt/songbird
chmod -Rf 777 /opt/songbird/
wget -c -q
mv songbirdicon.png /usr/share/pixmaps/songbird.png
wget -c -q
mv songbird.desktop /usr/share/applications/songbird.desktop

apt-get autoremove
apt-get upgrade
apt-get clean

echo “exiting from chrooted environment”
rm -rf /tmp/*
umount -l -f /proc
umount -l -f /sys
umount /dev/pts
echo “install mysql-server phymyadmin exim4-daemon-light apache2 php5 php-pear”
echo “************ CHEERS ***********”
echo “not yet exited from chroot”


echo “src=”
rm -rf chroot/
sudo apt-get install syslinux squashfs-tools mkisofs sbm
rm -rf image
mkdir image image/casper image/isolinux image/install
echo “enter correct kernel name if the below fails”
cp chroot/boot/vmlinuz-2.6.28-15-generic image/casper/vmlinuz
cp chroot/boot/initrd.img-2.6.28-15-generic image/casper/initrd.gz
cp /usr/lib/syslinux/isolinux.bin image/isolinux/
cp /boot/memtest86+.bin image/install/memtest
cp /boot/sbm.img image/install/
echo ”
This is an KaShUbuntu Remix Live CD.

For the default live system, enter ‘live’. To verify the CD for errors, enter ‘check’. To run memtest86+, enter ‘memtest'” > image/isolinux/isolinux.txt

echo “If you put this at the beginning of the isolinux.txt, the splash image will be displayed along with the text. The ^X is the control character which is mandatory for the splash image to work. To enter ^X in editor, do ctrl-V and follow with ctrl-X.”

echo “^Xsplash.rle”

echo ”
LABEL live
menu label ^Start or install Ubuntu
kernel /casper/vmlinuz
append file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.gz quiet splash —
LABEL check
menu label ^Check CD for defects
kernel /casper/vmlinuz
append boot=casper integrity-check initrd=/casper/initrd.gz quiet splash —
LABEL memtest
menu label ^Memory test
kernel /install/memtest
append –
menu label ^Boot from first hard disk
localboot 0x80
append –
DISPLAY isolinux.txt
PROMPT 1″ > image/isolinux/isolinux.cfg

“echo creating manifest”
sudo chroot chroot dpkg-query -W –showformat=’${Package} ${Version}\n’ | sudo tee image/casper/filesystem.manifest
sudo cp -v image/casper/filesystem.manifest image/casper/filesystem.manifest-desktop
REMOVE=’ubiquity casper live-initramfs user-setup discover1 xresprobe os-prober libdebian-installer4′
for i in $REMOVE
sudo sed -i “/${i}/d” image/casper/filesystem.manifest-desktop

echo “compress chroot”
sudo mksquashfs chroot image/casper/filesystem.squashfs

echo “information – appending -e chroot/boot for the previous line will erase the boot folder which is not needed for live usb”

echo “#define DISKNAME Ubuntu 9.04 “Jaunty Jackalope” – Release i386 **Remix**
#define TYPE binary
#define TYPEbinary 1
#define ARCH i386
#define ARCHi386 1
#define DISKNUM 1
#define DISKNUM1 1
#define TOTALNUM 0
#define TOTALNUM0 1″ > image/README.diskdefines

touch image/ubuntu
echo “Create hidden “.disk” folder. This is needed to make the USB Creator work with this custom iso image. ”
mkdir image/.disk
cd image/.disk
touch base_installable
echo “full_cd/single” > cd_type
echo ‘Ubuntu 9.04 “Kashubuntu” – i386 (20090429)’ > info
echo “” > release_notes_url
cd ../..

echo “Calculate MD5”
sudo -s
(cd image && find . -type f -print0 | xargs -0 md5sum > md5sum.txt)

4. save this as
rm -rf
echo “Turn the image directory into an iso image”
rm -rf *.iso
cd image
sudo mkisofs -r -V “$IMAGE_NAME” -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/ -no-emul-boot -boot-load-size 4 -boot-info-table -o ../kashubuntu-remix.iso .
cd ..

5. save the below as
echo “WARNING”
echo “insert thumbdrive before running this script”
sudo mkdir -p /mnt/isoimage
sudo mount -o loop work/kashubuntu-remix.iso /mnt/isoimage
rm -rf /media/PORTABLELNX/boot{vmlinuz,initrd.gz}
sudo cp /mnt/isoimage/casper/{vmlinuz,initrd.gz} /media/PORTABLELNX/boot
echo “copying persistance”
cp casper-rw /media/PORTABLELNX/casper-rw
sudo umount /mnt/isoimage
sudo rmdir /mnt/isoimage
echo “copying iso image to usb”
sudo dd if=work/kashubuntu-remix.iso of=/dev/sdb2

6. I use my home brewed ubuntu in a thumb drive. so download latest portable linux deb package and save it in your folder that contains the above 5 files.

7. run the first script and sit back and enjoy


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s