#!/bin/bash
if [ $(whoami) != "root" ];then
	if uname|grep -qi CYGWIN;then
		echo "Cygwin is not supported at the moment."
	else
		echo "This script must be run as root, so it can mount ISO images on the filesystem during the building process."
		exit 1
	fi
fi
set -e
#multicd.sh 5.0
#Copyright (c) 2009 maybeway36
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in
#all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#THE SOFTWARE.

if [ -d tags ];then rm -r tags;fi
mkdir -p tags/puppies

if echo $* | grep -q "\bmd5\b";then
 MD5=1
else
 if echo $* | grep -q "\bc\b";then
  MD5=1
 else
  MD5=0
 fi
fi
if echo $* | grep -q "\bm\b";then
 MEMTEST=0
else
 MEMTEST=1
fi
if echo $* | grep -q "\bv\b";then
 VERBOSE=1
 echo > tags/verbose
else
 VERBOSE=0
fi
if echo $* | grep -q "\bcondeb\b";then
 CONDEB=1
else
 CONDEB=0
fi
if echo $* | grep -q "\bmodules\b";then
 MODULES=1
else
 MODULES=0
fi

if [ $MODULES = 1 ];then
 if which dialog;then
  dialog --checklist "Slax modules to include:" 13 45 6 \
  002-xorg.lzm Xorg on \
  003-desktop.lzm KDE on \
  004-kdeapps.lzm "KDE applications" on \
  005-koffice.lzm "KDE Office" on \
  006-devel.lzm Development on \
  2> ./slaxlist0
  echo >> ./slaxlist0
  cat ./slaxlist0|sed -e 's/"//g' -e 's/ /\n/g'>./slaxlist
  rm ./slaxlist0
 else
  echo "Please install dialog to use the module selector."
  exit 1
 fi
fi

echo "List of boot options that will be included:"
#START SCAN
#antiX Linux plugin for multicd.sh
#version 5.0
	if [ -f antix.iso ];then
		echo "AntiX"
	fi
#Arch Linux installer plugin for multicd.sh
#version 5.0
	if [ -f arch.iso ];then
		echo "Arch Linux"
	fi
#Austrumi plugin for multicd.sh
#version 5.0.1
	if [ -f austrumi.iso ];then
		echo "Austrumi"
	elif [ -f al.iso ];then
		echo "Austrumi (moving al.iso to austrumi.iso)"
		mv al.iso austrumi.iso
	fi
#BackTrack plugin for multicd.sh (designed for BackTrack 4)
#version 5.0
	if [ -f backtrack.iso ];then
		if [ -f ubuntu.iso ] || [ -f linuxmint.iso ];then
			echo "Backtrack uses casper, so it can't be used with Ubuntu or Linux Mint right now. This feature will probably be added later."
		else
			echo "BackTrack"
		fi
	fi
#Clonezilla plugin for multicd.sh
#version 5.0
	if [ -f $ISONAME.iso ];then
		echo "Clonezilla"
	fi
#DBAN plugin for multicd.sh
#version 5.0
	if [ -f dban.iso ];then
		echo "DBAN"
	fi
#Debian installer plugin for multicd.sh
#version 5.0
	if [ -f debian-mini.iso ];then
		echo "Debian netboot installer"
	fi
#Debian Live plugin for multicd.sh
#version 5.0
	if [ -f binary.iso ];then
		echo "Debian Live"
	fi
#DeLi Linux plugin for multicd.sh
#version 5.0
	if [ -f deli.iso ];then
		echo "DeLi Linux"
	fi
#EASEUS Disk Copy plugin for multicd.sh
#version 5.0
	if [ -f $ISONAME.iso ];then
		echo "EASEUS Disk Copy"
		DCISO=1
	else
		if [ -f DC2.iso ];then
			ln -s DC2.iso $ISONAME.iso
			echo "EASEUS Disk Copy (note: made link from DC2.iso to $ISONAME.iso)"
			DCISO=1
		else
			DCISO=0
		fi
	fi
#DSL plugin for multicd.sh
#version 5.0
	if [ -f dsl.iso ];then
		echo "Damn Small Linux"
	fi
#Feather Linux plugin for multicd.sh
#version 5.0.1
	if [ -f feather.iso ];then
		echo "Feather"
	fi
#Fedora installer plugin for multicd.sh
#version 5.0
	if [ -f fedora-boot.iso ];then
		echo "Fedora netboot installer"
	fi
#FreeDOS installer plugin for multicd.sh
#version 5.0
	if [ -f fdfullcd.iso ] || [ -f fdbasecd.iso ];then
		echo "FreeDOS"
	fi
#GeeXboX plugin for multicd.sh
#version 5.0
	if [ -f geexbox.iso ];then
		echo "GeeXboX"
	elif [ -f gbox.iso ];then
		echo "GeeXboX (moving gbox.iso to geexbox.iso)"
		mv gbox.iso geexbox.iso
	fi
#GParted Live plugin for multicd.sh
#version 5.0
	if [ -f $ISONAME.iso ];then
		echo "GParted Live"
	fi
#INSERT plugin for multicd.sh
#version 5.0
	if [ -f $ISONAME.iso ];then
		echo "INSERT"
	fi
#Knoppix plugin for multicd.sh
#version 5.0
	if [ -f knoppix.iso ];then
		echo "Knoppix"
		export KNOPPIX=1
	fi
#Linux Mint plugin for multicd.sh
#version 5.0
	if [ -f linuxmint.iso ];then
		if [ -f ubuntu.iso ];then
			echo
			echo "Ubuntu and Linux Mint both use casper. They can't be on the same CD without"
			echo "initrd modifications, which this script does not support."
			echo "Ignoring linuxmint.iso."
		else
			echo "Linux Mint"
		fi
	fi
#Macpup plugin for multicd.sh
#version 5.0.1
	if [ -f macpup.iso ];then
		echo "Macpup"
		echo>tags/puppies/macpup
	fi
#Mandriva installer plugin for multicd.sh
#version 5.0
	if [ -f mandriva-boot.iso ];then
		echo "Mandriva netboot installer"
	fi
#NetbootCD 3.x plugin for multicd.sh
#version 5.0
	if [ -f netbootcd.iso ];then
		echo "NetbootCD"
	fi
#NT Password Editor plugin for multicd.sh
#version 5.0
	if [ -f $ISONAME.iso ];then
		echo "NT Password Editor"
	fi
#openSUSE installer plugin for multicd.sh
#version 5.0
	if [ -f opensuse.iso ];then
		echo "openSUSE netboot installer"
	fi
#PCLinuxOS LXDE plugin for multicd.sh
#version 5.0.1
	if [ -f pclx.iso ];then
		echo "PCLinuxOS LXDE"
	fi
#PING plugin for multicd.sh
#version 5.0
	if [ -f $ISONAME.iso ];then
		echo "PING"
	fi
#Parted Magic plugin for multicd.sh
#version 5.0
	if [ -f $ISONAME.iso ];then
		echo "Parted Magic"
	fi
#Puppy Linux plugin for multicd.sh
#version 5.0.1
	if [ -f puppy.iso ];then
		echo "Puppy Linux"
		echo>tags/puppies/puppy
	fi
#RIPLinuX plugin for multicd.sh
#version 5.0
	if [ -f $ISONAME.iso ];then
		echo "RIPLinuX"
	fi
#Slax 6 plugin for multicd.sh
#version 5.0.1
	if [ -f slax.iso ];then
		echo "Slax"
	fi
#SliTaz plugin for multicd.sh
#version 5.0
	if [ -f slitaz.iso ];then
		echo "SliTaz"
	fi
#SystemRescueCd plugin for multicd.sh
#version 5.0
	if [ -f $ISONAME.iso ];then
		echo "SystemRescueCd"
	fi
#TCNet plugin for multicd.sh
#version 5.0
	if [ -f tcnet.iso ];then
		echo "TCNet"
	fi
#Tiny Core Linux plugin for multicd.sh
#version 5.0
	if [ -f tinycore.iso ];then
		echo "Tiny Core Linux"
	fi
#TinyMe plugin for multicd.sh
#version 5.0
	if [ -f tinyme.iso ];then
		echo "TinyMe"
	fi
#Trinity Rescue Kit plugin for multicd.sh
#version 5.0
	if [ -f trk.iso ];then
		echo "Trinity Rescue Kit"
	fi
#Ultimate Boot CD plugin for multicd.sh
#version 5.0
	if [ -f ubcd.iso ];then
		echo "Ultimate Boot CD"
	fi
	if [ -f dban.iso ] && [ -f ubcd.iso ];then
		echo
		echo "Note: Ultimate Boot CD includes DBAN, so it is not necessary alone as well."
		echo "Continuing anyway."
	fi
	if [ -f ntpasswd.iso ] && [ -f ubcd.iso ];then
		echo
		echo "Note: UBCD includes NT Password & Registry Editor, so it is not necessary alone as well."
		echo "Continuing anyway."
	fi
#Ubuntu installer plugin for multicd.sh
#version 5.0
	if [ -f ubuntu-mini.iso ];then
		echo "Ubuntu netboot installer"
	fi
#Ubuntu plugin for multicd.sh
#version 5.0
	if [ -f ubuntu.iso ];then
		echo "Ubuntu"
	fi
#Ubuntu #2 plugin for multicd.sh
#version 5.0
	if [ -f ubuntu2.iso ];then
		echo "Ubuntu #2 (for using two versions on one disc)*"
		echo "  *Note: this plugin is still in beta. If you are not including two versions of"
		echo "  Ubuntu on this disc, rename ubuntu2.iso to ubuntu.iso instead and it'll work."
	fi
#WeakNet Linux plugin for multicd.sh
#version 5.0
	if [ -f weaknet.iso ];then
		#if [ -f ubuntu.iso ] || [ -f linuxmint.iso ] || [ -f backtrack.iso ];then
			#echo "WeakNet uses casper, so it can't be used with Ubuntu, Linux Mint or BackTrack right now. This feature will probably be added later."
		#else
			echo "WeakNet Linux"
		#fi
	fi
#Wolvix plugin for multicd.sh
#version 5.0
	if [ -f wolvix.iso ];then
		echo "Wolvix"
	fi
#END SCAN

for i in $( ls -1 *.im[g,z] 2> /dev/null); do
 echo $(echo $i|sed 's/\.im.//')
done
GAMES=0 #Will be changed if there are games
for i in $( ls -1 games/*.im[g,z] 2> /dev/null ); do
 echo Game: $(echo $i|sed 's/\.im.//'|sed 's/games\///')
 GAMES=1
done
if [ -f grub.exe ];then
 echo "GRUB4DOS"
fi
if [ $MEMTEST = 1 ];then
 echo "Memtest86+"
fi

echo
echo "Continuing in 3 seconds - press Ctrl+C to cancel"
sleep 3

if [ $(find tags/puppies -maxdepth 1 -type f|wc -l) -gt 0 ] && which dialog &> /dev/null;then
	echo 'dialog --radiolist "Which Puppy variant would you like to be installable to HD from the disc?" 13 45 6 \'>puppychooser
	for i in tags/puppies/*;do
		echo $(echo $i|sed -e 's/tags\/puppies\///g') \"\" off \\ >> puppychooser
	done
	echo "2> puppyresult" >> puppychooser
	sh puppychooser
	echo>tags/puppies/$(cat puppyresult).inroot
	rm puppychooser puppyresult
fi

if [ -d multicd-working ];then
 rm -r multicd-working/*
else
 mkdir multicd-working
fi

#Make sure it exists, you need to put stuff there later
mkdir -p multicd-working/boot/isolinux

#START COPY
	if [ -f antix.iso ];then
		if [ ! -d antix ];then
			mkdir antix
		fi
		if grep -q "`pwd`/antix" /etc/mtab ; then
			umount antix
		fi
		mount -o loop antix.iso antix/
		cp -r antix/mepis multicd-working/ #Everything in antiX but the kernel and initrd
		mkdir -p multicd-working/boot/antix
		cp antix/boot/vmlinuz multicd-working/boot/antix/vmlinuz #Kernel
		cp antix/boot/initrd.gz multicd-working/boot/antix/initrd.gz #Initrd
		umount antix
		rmdir antix
	fi
	if [ -f arch.iso ];then
		echo "Copying Arch Linux..."
		if [ ! -d arch ];then
			mkdir arch
		fi
		if grep -q "`pwd`/arch" /etc/mtab ; then
			umount arch
		fi
		mount -o loop arch.iso arch/
		mkdir multicd-working/boot/arch
		cp arch/boot/vmlinuz26 multicd-working/boot/arch/vmlinuz26 #Kernel
		cp arch/boot/archiso_pata.img multicd-working/boot/arch/archiso_pata.img #initrd
		cp arch/boot/archiso_ide.img multicd-working/boot/arch/archiso_ide.img #Another initrd
		cp arch/*.sqfs multicd-working/ #Compressed filesystems
		cp arch/isomounts multicd-working/ #Text file
		umount arch
		rmdir arch
	fi
	if [ -f austrumi.iso ];then
		echo "Copying Austrumi..."
		if [ ! -d austrumi ];then
			mkdir austrumi
		fi
		if grep -q "`pwd`/austrumi" /etc/mtab ; then
			umount austrumi
		fi
		mount -o loop austrumi.iso austrumi/
		cp -r austrumi/austrumi multicd-working/ #This folder also has the kernel and initrd
		cp austrumi/isolinux.cfg multicd-working/boot/isolinux/al.menu
		#These files were moved in 1.9.3
		#cp austrumi/boot/austrumi.fs multicd-working/boot/austrumi.fs
		#cp austrumi/boot/austrumi.tgz multicd-working/boot/austrumi.tgz
		umount austrumi;rmdir austrumi
	fi
	if [ -f backtrack.iso ] && [ ! -f ubuntu.iso ] && [ ! -f linuxmint.iso ];then
		echo "Copying BackTrack..."
		if [ ! -d backtrack ];then
			mkdir backtrack
		fi
		if grep -q "`pwd`/backtrack" /etc/mtab ; then
			umount backtrack
		fi
		mount -o loop backtrack.iso backtrack/
		cp -R backtrack/casper multicd-working/
		mkdir multicd-working/boot/backtrack
		cp backtrack/boot/vmlinuz multicd-working/boot/backtrack/
		cp backtrack/boot/initrd* multicd-working/boot/backtrack/
		umount backtrack
		rmdir backtrack
	fi
	if [ -f $ISONAME.iso ];then
		echo "Copying Clonezilla..."
		if [ ! -d clonezilla ];then
			mkdir clonezilla
		fi
		if grep -q "`pwd`/clonezilla" /etc/mtab ; then
			umount clonezilla
		fi
		mount -o loop clonezilla.iso clonezilla/
		cp clonezilla/isolinux/ocswp.png multicd-working/boot/isolinux/ocswp.png #Boot menu logo
		cp -R clonezilla/live multicd-working/boot/clonezilla #Another Debian Live-based ISO
		umount clonezilla
		rmdir clonezilla
		rm multicd-working/boot/clonezilla/memtest
	fi
	if [ -f dban.iso ];then
		echo "Copying DBAN..."
		if [ ! -d dban ];then
			mkdir dban
		fi
		if grep -q "`pwd`/dban" /etc/mtab ; then
			umount dban
		fi
		mount -o loop dban.iso dban/
		cp dban/dban*.ima /tmp/dban.ima #Get the floppy image from inside the CD image
		umount dban
		mount -o loop /tmp/dban.ima dban #Then mount that floppy image
		mkdir -p multicd-working/boot/dban1
		cp dban/kernel.bzi multicd-working/boot/dban1/kernel.bzi
		cp dban/initrd.gz multicd-working/boot/dban1/initrd.gz
		umount dban
		rmdir dban
	fi
	if [ -f debian-mini.iso ];then
		echo "Copying Debian netboot installer..."
		if [ ! -d debian-mini ];then
			mkdir debian-mini
		fi
		if grep -q "`pwd`/debian-mini" /etc/mtab ; then
			umount debian-mini
		fi
		mount -o loop debian-mini.iso debian-mini/
		mkdir multicd-working/boot/debian
		cp debian-mini/linux multicd-working/boot/debian/linux
		cp debian-mini/initrd.gz multicd-working/boot/debian/initrd.gz
		umount debian-mini
		rmdir debian-mini
	fi
	if [ -f binary.iso ];then
		echo "Copying Debian Live..."
		if [ ! -d dlive ];then
			mkdir dlive
		fi
		if grep -q "`pwd`/dlive" /etc/mtab ; then
			umount dlive
		fi
		mount -o loop binary.iso dlive/
		cp dlive/isolinux/live.cfg /tmp/live.cfg #Copy the menu so we can read it later
		cp -r dlive/live multicd-working/ #Copy live folder - usually all that is needed
		if [ -d dlive/install ];then
			cp -r dlive/install multicd-working/ #Doesn't hurt to check
		fi
		umount dlive
		rmdir dlive
		rm multicd-working/live/memtest||true #We don't need this now; we'll get it later
	fi
	if [ -f deli.iso ];then
		echo "Copying DeLi Linux..."
		if [ ! -d deli ];then
			mkdir deli
		fi
		if grep -q "`pwd`/deli" /etc/mtab ; then
			umount deli
		fi
		mount -o loop deli.iso deli/
		cp -r deli/isolinux multicd-working/ #Kernel and filesystem
		cp -r deli/pkg multicd-working/ #Packages
		umount deli
		rmdir deli
	fi
	if [ -f $ISONAME.iso ];then
		if [ ! -d diskcopy ];then
			mkdir diskcopy
		fi
		if grep -q "`pwd`/diskcopy" /etc/mtab ; then
			umount diskcopy
		fi
		mount -o loop diskcopy.iso diskcopy/
		mkdir -p multicd-working/boot/diskcopy
		cp diskcopy/boot/bzImage multicd-working/boot/diskcopy/bzImage
		cp diskcopy/boot/initrd.img multicd-working/boot/diskcopy/initrd.img
		umount diskcopy
		rmdir diskcopy
	fi
	if [ -f dsl.iso ];then
		echo "Copying Damn Small Linux..."
		if [ ! -d dsl ];then
			mkdir dsl
		fi
		if grep -q "`pwd`/dsl" /etc/mtab ; then
			umount dsl
		fi
		mount -o loop dsl.iso dsl/
		mkdir multicd-working/KNOPPIX
		cp -R dsl/KNOPPIX/* multicd-working/KNOPPIX/ #Compressed filesystem. We put it here so DSL's installer can find it.
		cp dsl/boot/isolinux/linux24 multicd-working/boot/isolinux/linux24 #Kernel. See above.
		cp dsl/boot/isolinux/minirt24.gz multicd-working/boot/isolinux/minirt24.gz #Initial ramdisk. See above.
		umount dsl;rmdir dsl
	fi
	if [ -f feather.iso ];then
		echo "Copying Feather..."
		if [ ! -d feather ];then
			mkdir feather
		fi
		if grep -q "`pwd`/feather" /etc/mtab ; then
			umount feather
		fi
		mount -o loop feather.iso feather/
		mkdir multicd-working/FEATHER
		cp -R feather/KNOPPIX/* multicd-working/FEATHER/ #Compressed filesystem
		mkdir multicd-working/boot/feather
		cp feather/boot/isolinux/linux24 multicd-working/boot/feather/linux24
		cp feather/boot/isolinux/minirt24.gz multicd-working/boot/feather/minirt24.gz
		umount feather
		rmdir feather
	fi
	if [ -f fedora-boot.iso ];then
		 echo "Copying Fedora netboot installer..."
		if [ ! -d fedora-boot ];then
			mkdir fedora-boot
		fi
		if grep -q "`pwd`/fedora-boot" /etc/mtab ; then
			umount fedora-boot
		fi
		mount -o loop fedora-boot.iso fedora-boot/
		mkdir multicd-working/boot/fedora
		cp fedora-boot/isolinux/vmlinuz multicd-working/boot/fedora/vmlinuz
		cp fedora-boot/isolinux/initrd.img multicd-working/boot/fedora/initrd.img
		#Commenting out the below line will save about 100MB on the CD, but it will have to be downloaded when you install Fedora
		cp -R fedora-boot/images multicd-working/
		umount fedora-boot
		rmdir fedora-boot
	fi
	if [ -f fdfullcd.iso ] || [ -f fdbasecd.iso ];then
		echo "Copying FreeDOS..."
		if [ ! -d freedos ];then
			mkdir freedos
		fi
		if grep -q "`pwd`/freedos" /etc/mtab ; then
			umount freedos
		fi
		if [ -f fdfullcd.iso ];then mount -o loop fdfullcd.iso freedos/ #It might be fdbasecd or fdfullcd
		else mount -o loop fdbasecd.iso freedos/;fi
			mkdir multicd-working/boot/freedos
		cp -r freedos/freedos multicd-working/ #Core directory with the packages
		cp freedos/setup.bat multicd-working/setup.bat #FreeDOS setup
		cp freedos/isolinux/data/fdboot.img multicd-working/boot/freedos/fdboot.img #Initial DOS boot image
		if [ -d freedos/fdos ];then
			cp -r freedos/fdos multicd-working/ #Live CD
		fi
		if [ -d freedos/gemapps ];then
			cp -r freedos/gemapps multicd-working/ #OpenGEM
		fi
		if [ -f freedos/gem.bat ];then
			cp -r freedos/gem.bat multicd-working/ #OpenGEM setup
		fi
		umount freedos
		rmdir freedos
	fi
	if [ -f geexbox.iso ];then
		echo "Copying GeeXboX..."
		if [ ! -d geexbox ];then
			mkdir geexbox
		fi
		if grep -q "`pwd`/geexbox" /etc/mtab ; then
			umount geexbox
		fi
		mount -o loop geexbox.iso geexbox/
		cp -r geexbox/GEEXBOX multicd-working/ #Everything GeeXbox has is in one folder. :)
		umount geexbox;rmdir geexbox
	fi
	if [ -f $ISONAME.iso ];then
		if [ ! -d gparted ];then
			mkdir gparted
		fi
		if grep -q "`pwd`/gparted" /etc/mtab ; then
			umount gparted
		fi
		mount -o loop gparted.iso gparted/
		cp -R gparted/live multicd-working/boot/gparted #Compressed filesystem and kernel/initrd
		rm multicd-working/boot/gparted/memtest #Remember how we needed to do this with Debian Live? They use the same framework
		umount gparted
		rmdir gparted
	fi
	if [ -f $ISONAME.iso ];then
	if [ ! -d insert ];then
		mkdir insert
	fi
	if grep -q "`pwd`/insert" /etc/mtab ; then
		umount insert
	fi
	mount -o loop insert.iso insert/
	cp -R insert/INSERT multicd-working/ #Compressed filesystem
	mkdir multicd-working/boot/insert
	cp insert/isolinux/vmlinuz multicd-working/boot/insert/vmlinuz
	cp insert/isolinux/miniroot.lz multicd-working/boot/insert/miniroot.lz
	umount insert
	rmdir insert
	fi
	if [ -f knoppix.iso ];then
		echo "Copying Knoppix..."
		if [ ! -d knoppix ];then
			mkdir knoppix
		fi
		if grep -q "`pwd`/knoppix" /etc/mtab ; then
			umount knoppix
		fi
		mount -o loop knoppix.iso knoppix/
		mkdir multicd-working/KNOPPIX5
		#Compressed filesystem and docs. We have to call it KNOPPIX5 because DSL uses KNOPPIX, and if we change that DSL's installer won't work.
		for i in $(ls knoppix/KNOPPIX*|grep -v '^KNOPPIX2$');do
			cp -r knoppix/KNOPPIX/$i multicd-working/KNOPPIX5/
		done
		mkdir -p multicd-working/boot/knoppix
		cp knoppix/boot/isolinux/linux multicd-working/boot/knoppix/linux
		cp knoppix/boot/isolinux/minirt.gz multicd-working/boot/knoppix/minirt.gz
		umount knoppix;rmdir knoppix
	fi
	if [ -f linuxmint.iso ] && [ ! -f ubuntu.iso ];then
		echo "Copying Linux Mint..."
		if [ ! -d linuxmint ];then
			mkdir linuxmint
		fi
		if grep -q "`pwd`/linuxmint" /etc/mtab ; then
			umount linuxmint
		fi
		mount -o loop linuxmint.iso linuxmint/
		cp -R linuxmint/casper multicd-working/ #Live system
		cp -R linuxmint/drivers multicd-working/ #Drivers added by the Mint team
		cp -R linuxmint/preseed multicd-working/ #Tells the installer what to install
		cp -R linuxmint/.disk multicd-working/ #A few more helper files
		umount linuxmint
		rmdir linuxmint
	fi
	if [ -f macpup.iso ];then
		echo "Copying Macpup..."
		if [ ! -d macpup ];then
			mkdir macpup
		fi
		if grep -q "`pwd`/macpup" /etc/mtab ; then
			umount macpup
		fi
		mount -o loop macpup.iso macpup/
		#The installer will only work if Macpup is in the root dir of the disc
		if [ ! -f tags/puppies/macpup.inroot ];then
			mkdir multicd-working/macpup
			cp macpup/*.sfs multicd-working/macpup/
			cp macpup/vmlinuz multicd-working/macpup/vmlinuz
			cp macpup/initrd.gz multicd-working/macpup/initrd.gz
		else
			cp macpup/*.sfs multicd-working/
			cp macpup/vmlinuz multicd-working/vmlinuz
			cp macpup/initrd.gz multicd-working/initrd.gz
		fi
		umount macpup
		rmdir macpup
	fi
	if [ -f mandriva-boot.iso ];then
		echo "Copying Mandriva netboot installer..."
		if [ ! -d mandriva-boot ];then
			mkdir mandriva-boot
		fi
		if grep -q "`pwd`/mandriva-boot" /etc/mtab ; then
			umount mandriva-boot
		fi
		mount -o loop mandriva-boot.iso mandriva-boot/
		mkdir multicd-working/boot/mandriva
		cp -r mandriva-boot/isolinux/alt0 multicd-working/boot/mandriva/
		cp -r mandriva-boot/isolinux/alt1 multicd-working/boot/mandriva/
		umount mandriva-boot
		rmdir mandriva-boot
	fi
	if [ -f netbootcd.iso ];then
		echo "Copying NetbootCD..."
		if [ ! -d netbootcd ];then
			mkdir netbootcd
		fi
		if grep -q "`pwd`/netbootcd" /etc/mtab ; then
			umount netbootcd
		fi
		mount -o loop netbootcd.iso netbootcd/
		mkdir -p multicd-working/boot/nbcd
		cp netbootcd/isolinux/kexec.bzI multicd-working/boot/nbcd/kexec.bzI
		cp netbootcd/isolinux/nbinit3.gz multicd-working/boot/nbcd/nbinit3.gz
		umount netbootcd;rmdir netbootcd
	fi
	if [ -f $ISONAME.iso ];then
		if [ ! -d ntpasswd ];then
			mkdir ntpasswd
		fi
		if grep -q "`pwd`/ntpasswd" /etc/mtab ; then
			umount ntpasswd
		fi
		mount -o loop ntpasswd.iso ntpasswd/
		mkdir multicd-working/boot/ntpasswd
		cp ntpasswd/vmlinuz multicd-working/boot/ntpasswd/vmlinuz
		cp ntpasswd/initrd.cgz multicd-working/boot/ntpasswd/initrd.cgz
		cp ntpasswd/scsi.cgz multicd-working/boot/ntpasswd/scsi.cgz #Alternate initrd
		umount ntpasswd
		rmdir ntpasswd
	fi
	if [ -f opensuse.iso ];then
		echo "Copying openSUSE netboot installer..."
		if [ ! -d opensuse ];then
			mkdir opensuse
		fi
		if grep -q "`pwd`/opensuse" /etc/mtab ; then
			umount opensuse
		fi
		mount -o loop opensuse.iso opensuse/
		mkdir multicd-working/boot/opensuse
		awk '/^VERSION/ {print $2}' opensuse/content >/tmp/$USER-opensuseversion.tmp
		cp opensuse/boot/i386/loader/linux multicd-working/boot/opensuse/linux
		cp opensuse/boot/i386/loader/initrd multicd-working/boot/opensuse/initrd
		umount opensuse
		rmdir opensuse
	fi
	if [ -f feather.iso ];then
		echo "Copying PCLinuxOS LXDE..."
		if [! -d pclinuxos ];then
			mkdir pclinuxos
		fi
		if grep -q `pwd`/pclinuxos /etc/mtab ; then
			umount pclinuxos
		fi
		mount -o loop pclx.iso pclinuxos/
		mkdir multicd-working/PCLinuxOS
		# Kernel, initrd
		cp -r pclinuxos/isolinux multicd-working/PCLinuxOS/isolinux
		# Empty boot folder, don't ask me...
		# cp -r pclinuxos/boot multicd-working/PCLinuxOS/boot
		# Filesystem
		cp pclinuxos/livecd.sqfs multicd-working/PCLinuxOS/livecd.sqfs
		# Remove memtest and mediacheck
		rm multicd-working/PCLinuxOS/isolinux/memtest multicd-working/PCLinuxOS/isolinux/mediacheck
		umount pclinuxos
		rmdir pclinuxos
	fi
	if [ -f $ISONAME.iso ];then
		echo "Copying PING..."
		if [ ! -d ping ];then
			mkdir ping
		fi
		if grep -q "`pwd`/ping" /etc/mtab ; then
			umount ping
		fi
		mount -o loop ping.iso ping/
		mkdir -p multicd-working/boot/ping
		cp ping/kernel multicd-working/boot/ping/kernel
		cp ping/initrd.gz multicd-working/boot/ping/initrd.gz
		umount ping
		rmdir ping
	fi
	if [ -f $ISONAME.iso ];then
	echo "Copying Parted Magic..."
	if [ ! -d pmagic ];then
		mkdir pmagic
	fi
	if grep -q "`pwd`/pmagic" /etc/mtab ; then
		umount pmagic
	fi
	mount -o loop pmagic.iso pmagic/
	#Sudo is needed b/c of weird permissions on 4.7 ISO for the initrd
	sudo cp -r pmagic/pmagic multicd-working/ #Compressed filesystem and kernel/initrd
	umount pmagic
	rmdir pmagic
	fi
	if [ -f puppy.iso ];then
		echo "Copying Puppy..."
		if [ ! -d puppy ];then
			mkdir puppy
		fi
		if grep -q "`pwd`/puppy" /etc/mtab ; then
			umount puppy
		fi
		mount -o loop puppy.iso puppy/
		#The installer will only work if Puppy is in the root dir of the disc
		if [ ! -f tags/puppies/puppy.inroot ];then
			mkdir multicd-working/puppy
			cp puppy/*.sfs multicd-working/puppy/
			cp puppy/vmlinuz multicd-working/puppy/vmlinuz
			cp puppy/initrd.gz multicd-working/puppy/initrd.gz
		else
			cp puppy/*.sfs multicd-working/
			cp puppy/vmlinuz multicd-working/vmlinuz
			cp puppy/initrd.gz multicd-working/initrd.gz
		fi
		umount puppy
		rmdir puppy
	fi
	if [ -f $ISONAME.iso ];then
		if [ ! -d riplinux ];then
			mkdir riplinux
		fi
		if grep -q "`pwd`/riplinux" /etc/mtab ; then
			umount riplinux
		fi
		mount -o loop riplinux.iso riplinux/
		mkdir -p multicd-working/boot/riplinux
		cp -r riplinux/boot/doc multicd-working/boot/ #Documentation
		cp -r riplinux/boot/grub4dos multicd-working/boot/riplinux/ #GRUB4DOS :)
		cp riplinux/boot/kernel multicd-working/boot/riplinux/kernel #32-bit kernel
		cp riplinux/boot/kernel64 multicd-working/boot/riplinux/kernel64 #64-bit kernel
		cp riplinux/boot/rootfs.cgz multicd-working/boot/riplinux/rootfs.cgz #Initrd
		perl -pi -e 's/\/boot\/kernel/\/boot\/riplinux\/kernel/g' multicd-working/boot/riplinux/grub4dos/menu.lst #Fix the menu.lst
		perl -pi -e 's/\/boot\/rootfs.cgz/\/boot\/riplinux\/rootfs.cgz/g' multicd-working/boot/riplinux/grub4dos/menu.lst #Fix it some more
		umount riplinux
		rmdir riplinux
	fi
	if [ -f slax.iso ];then
		echo "Copying Slax..."
		if [ ! -d slax ];then
			mkdir slax
		fi
		if grep -q "`pwd`/slax" /etc/mtab ; then
			umount slax
		fi
		mount -o loop slax.iso slax/
		#if [ $MODULES = 1 ];then
		#	mkdir multicd-working/slax
		#	for i in `ls slax/slax|sed -e '/^base$/ d'`;do
		#		cp -R slax/slax/$i multicd-working/slax/ #Copy everything but the base modules
		#	done
		#	mkdir multicd-working/slax/base
		#	for i in `cat ./slaxlist`;do
		#		cp slax/slax/base/$i multicd-working/slax/base/ #Copy only the modules you wanted
		#	done
		#	cp slax/slax/base/001-*.lzm multicd-working/slax/base/ #Don't forget the core module!
		#	rm ./slaxlist
		#else
			cp -R slax/slax multicd-working/ #Copy everything
		#fi
		mkdir -p multicd-working/boot/slax
		cp slax/boot/vmlinuz multicd-working/boot/slax/vmlinuz
		cp slax/boot/initrd.gz multicd-working/boot/slax/initrd.gz
		umount slax
		rmdir slax
	fi
ls -1 *.lzm 2> /dev/null;true
	if [ "`ls -1 *.lzm 2> /dev/null;true`" != "" ] && [ -f slax.iso ]; then echo "Copying Slax modules..."; fi
	
	if [ -f slax.iso ];then
		for i in `ls -1 *.lzm 2> /dev/null;true`; do
		cp $i multicd-working/slax/modules/ #Copy the .lzm module to the modules folder
		if [ -f tags/verbose ];then
			echo \(Copied $i\)
		fi
		done
	fi
	if [ -f slitaz.iso ];then
		echo "Copying SliTaz..."
		if [ ! -d slitaz ];then
			mkdir slitaz
		fi
		if grep -q "`pwd`/slitaz" /etc/mtab ; then
			umount slitaz
		fi
		mount -o loop slitaz.iso slitaz/
		mkdir -p multicd-working/boot/slitaz
		cp slitaz/boot/bzImage multicd-working/boot/slitaz/bzImage #Kernel
		cp slitaz/boot/rootfs.gz multicd-working/boot/slitaz/rootfs.gz #Root filesystem
		umount slitaz
		rmdir slitaz
	fi
	if [ -f $ISONAME.iso ];then
	if [ ! -d sysrcd ];then
		mkdir sysrcd
	fi
	if grep -q "`pwd`/sysrcd" /etc/mtab ; then
		umount sysrcd
	fi
	mount -o loop sysrcd.iso sysrcd/
	cp sysrcd/sysrcd.* multicd-working/ #Compressed filesystem
	mkdir multicd-working/boot/sysrcd
	cp sysrcd/isolinux/altker* multicd-working/boot/sysrcd/ #Kernels
	cp sysrcd/isolinux/rescue* multicd-working/boot/sysrcd/ #Kernels
	cp sysrcd/isolinux/initram.igz multicd-working/boot/sysrcd/initram.igz #Initrd
	umount sysrcd
	rmdir sysrcd
	fi
	if [ -f tcnet.iso ];then
		echo "Copying TCNet..."
		if [ ! -d tcnet ];then
			mkdir tcnet
		fi
		if grep -q "`pwd`/tcnet" /etc/mtab ; then
			umount tcnet
		fi
		mount -o loop tcnet.iso tcnet/
		mkdir multicd-working/boot/tcnet
		cp tcnet/boot/bzImage multicd-working/boot/tcnet/bzImage #Linux kernel
		cp tcnet/boot/tcnet.gz multicd-working/boot/tcnet/tcnet.gz #TCNet image w/o apps - must load them from TCEs
		cp tcnet/boot/tcntfull.gz multicd-working/boot/tcnet/tcntfull.gz #TCNet image w/o apps - must have 192 MB RAM or more
		umount tcnet
		rmdir tcnet
	fi
	if [ -f tinycore.iso ];then
		echo "Copying Tiny Core..."
		if [ ! -d tinycore ];then
			mkdir tinycore
		fi
		if grep -q "`pwd`/tinycore" /etc/mtab ; then
			umount tinycore
		fi
		mount -o loop tinycore.iso tinycore/
		mkdir multicd-working/boot/tinycore
		cp tinycore/boot/bzImage multicd-working/boot/tinycore/bzImage #Linux kernel
		cp tinycore/boot/tinycore.gz multicd-working/boot/tinycore/tinycore.gz #Entire Tiny Core image is in this file
		umount tinycore
		rmdir tinycore
	fi
	if [ -f tinyme.iso ];then
		echo "Copying TinyMe..."
		if [ ! -d tinyme ];then
			mkdir tinyme
		fi
		if grep -q "`pwd`/tinyme" /etc/mtab ; then
			umount tinyme
		fi
		mount -o loop tinyme.iso tinyme/
		cp tinyme/livecd.sqfs multicd-working/livecd.sqfs #Compressed filesystem
		mkdir -p multicd-working/boot/tinyme
		cp tinyme/isolinux/vmlinuz multicd-working/boot/tinyme/vmlinuz
		cp tinyme/isolinux/initrd.gz multicd-working/boot/tinyme/initrd.gz
		umount tinyme
		rmdir tinyme
	fi
	if [ -f trk.iso ];then
		echo "Copying Trinity Rescue Kit..."
		if [ ! -d trinity ];then
			mkdir trinity
		fi
		if grep -q "`pwd`/trinity" /etc/mtab ; then
			umount trinity
		fi
		mount -o loop trk.iso trinity/
		cp -r trinity/trk3 multicd-working/ #TRK files
		mkdir multicd-working/boot/trinity
		cp trinity/kernel.trk multicd-working/boot/trinity/kernel.trk
		cp trinity/initrd.trk multicd-working/boot/trinity/initrd.trk
		cp trinity/bootlogo.jpg multicd-working/boot/isolinux/trklogo.jpg #Boot logo
		umount trinity;rmdir trinity
	fi
	set -e
	if [ -f ubcd.iso ];then
		echo "Copying Ultimate Boot CD..."
		if [ ! -d ubcd ];then
			mkdir ubcd
		fi
		if grep -q "`pwd`/ubcd" /etc/mtab ; then
			umount ubcd
		fi
		mount -o loop ubcd.iso ubcd/
		cp -r ubcd/dosapps multicd-working/
		cp -r ubcd/images multicd-working/
		cp -r ubcd/menus multicd-working/
		cp -r ubcd/boot/* multicd-working/boot/ #Some boot files needed for UBCD
		cp ubcd/isolinux/sbm.cbt multicd-working/boot/isolinux/sbm.cbt #Smart Boot Manager
		umount ubcd
		rmdir ubcd
	fi
	if [ -f ubuntu-mini.iso ];then
		echo "Copying Ubuntu netboot installer..."
		if [ ! -d ubuntu-mini ];then
			mkdir ubuntu-mini
		fi
		if grep -q "`pwd`/ubuntu-mini" /etc/mtab ; then
			umount ubuntu-mini
		fi
		mount -o loop ubuntu-mini.iso ubuntu-mini/
		mkdir multicd-working/boot/ubuntu
		cp ubuntu-mini/linux multicd-working/boot/ubuntu/linux
		cp ubuntu-mini/initrd.gz multicd-working/boot/ubuntu/initrd.gz
		umount ubuntu-mini
		rmdir ubuntu-mini
	fi
	if [ -f ubuntu.iso ];then
		echo "Copying Ubuntu..."
		if [ ! -d ubuntu ];then
			mkdir ubuntu
		fi
		if grep -q "`pwd`/ubuntu" /etc/mtab ; then
			umount ubuntu
		fi
		mount -o loop ubuntu.iso ubuntu/
		cp -R ubuntu/casper multicd-working/ #Live system
		cp -R ubuntu/dists multicd-working/ #Other packages contained on CD
		cp -R ubuntu/pool multicd-working/ #Other packages contained on CD
		cp -R ubuntu/preseed multicd-working/ #Tells the installer what to install
		cp -R ubuntu/README.diskdefines multicd-working/ #Goes along with dists and pool
		cp -R ubuntu/.disk multicd-working/ #A few more helper files
		ln -s . multicd-working/ubuntu #Because the original disc had it
		umount ubuntu;rmdir ubuntu
	fi
	if [ -f ubuntu2.iso ];then
		echo "Copying Ubuntu #2..."
		if [ ! -d ubuntu2 ];then
			mkdir ubuntu2
		fi
		if grep -q "`pwd`/ubuntu2" /etc/mtab ; then
			umount ubuntu2
		fi
		mount -o loop ubuntu2.iso ubuntu2/
		cp -R ubuntu2/casper multicd-working/ubuntu2 #Live system
		cp -R ubuntu2/.disk multicd-working/.disk-ubuntu2 #.disk
		umount ubuntu2;rmdir ubuntu2
		if false;then
		echo -n "Making initrd..."
		if [ -f multicd-working/ubuntu2/initrd.lz ];then
			cp multicd-working/ubuntu2/initrd.lz tmpinit.lzma
			lzma -d tmpinit.lzma
		else
			gzip -cd multicd-working/ubuntu2/initrd.gz>tmpinit
		fi
		mkdir ubuntu2-inittmp
		cd ubuntu2-inittmp
		cpio -id < ../tmpinit
		rm ../tmpinit
		perl -pi -e 's/LIVE_MEDIA_PATH=casper/LIVE_MEDIA_PATH=ubuntu2/g' scripts/casper
		find . | cpio --create --format='newc' | gzip -c > ../multicd-working/ubuntu2/initrd.gz
		rm ../multicd-working/ubuntu2/initrd.lz||true
		cd ..
		rm -r ubuntu2-inittmp
		echo " done."
		fi
	fi
	if [ -f weaknet.iso ];then
		echo "Copying WeakNet Linux..."
		if [ ! -d weaknet ];then
			mkdir weaknet
		fi
		if grep -q "`pwd`/weaknet" /etc/mtab ; then
			umount weaknet
		fi
		mount -o loop weaknet.iso weaknet/
		mkdir multicd-working/weaknet
		cp -R weaknet/casper/* multicd-working/weaknet/
			echo -n "Making initrd..."
			mkdir tmp
			cd tmp
			gzip -cd ../multicd-working/weaknet/initrd.gz|cpio -id
			perl -pi -e 's/\$path\/casper/\$path\/weaknet/g' scripts/casper
			perl -pi -e 's/\$path\/.disk\/casper-uuid/\$path\/.disk\/weaknet-uuid/g' scripts/casper
			perl -pi -e 's/\$directory\/casper/\$directory\/weaknet/g' scripts/casper
			find . | cpio --create --format='newc' | gzip -c > ../multicd-working/weaknet/initrd2.gz
			cd ..
			#rm -r tmp
			echo " done."
		umount weaknet
		rmdir weaknet
	fi
	if [ -f wolvix.iso ];then
		echo "Copying Wolvix..."
		if [ ! -d wolvix ];then
			mkdir wolvix
		fi
		if grep -q "`pwd`/wolvix" /etc/mtab ; then
			umount wolvix
		fi
		mount -o loop wolvix.iso wolvix/
		cp -r wolvix/wolvix multicd-working/ #The Wolvix folder with all its files
		mkdir -p multicd-working/boot/wolvix
		#The kernel/initrd must be here for the installer
		cp wolvix/boot/vmlinuz multicd-working/boot/vmlinuz
		cp wolvix/boot/initrd.gz multicd-working/boot/initrd.gz
		umount wolvix
		rmdir wolvix
	fi
#END COPY

#The below chunk copies floppy images.
j="0"
for i in $( ls -1 *.im[g,z] 2> /dev/null); do
	echo -n Copying $(echo $i|sed 's/\.im.//')"... "
	cp $i multicd-working/boot/$j.img
	if [ $VERBOSE = 1 ];then
		echo "Saved as "$j".img."
	else
		echo
	fi
	j=$( expr $j + 1 )
done

#This chunk copies floppy images in the "games" folder. They will have their own submenu.
if [ $GAMES = 1 ];then
	k="0"
	mkdir -p multicd-working/boot/games
	for i in $( ls -1 games/*.im[g,z] 2> /dev/null ); do
		echo -n Copying $(echo $i|sed 's/\.im.//'|sed 's/games\///')"... "
		cp $i multicd-working/boot/games/$k.img
		if [ $VERBOSE = 1 ];then
			echo "Saved as games/"$k".img."
		else
			echo
		fi
		k=$( expr $k + 1 )
	done
fi

if [ -f grub.exe ];then
 echo "Copying GRUB4DOS..."
 cp grub.exe multicd-working/boot/grub.exe
fi

echo "Downloading SYSLINUX..."
if [ -f syslinux.tar.gz ];then
	cp syslinux.tar.gz /tmp/syslinux.tar.gz
else
	if [ $VERBOSE != 0 ];then
		wget -O /tmp/syslinux.tar.gz ftp://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-*.tar.gz
	else
		wget -qO /tmp/syslinux.tar.gz ftp://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-*.tar.gz
	fi
fi
if [ $? = 0 ];then
	echo "Unpacking and copying files..."
	tar -C /tmp -xzf /tmp/syslinux.tar.gz
	cp /tmp/syslinux-*/core/isolinux.bin multicd-working/boot/isolinux/
	cp /tmp/syslinux-*/memdisk/memdisk multicd-working/boot/isolinux/
	cp /tmp/syslinux-*/com32/menu/menu.c32 multicd-working/boot/isolinux/
	cp /tmp/syslinux-*/com32/menu/vesamenu.c32 multicd-working/boot/isolinux/
	cp /tmp/syslinux-*/com32/modules/chain.c32 multicd-working/boot/isolinux/
	rm -r /tmp/syslinux-*/ /tmp/syslinux.tar.gz
else
	echo "Downloading of SYSLINUX failed."
	exit 1
fi

if [ $MEMTEST = 1 ];then
 if [ -f memtest ];then
  cp memtest multicd-working/boot/memtest
 else
  echo "Downloading memtest86+ 2.11 from memtest.org..."
  if [ $VERBOSE != 0 ];then
   wget -O- http://www.memtest.org/download/2.11/memtest86+-2.11.bin.gz|gzip -cd>multicd-working/boot/memtest
  else
   wget -qO- http://www.memtest.org/download/2.11/memtest86+-2.11.bin.gz|gzip -cd>multicd-working/boot/memtest
  fi
 fi
fi

echo "Writing isolinux.cfg..."

##BEGIN ISOLINUX MENU CODE##
#The ISOLINUX menu can be rearranged by renaming your plugin scripts - they are processed in alphabetical order.

#BEGIN HEADER#
#Don't move this part. You can change the timeout and menu title, however.
cat > multicd-working/boot/isolinux/isolinux.cfg << "EOF"
DEFAULT menu.c32
TIMEOUT 0
PROMPT 0
menu title Welcome to GNU/Linux!
EOF
#END HEADER#

#BEGIN HD BOOT OPTION#
#If this bugs you, get rid of it.
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label local
menu label Boot from ^hard drive
kernel chain.c32
append hd0
EOF
#END HD BOOT OPTION#

#START WRITE
if [ -f antix.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label anitX
menu label ^antiX
com32 menu.c32
append antix.menu
EOF
cat > multicd-working/boot/isolinux/antix.menu << "EOF"
DEFAULT menu.c32
TIMEOUT 0
PROMPT 0
menu title AntiX Options

label  antiX-Default
menu label ^antiX-Default
kernel /boot/antix/vmlinuz
append SELINUX_INIT=NO init=/etc/init quiet nosplash vga=791 aufs  initrd=/boot/antix/initrd.gz

label  antiX-Lite-noNet
kernel /boot/antix/vmlinuz
append SELINUX_INIT=NO init=/etc/init quiet nosplash vga=791 aufs mean lean initrd=/boot/antix/initrd.gz

label  antiX-Vesa
menu label antiX-Vesa (display problem or virtualbox)
kernel /boot/antix/vmlinuz
append SELINUX_INIT=NO init=/etc/init vga=normal quiet nosplash drvr=vesa aufs lean initrd=/boot/antix/initrd.gz

label  antiX-UltraLite-Vesa
menu label antiX-UltraLite-Vesa (Fast boot)
kernel /boot/antix/vmlinuz
append SELINUX_INIT=NO init=/etc/init vga=normal quiet nosplash drvr=vesa aufs lean Xtralean initrd=/boot/antix/initrd.gz

label  antiX-Failsafe
menu label antiX-Failsafe (minimum options, small display)
kernel /boot/antix/vmlinuz
append SELINUX_INIT=NO init=/etc/init quiet nosplash vga=normal nosound noapic noscsi nodma noapm nousb nopcmcia nofirewire noagp nomce nodhcp nodbus nocpufreq nobluetooth drvr=fbdev aufs res=800x600v initrd=/boot/antix/initrd.gz

label  antiX-60Hz
menu label antiX-60Hz (force monitor to 58-62 Hz)
kernel /boot/antix/vmlinuz
append SELINUX_INIT=NO init=/etc/init vga=791 quiet nosplash vsync=58-62 aufs initrd=/boot/antix/initrd.gz

label  antiX-75Hz
menu label antiX-75Hz (force monitor to 73-77 Hz)
kernel /boot/antix/vmlinuz
append SELINUX_INIT=NO init=/etc/init vga=791 quiet nosplash vsync=73-77 aufs initrd=/boot/antix/initrd.gz

label back
menu label ^Back to main menu
com32 menu.c32
append isolinux.cfg
EOF
fi
if [ -f arch.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label arch
menu label Boot ^ArchLive
kernel /boot/arch/vmlinuz26
append lang=en locale=en_US.UTF-8 usbdelay=5 ramdisk_size=75% initrd=/boot/arch/archiso_pata.img

label arch-ide
menu label Boot ArchLive [legacy IDE]
kernel /boot/arch/vmlinuz26
append lang=en locale=en_US.UTF-8 usbdelay=5 ramdisk_size=75% ide-legacy initrd=/boot/arch/archiso_ide.img
EOF
fi
if [ -f austrumi.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label austrumilinux
	menu label ^Austrumi
	com32 vesamenu.c32
	append al.menu
EOF
fi
if [ -f backtrack.iso ] && [ ! -f ubuntu.iso ] && [ ! -f linuxmint.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label			backtrack1024
menu label		Start ^BackTrack FrameBuffer (1024x768)
kernel			/boot/backtrack/vmlinuz
append			BOOT=casper boot=casper nopersistent rw quiet vga=0x317
initrd			/boot/backtrack/initrd.gz

label			backtrack800
menu label		Start BackTrack FrameBuffer (800x600)
kernel			/boot/backtrack/vmlinuz
append			BOOT=casper boot=casper nopersistent rw quiet vga=0x314
initrd			/boot/backtrack/initrd800.gz

label			backtrack-forensics
menu label		Start BackTrack Forensics (no swap)
kernel			/boot/backtrack/vmlinuz
append			BOOT=casper boot=casper nopersistent rw vga=0x317
initrd			/boot/backtrack/initrdfr.gz

label			backtrack-safe
menu label 		Start BackTrack in Safe Graphical Mode
kernel			/boot/backtrack/vmlinuz
append			BOOT=casper boot=casper xforcevesa rw quiet 
initrd			/boot/backtrack/initrd.gz

label			backtrack-persistent
menu label		Start Persistent Backtrack Live CD
kernel			/boot/backtrack/vmlinuz
append			BOOT=casper boot=casper persistent rw quiet 
initrd			/boot/backtrack/initrd.gz

label			backtrack-text
menu label		Start BackTrack in Text Mode
kernel			/boot/backtrack/vmlinuz
append			BOOT=casper boot=casper nopersistent textonly rw quiet
initrd			/boot/backtrack/initrd.gz

label			backtrack-ram
menu label		Start BackTrack Graphical Mode from RAM
kernel			/boot/backtrack/vmlinuz
append			BOOT=casper boot=casper toram nopersistent rw quiet 
initrd			/boot/backtrack/initrd.gz
EOF
fi
if [ -f $ISONAME.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label clonezilla
menu label ^Clonezilla
com32 vesamenu.c32
append clonezil.cfg
EOF
cat >> multicd-working/boot/isolinux/clonezil.cfg << "EOF"
# Created by generate-pxe-menu! Do NOT edit unless you know what you are doing! 
# Keep those comment "MENU DEFAULT" and "MENU HIDE"! Do NOT remove them.
# Note!!! If "serial" directive exists, it must be the first directive
default vesamenu.c32
timeout 300
prompt 0
noescape 1
MENU MARGIN 5
 MENU BACKGROUND ocswp.png
# Set the color for unselected menu item and timout message
 MENU COLOR UNSEL 7;32;41 #c0000090 #00000000
 MENU COLOR TIMEOUT_MSG 7;32;41 #c0000090 #00000000
 MENU COLOR TIMEOUT 7;32;41 #c0000090 #00000000
 MENU COLOR HELP 7;32;41 #c0000090 #00000000

# MENU MASTER PASSWD

say **********************************************************************
say Clonezilla, the OpenSource Clone System.
say NCHC Free Software Labs, Taiwan.
say clonezilla.sourceforge.net, clonezilla.nchc.org.tw
say THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK! 
say **********************************************************************

# Allow client to edit the parameters
ALLOWOPTIONS 1

# simple menu title
MENU TITLE clonezilla.sourceforge.net, clonezilla.nchc.org.tw

# Since no network setting in the squashfs image, therefore if ip=frommedia, the network is disabled. That's what we want.
label Clonezilla live
  MENU DEFAULT
  # MENU HIDE
  MENU LABEL Clonezilla live (Default settings, VGA 1024x768)
  # MENU PASSWD
  kernel /boot/clonezilla/vmlinuz1
  append initrd=/boot/clonezilla/initrd1.img boot=live union=aufs live-media-path=/boot/clonezilla ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_keymap="" ocs_live_batch="no" ocs_lang="" vga=791 ip=frommedia nolocales
  TEXT HELP
  * Clonezilla live version: 1.2.1-23. (C) 2003-2008, NCHC, Taiwan
  * Disclaimer: Clonezilla comes with ABSOLUTE NO WARRANTY
  ENDTEXT

label Clonezilla live 800x600
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL Clonezilla live (Default settings, VGA 800x600)
  # MENU PASSWD
  kernel /boot/clonezilla/vmlinuz1
  append initrd=/boot/clonezilla/initrd1.img boot=live union=aufs live-media-path=/boot/clonezilla ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_keymap="" ocs_live_batch="no" ocs_lang="" vga=788 ip=frommedia nolocales
  TEXT HELP
  VGA mode 800x600. OK for most of VGA cards.
  ENDTEXT

label Clonezilla live 640x480
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL Clonezilla live (Default settings, VGA 640x480)
  # MENU PASSWD
  kernel /boot/clonezilla/vmlinuz1
  append initrd=/boot/clonezilla/initrd1.img boot=live union=aufs live-media-path=/boot/clonezilla ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_keymap="" ocs_live_batch="no" ocs_lang="" vga=785 ip=frommedia nolocales
  TEXT HELP
  VGA mode 640x480. OK for most of VGA cards.
  ENDTEXT

label Clonezilla live (To RAM)
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL Clonezilla live (To RAM. Boot media can be removed later)
  # MENU PASSWD
  kernel /boot/clonezilla/vmlinuz1
  append initrd=/boot/clonezilla/initrd1.img boot=live union=aufs live-media-path=/boot/clonezilla ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_keymap="" ocs_live_batch="no" ocs_lang="" vga=791 toram ip=frommedia nolocales
  TEXT HELP
  All the programs will be copied to RAM, so you can
  remove boot media (CD or USB flash drive) later
  ENDTEXT

label Clonezilla live without framebuffer
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL Clonezilla live (Safe graphic settings, vga=normal)
  # MENU PASSWD
  kernel /boot/clonezilla/vmlinuz1
  append initrd=/boot/clonezilla/initrd1.img boot=live union=aufs live-media-path=/boot/clonezilla ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_keymap="" ocs_live_batch="no" ocs_lang="" ip=frommedia nolocales vga=normal
  TEXT HELP
  Disable console frame buffer support
  ENDTEXT

label Clonezilla live failsafe mode
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL Clonezilla live (Failsafe mode)
  # MENU PASSWD
  kernel /boot/clonezilla/vmlinuz1
  append initrd=/boot/clonezilla/initrd1.img boot=live union=aufs live-media-path=/boot/clonezilla ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_keymap="" ocs_live_batch="no" ocs_lang="" acpi=off irqpoll noapic noapm nodma nomce nolapic nosmp ip=frommedia nolocales vga=normal
  TEXT HELP
  acpi=off irqpoll noapic noapm nodma nomce nolapic 
  nosmp vga=normal
  ENDTEXT

label local
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL Local operating system in harddrive (if available)
  # MENU PASSWD
  # 2 method to boot local device:
  # (1) For localboot 0, it is decided by boot order in BIOS, so uncomment the follow 1 line if you want this method:
  # localboot 0

  # (2) For chain.c32, you can assign the boot device.
  # Ref: extlinux.doc from syslinux
  # Syntax: APPEND [hd|fd]<number> [<partition>]
  # [<partition>] is optional.
  # Ex:
  # Second partition (2) on the first hard disk (hd0);
  # Linux would *typically* call this /dev/hda2 or /dev/sda2, then it's "APPEND hd0 2"
  #
  kernel chain.c32
  append hd0
  TEXT HELP
  Boot local OS from first hard disk if it's available
  ENDTEXT

# Note! *.bin is specially purpose for syslinux, 
# Do NOT use memtest.bin, use memtest instead of memtest.bin
label memtest
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL Memory test using Memtest86+
  # MENU PASSWD
  kernel /boot/isoliux/memtest
  TEXT HELP
  Run memory test using Memtest86+
  ENDTEXT

label FreeDOS
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL FreeDOS
  # MENU PASSWD
  kernel memdisk
  append initrd=/boot/clonezilla/freedos.img
  TEXT HELP
  Run FreeDOS
  ENDTEXT

label etherboot
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL Network boot via etherboot
  # MENU PASSWD
  kernel /boot/clonezilla/eb.zli
  TEXT HELP
  Run Etherbot to enable network (PXE) boot
  ENDTEXT

label gPXE
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL Network boot via gPXE
  # MENU PASSWD
  kernel /boot/clonezilla/gpxe.lkn
  TEXT HELP
  Run gPXE to enable network (PXE) boot
  ENDTEXT

label back
menu label Back to main menu
com32 menu.c32
append isolinux.cfg
EOF
fi
#BEGIN DBAN ENTRY#
if [ -f dban.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
#Most of the DBAN options are hidden on the menu because they're so dangerous.
#You can comment the "menu hide" line and they will appear as seperate boot options on the menu.

LABEL  dban
MENU LABEL ^DBAN
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc nuke="dwipe" silent

LABEL  autonuke
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc nuke="dwipe --autonuke" silent

LABEL  dod
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc nuke="dwipe --autonuke --method dod522022m" silent

LABEL  dod3pass
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc nuke="dwipe --autonuke --method dod3pass" silent

LABEL  dodshort
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc nuke="dwipe --autonuke --method dodshort" silent

LABEL  gutmann
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc nuke="dwipe --autonuke --method gutmann" silent

LABEL  ops2
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc quiet nuke="dwipe --autonuke --method ops2" silent

LABEL  paranoid
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc quiet nuke="dwipe --autonuke --method prng --rounds 8 --verify all" silent

LABEL  prng
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc quiet nuke="dwipe --autonuke --method prng --rounds 8" silent

LABEL  quick
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc quiet nuke="dwipe --autonuke --method quick" silent

LABEL  zero
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc quiet nuke="dwipe --autonuke --method zero" silent

LABEL  nofloppy
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc quiet nuke="dwipe" floppy=0,16,cmos

LABEL  nosilent
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc quiet nuke="dwipe"

LABEL  noverify
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc quiet nuke="dwipe --verify off"

LABEL  debug
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc nuke="exec ash" debug

LABEL  shell
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc nuke="exec ash"

LABEL  verbose
MENU HIDE
KERNEL /boot/dban1/kernel.bzi
APPEND initrd=/boot/dban1/initrd.gz root=/dev/ram0 init=/rc nuke="dwipe --method quick"
EOF
fi
#END DBAN ENTRY#
if [ -f ubuntu-mini.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
LABEL dinstall
menu label ^Install Debian
	kernel /boot/debian/linux
	append vga=normal initrd=/boot/debian/initrd.gz -- quiet 
LABEL dexpert
menu label Install Debian - expert mode
	kernel /boot/debian/linux
	append priority=low vga=normal initrd=/boot/debian/initrd.gz -- 
EOF
fi
if [ -f binary.iso ];then
cat /tmp/live.cfg|grep -v memtest|grep -v "Memory test">>multicd-working/boot/isolinux/isolinux.cfg
rm /tmp/live.cfg
fi
if [ -f deli.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label deli-ide
	menu label ^DeLi Linux
	kernel /isolinux/bzImage
	append initrd=/isolinux/initrd.gz load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=6464 rw root=/dev/ram

label deli-scsi
	menu label ^DeLi Linux - SCSI
	kernel /isolinux/scsi
	append initrd=/isolinux/initrd.gz load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=6464 rw root=/dev/ram
EOF
fi
if [ -f $ISONAME.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label diskcopy
menu label ^EASEUS Disk Copy
kernel /boot/diskcopy/bzImage
append initrd=/boot/diskcopy/initrd.img
EOF
fi
if [ -f dsl.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
LABEL dsl
MENU LABEL ^DSL
KERNEL /boot/isolinux/linux24
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=/boot/isolinux/minirt24.gz nomce noapic quiet BOOT_IMAGE=knoppix

LABEL dsl-toram
MENU LABEL DSL (load to RAM)
KERNEL /boot/isolinux/linux24
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=/boot/isolinux/minirt24.gz nomce noapic quiet toram BOOT_IMAGE=knoppix

LABEL dsl-2
MENU LABEL DSL (boot to command line)
KERNEL /boot/isolinux/linux24
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=/boot/isolinux/minirt24.gz nomce noapic quiet 2 BOOT_IMAGE=knoppix

#LABEL dsl-expert
#MENU LABEL DSL (expert mode)
#KERNEL /boot/isolinux/linux24
#APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=/boot/isolinux/minirt24.gz nomce BOOT_IMAGE=expert

#LABEL dsl-fb1280x1024
#MENU LABEL DSL (1280x1024 framebuffer)
#KERNEL /boot/isolinux/linux24
#APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=794 xmodule=fbdev initrd=/boot/isolinux/minirt24.gz nomce noapic quiet BOOT_IMAGE=knoppix

#LABEL dsl-fb1024x768
#MENU LABEL DSL (1024x768 framebuffer)
#KERNEL /boot/isolinux/linux24
#APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 xmodule=fbdev initrd=/boot/isolinux/minirt24.gz nomce noapic quiet BOOT_IMAGE=knoppix

#LABEL dsl-fb800x600
#MENU LABEL DSL (800x600 framebuffer)
#KERNEL /boot/isolinux/linux24
#APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=788 xmodule=fbdev initrd=/boot/isolinux/minirt24.gz nomce noapic quiet BOOT_IMAGE=knoppix

#LABEL dsl-lowram
#MENU LABEL DSL (for low RAM)
#KERNEL /boot/isolinux/linux24
#APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=normal initrd=/boot/isolinux/minirt24.gz noscsi noideraid nosound nousb nofirewire noicons minimal nomce noapic noapm lowram quiet BOOT_IMAGE=knoppix

#LABEL dsl-install
#MENU LABEL Install DSL
#KERNEL /boot/isolinux/linux24
#APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=normal initrd=/boot/isolinux/minirt24.gz noscsi noideraid nosound nofirewire legacy base norestore _install_ nomce noapic noapm quiet BOOT_IMAGE=knoppix

#LABEL dsl-failsafe
#MENU LABEL DSL (failsafe)
#KERNEL /boot/isolinux/linux24
#APPEND ramdisk_size=100000 init=/etc/init 2 lang=us vga=normal atapicd nosound noscsi nousb nopcmcia nofirewire noagp nomce nodhcp xmodule=vesa initrd=/boot/isolinux/minirt24.gz BOOT_IMAGE=knoppix base norestore legacy
EOF
fi
if [ -f feather.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
LABEL feather
MENU LABEL ^Feather Linux
KERNEL /boot/feather/linux24
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=/boot/feather/minirt24.gz knoppix_dir=FEATHER nomce quiet BOOT_IMAGE=knoppix
LABEL feather-toram
MENU LABEL Feather Linux (load to RAM)
KERNEL /boot/feather/linux24
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=/boot/feather/minirt24.gz knoppix_dir=FEATHER nomce quiet toram BOOT_IMAGE=knoppix
LABEL feather-2
MENU LABEL Feather Linux (boot to command line)
KERNEL /boot/feather/linux24
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=/boot/feather/minirt24.gz knoppix_dir=FEATHER nomce quiet 2 BOOT_IMAGE=knoppix
EOF
fi
if [ -f fedora-boot.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label flinux
  #TIP: If you change the method= entry in the append line, you can change the mirror and version installed.
  menu label ^Install Fedora from mirrors.kernel.org (Fedora 11 only)
  kernel /boot/fedora/vmlinuz
  append initrd=/boot/fedora/initrd.img method=http://mirrors.kernel.org/fedora/releases/11/Fedora/i386/os
label flinux
  menu label ^Install or upgrade Fedora from another mirror
  kernel /boot/fedora/vmlinuz
  append initrd=/boot/fedora/initrd.img
label ftext
  menu label Install or upgrade Fedora (text mode)
  kernel /boot/fedora/vmlinuz
  append initrd=/boot/fedora/initrd.img text
label frescue
  menu label Rescue installed Fedora system
  kernel /boot/fedora/vmlinuz
  append initrd=/boot/fedora/initrd.img rescue
EOF
fi
if [ -f freedos.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label fdos
menu label ^FreeDOS 1.0
kernel memdisk
append initrd=/boot/freedos/fdboot.img
EOF
fi
if [ -f geexbox.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label gbox
	menu label ^GeeXboX
	com32 vesamenu.c32
	append gbox.menu
EOF
cat > multicd-working/boot/isolinux/gbox.menu << "EOF"
PROMPT 0

TIMEOUT 20

MENU BACKGROUND /GEEXBOX/boot/splash.png
MENU TITLE Welcome to GeeXboX i386 (C) 2002-2009
MENU VSHIFT 11
MENU ROWS 6
MENU TABMSGROW 15
MENU CMDLINEROW 14
MENU HELPMSGROW 16
MENU TABMSG Press [Tab] to edit options, [F1] for boot options.
MENU COLOR sel 7;37;40 #e0000000 #fa833b all
MENU COLOR border 30;44 #00000000 #00000000 none

LABEL geexbox
  MENU LABEL Start GeeXboX ...
  KERNEL /GEEXBOX/boot/vmlinuz
  APPEND initrd=/GEEXBOX/boot/initrd.gz root=/dev/ram0 rw rdinit=linuxrc boot=cdrom lang=en remote=atiusb receiver=atiusb keymap=qwerty splash=silent vga=789 video=vesafb:ywrap,mtrr quiet

LABEL hdtv
  MENU DEFAULT
  MENU LABEL Start GeeXboX for HDTV ...
  KERNEL /GEEXBOX/boot/vmlinuz
  APPEND initrd=/GEEXBOX/boot/initrd.gz root=/dev/ram0 rw rdinit=linuxrc boot=cdrom lang=en remote=atiusb receiver=atiusb keymap=qwerty splash=silent vga=789 video=vesafb:ywrap,mtrr hdtv quiet

LABEL install
  MENU LABEL Install GeeXboX to disk ...
  KERNEL /GEEXBOX/boot/vmlinuz
  APPEND initrd=/GEEXBOX/boot/initrd.gz root=/dev/ram0 rw rdinit=linuxrc boot=cdrom lang=en remote=atiusb receiver=atiusb keymap=qwerty splash=silent vga=789 video=vesafb:ywrap,mtrr installator quiet

#CFG#LABEL configure
#CFG#  MENU LABEL Reconfigure a GeeXboX installation ...
#CFG#  KERNEL /GEEXBOX/boot/vmlinuz
#CFG#  APPEND initrd=/GEEXBOX/boot/initrd.gz root=/dev/ram0 rw rdinit=linuxrc boot=cdrom lang=en remote=atiusb receiver=atiusb keymap=qwerty splash=silent vga=789 video=vesafb:ywrap,mtrr configure

MENU SEPARATOR

LABEL debug
  MENU LABEL Start in debugging mode ...
  KERNEL /GEEXBOX/boot/vmlinuz
  APPEND initrd=/GEEXBOX/boot/initrd.gz root=/dev/ram0 rw rdinit=linuxrc boot=cdrom lang=en remote=atiusb receiver=atiusb keymap=qwerty splash=0 vga=789 video=vesafb:ywrap,mtrr debugging

LABEL hdtvdebug
  MENU LABEL Start HDTV edition in debugging mode ...
  KERNEL /GEEXBOX/boot/vmlinuz
  APPEND initrd=/GEEXBOX/boot/initrd.gz root=/dev/ram0 rw rdinit=linuxrc boot=cdrom lang=en remote=atiusb receiver=atiusb keymap=qwerty splash=0 vga=789 video=vesafb:ywrap,mtrr hdtv debugging

F1 help.msg #00000000
EOF
fi
if [ -f $ISONAME.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label GParted Live
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL ^GParted Live (Default settings)
  # MENU PASSWD
  kernel /boot/gparted/vmlinuz1
  append initrd=/boot/gparted/initrd1.img boot=live union=aufs live-media-path=/boot/gparted noswap vga=788 ip=frommedia

label GParted Live (To RAM)
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL GParted Live (To RAM. Boot media can be removed later)
  # MENU PASSWD
  kernel /boot/gparted/vmlinuz1
  append initrd=/boot/gparted/initrd1.img boot=live union=aufs live-media-path=/boot/gparted noswap vga=788 toram ip=frommedia

label GParted Live without framebuffer
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL GParted Live (Safe graphic settings, vga=normal)
  # MENU PASSWD
  kernel /boot/gparted/vmlinuz1
  append initrd=/boot/gparted/initrd1.img boot=live union=aufs live-media-path=/boot/gparted noswap ip=frommedia vga=normal

label GParted Live failsafe mode
  # MENU DEFAULT
  # MENU HIDE
  MENU LABEL GParted Live (Failsafe mode)
  # MENU PASSWD
  kernel /boot/gparted/vmlinuz1
  append initrd=/boot/gparted/initrd1.img boot=live union=aufs live-media-path=/boot/gparted noswap acpi=off irqpoll noapic noapm nodma nomce nolapic nosmp ip=frommedia vga=normal
EOF
fi
if [ -f $ISONAME.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
LABEL insert
menu label ^INSERT
KERNEL /boot/insert/vmlinuz
APPEND ramdisk_size=100000 init=/etc/init lang=en apm=power-off vga=773 initrd=/boot/insert/miniroot.lz nomce noapic dma BOOT_IMAGE=insert
LABEL insert-txt
menu label INSERT (vga=normal)
KERNEL /boot/insert/vmlinuz
APPEND ramdisk_size=100000 init=/etc/init lang=en apm=power-off vga=normal initrd=/boot/insert/miniroot.lz nomce noapic dma BOOT_IMAGE=insert
LABEL expert
menu label INSERT (expert mode)
KERNEL /boot/insert/vmlinuz
APPEND ramdisk_size=100000 init=/etc/init lang=en apm=power-off vga=773 initrd=/boot/insert/miniroot.lz nomce noapic dma BOOT_IMAGE=expert
LABEL failsafe
menu label INSERT (failsafe)
KERNEL /boot/insert/vmlinuz
APPEND ramdisk_size=100000 init=/etc/init lang=en vga=normal atapicd nosound noapic noacpi pnpbios=off acpi=off nofstab noscsi nodma noapm nousb nopcmcia nofirewire noagp nomce nodhcp xmodule=vesa initrd=/boot/insert/miniroot.lz BOOT_IMAGE=insert
EOF
fi
if [ -f knoppix.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
LABEL knoppix
MENU LABEL Knoppix
KERNEL /boot/knoppix/linux
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=/boot/knoppix/minirt.gz knoppix_dir=KNOPPIX5 nomce highres=off loglevel=0 libata.atapi_enabled=1 quiet SELINUX_INIT=NO nmi_watchdog=0 BOOT_IMAGE=knoppix

LABEL adriane
MENU LABEL Adriane (Knoppix)
KERNEL /boot/knoppix/linux
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=785 initrd=/boot/knoppix/minirt.gz knoppix_dir=KNOPPIX5 nomce highres=off loglevel=0 libata.atapi_enabled=1 quiet SELINUX_INIT=NO nmi_watchdog=0 BOOT_IMAGE=adriane

LABEL knoppix-2
MENU LABEL Knoppix (boot to command line)
KERNEL /boot/knoppix/linux
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=/boot/knoppix/minirt.gz knoppix_dir=KNOPPIX5 nomce highres=off loglevel=0 libata.atapi_enabled=1 quiet SELINUX_INIT=NO nmi_watchdog=0 BOOT_IMAGE=knoppix 2
EOF
fi
if [ -f linuxmint.iso ] && [ ! -f ubuntu.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label mint-live
  menu label ^Try Linux Mint without any change to your computer
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/mint.seed boot=casper initrd=/casper/initrd.gz quiet splash --
label mint-live-install
  menu label ^Install Linux Mint
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/mint.seed boot=casper only-ubiquity initrd=/casper/initrd.gz quiet splash --
EOF
fi
#BEGIN PUPPY ENTRY#
if [ -f macpup.iso ];then
if [ -d multicd-working/macpup ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label macpup
menu label ^Macpup
kernel /macpup/vmlinuz
append initrd=/macpup/initrd.gz pmedia=cd pdir=macpup
#label macpup-nox
#menu label Macpup (boot to command line)
#kernel /macpup/vmlinuz
#append initrd=/macpup/initrd.gz pmedia=cd pfix=nox pdir=macpup
#label macpup-noram
#menu label Macpup (don't load to RAM)
#kernel /macpup/vmlinuz
#append initrd=/macpup/initrd.gz pmedia=cd pfix=noram pdir=macpup
EOF
else
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label macpup
menu label ^Macpup
kernel /vmlinuz
append initrd=/initrd.gz pmedia=cd
#label macpup-nox
#menu label Macpup (boot to command line)
#kernel /vmlinuz
#append initrd=/initrd.gz pmedia=cd pfix=nox
#label macpup-noram
#menu label Macpup (don't load to RAM)
#kernel /vmlinuz
#append initrd=/initrd.gz pmedia=cd pfix=noram
EOF
fi
fi
#END PUPPY ENTRY#
if [ -f mandriva-boot.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label alt0
  menu label Install ^Mandriva
  kernel /boot/mandriva/alt0/vmlinuz
  append initrd=/boot/mandriva/alt0/all.rdz  vga=788 splash=silent
label alt0-vgahi
  menu label Install Mandriva (hi-res installer)
  kernel /boot/mandriva/alt0/vmlinuz
  append initrd=/boot/mandriva/alt0/all.rdz  vga=791
label alt0-text
  menu label Install Mandriva (text-mode installer)
  kernel /boot/mandriva/alt0/vmlinuz
  append initrd=/boot/mandriva/alt0/all.rdz  text
label alt1
  menu label Install Mandriva (server kernel)
  kernel /boot/mandriva/alt1/vmlinuz
  append initrd=/boot/mandriva/alt1/all.rdz vga=788 splash=silent
EOF
fi
#BEGIN NETBOOTCD ENTRY#
if [ -f netbootcd.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
LABEL netbootcd
MENU LABEL ^NetbootCD
KERNEL /boot/nbcd/kexec.bzI
APPEND quiet initrd=/boot/nbcd/nbinit3.gz
EOF
fi
#END NETBOOTCD ENTRY#
if [ -f $ISONAME.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label ntpasswd
menu label ^NT Offline Password & Registry Editor
kernel /boot/ntpasswd/vmlinuz
append rw vga=1 init=/linuxrc initrd=/boot/ntpasswd/initrd.cgz,/boot/ntpasswd/scsi.cgz
EOF
fi
if [ -f opensuse.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label opensuse-kernel
  menu label Install ^openSUSE (from mirrors.kernel.org)
  kernel /boot/opensuse/linux
EOF
echo "  append initrd=/boot/opensuse/initrd splash=silent showopts install=ftp://mirrors.kernel.org/opensuse/distribution/"$(cat /tmp/$USER-opensuseversion.tmp)"/repo/oss" >> multicd-working/boot/isolinux/isolinux.cfg
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label opensuse
  menu label Install openSUSE (specify mirror)
  kernel /boot/opensuse/linux
  append initrd=/boot/opensuse/initrd splash=silent showopts
label opensuse-repair
  menu label Repair an installed openSUSE system
  kernel /boot/opensuse/linux
  append initrd=/boot/opensuse/initrd splash=silent repair=1 showopts
label opensuse-rescue
  menu label openSUSE rescue system
  kernel /boot/opensuse/linux
  append initrd=/boot/opensuse/initrd splash=silent rescue=1 showopts
EOF
fi
if [ -f feather.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label LiveCD
    menu label ^PCLinuxOS LXDE Live
    kernel /PCLinuxOS/isolinux/vmlinuz
    append livecd=/PCLinuxOS/livecd initrd=/PCLinuxOS/isolinux/initrd.gz root=/dev/rd/3 acpi=on vga=788 keyb=us splash=silent fstab=rw,auto noscsi
label LiveCD_sata_probe
    menu label ^PCLinuxOS LXDE Live - SATA probe
    kernel /PCLinuxOS/isolinux/vmlinuz
    append livecd=/PCLinuxOS/livecd initrd=/PCLinuxOS/isolinux/initrd.gz root=/dev/rd/3 acpi=on vga=788 keyb=us splash=silent fstab=rw,auto
label Video_SafeMode_FBDevice
    menu label ^PCLinuxOS LXDE Live - SafeMode FBDevice
    kernel /PCLinuxOS/isolinux/vmlinuz
    append livecd=/PCLinuxOS/livecd initrd=/PCLinuxOS/isolinux/initrd.gz root=/dev/rd/3 acpi=on vga=788 keyb=us splash=silent fstab=rw,auto framebuffer
label Video_SafeMode_Vesa
    menu label ^PCLinuxOS LXDE Live - SafeMode VESA
    kernel /PCLinuxOS/isolinux/vmlinuz
    append livecd=/PCLinuxOS/livecd initrd=/PCLinuxOS/isolinux/initrd.gz root=/dev/rd/3 acpi=on vga=788 keyb=us splash=silent fstab=rw,auto vesa
label Safeboot
    menu label ^PCLinuxOS LXDE Live - Safeboot
    kernel /PCLinuxOS/isolinux/vmlinuz
    append livecd=/PCLinuxOS/livecd initrd=/PCLinuxOS/isolinux/initrd.gz root=/dev/rd/3 acpi=off vga=normal keyb=us noscsi nopcmcia
label Console
    menu label ^PCLinuxOS LXDE Live - Console
    kernel /PCLinuxOS/isolinux/vmlinuz
    append livecd=/PCLinuxOS/livecd 3 initrd=/PCLinuxOS/isolinux/initrd.gz root=/dev/rd/3 acpi=on vga=788 keyb=us splash=silent fstab=rw,auto
label Copy_to_ram
    menu label ^PCLinuxOS LXDE Live - Copy to RAM
    kernel /PCLinuxOS/isolinux/vmlinuz
    append livecd=/PCLinuxOS/livecd copy2ram initrd=/PCLinuxOS/isolinux/initrd.gz root=/dev/rd/3 acpi=on vga=788 keyb=us splash=silent fstab=rw,auto splash=verbose
EOF
fi
if [ -f $ISONAME.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label ping
menu label ^PING (Partimage Is Not Ghost)
kernel /boot/ping/kernel
append vga=normal devfs=nomount pxe ramdisk_size=33000 load_ramdisk=1 init=/linuxrc prompt_ramdisk=0 initrd=/boot/ping/initrd.gz root=/dev/ram0 rw noapic nolapic lba combined_mode=libata ide0=noprobe nomce pci=nommconf pci=nomsi irqpoll
EOF
fi
if [ -f $ISONAME.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
LABEL normal
MENU LABEL ^Parted Magic: Default settings (Runs from RAM / Ejects CD)
KERNEL /pmagic/bzImage
APPEND noapic initrd=/pmagic/initramfs load_ramdisk=1 prompt_ramdisk=0 rw vga=791 sleep=10 loglevel=0 keymap=us

LABEL live
MENU LABEL ^Parted Magic: Live with default settings (USB not usable)
KERNEL /pmagic/bzImage
APPEND noapic initrd=/pmagic/initramfs load_ramdisk=1 prompt_ramdisk=0 rw vga=791 sleep=10 livemedia noeject loglevel=0 keymap=us

LABEL lowram
MENU LABEL ^Parted Magic: Live with low RAM settings
KERNEL /pmagic/bzImage
APPEND noapic initrd=/pmagic/initramfs load_ramdisk=1 prompt_ramdisk=0 rw vga=normal sleep=10 lowram livemedia noeject nogpm nolvm nonfs nofstabdaemon nosmart noacpid nodmeventd nohal loglevel=0 xvesa keymap=us

LABEL xvesa
MENU LABEL ^Parted Magic: Alternate graphical server
KERNEL /pmagic/bzImage
APPEND noapic initrd=/pmagic/initramfs load_ramdisk=1 prompt_ramdisk=0 rw vga=791 sleep=10 xvesa loglevel=0 keymap=us

LABEL normal-vga
MENU LABEL ^Parted Magic: Safe Graphics Settings (vga=normal)
KERNEL /pmagic/bzImage
APPEND noapic initrd=/pmagic/initramfs load_ramdisk=1 prompt_ramdisk=0 rw vga=normal sleep=10 loglevel=0 keymap=us

LABEL failsafe
MENU LABEL ^Parted Magic: Failsafe Settings
KERNEL /pmagic/bzImage
APPEND noapic initrd=/pmagic/initramfs load_ramdisk=1 prompt_ramdisk=0 rw vga=normal sleep=10 acpi=off noapic nolapic nopcmcia noscsi nogpm consoleboot nosmart keymap=us

LABEL console
MENU LABEL ^Parted Magic: Console (boots to the shell)
KERNEL /pmagic/bzImage
APPEND noapic initrd=/pmagic/initramfs load_ramdisk=1 prompt_ramdisk=0 rw vga=normal sleep=10 consoleboot keymap=us
EOF
fi
#BEGIN PUPPY ENTRY#
if [ -f puppy.iso ];then
if [ -d multicd-working/puppy ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label puppy
menu label ^Puppy Linux
kernel /puppy/vmlinuz
append initrd=/puppy/initrd.gz pmedia=cd pdir=puppy
#label puppy-nox
#menu label Puppy Linux (boot to command line)
#kernel /puppy/vmlinuz
#append initrd=/puppy/initrd.gz pmedia=cd pfix=nox pdir=puppy
#label puppy-noram
#menu label Puppy Linux (don't load to RAM)
#kernel /puppy/vmlinuz
#append initrd=/puppy/initrd.gz pmedia=cd pfix=noram pdir=puppy
EOF
else
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label puppy
menu label ^Puppy Linux
kernel /vmlinuz
append initrd=/initrd.gz pmedia=cd
#label puppy-nox
#menu label Puppy Linux (boot to command line)
#kernel /vmlinuz
#append initrd=/initrd.gz pmedia=cd pfix=nox
#label puppy-noram
#menu label Puppy Linux (don't load to RAM)
#kernel /vmlinuz
#append initrd=/initrd.gz pmedia=cd pfix=noram
EOF
fi
fi
#END PUPPY ENTRY#
if [ -f $ISONAME.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label riplinux
menu label ^RIPLinuX
com32 menu.c32
append riplinux.cfg
EOF
cat >> multicd-working/boot/isolinux/riplinux.cfg << "EOF"
DEFAULT menu.c32
PROMPT 0
MENU TITLE RIPLinuX v6.7

LABEL Boot Linux system! (32-bit kernel)
KERNEL /boot/riplinux/kernel
APPEND vga=normal initrd=/boot/riplinux/rootfs.cgz root=/dev/ram0 rw

LABEL Boot Linux system! (skip keymap prompt)
KERNEL /boot/riplinux/kernel
APPEND vga=normal nokeymap initrd=/boot/riplinux/rootfs.cgz root=/dev/ram0 rw

LABEL Boot Linux system to X! (32-bit kernel)
KERNEL /boot/riplinux/kernel
APPEND vga=normal xlogin initrd=/boot/riplinux/rootfs.cgz root=/dev/ram0 rw

LABEL Boot Linux system to X! (skip keymap prompt)
KERNEL /boot/riplinux/kernel
APPEND vga=normal xlogin nokeymap initrd=/boot/riplinux/rootfs.cgz root=/dev/ram0 rw

LABEL Boot Linux system! (64-bit kernel)
KERNEL /boot/riplinux/kernel64
APPEND vga=normal initrd=/boot/riplinux/rootfs.cgz root=/dev/ram0 rw

LABEL Boot Linux system! (skip keymap prompt)
KERNEL /boot/riplinux/kernel64
APPEND vga=normal nokeymap initrd=/boot/riplinux/rootfs.cgz root=/dev/ram0 rw

LABEL Boot Linux system to X! (64-bit kernel)
KERNEL /boot/riplinux/kernel64
APPEND vga=normal xlogin initrd=/boot/riplinux/rootfs.cgz root=/dev/ram0 rw

LABEL Boot Linux system to X! (skip keymap prompt)
KERNEL /boot/riplinux/kernel64
APPEND vga=normal xlogin nokeymap initrd=/boot/riplinux/rootfs.cgz root=/dev/ram0 rw

LABEL Edit and put Linux partition to boot! (32-bit kernel)
KERNEL /boot/riplinux/kernel
APPEND vga=normal ro root=/dev/XXXX

LABEL Edit and put Linux partition to boot! (64-bit kernel)
KERNEL /boot/riplinux/kernel64
APPEND vga=normal ro root=/dev/XXXX

LABEL Boot memory tester!
KERNEL /boot/memtest
APPEND -

LABEL Boot GRUB bootloader!
KERNEL /boot/riplinux/grub4dos/grub.exe
APPEND --config-file=(cd)/boot/riplinux/grub4dos/menu.lst

LABEL Boot MBR on first hard drive!
KERNEL chain.c32
APPEND hd0 0

LABEL Boot partition #1 on first hard drive!
KERNEL chain.c32
APPEND hd0 1

LABEL Boot partition #2 on first hard drive!
KERNEL chain.c32
APPEND hd0 2

LABEL Boot partition #3 on first hard drive!
KERNEL chain.c32
APPEND hd0 3

LABEL Boot partition #4 on first hard drive!
KERNEL chain.c32
APPEND hd0 4

LABEL Boot MBR on second hard drive!
KERNEL chain.c32
APPEND hd1 0

LABEL Boot partition #1 on second hard drive!
KERNEL chain.c32
APPEND hd1 1

LABEL Boot partition #2 on second hard drive!
KERNEL chain.c32
APPEND hd1 2

LABEL Boot partition #3 on second hard drive!
KERNEL chain.c32
APPEND hd1 3

LABEL Boot partition #4 on second hard drive!
KERNEL chain.c32
APPEND hd1 4

label back
menu label Back to main menu
com32 menu.c32
append isolinux.cfg
EOF
fi
#BEGIN SLAX ENTRY#
#Note: All Slax options are "Always Fresh," because Slax is running from CD
if [ -f slax.iso ];then
if [ -f multicd-working/slax/base/002-xorg.lzm ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
LABEL xconf
MENU LABEL ^Slax Graphics mode (KDE)
KERNEL /boot/slax/vmlinuz
APPEND initrd=/boot/slax/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw autoexec=xconf;telinit~4

LABEL copy2ram
MENU LABEL Slax Graphics mode, Copy To RAM
KERNEL /boot/slax/vmlinuz
APPEND initrd=/boot/slax/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw copy2ram autoexec=xconf;telinit~4

LABEL startx
MENU LABEL Slax Graphics VESA mode
KERNEL /boot/slax/vmlinuz
APPEND initrd=/boot/slax/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw autoexec=telinit~4

LABEL slax
MENU LABEL Slax Text mode
KERNEL /boot/slax/vmlinuz
APPEND initrd=/boot/slax/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw
EOF
else
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
LABEL slax
MENU LABEL ^Slax Text mode
KERNEL /boot/slax/vmlinuz
APPEND initrd=/boot/slax/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw

LABEL slax2ram
MENU LABEL Slax Text mode, Copy To RAM
KERNEL /boot/slax/vmlinuz
APPEND initrd=/boot/slax/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw copy2ram
EOF
fi
fi
#END SLAX ENTRY#
if [ -f slitaz.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label slitaz
	menu label ^SliTaz GNU/Linux
	kernel /boot/slitaz/bzImage
	append initrd=/boot/slitaz/rootfs.gz rw root=/dev/null vga=normal
EOF
fi
if [ -f $ISONAME.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label rescuecd0
menu label ^SystemRescueCd 32-bit
kernel /boot/sysrcd/rescuecd
append initrd=/boot/sysrcd/initram.igz
label rescuecd1
menu label SystemRescueCd 64-bit
kernel /boot/sysrcd/rescue64
append initrd=/boot/sysrcd/initram.igz
label rescuecd2
menu label SystemRescueCd 32-bit (alternate kernel)
kernel /boot/sysrcd/altker32
append initrd=/boot/sysrcd/initram.igz video=ofonly
label rescuecd3
menu label SystemRescueCd 64-bit (alternate kernel)
kernel /boot/sysrcd/altker64
append initrd=/boot/sysrcd/initram.igz video=ofonly
label rescuecd-rootauto
menu label SysRCD: rescue installed Linux (root=auto; 32-bit)
kernel /boot/sysrcd/rescuecd
append initrd=/boot/sysrcd/initram.igz root=auto
EOF
fi
#BEGIN TCNET ENTRY#
if [ -f tcnet.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label tcnet-hdc
	menu label ^Boot TCNet (128 MB RAM or less; CD drive must be IDE secondary master)
	kernel /boot/bzImage
	append initrd=/boot/tcnet.gz max_loop=255 norestore tce=hdc/tcnet
label tcnet-full
	menu label ^Boot TCNet (192 MB RAM or more; everything loaded to RAM)
	kernel /boot/bzImage
	append initrd=/boot/tcntfull.gz max_loop=255 norestore base
EOF
fi
#END TCNET ENTRY#
#BEGIN TINY CORE ENTRY#
if [ -f tinycore.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label tinycore
menu label ^Tiny Core Linux
kernel /boot/tinycore/bzImage
append quiet initrd=/boot/tinycore/tinycore.gz
EOF
fi
#END TINY CORE ENTRY#
if [ -f tinyme.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label LiveCD
    menu label ^TinyMe - LiveCD
    kernel /boot/tinyme/vmlinuz
    append livecd=livecd initrd=/boot/tinyme/initrd.gz root=/dev/rd/3 acpi=on vga=788 keyb=us splash=silent fstab=rw,noauto
label VideoSafeModeFBDev
    menu label TinyMe - VideoSafeModeFBDev
    kernel /boot/tinyme/vmlinuz
    append livecd=livecd initrd=/boot/tinyme/initrd.gz root=/dev/rd/3 acpi=on vga=788 keyb=us splash=silent fstab=rw,noauto framebuffer
label VideoSafeModeVesa
    menu label TinyMe - VideoSafeModeVesa
    kernel /boot/tinyme/vmlinuz
    append livecd=livecd initrd=/boot/tinyme/initrd.gz root=/dev/rd/3 acpi=on vga=788 keyb=us splash=silent fstab=rw,noauto vesa
label Safeboot
    menu label TinyMe - Safeboot
    kernel /boot/tinyme/vmlinuz
    append livecd=livecd initrd=/boot/tinyme/initrd.gz root=/dev/rd/3 acpi=off vga=normal keyb=us noapic nolapic noscsi nopcmcia
label Console
    menu label TinyMe - Console
    kernel /boot/tinyme/vmlinuz
    append livecd=livecd 3 initrd=/boot/tinyme/initrd.gz root=/dev/rd/3 acpi=on vga=788 keyb=us splash=silent fstab=rw,noauto
label Copy2ram
    menu label TinyMe - Copy2ram
    kernel /boot/tinyme/vmlinuz
    append livecd=livecd copy2ram initrd=/boot/tinyme/initrd.gz root=/dev/rd/3 acpi=on vga=788 keyb=us splash=silent fstab=rw,noauto splash=verbose
EOF
fi
if [ -f trk.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label trk
menu label ^Trinity Rescue Kit
com32 vesamenu.c32
append trk.menu
EOF
cat > multicd-working/boot/isolinux/trk.menu << "EOF"
prompt 0

menu title     build 318
menu background trklogo.jpg
menu color tabmsg 37;40      #80ffffff #00000000
menu color hotsel 30;47      #40000000 #20ffffff
menu color sel 30;47      #40000000 #20ffffff
menu color scrollbar 30;47      #40000000 #20ffffff

MENU WIDTH 75
MENU MARGIN 5
MENU PASSWORDMARGIN 3
MENU ROWS 18
MENU TABMSGROW 22
MENU CMDLINEROW 22
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 23

label trk3
menu label Run ^Trinity Rescue Kit 3.3 (default)
kernel /boot/trinity/kernel.trk
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1

label trk3-1
menu label ^1 : TRK 3.3 as bootserver to boot other TRK clients
kernel /boot/trinity/kernel.trk
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 trkbootnet

label trk3-2
menu label ^2 : TRK 3.3 running from RAM (best >= 512mb, 256mb min)
kernel /boot/trinity/kernel.trk
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 trkinmem

label trk3-3
menu label ^3 : TRK 3.3 with bigger screenfont
kernel /boot/trinity/kernel.trk
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 normalfont

label trk3-4
menu label ^4 : TRK 3.3 in simple VGA mode (debugging of kernel output)
kernel /boot/trinity/kernel.trk
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=1 pci=conf1 splash=off

label trk3-5
kernel /boot/trinity/kernel.trk
menu label ^5 : TRK 3.3 with Belgian keyboard (see docs for other)
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 keyb_be

label trk3-6
kernel /boot/trinity/kernel.trk
menu label ^6 : TRK 3.3 - Virusscan all drives (non interactive)
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 virusscan

label trk3-7
kernel /boot/trinity/kernel.trk
menu label ^7 : TRK 3.3 - Try more pcmcia and usb nics (when not detected)
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 pcmcia

label trk3-8
kernel /boot/trinity/kernel.trk
menu label ^8 : TRK 3.3 - Try more SCSI drivers (when disks not detected)
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 scsidrv

label trk3-9
kernel /boot/trinity/kernel.trk
menu label ^9 : TRK 3.3 with a secure shell server enabled
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 sshd

label trk3-10
kernel /boot/trinity/kernel.trk
menu label ^10 : TRK 3.3 - Execute local scripts on harddrive of PC
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 locscr

label trk3-11
kernel /boot/trinity/kernel.trk
menu label 11: TRK 3.3 - ^Fileshare all drives, secured with user
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 smbsec

label trk3-12
kernel /boot/trinity/kernel.trk
menu label 11: TRK 3.3 - Fileshare all drives as ^guest, no security
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 smbguest


label trk3-0
kernel /boot/trinity/kernel.trk
menu label 13: TRK 3.3 - ^Single user mode
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 runlevel 1

label trk3-noacpi
kernel /boot/trinity/kernel.trk
menu label 14: TRK 3.3 - Acpi=off, noapic  PCI=^bios (Alternate boot 1)
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose acpi=off noapic pci=bios

label trk3-pcinormal
kernel /boot/trinity/kernel.trk
menu label 15: TRK 3.3 - ^Acpi=off, noapic PCI=any (Alternate boot 2)
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose acpi=off noapic

label trk3-pciconf1
kernel /boot/trinity/kernel.trk
menu label 16: TRK 3.3 - ^PCI=conf2 (Alternate boot 3)
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf2

label trk3-debug
menu label 17: TRK 3.3 - ^Verbose startup for debugging after initial bootfase
kernel /boot/trinity/kernel.trk
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 debugging

label trk3-18
menu label 18: TRK 3.3 - SSH server and run from ^RAM
kernel /boot/trinity/kernel.trk
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 sshd trkinmem

label trk3-19
menu label 19: TRK 3.3 - SSH server, run from RAM, act as a ^secure fileserver
kernel /boot/trinity/kernel.trk
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 sshd trkinmem smbsec

label trk3-20
menu label 20 : TRK 3.3 with ^proxyserver support enabled
kernel /boot/trinity/kernel.trk
append initrd=/boot/trinity/initrd.trk ramdisk_size=49152 root=/dev/ram0 vga=788 splash=verbose pci=conf1 proxy

label back
menu label ^Back to main menu
com32 menu.c32
append isolinux.cfg
EOF
fi
if [ -f ubcd.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label ubcd
menu label ^Ultimate Boot CD - Main menu
com32 menu.c32
append /menus/main.cfg
EOF
fi
if [ -f ubuntu-mini.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
LABEL uinstall
menu label Install ^Ubuntu
	kernel /boot/ubuntu/linux
	append vga=normal initrd=/boot/ubuntu/initrd.gz -- 
LABEL ucli
menu label Install Ubuntu (CLI)
	kernel /boot/ubuntu/linux
	append tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false vga=normal initrd=/boot/ubuntu/initrd.gz -- 

LABEL uexpert
menu label Install Ubuntu - expert mode
	kernel /boot/ubuntu/linux
	append priority=low vga=normal initrd=/boot/ubuntu/initrd.gz -- 
LABEL ucli-expert
menu label Install Ubuntu (CLI) - expert mode
	kernel /boot/ubuntu/linux
	append tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false priority=low vga=normal initrd=/boot/ubuntu/initrd.gz -- 
EOF
fi
if [ -f ubuntu.iso ];then
if [ -f multicd-working/casper/initrd.lz ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label ubuntu-live
  menu label ^Try Ubuntu without any change to your computer
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz quiet splash --
label ubuntu-live-install
  menu label ^Install Ubuntu
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.lz quiet splash --
EOF
else
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label ubuntu-live
  menu label ^Try Ubuntu without any change to your computer
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.gz quiet splash --
label ubuntu-live-install
  menu label ^Install Ubuntu
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.gz quiet splash --
EOF
fi
fi
if [ -f ubuntu2.iso ];then
if [ -f multicd-working/ubuntu2/initrd.lz ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label ubuntu2-live
  menu label ^Try Ubuntu #2 without any change to your computer
  kernel /ubuntu2/vmlinuz
  append  file=/cdrom/preseed/ubuntu.seed initrd=/ubuntu2/initrd.lz quiet splash -- live-media-path=/ubuntu2
label ubuntu2-live-install
  menu label ^Install Ubuntu #2
  kernel /ubuntu2/vmlinuz
  append  file=/cdrom/preseed/ubuntu.seed only-ubiquity initrd=/ubuntu2/initrd.lz quiet splash -- live-media-path=/ubuntu2
EOF
else
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label ubuntu2-live
  menu label ^Try Ubuntu #2 without any change to your computer
  kernel /ubuntu2/vmlinuz
  append  file=/cdrom/preseed/ubuntu.seed initrd=/ubuntu2/initrd.gz quiet splash -- live-media-path=/ubuntu2
label ubuntu2-live-install
  menu label ^Install Ubuntu #2
  kernel /ubuntu2/vmlinuz
  append  file=/cdrom/preseed/ubuntu.seed only-ubiquity initrd=/ubuntu2/initrd.gz quiet splash -- live-media-path=/ubuntu2
EOF
fi
fi
if [ -f weaknet.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
LABEL live
  menu label ^WeakNet Linux (live)
  kernel /weaknet/vmlinuz
  append  file=/cdrom/preseed/custom.seed boot=casper initrd=/weaknet/initrd2.gz quiet splash --
LABEL xforcevesa
  menu label WeakNet Linux (safe graphics mode)
  kernel /weaknet/vmlinuz
  append  file=/cdrom/preseed/custom.seed boot=casper xforcevesa initrd=/weaknet/initrd2.gz quiet splash --
LABEL install
  menu label Install WeakNet Linux
  kernel /weaknet/vmlinuz
  append  file=/cdrom/preseed/custom.seed boot=casper only-ubiquity initrd=/weaknet/initrd2.gz quiet splash --
EOF
fi
if [ -f wolvix.iso ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label wolvix
menu label ^Wolvix GNU/Linux (login as root, password is toor)
kernel /boot/vmlinuz
append changes=wolvixsave.xfs max_loop=255 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw vga=791 splash=silent
EOF
fi
#END WRITE

#BEGIN DISK IMAGE ENTRY#
j="0"
for i in $( ls -1 *.im[g,z] 2> /dev/null); do
  BASICNAME=$(echo $i|sed 's/\.im.//')
  echo label $BASICNAME >> multicd-working/boot/isolinux/isolinux.cfg
  echo kernel memdisk >> multicd-working/boot/isolinux/isolinux.cfg
  echo append initrd=/boot/$j.img >> multicd-working/boot/isolinux/isolinux.cfg
  j=$( expr $j + 1 )
done
#END DISK IMAGE ENTRY#

#BEGIN GRUB4DOS ENTRY#
if [ -f multicd-working/boot/grub.exe ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label grub4dos
menu label ^GRUB4DOS
kernel /boot/grub.exe
EOF
elif [ -f multicd-working/boot/riplinux/grub4dos/grub.exe ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label grub4dos
menu label ^GRUB4DOS
kernel /boot/riplinux/grub4dos/grub.exe
EOF
fi
#END GRUB4DOS ENTRY#

#BEGIN GAMES ENTRY#
if [ $GAMES = 1 ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label games
menu label ^Games on disk images
com32 menu.c32
append games.cfg
EOF
fi
#END GAMES ENTRY#

#BEGIN MEMTEST ENTRY#
if [ -f multicd-working/boot/memtest ];then
cat >> multicd-working/boot/isolinux/isolinux.cfg << "EOF"
label memtest
menu label ^Memtest86+ v2.01
kernel /boot/memtest
EOF
fi
#END MEMTEST ENTRY#
##END ISOLINUX MENU CODE##

if [ $GAMES = 1 ];then
k="0"
cat > multicd-working/boot/isolinux/games.cfg << "EOF"
default menu.c32
timeout 300

menu title "Choose a game to play:"
EOF
for i in $( ls -1 games/*.im[g,z] 2> /dev/null ); do
  BASICNAME=$(echo $i|sed 's/\.im.//'|sed 's/games\///')
  echo label $BASICNAME >> multicd-working/boot/isolinux/games.cfg
  echo kernel memdisk >> multicd-working/boot/isolinux/games.cfg
  echo append initrd=/boot/games/$k.img >> multicd-working/boot/isolinux/games.cfg
  k=$( expr $k + 1 )
done
cat >> multicd-working/boot/isolinux/games.cfg << "EOF"
label back
menu label Back to main menu
com32 menu.c32
append isolinux.cfg
EOF
fi

if [ -d includes ];then
 echo "Copying includes..."
 cp -r includes/* multicd-working/
fi

if [ $MD5 = 1 ];then
 echo "Generating MD5 checksums..."
 if [ $VERBOSE != 0 ];then
  find multicd-working/ -type f -not -name md5sum.txt -not -name boot.cat -not -name isolinux.bin \
  -exec md5sum '{}' \; | sed 's/multicd-working\///g' | tee multicd-working/md5sum.txt
 else
  find multicd-working/ -type f -not -name md5sum.txt -not -name boot.cat -not -name isolinux.bin\
  -exec md5sum '{}' \; | sed 's/multicd-working\///g' > multicd-working/md5sum.txt
 fi
fi

if which genisoimage > /dev/null;then
 GENERATOR="genisoimage"
elif which mkisofs > /dev/null;then
 GENERATOR="mkisofs"
else
 echo "Neither genisoimage nor mkisofs was found."
 exit 1
fi
if [ -d multicd-working/boot/trinity ];then
 ISOLABEL=TRK_3.3
else
 ISOLABEL=GNULinux
fi
echo "Building CD image..."
if [ $VERBOSE != 0 ];then
 $GENERATOR -o multicd.iso \
 -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
 -no-emul-boot -boot-load-size 4 -boot-info-table \
 -r -J -l -V "$ISOLABEL" multicd-working/
else
 $GENERATOR -o multicd.iso \
 -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
 -no-emul-boot -boot-load-size 4 -boot-info-table \
 -r -J -l -quiet -V "$ISOLABEL" multicd-working/
fi
rm -r multicd-working/
chmod 666 multicd.iso
rm -r tags
#END SCRIPT
