Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: HOW TO: Customize the LiveCD

  1. #1
    Join Date
    Feb 2007
    Location
    Everywhere
    Beans
    1,529
    Distro
    Ubuntu Development Release

    HOW TO: Customize the LiveCD

    I have seen the question raised quite a lot on this forum, so I have decided to do a comprehensive tutorial on how to customize the LiveCD.

    This will work for Feisty, and for Gutsy too.

    This tutorial is actually based on a bash script. I figured typing commands line by line is far to slow, and mistakes can be made. A script simplifies the operation, and can be modified to taste.

    I will first provide a basic script that everyone should find useful. The script can be further modified by simply adding lines of code where necessary.

    Here's how you do it:

    1 - What you need:
    Create a new folder called: live
    Download the 7.04 (Feisty) desktop iso and place in the live folder.
    Download the Flash browser plugin from Adobe: http://fpdownload.macromedia.com/get...9_linux.tar.gz
    Extract the flashplayer.xpt and the libflashplayer.so files and place in the live folder.
    You will also need to install a couple of tools onto your computer to make this whole thing possible:
    Code:
    sudo apt-get install squashfs-tools mkisofs
    These only need to be installed the once, and so don't need to be part of the script.

    2 - The basic script:

    Code:
    #!/bin/bash
    
    ubuntuiso=ubuntu-7.04-desktop-i386.iso
    customiso=ubuntu-7.04-H12Y-v1.iso
    kernel=2.6.20-15-generic
    
    clear
    echo Customize Ubuntu LiveCD
    echo
    echo Script by: Stephen Clark
    echo Based on documentation found at:
    echo https://help.ubuntu.com/community/LiveCDCustomization
    echo
    echo "For customizing Ubuntu 7.04 (Feisty Fawn)"
    echo
    echo Press Ctrl C at any time to quit
    echo
    
    echo -n "Loading squashfs module... "
    modprobe squashfs
    echo Done
    echo
    
    echo -n "Extract iso contents? y/[n] "
    read ua
    if [ "$ua" = "y" ]; then
    	if [ -e "edit" ]; then
    		echo -n "Removing existing Desktop System... "
    		rm -r edit
    		echo Done
    	fi
    	mkdir edit
    	if [ -e "extract-cd" ]; then
    		echo -n "Removing existing CD contents... "
    		rm -r extract-cd
    		echo Done
    	fi
    	mkdir extract-cd
    	if ! [ -e "mnt" ]; then
    		mkdir mnt
    	fi
    	if ! [ -e "squashfs" ]; then
    		mkdir squashfs
    	fi
    	echo -n "Extracting CD contents... "
    	mount -o loop $ubuntuiso mnt
    	rsync --exclude=/casper/filesystem.squashfs -a mnt/ extract-cd
    	echo Done
    	echo -n "Extracting Desktop System... "
    	mount -t squashfs -o loop mnt/casper/filesystem.squashfs squashfs
    	cp -a squashfs/* edit/
    	umount squashfs
    	umount mnt
    	echo Done
    fi
    echo
    
    # Place custom scripting here
    
    # Initialize networking and sources
    
    cp /etc/resolv.conf edit/etc
    cp /etc/hosts edit/etc
    cp /etc/apt/sources.list edit/etc/apt
    
    echo -n "Start package removal? y/[n] "
    read ua
    if [ "$ua" = "y" ]; then
    	echo
    	# Not all apps can be purged without dependency problems
    	# Accept whatever solution aptitude offers
    	chroot edit apt-get remove --purge ekiga evolution tomboy serpentine f-spot gnome-games bittorrent onboard gnome-pilot gnome-pilot-conduits libpisock9 libpisync0
    fi
    echo
    
    echo -n "Start package installation? y/[n] "
    read ua
    if [ "$ua" = "y" ]; then
    	echo
    	# -q supresses the output to a minimum
    	chroot edit apt-get update -qq
    	# sox, vorbis-tools, & mpg123-alsa are for previewing sound files in nautilus
    	# The gstreamer packages are for codec support
    	chroot edit apt-get install mozilla-thunderbird sox vorbis-tools mpg123-alsa vlc comixcursors gnome-themes-extras gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad
    	chroot edit apt-get clean
    fi
    echo
    
    echo -n "Installing Flash plugin for Firefox... "
    # Install flash plugins
    cp flashplayer.xpt edit/usr/lib/firefox/plugins
    cp libflashplayer.so edit/usr/lib/firefox/plugins
    echo Done
    echo
    
    # Clean up
    
    rm edit/etc/resolv.conf
    rm edit/etc/hosts
    rm edit/etc/apt/sources.list
    
    if [ -e "extract-cd/programs" ]; then
    	echo -n "Remove unwanted Windows applications from LiveCD? [y]/n "
    	read ua
    	if ! [ "$ua" = "n" ]; then
    		echo -n "Removing Windows applications... "
    		rm -r extract-cd/programs
    		echo Done
    	fi
    	echo
    fi
    
    echo -n "Copying wallpaper... "
    if [ -f "edit/usr/share/backgrounds/*.*" ]; then
    	rm edit/usr/share/backgrounds/*.*
    fi
    cp wallpaper/* edit/usr/share/backgrounds/
    cp ubuntu-wallpapers.xml edit/usr/share/gnome-background-properties/
    echo Done
    echo
    
    echo Setting gconf defaults for wallpaper, mouse, theme, nautilus and panel
    # Wallpaper
    chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /desktop/gnome/background/picture_filename "/usr/share/backgrounds/01.jpg"
    # Mouse
    chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /desktop/gnome/peripherals/mouse/cursor_theme "ComixCursors-Orange-Large-Slim"
    # Theme
    chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /desktop/gnome/interface/gtk_theme "Nuvola"
    chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /desktop/gnome/interface/icon_theme "Nuvola"
    chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/metacity/general/theme "Nuvola"
    # Nautilus
    chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/nautilus/preferences/click_policy "single"
    chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/nautilus/preferences/desktop_font "Sans Bold 10"
    chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/nautilus/preferences/start_with_sidebar "false"
    chroot edit gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/nautilus/icon_view/default_use_tighter_layout "true"
    echo
    
    # End of custom scripting
    
    # Putting the CD together
    
    echo -n "Recompile iso? [y]/n "
    read ua
    if [ "$ua" = "n" ]; then
    	echo
    	echo The End
    	echo
    	exit
    fi
    
    echo Compressing filesystem
    if [ -e "extract-cd/casper/filesystem.squashfs" ]; then
    	rm extract-cd/casper/filesystem.squashfs
    fi
    mksquashfs edit extract-cd/casper/filesystem.squashfs
    echo
    
    echo -n "Removing old md5sum.txt and calculating new md5 sums... "
    rm extract-cd/md5sum.txt
    (cd extract-cd && find . -type f -print0 | xargs -0 md5sum > md5sum.txt)
    echo Done
    echo
    
    echo Creating iso
    if [ -f "$customiso" ]; then
    	echo -n "Removing old custom iso... "
    	rm $customiso
    	echo Done
    	echo
    fi
    cd extract-cd
    mkisofs -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../$customiso .
    echo
    
    echo The End
    echo
    Open Gedit and paste this code in. Save file as: customize-livecd.sh and place in your live folder.
    To run the script, open a terminal and type:
    Code:
    sudo sh ./customize-livecd.sh
    The first time round, you will answer yes to all questions. After that, you can respond with no to save time extracting the iso again (unless you want to clean things up).

    3 - A brief explanation:

    The first thing the script does is to load the squashfs module. This is necessary for the extraction/compression process to work.
    Then it asks whether to extract the iso contents. If you want to start a fresh customization, answer yes. Answering no will save time having to extract everything from the iso again.
    There are 3 lines that copy your network settings and the sources.list to enable downloading of packages to the extracted iso.
    Then follows package removal and installation. Again, you can answer no to save time if you have already done it. Adjust the packages to be removed or installed to taste.
    Then your Flash plugin for Firefox will be copied over.
    There are some Windows application on the LiveCD which don't serve much purpose, so they can be removed too making a bit of room.
    The next section is for copying any wallpaper over. If you don't want this, delete these 7 lines. If you do, create a folder in the live folder called wallpaper. Copy any wallpaper you want into this folder. If you wish to have these show up in the Desktop Background applet, you can customize the ubuntu-wallpapers.xml and add them. You can find this file in /usr/share/gnome-background-properties/. Make a copy of the ubuntu-wallpapers.xml file into the live folder and alter this copy instead. This will have to be modified by hand using Gedit before running the script. It's quite obvious how to alter the xml file once you've opened it.
    The next few lines are for modifying some settings that you can find using the Configuration Editor. It gives you an idea of how to create your own default settings. This can be extended to just about everything you find in the Configuration Editor including setting up a complete customized desktop and panel(s).
    Now we come to the part where the whole thing will be put back together and create a new iso.
    At the very beginning of the script, you will notice 3 variables. ubuntuiso is the name of the Ubuntu iso you downloaded. customiso is the name of the new iso you will create from this script. kernel is the kernel used in the iso you downloaded. If you're customizing Gutsy, it will be 2.6.22-7-generic.

    4 - There are some laptop owners having problems booting the LiveCD due to driver problems. I personally own a Philips X56 which has this exact problem. So, for anyone with a Philips freevents X56, Twinhead H12Y, Avaretec 2460, or Everex Stepnote SA2050, this is the fix:
    EDIT: Ubuntu 7.04 ships with the 2.6.20-15-generic kernel. Arne.F informs me you need the correct module version available here:
    http://www.fitzenreiter.de/averatec/8139too.ko
    Copy this to the live folder. Add these few lines to the script:
    Code:
    # Patch for Twinhead H12Y notebooks
    echo -n "Install patch for $kernel kernel? y/[n] "
    read ua
    if [ "$ua" = "y" ]; then
    	echo 8139too PIO from: http://www.fitzenreiter.de/averatec/index-e.htm
    	echo -n "Removing SDHCI and replacing 8139too MIMO to PIO... "
    	sdhci=edit/lib/modules/$kernel/kernel/drivers/mmc/host/sdhci.ko
    	too=edit/lib/modules/$kernel/kernel/drivers/net/8139too.ko
    	if [ -f "$sdhci" ]; then
    		rm $sdhci
    	fi
    	if [ -f "$too" ]; then
    		rm $too
    	fi
    	cp 8139too.ko $too
    	echo Done
    	echo
    	echo -n "Rebuilding initrd... "
    	chroot edit mkinitramfs -o /initrd.gz $kernel
    	mv edit/initrd.gz extract-cd/casper/
    	echo Done
    fi
    echo
    ... just before the line that reads: # End of custom scripting. Bear in mind that any updates to the kernel will also have to be patched. After installation, any new kernels can be patched using the patch you just download and extracted. Follow the instructions within.

    That's about it.

    Please post any comments/question here for all to read, and I will keep this updated as questions arise.
    Last edited by phenest; August 16th, 2007 at 11:28 AM. Reason: Incorrect Twinhead H12Y patch for 2.6.20-15-generic kernel

  2. #2
    Join Date
    Jun 2005
    Location
    France
    Beans
    7,100
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOW TO: Customize the LiveCD

    How is this different from what reconstructor do ?
    http://reconstructor.aperantis.com/i...d=14&Itemid=37
    Last edited by frodon; August 2nd, 2007 at 02:49 PM.

  3. #3
    Join Date
    Feb 2007
    Location
    Everywhere
    Beans
    1,529
    Distro
    Ubuntu Development Release

    Re: HOW TO: Customize the LiveCD

    Reconstructor doesn't appear to be open source. Some would like to know how it works. Scripts offer much greater flexibility.

  4. #4
    Join Date
    Jun 2005
    Location
    France
    Beans
    7,100
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOW TO: Customize the LiveCD

    Reconstructor is written in python and is licensed under the GNU General Public License (GPL).
    I think it is is open source but yeah getting knowledge to do the things with a custom script is always better or offers way more flexibility, advanced users will surely prefer the way described in your post
    However i think some beginners will prefer reconstructor for understandable reasons (it is a GUI).

  5. #5
    Join Date
    Feb 2007
    Location
    Everywhere
    Beans
    1,529
    Distro
    Ubuntu Development Release

    Re: HOW TO: Customize the LiveCD

    I couldn't find the source to download, so it's a bit of an assumption that it's not open source.

    I totally agree that the script method is for advanced users or for those wishing to learn. I did try Reconstructor myself but, being a programmer, I had to find my own way of doing it.

    I would like to advance the script to a menu system to advance its features further and make it more user friendly, so maybe even a novice could use it. That will still leave it open source so others can learn from it.

  6. #6
    Join Date
    Dec 2006
    Beans
    99
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOW TO: Customize the LiveCD

    Quote Originally Posted by frodon View Post
    How is this different from what reconstructor do ?
    http://reconstructor.aperantis.com/i...d=14&Itemid=37
    Thanks for the tip. I will see if this works on the newest oversized Gutsy build.

  7. #7

    Re: HOW TO: Customize the LiveCD

    Hi phenest, nice script. I had used UCK to do this job.

    Please change your description. The 8139too.ko file from http://www.fitzenreiter.de/averatec/...16-generic.tgz
    is not the correct one for Kernel 2.6.20-15 that was used on the 7.04 cd.

    http://www.fitzenreiter.de/averatec/8139too.ko is the korrekt one for 2.6.20-15-generic.

    This modul is different for every kernel version.

  8. #8
    Join Date
    Feb 2007
    Location
    Everywhere
    Beans
    1,529
    Distro
    Ubuntu Development Release

    Re: HOW TO: Customize the LiveCD

    Quote Originally Posted by Arne.F View Post
    Please change your description. The 8139too.ko file from http://www.fitzenreiter.de/averatec/...16-generic.tgz
    is not the correct one for Kernel 2.6.20-15 that was used on the 7.04 cd.
    Er, that may be true, but that module worked for me in both the 2.6.20-15 and 2.6.20-16 kernels.

  9. #9
    Join Date
    Oct 2004
    Location
    Kingston, On
    Beans
    Hidden!

    Re: HOW TO: Customize the LiveCD

    https://help.ubuntu.com/community/LiveCDCustomization
    and my personal favorite:
    https://help.ubuntu.com/community/Li...ionFromScratch

    The former is a well-maintained howto that starts from an Ubuntu live cd. The latter starts from nothing - you build it from scratch.
    I lost a "z". Anyone seen it around here?

  10. #10
    Join Date
    Feb 2007
    Location
    Everywhere
    Beans
    1,529
    Distro
    Ubuntu Development Release

    Re: HOW TO: Customize the LiveCD

    Quote Originally Posted by az View Post
    https://help.ubuntu.com/community/LiveCDCustomization
    and my personal favorite:
    https://help.ubuntu.com/community/Li...ionFromScratch

    The former is a well-maintained howto that starts from an Ubuntu live cd. The latter starts from nothing - you build it from scratch.
    No dis-respect to anyone, but my script method is quite possibly far easier to modify and/or understand for both newbie and power user.

    Also, my script is based on the 1st link (as mentioned). I wasn't aware of the 2nd.

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •