All pastes #479907 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-09 23:29 UTC
rendered paste body
34c34
< 	BASE_INSTALL='/home/supermario/Software/temp'
---
> 	BASE_INSTALL='/home/mythbuntu/isobuild'
41c41
< 	BASE_MIRROR='http://mirror.cs.umn.edu/ubuntu/'
---
> #	BASE_MIRROR='http://mirror.cs.umn.edu/ubuntu/'
43c43
< #	BASE_MIRROR='http://archive.ubuntu.com/ubuntu'
---
> 	BASE_MIRROR='http://archive.ubuntu.com/ubuntu'
68c68
< 	ARCHITECTURE='i386'
---
> 	ARCHITECTURE='amd64'
74c74
< 	NEW_ISO="/home/supermario/mythbuntu-$VERSION~$DATE-$ARCHITECTURE.iso"
---
> 	NEW_ISO="/home/mythbuntu/result/mythbuntu-$VERSION~$DATE-$ARCHITECTURE.iso"
676a677,2028
> echo "The ISO md5sum is located in $NEW_MD5"#!/bin/bash
> #Mythbuntu live cd generating script
> 
> #####################
> # Copyright © 2007  Mario Limonciello
> #
> # This script is loosely based from Linux Mint's live CD building script remastersys.
> #
> # * This program is free software; you can redistribute it and/or modify
> # * it under the terms of the GNU General Public License as published by
> # * the Free Software Foundation; either version 2 of the License, or
> # * (at your option) any later version.
> # *
> # * This program is distributed in the hope that it will be useful,
> # * but WITHOUT ANY WARRANTY; without even the implied warranty of
> # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> # * GNU General Public License for more details.
> # *
> # * You should have received a copy of the GNU General Public License
> # * along with this program; if not, write to the Free Software
> # * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
> #
> # On Ubuntu systems, a copy of the GPLv2 is available in /usr/share/common-licenses/GPL-2
> #
> #####################
> 
> #NOTE: This assumes that you have appropriate version of debootstrap on this system
> #Eg, if your debootstrapping into feisty, you need the feisty debootstrap installed
> 
> #NOTE2: You will need to setup the following env variables:
> 
> #Working Directory.  You will need 2-3 GB space here.
> if [ -z "$BASE_INSTALL" ] ; then
> 	BASE_INSTALL='/home/mythbuntu/isobuild'
> #	BASE_INSTALL='/tmp/mythbuntu_iso'
> fi
> 
> #Base mirror for repositories
> if [ -z "$BASE_MIRROR" ] ; then
> #	BASE_MIRROR='http://mirror.imbrandon.com/ubuntu/'
> #	BASE_MIRROR='http://mirror.cs.umn.edu/ubuntu/'
> #	BASE_MIRROR='http://ftp.ussg.iu.edu/linux/ubuntu'
> 	BASE_MIRROR='http://archive.ubuntu.com/ubuntu'
> fi
> 
> #Proxy if needed
> if [ -z "$HTTP_PROXY" ] ; then
>   http_proxy=http://proxy.url
> fi
> 
> #Ubuntu Release to base from
> if [ -z "$BASE_RELEASE" ] ; then
> 	BASE_RELEASE='feisty'
> fi
> 
> #Ubuntu Version to base from
> if [ -z "$VERSION" ] ; then
> 	VERSION='7.04'
> fi
> 
> #Mythbuntu Release
> if [ -z "$MYTHBUNTU_RELEASE" ] ; then
> 	MYTHBUNTU_RELEASE='alpha'
> fi
> 
> #Architecture we are building on
> if [ -z "$ARCHITECTURE" ] ; then
> 	ARCHITECTURE='amd64'
> fi
> 
> #Place to put the final ISO when done.  You will need 300-700 MB here.
> if [ -z "$NEW_ISO" ] ; then
> 	DATE=`date '+%m%d%y'`
> 	NEW_ISO="/home/mythbuntu/result/mythbuntu-$VERSION~$DATE-$ARCHITECTURE.iso"
> 	NEW_MD5="$NEW_ISO.md5sum"
> fi
> 
> #Setup our date that is used throughout the rest of the build
> DATE=`date '+%D'`
> 
> #Find the user building this
> ID=`id -u`
> 
> #For testing the port to non root user
> #FAKECHROOT='no'
> 
> #Enable the on CD repository
> #CDREPOSITORY='no'
> 
> #####################################
> #Step 0 - Check users, Clean up old stuf
> if [ -z $FAKECHROOT ] ; then
> 	if [ $ID != '0' ] ; then
> 		echo "Not building with fakechroot, need to build as root"
> 		exit 1
> 	else
> 		echo "Starting normal Mythbuntu build initiated by $ID at `date`"
> 	fi
> else
> 	if [ $ID != '0' ] ; then
> 		echo "Starting fakechroot'ed Mythbuntu build initiated by $ID at `date`"
> 	else
> 		echo "Don't build in fakechroot as root."
> 		exit 1
> 	fi
> fi
> mkdir -p $BASE_INSTALL
> rm -rf $BASE_INSTALL/*
> 
> #####################################
> #Step 1 - debootstrap new base system
> if [ -z $FAKECHROOT ] ; then
> 	debootstrap --arch $ARCHITECTURE $BASE_RELEASE $BASE_INSTALL $BASE_MIRROR
> else
> 	fakeroot fakechroot debootstrap  --variant=fakechroot --arch $ARCHITECTURE $BASE_RELEASE $BASE_INSTALL $BASE_MIRROR
> fi
> 
> #####################################
> #Step 2, Prep remastersys directory
> mkdir -p $BASE_INSTALL/home/remastersys
> mkdir -p $BASE_INSTALL/home/remastersys/dummysys
> mkdir -p $BASE_INSTALL/home/remastersys/dummysys/proc
> mkdir -p $BASE_INSTALL/home/remastersys/dummysys/tmp
> chmod ug+rwx,o+rwt $BASE_INSTALL/home/remastersys/dummysys/tmp
> mkdir -p $BASE_INSTALL/home/remastersys/dummysys/sys
> mkdir -p $BASE_INSTALL/home/remastersys/dummysys/mnt
> mkdir -p $BASE_INSTALL/home/remastersys/dummysys/media
> mkdir -p $BASE_INSTALL/home/remastersys/dummysys/var
> mkdir -p $BASE_INSTALL/var/cache/apt/archives
> mkdir -p $BASE_INSTALL/tmp
> mkdir -p $BASE_INSTALL/etc/apt
> cp -R ISOTMP $BASE_INSTALL/home/remastersys
> 
> #####################################
> #Step 3 - copy over networking config
> cp /etc/resolv.conf $BASE_INSTALL/etc/.
> cp /etc/apt/apt.conf  $BASE_INSTALL/etc/apt/.
> 
> #####################################
> #Step 4, Copy in our modified debs (Splash, ubiquity)
> cp ../splash/bin/$BASE_RELEASE/mythbuntu-artwork-usplash_0.1_$ARCHITECTURE.deb $BASE_INSTALL/var/cache/apt/archives
> 
> #####################################
> #Step 5, Copy in our background files
> cp background_setup.xpm $BASE_INSTALL/tmp
> cp background_install.xpm $BASE_INSTALL/tmp
> 
> #Step 5a, make symlinks to directories we will need to access in fakechroot mode
> if [ ! -z $FAKECHROOT ] ; then
> 	rm $BASE_INSTALL/proc -r
> 	rm $BASE_INSTALL/sys -r
> 	rm $BASE_INSTALL/dev -r
> 	ln -s /proc $BASE_INSTALL/proc
> 	ln -s /dev  $BASE_INSTALL/dev
> 	ln -s /sys  $BASE_INSTALL/sys
> fi
> 
> #####################################
> #Step 6, generate our chroot script
> cat <<EOCHROOT >$BASE_INSTALL/tmp/mythbuntu-install-script
> #!/bin/bash
> #Mythbuntu chroot install script
> # Copyright © 2007  Mario Limonciello
> 
> export DEBIAN_FRONTEND=noninteractive
> 
> #Step A: Clean up any old builds if debugging script
> rm -rf /home/remastersys/ISOTMP/casper/filesystem.squashfs
> rm -rf /home/remastersys/mythbuntu.iso
> 
> #Step B: Install the minimal ubuntu system in fakechroot mode, mount imaginary systems in normal mode
> if [ ! -z $FAKECHROOT ] ; then
> 	#Note, this needs to be forced because we don't yet have any apt keys
> 	apt-get install ubuntu-minimal -y --force-yes -o Acquire::Retries=25
> else
> 	mount -t proc   none  /proc
> 	mount -t devpts none  /dev/pts
> 	mount -t sysfs  sysfs /sys
> fi
> 
> #Step C: Generate sources.list
> cat <<EOF >/etc/apt/sources.list
> deb $BASE_MIRROR $BASE_RELEASE main restricted universe multiverse
> deb $BASE_MIRROR $BASE_RELEASE-updates main restricted universe multiverse
> deb $BASE_MIRROR $BASE_RELEASE-security main restricted universe multiverse
> deb $BASE_MIRROR $BASE_RELEASE-backports main restricted universe multiverse
> deb-src $BASE_MIRROR $BASE_RELEASE-updates main restricted universe multiverse
> deb-src $BASE_MIRROR $BASE_RELEASE universe multiverse main restricted
> deb-src $BASE_MIRROR $BASE_RELEASE-backports main restricted universe multiverse
> deb-src $BASE_MIRROR $BASE_RELEASE-security main restricted universe multiverse
> EOF
> 
> #Step D: Set default locale and timezone
> localedef -i en_US -c -f UTF-8 en_US.UTF-8
> echo "America/Chicago" > /etc/timezone
> cp /usr/share/zoneinfo/America/Chicago /etc/localtime
> 
> #Step E: Set up base configuration files for the rest of installation
> cat <<EOF >/etc/network/interfaces
> auto lo
> iface lo inet loopback 
> EOF
> cat <<EOF >/etc/kernel-img.conf
> do_symlinks = yes
> do_initrd = yes
> EOF
> cat <<EOF >/etc/casper.conf
> # This file should go in /etc/casper.conf
> # Supported variables are:
> # USERNAME, USERFULLNAME, HOST, BUILD_SYSTEM
> 
> export USERNAME="ubuntu"
> export USERFULLNAME="Live session user"
> export HOST="ubuntu"
> export BUILD_SYSTEM="Ubuntu"
> EOF
> 
> #Step F: Update the bootstrapped install
> apt-get update
> apt-get upgrade -y
> 
> #Step G: install the standard ubuntu utils
> apt-get install -y -o Acquire::Retries=25 ubuntu-standard
> 
> #Step H: Install a kernel & Restricted modules
> apt-get install -y -o Acquire::Retries=25 linux-image-generic linux-restricted-modules-generic
> 
> #Step I: install X, openbox, gdm, gnome-screensaver, idesk, feh, theme, firefox, libgnome2-perl
> apt-get install -y -o Acquire::Retries=25 openbox gdm xserver-xorg xterm xfonts-100dpi xfonts-75dpi xfonts-base gnome-screensaver ubuntu-artwork gsfonts-x11 idesk feh silicon-theme firefox libgnome2-perl
> 
> #Step J: install media players and mythtv frontend and all plugins
> apt-get install -y -o Acquire::Retries=25 vlc mythtv-frontend mythvideo mythdvd mythnews mythflix mythweather mythgame mythmusic mythgallery mythtv-themes mythphone mytharchive mythcontrols mythbrowser mplayer xine-ui
> 
> #Step K: install modified debs that we assembled
> apt-get install -y -o Acquire::Retries=25 libusplash-dev usplash
> dpkg -i /var/cache/apt/archives/mythbuntu-artwork-usplash_0.1_i386.deb
> 
> #Step L: Generate Skeleton Files & Configuration Files
> cat > /etc/skel/.ideskrc <<EOF
> table Config
>   FontName: arial
>   FontSize: 14
>   FontColor: #37CFA6
>   ToolTip.FontSize: 11
>   ToolTip.FontName: arial
>   ToolTip.ForeColor: #0000FF
>   ToolTip.BackColor: #FFFFFF
>   ToolTip.CaptionOnHover: true
>   ToolTip.CaptionPlacement: Right
>   Locked: false
>   Transparency: 92
>   Shadow: true
>   ShadowColor: #000000
>   ShadowX: 1
>   ShadowY: 1 
>   Bold: true
>   ClickDelay: 300
>   IconSnap: true
>   SnapWidth: 10
>   SnapHeight: 10
>   SnapOrigin: BottomRight
>   SnapShadow: false
>   SnapShadowTrans: 200
>   CaptionOnHover: false
>   CaptionPlacement: bottom
>   FillStyle: fillinvert
>   Background.Delay: 0
>   Background.Source: None
>   Background.File: None 
>   Background.Mode: Center 
>   Background.Color: #C2CCFF
> end
> 
> table Actions
>   Lock: control right doubleClk
>   Reload: middle doubleClk
>   Drag: left hold
>   EndDrag: left singleClk
>   Execute[0]: left doubleClk
>   Execute[1]: right doubleClk
> end
> EOF
> mkdir /etc/skel/.idesktop
> cat > /etc/skel/.dmrc <<EOF
> [Desktop]
> Session=mythtv_setup
> EOF
> cat > /etc/skel/.idesktop/mythtv-setup.lnk <<EOF
> table Icon
>   Caption: MythTV Setup
>   CaptionTip: Runs mythtv-setup
>   Command: mythtv-setup
>   Icon: /usr/share/mythtv/themes/blue/setup.png
>   Width: 90
>   Height: 60
>   X: 59
>   Y: 3
> end
> EOF
> cat > /etc/skel/.idesktop/mythtv-backend-stop.lnk <<EOF
> table Icon
>   Caption: Stop MythTV Backend
>   CaptionTip: Stops backend
>   Command: xterm -e "gksudo /etc/init.d/mythtv-backend stop --description \"Stop Mythtv-Backend\" && sleep 3"
>   Icon: /usr/share/mythtv/themes/blue/stop_button_pushed.png
>   Width: 60
>   Height: 60
>   X: 299
>   Y: 3
> end
> EOF
> cat > /etc/skel/.idesktop/mythtv-backend-start.lnk <<EOF
> table Icon
>   Caption: Start MythTV Backend
>   CaptionTip: Starts backend
>   Command: xterm -e "gksudo /etc/init.d/mythtv-backend start --description \"Start Mythtv-Backend\" && sleep 3"
>   Icon: /usr/share/mythtv/themes/blue/play_button_on.png
>   Width: 60
>   Height: 60
>   X: 519
>   Y: 3
> end
> EOF
> cat > /etc/skel/.idesktop/mythtv-backend-restart.lnk <<EOF
> table Icon
>   Caption: Restart MythTV Backend
>   CaptionTip: Restarts backend
>   Command: xterm -e "gksudo /etc/init.d/mythtv-backend restart --description \"Restart Mythtv-Backend\" && sleep 3"
>   Icon: /usr/share/mythtv/themes/default/mv_gallery_dir_up.png
>   Width: 60
>   Height: 60
>   X: 704
>   Y: 3
> end
> EOF
> cat > /etc/skel/.idesktop/mythfilldatabase.lnk <<EOF
> table Icon
>   Caption: mythfilldatabase
>   CaptionTip: Fills with initial data
>   Command: xterm -e "mythfilldatabase && sleep 3"
>   Icon: /usr/share/mythtv/themes/blue/showstatus.png
>   Width: 90
>   Height: 60
>   X: 864
>   Y: 3
> end
> EOF
> cat > /usr/share/xsessions/mythtv_setup.desktop <<EOF
> [Desktop Entry]
> Encoding=UTF-8
> Name=MythTV Setup
> Comment=Use this session to install and change mythtv settings
> Exec=/usr/share/mythtv/startmythtv_setup.sh
> Icon=
> Type=Application
> EOF
> cat > /usr/share/mythtv/startmythtv_setup.sh <<EOF
> #!/bin/sh
> #MythTV Install & Settings Session
> # Copyright © 2007  Mario Limonciello
> 
> #Setup background
> feh --bg-center ~/.background.xpm
> 
> #Start screensaver
> gnome-screensaver
> 
> #Start desktop icons
> idesk &
> 
> #Start window manager
> exec openbox
> EOF
> chmod +x /usr/share/mythtv/startmythtv_setup.sh
> cat > /etc/skel/.gtkrc-2.0 <<EOF
> include "/usr/share/themes/Silicon/gtk-2.0/gtkrc"
> EOF
> cp /etc/skel/.gtkrc-2.0 /root
> mv /tmp/background_setup.xpm /etc/skel/.background.xpm
> 
> 
> #Step M: Grab Live Cd Build Dependencies
> apt-get install -y -o Acquire::Retries=25 coreutils mkisofs findutils bash passwd sed squashfs-tools casper rsync mount eject libdebian-installer4 os-prober ubiquity user-setup memtest86+ dpkg-dev
> 
> #Step N: Preinstall all other options
> apt-get -y install -o Acquire::Retries=25 ubuntu-mythtv-frontend mythtv-backend-master lirc lirc-modules-source module-assistant mythweb openssh-server mythtv 
> 
> #Step O: clean up downloaded packages to shrink CD size
> apt-get -y -q clean
> 
> #Step P: Build CD information and CD Based repository
> cd /
> mkdir -p /home/remastersys/ISOTMP/.disk
> cat > /home/remastersys/ISOTMP/.disk/info << EOF
> Mythbuntu $VERSION "$BASE_RELEASE" - $MYTHBUNTU_RELEASE $ARCHITECTURE ($DATE)
> EOF
> if [ ! -z $CDREPOSITORY ] ; then
> 	#apt-get -d -y install phpmyadmin
> 	mkdir -p /home/remastersys/ISOTMP/pool/universe
> 	mkdir -p /home/remastersys/ISOTMP/pool/universe/c
> 	mv /var/cache/apt/archives/cabextract* /home/remastersys/ISOTMP/pool/universe/c
> 	mkdir -p /home/remastersys/ISOTMP/pool/universe/d
> 	mv /var/cache/apt/archive/dialog* /home/remastersys/ISOTMP/pool/universe/d
> 	mkdir -p /home/remastersys/ISOTMP/pool/universe/l
> 	mv /var/cache/apt/archive/lirc* /home/remastersys/ISOTMP/pool/universe/l
> 	mv /var/cache/apt/archive/libpvm3* /home/remastersys/ISOTMP/pool/universe/l
> 	mkdir -p /home/remastersys/ISOTMP/pool/universe/m
> 	mv /var/cache/apt/archive/module-assistant* /home/remastersys/ISOTMP/pool/universe/l
> 	#mkdir -p /home/remastersys/ISOTMP/pool/universe/p
> 	#mv /var/cache/apt/archives/phpmyadmin* /home/remastersys/ISOTMP/pool/universe/p
> 	mkdir -p /home/remastersys/ISOTMP/pool/multiverse
> 	mkdir -p /home/remastersys/ISOTMP/pool/multiverse/l
> 	mv /var/cache/apt/archives/libfame* /home/remastersys/ISOTMP/pool/multiverse/l
> 	mkdir -p /home/remastersys/ISOTMP/pool/multiverse/m
> 	mv /var/cache/apt/archives/mstt* /home/remastersys/ISOTMP/pool/multiverse/m
> 	mv /var/cache/apt/archives/myth* /home/remastersys/ISOTMP/pool/multiverse/m
> 	mkdir -p /home/remastersys/ISOTMP/pool/multiverse/u
> 	mv /var/cache/apt/archives/ubuntu-mythtv* /home/remastersys/ISOTMP/pool/multiverse/u
> 	mkdir -p /home/remastersys/ISOTMP/pool/multiverse/t
> 	mv /var/cache/apt/archives/transcode* /home/remastersys/ISOTMP/pool/multiverse/t
> 	mkdir -p /home/remastersys/ISOTMP/pool/main
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/a
> 	mv /var/cache/apt/archives/a* /home/remastersys/ISOTMP/pool/main/a*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/b
> 	mv /var/cache/apt/archives/b* /home/remastersys/ISOTMP/pool/main/b*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/d
> 	mv /var/cache/apt/archives/d* /home/remastersys/ISOTMP/pool/main/d*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/g
> 	mv /var/cache/apt/archives/g* /home/remastersys/ISOTMP/pool/main/g*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/h
> 	mv /var/cache/apt/archives/h* /home/remastersys/ISOTMP/pool/main/h*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/i
> 	mv /var/cache/apt/archives/i* /home/remastersys/ISOTMP/pool/main/i*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/l
> 	mv /var/cache/apt/archives/l* /home/remastersys/ISOTMP/pool/main/l*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/m
> 	mv /var/cache/apt/archives/m* /home/remastersys/ISOTMP/pool/main/m*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/n
> 	mv /var/cache/apt/archives/n* /home/remastersys/ISOTMP/pool/main/n*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/o
> 	mv /var/cache/apt/archives/o* /home/remastersys/ISOTMP/pool/main/o*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/p
> 	mv /var/cache/apt/archives/p* /home/remastersys/ISOTMP/pool/main/p*
> 	mv /home/remastersys/ISOTMP/pool/main/p/partial /var/cache/apt/archives
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/u
> 	mv /var/cache/apt/archives/u* /home/remastersys/ISOTMP/pool/main/u*
> 	mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/main/binary-$ARCHITECTURE
> 	cat > /home/remastersys/ISOTMP/dists/$BASE_RELEASE/main/binary-$ARCHITECTURE/Release <<EOF
> 
> Archive: $BASE_RELEASE
> Version: $VERSION
> Component: main
> Origin: Ubuntu
> Label: Ubuntu
> Architecture: $ARCHITECTURE
> EOF
> 	mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/main/source
> 	mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/universe/binary-$ARCHITECTURE
> 	cat > /home/remastersys/ISOTMP/dists/$BASE_RELEASE/universe/binary-$ARCHITECTURE/Release <<EOF
> 
> Archive: $BASE_RELEASE
> Version: $VERSION
> Component: universe
> Origin: Ubuntu
> Label: Ubuntu
> Architecture: $ARCHITECTURE
> EOF
> 	mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/universe/source
> 	mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/multiverse/binary-$ARCHITECTURE
> 	cat > /home/remastersys/ISOTMP/dists/$BASE_RELEASE/multiverse/binary-$ARCHITECTURE/Release <<EOF
> 
> Archive: $BASE_RELEASE
> Version: $VERSION
> Component: multiverse
> Origin: Ubuntu
> Label: Ubuntu
> Architecture: $ARCHITECTURE
> EOF
> 	mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/multiverse/source
> 	cd /home/remastersys/ISOTMP/
> 	dpkg-scanpackages pool/main /dev/null > dists/$BASE_RELEASE/main/binary-$ARCHITECTURE/Packages
> 	cat dists/$BASE_RELEASE/main/binary-$ARCHITECTURE/Packages | gzip -9 > dists/$BASE_RELEASE/main/binary-$ARCHITECTURE/Packages.gz
> 	dpkg-scanpackages pool/universe /dev/null > dists/$BASE_RELEASE/universe/binary-$ARCHITECTURE/Packages
> 	cat dists/$BASE_RELEASE/universe/binary-$ARCHITECTURE/Packages | gzip -9 > dists/$BASE_RELEASE/universe/binary-$ARCHITECTURE/Packages.gz
> 	dpkg-scanpackages pool/multiverse /dev/null > dists/$BASE_RELEASE/multiverse/binary-$ARCHITECTURE/Packages
> 	cat dists/$BASE_RELEASE/multiverse/binary-$ARCHITECTURE/Packages | gzip -9 > dists/$BASE_RELEASE/multiverse/binary-$ARCHITECTURE/Packages.gz
> 	ln -s /home/remastersys/ISOTMP /cdrom
> 	cp /etc/apt/sources.list /etc/apt/sources.list~
> 	cat /etc/apt/sources.list~ | grep  "\n" | sed "s/^/#/" > /etc/apt/sources.list
> 	cat >>/etc/apt/sources.list <<EOF
> deb file:/cdrom feisty main universe multiverse
> EOF
> 	apt-get update
> 	cp /etc/apt/sources.list /etc/apt/sources.list~
> 	cat /etc/apt/sources.list~ | grep  "\n" | sed "s/^#//" > /etc/apt/sources.list
> 	rm /cdrom
> fi
> 
> #Step Q: Generate manifests and control scripts
> dpkg-query -W --showformat='${Package} ${Version}\n' \
>         | grep -v deinstall > /home/remastersys/ISOTMP/casper/filesystem.manifest
> cat > /home/remastersys/control <<EOF
> /casper/d
> /libdebian-installer4/d
> /os-prober/d
> /ubiquity/d
> /user-setup/d
> EOF
> sed -f /home/remastersys/control < /home/remastersys/ISOTMP/casper/filesystem.manifest > /home/remastersys/ISOTMP/casper/filesystem.manifest-desktop
> 
> #Step R: Create Live Disk User & prep their personalized desktop
> groupadd -g 999 ubuntu
> useradd -g 999 -u 999 -s /bin/bash -m -G adm,dialout,cdrom,floppy,audio,dip,video,plugdev,mythtv ubuntu
> mv /tmp/background_install.xpm /home/ubuntu/.background.xpm
> rm /home/ubuntu/.idesktop/*
> cat > /home/ubuntu/.idesktop/gmplayer.lnk <<EOF
> table Icon
>   Caption: GMplayer
>   CaptionTip: Runs mplayer from livecd
>   Command: gmplayer
>   Icon: /usr/share/pixmaps/mplayer.xpm
>   Width: 48
>   Height: 48
>   X: 243
>   Y: 0
> end
> EOF
> cat > /home/ubuntu/.idesktop/mythfrontend.lnk <<EOF
> table Icon
>   Caption: MythTV Frontend
>   CaptionTip: Runs directly from live cd
>   Command: export DEBIAN_FRONTEND=gnome; echo | sudo -S dpkg-reconfigure mythtv-common; mythfrontend
>   Icon: /usr/share/mythtv/themes/blue/myth_tv_logo.png
>   Width: 145
>   Height: 48
>   X: 1
>   Y: 0
> end
> EOF
> cat > /home/ubuntu/.idesktop/ubiquity.lnk <<EOF
> table Icon
>   Caption: Install MythTV
>   Caption Tip: Installs MythTV directly to this system
>   Command: echo | sudo -S /usr/bin/ubiquity --no-migration-assistant
>   Icon: /usr/share/pixmaps/ubiquity.png
>   Width: 64
>   Height: 64
>   X: 51
>   Y: 85
> end
> EOF
> cat > /home/ubuntu/.idesktop/vlc.lnk <<EOF
> table Icon
>   Caption: VLC
>   CaptionTip: Runs VLC from live cd
>   Command: vlc
>   Icon: /usr/share/vlc/vlc.xpm
>   Width: 48
>   Height: 48
>   X: 163
>   Y: 0
> end
> EOF
> cat > /home/ubuntu/.idesktop/firefox.lnk <<EOF
> table Icon
>   Caption: Firefox
>   CaptionTip: Runs Firefox from live cd
>   Command: firefox http://www.mythbuntu.org
>   Icon: /usr/share/pixmaps/mozilla-firefox.png
>   Width: 48
>   Height: 48
>   X: 323
>   Y: 0
> end
> EOF
> chown 999:999 /home/ubuntu/.idesk* -R
> 
> #Step S: prepare ubiquity
> rm -f /usr/share/ubiquity/apt-setup
> echo "#do nothing" > /usr/share/ubiquity/apt-setup
> chmod 755 /usr/share/ubiquity/apt-setup
> dpkg-reconfigure casper
> 
> #Step T: copy current kernel/initrd
> cp /vmlinuz /home/remastersys/ISOTMP/casper/
> cp /initrd.img /home/remastersys/ISOTMP/casper/initrd.gz
> 
> #Step U: Prep remastersys directories
> find /var/log -name *log.* > /home/remastersys/varexc
> find /var -name *.pid >> /home/remastersys/varexc
> find /var/tmp -name *cache* >> /home/remastersys/varexc
> rsync --exclude-from=/home/remastersys/varexc -av /var/. /home/remastersys/dummysys/var/.
> cp /boot/memtest86+.bin /home/remastersys/ISOTMP/install/mt86plus
> 
> #Step V: create squashfs
> if [ ! -z $FAKECHROOT ] ; then
> 	#Clean up directories before making ISO	TIME="The chroot build process ran for %E." time fakeroot fakechroot chroot $BASE_INSTALL /tmp/mythbuntu-install-script
> 	rm -r /proc /sys /dev
> 	mkdir -p /proc
> 	mkdir -p /dev
> 	mkdir -p /sys
> fi
> mksquashfs / /home/remastersys/ISOTMP/casper/filesystem.squashfs -e \
> .thumbnails \
> Cache \
> /etc/X11/xorg.conf \
> /etc/resolv.conf \
> /etc/mtab \
> /etc/fstab \
> /media \
> /mnt \
> /proc \
> /sys \
> /tmp \
> /var \
> /home/remastersys
> 
> #Step W: add other live cd folder requirements
> mksquashfs /home/remastersys/dummysys/ /home/remastersys/ISOTMP/casper/filesystem.squashfs
> 
> #Step X: remove our live user
> userdel ubuntu
> 
> #Step Xb: remove our proxy conf file
> rm /etc/apt/apt.conf
> 
> #Step Y: create a md5sum for the ISO
> cd /home/remastersys/ISOTMP && find . -type f -print0 | xargs -0 md5sum > md5sum.txt
> 
> #Step Z: create ISO
> mkisofs    \
>  -r    \
>  -V "Mythbuntu $MYTHBUNTU_RELEASE $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/remastersys/mythbuntu.iso "/home/remastersys/ISOTMP"
> ls -hs /home/remastersys/mythbuntu.iso
> 
> #Step ZA: unmount imaginary filesystems
> #the last one gets mounted during l-r-m install, but can be from many different kernels
> if [ -z $FAKECHROOT ] ; then
> 	umount /proc
> 	umount /dev/pts
> 	umount /sys
> 	find /lib/modules/ -name volatile | xargs umount
> fi
> 
> EOCHROOT
> 
> #####################################
> #Step 7, run our chroot script
> chmod +x $BASE_INSTALL/tmp/mythbuntu-install-script
> if [ ! -z $FAKECHROOT ] ; then
> 	TIME="The fakechroot build process ran for %E." time fakeroot fakechroot chroot $BASE_INSTALL /tmp/mythbuntu-install-script
> else
> 	TIME="The chroot build process ran for %E." time chroot $BASE_INSTALL /tmp/mythbuntu-install-script
> fi
> #!/bin/bash
> #Mythbuntu live cd generating script
> 
> #####################
> # Copyright © 2007  Mario Limonciello
> #
> # This script is loosely based from Linux Mint's live CD building script remastersys.
> #
> # * This program is free software; you can redistribute it and/or modify
> # * it under the terms of the GNU General Public License as published by
> # * the Free Software Foundation; either version 2 of the License, or
> # * (at your option) any later version.
> # *
> # * This program is distributed in the hope that it will be useful,
> # * but WITHOUT ANY WARRANTY; without even the implied warranty of
> # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> # * GNU General Public License for more details.
> # *
> # * You should have received a copy of the GNU General Public License
> # * along with this program; if not, write to the Free Software
> # * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
> #
> # On Ubuntu systems, a copy of the GPLv2 is available in /usr/share/common-licenses/GPL-2
> #
> #####################
> 
> #NOTE: This assumes that you have appropriate version of debootstrap on this system
> #Eg, if your debootstrapping into feisty, you need the feisty debootstrap installed
> 
> #NOTE2: You will need to setup the following env variables:
> 
> #Working Directory.  You will need 2-3 GB space here.
> if [ -z "$BASE_INSTALL" ] ; then
> 	BASE_INSTALL='/home/mythbuntu/isobuild'
> #	BASE_INSTALL='/tmp/mythbuntu_iso'
> fi
> 
> #Base mirror for repositories
> if [ -z "$BASE_MIRROR" ] ; then
> #	BASE_MIRROR='http://mirror.imbrandon.com/ubuntu/'
> #	BASE_MIRROR='http://mirror.cs.umn.edu/ubuntu/'
> #	BASE_MIRROR='http://ftp.ussg.iu.edu/linux/ubuntu'
> 	BASE_MIRROR='http://archive.ubuntu.com/ubuntu'
> fi
> 
> #Proxy if needed
> if [ -z "$HTTP_PROXY" ] ; then
>   http_proxy=http://proxy.url
> fi
> 
> #Ubuntu Release to base from
> if [ -z "$BASE_RELEASE" ] ; then
> 	BASE_RELEASE='feisty'
> fi
> 
> #Ubuntu Version to base from
> if [ -z "$VERSION" ] ; then
> 	VERSION='7.04'
> fi
> 
> #Mythbuntu Release
> if [ -z "$MYTHBUNTU_RELEASE" ] ; then
> 	MYTHBUNTU_RELEASE='alpha'
> fi
> 
> #Architecture we are building on
> if [ -z "$ARCHITECTURE" ] ; then
> 	ARCHITECTURE='amd64'
> fi
> 
> #Place to put the final ISO when done.  You will need 300-700 MB here.
> if [ -z "$NEW_ISO" ] ; then
> 	DATE=`date '+%m%d%y'`
> 	NEW_ISO="/home/mythbuntu/result/mythbuntu-$VERSION~$DATE-$ARCHITECTURE.iso"
> 	NEW_MD5="$NEW_ISO.md5sum"
> fi
> 
> #Setup our date that is used throughout the rest of the build
> DATE=`date '+%D'`
> 
> #Find the user building this
> ID=`id -u`
> 
> #For testing the port to non root user
> #FAKECHROOT='no'
> 
> #Enable the on CD repository
> #CDREPOSITORY='no'
> 
> #####################################
> #Step 0 - Check users, Clean up old stuf
> if [ -z $FAKECHROOT ] ; then
> 	if [ $ID != '0' ] ; then
> 		echo "Not building with fakechroot, need to build as root"
> 		exit 1
> 	else
> 		echo "Starting normal Mythbuntu build initiated by $ID at `date`"
> 	fi
> else
> 	if [ $ID != '0' ] ; then
> 		echo "Starting fakechroot'ed Mythbuntu build initiated by $ID at `date`"
> 	else
> 		echo "Don't build in fakechroot as root."
> 		exit 1
> 	fi
> fi
> mkdir -p $BASE_INSTALL
> rm -rf $BASE_INSTALL/*
> 
> #####################################
> #Step 1 - debootstrap new base system
> if [ -z $FAKECHROOT ] ; then
> 	debootstrap --arch $ARCHITECTURE $BASE_RELEASE $BASE_INSTALL $BASE_MIRROR
> else
> 	fakeroot fakechroot debootstrap  --variant=fakechroot --arch $ARCHITECTURE $BASE_RELEASE $BASE_INSTALL $BASE_MIRROR
> fi
> 
> #####################################
> #Step 2, Prep remastersys directory
> mkdir -p $BASE_INSTALL/home/remastersys
> mkdir -p $BASE_INSTALL/home/remastersys/dummysys
> mkdir -p $BASE_INSTALL/home/remastersys/dummysys/proc
> mkdir -p $BASE_INSTALL/home/remastersys/dummysys/tmp
> chmod ug+rwx,o+rwt $BASE_INSTALL/home/remastersys/dummysys/tmp
> mkdir -p $BASE_INSTALL/home/remastersys/dummysys/sys
> mkdir -p $BASE_INSTALL/home/remastersys/dummysys/mnt
> mkdir -p $BASE_INSTALL/home/remastersys/dummysys/media
> mkdir -p $BASE_INSTALL/home/remastersys/dummysys/var
> mkdir -p $BASE_INSTALL/var/cache/apt/archives
> mkdir -p $BASE_INSTALL/tmp
> mkdir -p $BASE_INSTALL/etc/apt
> cp -R ISOTMP $BASE_INSTALL/home/remastersys
> 
> #####################################
> #Step 3 - copy over networking config
> cp /etc/resolv.conf $BASE_INSTALL/etc/.
> cp /etc/apt/apt.conf  $BASE_INSTALL/etc/apt/.
> 
> #####################################
> #Step 4, Copy in our modified debs (Splash, ubiquity)
> cp ../splash/bin/$BASE_RELEASE/mythbuntu-artwork-usplash_0.1_$ARCHITECTURE.deb $BASE_INSTALL/var/cache/apt/archives
> 
> #####################################
> #Step 5, Copy in our background files
> cp background_setup.xpm $BASE_INSTALL/tmp
> cp background_install.xpm $BASE_INSTALL/tmp
> 
> #Step 5a, make symlinks to directories we will need to access in fakechroot mode
> if [ ! -z $FAKECHROOT ] ; then
> 	rm $BASE_INSTALL/proc -r
> 	rm $BASE_INSTALL/sys -r
> 	rm $BASE_INSTALL/dev -r
> 	ln -s /proc $BASE_INSTALL/proc
> 	ln -s /dev  $BASE_INSTALL/dev
> 	ln -s /sys  $BASE_INSTALL/sys
> fi
> 
> #####################################
> #Step 6, generate our chroot script
> cat <<EOCHROOT >$BASE_INSTALL/tmp/mythbuntu-install-script
> #!/bin/bash
> #Mythbuntu chroot install script
> # Copyright © 2007  Mario Limonciello
> 
> export DEBIAN_FRONTEND=noninteractive
> 
> #Step A: Clean up any old builds if debugging script
> rm -rf /home/remastersys/ISOTMP/casper/filesystem.squashfs
> rm -rf /home/remastersys/mythbuntu.iso
> 
> #Step B: Install the minimal ubuntu system in fakechroot mode, mount imaginary systems in normal mode
> if [ ! -z $FAKECHROOT ] ; then
> 	#Note, this needs to be forced because we don't yet have any apt keys
> 	apt-get install ubuntu-minimal -y --force-yes -o Acquire::Retries=25
> else
> 	mount -t proc   none  /proc
> 	mount -t devpts none  /dev/pts
> 	mount -t sysfs  sysfs /sys
> fi
> 
> #Step C: Generate sources.list
> cat <<EOF >/etc/apt/sources.list
> deb $BASE_MIRROR $BASE_RELEASE main restricted universe multiverse
> deb $BASE_MIRROR $BASE_RELEASE-updates main restricted universe multiverse
> deb $BASE_MIRROR $BASE_RELEASE-security main restricted universe multiverse
> deb $BASE_MIRROR $BASE_RELEASE-backports main restricted universe multiverse
> deb-src $BASE_MIRROR $BASE_RELEASE-updates main restricted universe multiverse
> deb-src $BASE_MIRROR $BASE_RELEASE universe multiverse main restricted
> deb-src $BASE_MIRROR $BASE_RELEASE-backports main restricted universe multiverse
> deb-src $BASE_MIRROR $BASE_RELEASE-security main restricted universe multiverse
> EOF
> 
> #Step D: Set default locale and timezone
> localedef -i en_US -c -f UTF-8 en_US.UTF-8
> echo "America/Chicago" > /etc/timezone
> cp /usr/share/zoneinfo/America/Chicago /etc/localtime
> 
> #Step E: Set up base configuration files for the rest of installation
> cat <<EOF >/etc/network/interfaces
> auto lo
> iface lo inet loopback 
> EOF
> cat <<EOF >/etc/kernel-img.conf
> do_symlinks = yes
> do_initrd = yes
> EOF
> cat <<EOF >/etc/casper.conf
> # This file should go in /etc/casper.conf
> # Supported variables are:
> # USERNAME, USERFULLNAME, HOST, BUILD_SYSTEM
> 
> export USERNAME="ubuntu"
> export USERFULLNAME="Live session user"
> export HOST="ubuntu"
> export BUILD_SYSTEM="Ubuntu"
> EOF
> 
> #Step F: Update the bootstrapped install
> apt-get update
> apt-get upgrade -y
> 
> #Step G: install the standard ubuntu utils
> apt-get install -y -o Acquire::Retries=25 ubuntu-standard
> 
> #Step H: Install a kernel & Restricted modules
> apt-get install -y -o Acquire::Retries=25 linux-image-generic linux-restricted-modules-generic
> 
> #Step I: install X, openbox, gdm, gnome-screensaver, idesk, feh, theme, firefox, libgnome2-perl
> apt-get install -y -o Acquire::Retries=25 openbox gdm xserver-xorg xterm xfonts-100dpi xfonts-75dpi xfonts-base gnome-screensaver ubuntu-artwork gsfonts-x11 idesk feh silicon-theme firefox libgnome2-perl
> 
> #Step J: install media players and mythtv frontend and all plugins
> apt-get install -y -o Acquire::Retries=25 vlc mythtv-frontend mythvideo mythdvd mythnews mythflix mythweather mythgame mythmusic mythgallery mythtv-themes mythphone mytharchive mythcontrols mythbrowser mplayer xine-ui
> 
> #Step K: install modified debs that we assembled
> apt-get install -y -o Acquire::Retries=25 libusplash-dev usplash
> dpkg -i /var/cache/apt/archives/mythbuntu-artwork-usplash_0.1_i386.deb
> 
> #Step L: Generate Skeleton Files & Configuration Files
> cat > /etc/skel/.ideskrc <<EOF
> table Config
>   FontName: arial
>   FontSize: 14
>   FontColor: #37CFA6
>   ToolTip.FontSize: 11
>   ToolTip.FontName: arial
>   ToolTip.ForeColor: #0000FF
>   ToolTip.BackColor: #FFFFFF
>   ToolTip.CaptionOnHover: true
>   ToolTip.CaptionPlacement: Right
>   Locked: false
>   Transparency: 92
>   Shadow: true
>   ShadowColor: #000000
>   ShadowX: 1
>   ShadowY: 1 
>   Bold: true
>   ClickDelay: 300
>   IconSnap: true
>   SnapWidth: 10
>   SnapHeight: 10
>   SnapOrigin: BottomRight
>   SnapShadow: false
>   SnapShadowTrans: 200
>   CaptionOnHover: false
>   CaptionPlacement: bottom
>   FillStyle: fillinvert
>   Background.Delay: 0
>   Background.Source: None
>   Background.File: None 
>   Background.Mode: Center 
>   Background.Color: #C2CCFF
> end
> 
> table Actions
>   Lock: control right doubleClk
>   Reload: middle doubleClk
>   Drag: left hold
>   EndDrag: left singleClk
>   Execute[0]: left doubleClk
>   Execute[1]: right doubleClk
> end
> EOF
> mkdir /etc/skel/.idesktop
> cat > /etc/skel/.dmrc <<EOF
> [Desktop]
> Session=mythtv_setup
> EOF
> cat > /etc/skel/.idesktop/mythtv-setup.lnk <<EOF
> table Icon
>   Caption: MythTV Setup
>   CaptionTip: Runs mythtv-setup
>   Command: mythtv-setup
>   Icon: /usr/share/mythtv/themes/blue/setup.png
>   Width: 90
>   Height: 60
>   X: 59
>   Y: 3
> end
> EOF
> cat > /etc/skel/.idesktop/mythtv-backend-stop.lnk <<EOF
> table Icon
>   Caption: Stop MythTV Backend
>   CaptionTip: Stops backend
>   Command: xterm -e "gksudo /etc/init.d/mythtv-backend stop --description \"Stop Mythtv-Backend\" && sleep 3"
>   Icon: /usr/share/mythtv/themes/blue/stop_button_pushed.png
>   Width: 60
>   Height: 60
>   X: 299
>   Y: 3
> end
> EOF
> cat > /etc/skel/.idesktop/mythtv-backend-start.lnk <<EOF
> table Icon
>   Caption: Start MythTV Backend
>   CaptionTip: Starts backend
>   Command: xterm -e "gksudo /etc/init.d/mythtv-backend start --description \"Start Mythtv-Backend\" && sleep 3"
>   Icon: /usr/share/mythtv/themes/blue/play_button_on.png
>   Width: 60
>   Height: 60
>   X: 519
>   Y: 3
> end
> EOF
> cat > /etc/skel/.idesktop/mythtv-backend-restart.lnk <<EOF
> table Icon
>   Caption: Restart MythTV Backend
>   CaptionTip: Restarts backend
>   Command: xterm -e "gksudo /etc/init.d/mythtv-backend restart --description \"Restart Mythtv-Backend\" && sleep 3"
>   Icon: /usr/share/mythtv/themes/default/mv_gallery_dir_up.png
>   Width: 60
>   Height: 60
>   X: 704
>   Y: 3
> end
> EOF
> cat > /etc/skel/.idesktop/mythfilldatabase.lnk <<EOF
> table Icon
>   Caption: mythfilldatabase
>   CaptionTip: Fills with initial data
>   Command: xterm -e "mythfilldatabase && sleep 3"
>   Icon: /usr/share/mythtv/themes/blue/showstatus.png
>   Width: 90
>   Height: 60
>   X: 864
>   Y: 3
> end
> EOF
> cat > /usr/share/xsessions/mythtv_setup.desktop <<EOF
> [Desktop Entry]
> Encoding=UTF-8
> Name=MythTV Setup
> Comment=Use this session to install and change mythtv settings
> Exec=/usr/share/mythtv/startmythtv_setup.sh
> Icon=
> Type=Application
> EOF
> cat > /usr/share/mythtv/startmythtv_setup.sh <<EOF
> #!/bin/sh
> #MythTV Install & Settings Session
> # Copyright © 2007  Mario Limonciello
> 
> #Setup background
> feh --bg-center ~/.background.xpm
> 
> #Start screensaver
> gnome-screensaver
> 
> #Start desktop icons
> idesk &
> 
> #Start window manager
> exec openbox
> EOF
> chmod +x /usr/share/mythtv/startmythtv_setup.sh
> cat > /etc/skel/.gtkrc-2.0 <<EOF
> include "/usr/share/themes/Silicon/gtk-2.0/gtkrc"
> EOF
> cp /etc/skel/.gtkrc-2.0 /root
> mv /tmp/background_setup.xpm /etc/skel/.background.xpm
> 
> 
> #Step M: Grab Live Cd Build Dependencies
> apt-get install -y -o Acquire::Retries=25 coreutils mkisofs findutils bash passwd sed squashfs-tools casper rsync mount eject libdebian-installer4 os-prober ubiquity user-setup memtest86+ dpkg-dev
> 
> #Step N: Preinstall all other options
> apt-get -y install -o Acquire::Retries=25 ubuntu-mythtv-frontend mythtv-backend-master lirc lirc-modules-source module-assistant mythweb openssh-server mythtv 
> 
> #Step O: clean up downloaded packages to shrink CD size
> apt-get -y -q clean
> 
> #Step P: Build CD information and CD Based repository
> cd /
> mkdir -p /home/remastersys/ISOTMP/.disk
> cat > /home/remastersys/ISOTMP/.disk/info << EOF
> Mythbuntu $VERSION "$BASE_RELEASE" - $MYTHBUNTU_RELEASE $ARCHITECTURE ($DATE)
> EOF
> if [ ! -z $CDREPOSITORY ] ; then
> 	#apt-get -d -y install phpmyadmin
> 	mkdir -p /home/remastersys/ISOTMP/pool/universe
> 	mkdir -p /home/remastersys/ISOTMP/pool/universe/c
> 	mv /var/cache/apt/archives/cabextract* /home/remastersys/ISOTMP/pool/universe/c
> 	mkdir -p /home/remastersys/ISOTMP/pool/universe/d
> 	mv /var/cache/apt/archive/dialog* /home/remastersys/ISOTMP/pool/universe/d
> 	mkdir -p /home/remastersys/ISOTMP/pool/universe/l
> 	mv /var/cache/apt/archive/lirc* /home/remastersys/ISOTMP/pool/universe/l
> 	mv /var/cache/apt/archive/libpvm3* /home/remastersys/ISOTMP/pool/universe/l
> 	mkdir -p /home/remastersys/ISOTMP/pool/universe/m
> 	mv /var/cache/apt/archive/module-assistant* /home/remastersys/ISOTMP/pool/universe/l
> 	#mkdir -p /home/remastersys/ISOTMP/pool/universe/p
> 	#mv /var/cache/apt/archives/phpmyadmin* /home/remastersys/ISOTMP/pool/universe/p
> 	mkdir -p /home/remastersys/ISOTMP/pool/multiverse
> 	mkdir -p /home/remastersys/ISOTMP/pool/multiverse/l
> 	mv /var/cache/apt/archives/libfame* /home/remastersys/ISOTMP/pool/multiverse/l
> 	mkdir -p /home/remastersys/ISOTMP/pool/multiverse/m
> 	mv /var/cache/apt/archives/mstt* /home/remastersys/ISOTMP/pool/multiverse/m
> 	mv /var/cache/apt/archives/myth* /home/remastersys/ISOTMP/pool/multiverse/m
> 	mkdir -p /home/remastersys/ISOTMP/pool/multiverse/u
> 	mv /var/cache/apt/archives/ubuntu-mythtv* /home/remastersys/ISOTMP/pool/multiverse/u
> 	mkdir -p /home/remastersys/ISOTMP/pool/multiverse/t
> 	mv /var/cache/apt/archives/transcode* /home/remastersys/ISOTMP/pool/multiverse/t
> 	mkdir -p /home/remastersys/ISOTMP/pool/main
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/a
> 	mv /var/cache/apt/archives/a* /home/remastersys/ISOTMP/pool/main/a*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/b
> 	mv /var/cache/apt/archives/b* /home/remastersys/ISOTMP/pool/main/b*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/d
> 	mv /var/cache/apt/archives/d* /home/remastersys/ISOTMP/pool/main/d*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/g
> 	mv /var/cache/apt/archives/g* /home/remastersys/ISOTMP/pool/main/g*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/h
> 	mv /var/cache/apt/archives/h* /home/remastersys/ISOTMP/pool/main/h*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/i
> 	mv /var/cache/apt/archives/i* /home/remastersys/ISOTMP/pool/main/i*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/l
> 	mv /var/cache/apt/archives/l* /home/remastersys/ISOTMP/pool/main/l*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/m
> 	mv /var/cache/apt/archives/m* /home/remastersys/ISOTMP/pool/main/m*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/n
> 	mv /var/cache/apt/archives/n* /home/remastersys/ISOTMP/pool/main/n*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/o
> 	mv /var/cache/apt/archives/o* /home/remastersys/ISOTMP/pool/main/o*
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/p
> 	mv /var/cache/apt/archives/p* /home/remastersys/ISOTMP/pool/main/p*
> 	mv /home/remastersys/ISOTMP/pool/main/p/partial /var/cache/apt/archives
> 	mkdir -p /home/remastersys/ISOTMP/pool/main/u
> 	mv /var/cache/apt/archives/u* /home/remastersys/ISOTMP/pool/main/u*
> 	mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/main/binary-$ARCHITECTURE
> 	cat > /home/remastersys/ISOTMP/dists/$BASE_RELEASE/main/binary-$ARCHITECTURE/Release <<EOF
> 
> Archive: $BASE_RELEASE
> Version: $VERSION
> Component: main
> Origin: Ubuntu
> Label: Ubuntu
> Architecture: $ARCHITECTURE
> EOF
> 	mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/main/source
> 	mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/universe/binary-$ARCHITECTURE
> 	cat > /home/remastersys/ISOTMP/dists/$BASE_RELEASE/universe/binary-$ARCHITECTURE/Release <<EOF
> 
> Archive: $BASE_RELEASE
> Version: $VERSION
> Component: universe
> Origin: Ubuntu
> Label: Ubuntu
> Architecture: $ARCHITECTURE
> EOF
> 	mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/universe/source
> 	mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/multiverse/binary-$ARCHITECTURE
> 	cat > /home/remastersys/ISOTMP/dists/$BASE_RELEASE/multiverse/binary-$ARCHITECTURE/Release <<EOF
> 
> Archive: $BASE_RELEASE
> Version: $VERSION
> Component: multiverse
> Origin: Ubuntu
> Label: Ubuntu
> Architecture: $ARCHITECTURE
> EOF
> 	mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/multiverse/source
> 	cd /home/remastersys/ISOTMP/
> 	dpkg-scanpackages pool/main /dev/null > dists/$BASE_RELEASE/main/binary-$ARCHITECTURE/Packages
> 	cat dists/$BASE_RELEASE/main/binary-$ARCHITECTURE/Packages | gzip -9 > dists/$BASE_RELEASE/main/binary-$ARCHITECTURE/Packages.gz
> 	dpkg-scanpackages pool/universe /dev/null > dists/$BASE_RELEASE/universe/binary-$ARCHITECTURE/Packages
> 	cat dists/$BASE_RELEASE/universe/binary-$ARCHITECTURE/Packages | gzip -9 > dists/$BASE_RELEASE/universe/binary-$ARCHITECTURE/Packages.gz
> 	dpkg-scanpackages pool/multiverse /dev/null > dists/$BASE_RELEASE/multiverse/binary-$ARCHITECTURE/Packages
> 	cat dists/$BASE_RELEASE/multiverse/binary-$ARCHITECTURE/Packages | gzip -9 > dists/$BASE_RELEASE/multiverse/binary-$ARCHITECTURE/Packages.gz
> 	ln -s /home/remastersys/ISOTMP /cdrom
> 	cp /etc/apt/sources.list /etc/apt/sources.list~
> 	cat /etc/apt/sources.list~ | grep  "\n" | sed "s/^/#/" > /etc/apt/sources.list
> 	cat >>/etc/apt/sources.list <<EOF
> deb file:/cdrom feisty main universe multiverse
> EOF
> 	apt-get update
> 	cp /etc/apt/sources.list /etc/apt/sources.list~
> 	cat /etc/apt/sources.list~ | grep  "\n" | sed "s/^#//" > /etc/apt/sources.list
> 	rm /cdrom
> fi
> 
> #Step Q: Generate manifests and control scripts
> dpkg-query -W --showformat='${Package} ${Version}\n' \
>         | grep -v deinstall > /home/remastersys/ISOTMP/casper/filesystem.manifest
> cat > /home/remastersys/control <<EOF
> /casper/d
> /libdebian-installer4/d
> /os-prober/d
> /ubiquity/d
> /user-setup/d
> EOF
> sed -f /home/remastersys/control < /home/remastersys/ISOTMP/casper/filesystem.manifest > /home/remastersys/ISOTMP/casper/filesystem.manifest-desktop
> 
> #Step R: Create Live Disk User & prep their personalized desktop
> groupadd -g 999 ubuntu
> useradd -g 999 -u 999 -s /bin/bash -m -G adm,dialout,cdrom,floppy,audio,dip,video,plugdev,mythtv ubuntu
> mv /tmp/background_install.xpm /home/ubuntu/.background.xpm
> rm /home/ubuntu/.idesktop/*
> cat > /home/ubuntu/.idesktop/gmplayer.lnk <<EOF
> table Icon
>   Caption: GMplayer
>   CaptionTip: Runs mplayer from livecd
>   Command: gmplayer
>   Icon: /usr/share/pixmaps/mplayer.xpm
>   Width: 48
>   Height: 48
>   X: 243
>   Y: 0
> end
> EOF
> cat > /home/ubuntu/.idesktop/mythfrontend.lnk <<EOF
> table Icon
>   Caption: MythTV Frontend
>   CaptionTip: Runs directly from live cd
>   Command: export DEBIAN_FRONTEND=gnome; echo | sudo -S dpkg-reconfigure mythtv-common; mythfrontend
>   Icon: /usr/share/mythtv/themes/blue/myth_tv_logo.png
>   Width: 145
>   Height: 48
>   X: 1
>   Y: 0
> end
> EOF
> cat > /home/ubuntu/.idesktop/ubiquity.lnk <<EOF
> table Icon
>   Caption: Install MythTV
>   Caption Tip: Installs MythTV directly to this system
>   Command: echo | sudo -S /usr/bin/ubiquity --no-migration-assistant
>   Icon: /usr/share/pixmaps/ubiquity.png
>   Width: 64
>   Height: 64
>   X: 51
>   Y: 85
> end
> EOF
> cat > /home/ubuntu/.idesktop/vlc.lnk <<EOF
> table Icon
>   Caption: VLC
>   CaptionTip: Runs VLC from live cd
>   Command: vlc
>   Icon: /usr/share/vlc/vlc.xpm
>   Width: 48
>   Height: 48
>   X: 163
>   Y: 0
> end
> EOF
> cat > /home/ubuntu/.idesktop/firefox.lnk <<EOF
> table Icon
>   Caption: Firefox
>   CaptionTip: Runs Firefox from live cd
>   Command: firefox http://www.mythbuntu.org
>   Icon: /usr/share/pixmaps/mozilla-firefox.png
>   Width: 48
>   Height: 48
>   X: 323
>   Y: 0
> end
> EOF
> chown 999:999 /home/ubuntu/.idesk* -R
> 
> #Step S: prepare ubiquity
> rm -f /usr/share/ubiquity/apt-setup
> echo "#do nothing" > /usr/share/ubiquity/apt-setup
> chmod 755 /usr/share/ubiquity/apt-setup
> dpkg-reconfigure casper
> 
> #Step T: copy current kernel/initrd
> cp /vmlinuz /home/remastersys/ISOTMP/casper/
> cp /initrd.img /home/remastersys/ISOTMP/casper/initrd.gz
> 
> #Step U: Prep remastersys directories
> find /var/log -name *log.* > /home/remastersys/varexc
> find /var -name *.pid >> /home/remastersys/varexc
> find /var/tmp -name *cache* >> /home/remastersys/varexc
> rsync --exclude-from=/home/remastersys/varexc -av /var/. /home/remastersys/dummysys/var/.
> cp /boot/memtest86+.bin /home/remastersys/ISOTMP/install/mt86plus
> 
> #Step V: create squashfs
> if [ ! -z $FAKECHROOT ] ; then
> 	#Clean up directories before making ISO	TIME="The chroot build process ran for %E." time fakeroot fakechroot chroot $BASE_INSTALL /tmp/mythbuntu-install-script
> 	rm -r /proc /sys /dev
> 	mkdir -p /proc
> 	mkdir -p /dev
> 	mkdir -p /sys
> fi
> mksquashfs / /home/remastersys/ISOTMP/casper/filesystem.squashfs -e \
> .thumbnails \
> Cache \
> /etc/X11/xorg.conf \
> /etc/resolv.conf \
> /etc/mtab \
> /etc/fstab \
> /media \
> /mnt \
> /proc \
> /sys \
> /tmp \
> /var \
> /home/remastersys
> 
> #Step W: add other live cd folder requirements
> mksquashfs /home/remastersys/dummysys/ /home/remastersys/ISOTMP/casper/filesystem.squashfs
> 
> #Step X: remove our live user
> userdel ubuntu
> 
> #Step Xb: remove our proxy conf file
> rm /etc/apt/apt.conf
> 
> #Step Y: create a md5sum for the ISO
> cd /home/remastersys/ISOTMP && find . -type f -print0 | xargs -0 md5sum > md5sum.txt
> 
> #Step Z: create ISO
> mkisofs    \
>  -r    \
>  -V "Mythbuntu $MYTHBUNTU_RELEASE $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/remastersys/mythbuntu.iso "/home/remastersys/ISOTMP"
> ls -hs /home/remastersys/mythbuntu.iso
> 
> #Step ZA: unmount imaginary filesystems
> #the last one gets mounted during l-r-m install, but can be from many different kernels
> if [ -z $FAKECHROOT ] ; then
> 	umount /proc
> 	umount /dev/pts
> 	umount /sys
> 	find /lib/modules/ -name volatile | xargs umount
> fi
> 
> EOCHROOT
> 
> #####################################
> #Step 7, run our chroot script
> chmod +x $BASE_INSTALL/tmp/mythbuntu-install-script
> if [ ! -z $FAKECHROOT ] ; then
> 	TIME="The fakechroot build process ran for %E." time fakeroot fakechroot chroot $BASE_INSTALL /tmp/mythbuntu-install-script
> else
> 	TIME="The chroot build process ran for %E." time chroot $BASE_INSTALL /tmp/mythbuntu-install-script
> fi
> 
> #####################################
> #Step 8, Cleanup
> rm $BASE_INSTALL/tmp/mythbuntu-install-script
> 
> #####################################
> #Step 9, Finished up
> #####################################
> mv $BASE_INSTALL/home/remastersys/mythbuntu.iso $NEW_ISO
> md5sum $NEW_ISO > $NEW_MD5
> echo "Your mythbuntu image generation completed at `date`"
> echo "The base install is located in $BASE_INSTALL"
> echo "The ISO image is located in $NEW_ISO"
> echo "The ISO md5sum is located in $NEW_MD5"
> #####################################
> #Step 8, Cleanup
> rm $BASE_INSTALL/tmp/mythbuntu-install-script
> 
> #####################################
> #Step 9, Finished up
> #####################################
> mv $BASE_INSTALL/home/remastersys/mythbuntu.iso $NEW_ISO
> md5sum $NEW_ISO > $NEW_MD5
> echo "Your mythbuntu image generation completed at `date`"
> echo "The base install is located in $BASE_INSTALL"
> echo "The ISO image is located in $NEW_ISO"