Rev 16 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed
#!/bin/bash## run this script to create a LiveCD in /tmp/livecd.iso# Your kernel image has to be in $ROOT/boot/vmlinuz or $ROOT/vmlinuz## Urs Beyerle, PSI:# - add x86_64 support# - add support to build for UP and SMP kernel# SMP kernel is added to LiveCD, if variable $SMP is set# - copy System.map-* and config-* to CDDATA/boot# and copy /boot/grub/splash.xpm.gz to CDDATA/boot/grub# both needed for install LiveCD in local harddisk# - config no longer sourced, we take ../livecd.conf#export LANG=CARCH=$( /bin/arch )[ "$ARCH" != "x86_64" ] && ARCH=i686# export PATH=.:./tools:../tools:/usr/sbin:/usr/bin:/sbin:/bin:/export PATH=/usr/sbin:/usr/bin:/sbin:/bin:/:.:./tools:../toolsCHANGEDIR="`dirname \`readlink -f $0\``"echo "Changing current directory to $CHANGEDIR"cd $CHANGEDIR. liblinuxlive || exit 1# . config || exit 1. ../livecd.conf || exit 1./install $ROOTVMLINUZ=$ROOT/boot/vmlinuzif [ -L "$VMLINUZ" ]; then VMLINUZ=`readlink -f $VMLINUZ`; fiif [ "`ls $VMLINUZ 2>/dev/null`" = "" ]; then echo "cannot find $VMLINUZ"; exit 1; fiif [ $SMP ]; thenVMLINUZ_SMP=$ROOT/boot/vmlinuz${SMP}if [ -L "$VMLINUZ_SMP" ]; then VMLINUZ_SMP=`readlink -f $VMLINUZ_SMP`; fiif [ "`ls $VMLINUZ_SMP 2>/dev/null`" = "" ]; then echo "cannot find $VMLINUZ_SMP"; exit 1; fifiheader "Creating LiveCD from your Linux"mkdir -p $CDDATA/basemkdir -p $CDDATA/modulesmkdir -p $CDDATA/optionalmkdir -p $CDDATA/rootcopyecho "copying livecd.conf to $CDDATA"cp -a ../livecd.conf $CDDATA/echo "copying cd-root to $CDDATA"cp -R cd-root/* $CDDATAif [ ! $SMP ]; then# delete line with "SMP kernel" in boot/splash.cfgsed -i "/SMP kernel/d" $CDDATA/boot/splash.cfg# delete 'or "smp" ' in boot/help*.txtsed -i 's/or "smp" //' $CDDATA/boot/help*.txtfi# cp -R tools $CDDATAcp -R info/* $CDDATA# copy splash.xpm.gz to LiveCDmkdir -p $CDDATA/boot/grubcp -a $ROOT/boot/grub/splash.xpm.gz $CDDATA/boot/grub/# copy kernel(s) to LiveCDecho "using kernel from $VMLINUZ"echo "and kernel modules from /lib/modules/$KERNEL"cp -a $VMLINUZ $CDDATA/boot/vmlinuzif [ $SMP ]; thenecho "using kernel from $VMLINUZ_SMP"echo "and kernel modules from /lib/modules/${KERNEL}smp"cp -a $VMLINUZ_SMP $CDDATA/boot/vmlinuz${SMP}fi# copy System.map and config to LiveCDcp -a $ROOT/boot/System.map-* $CDDATA/boot/cp -a $ROOT/boot/config-* $CDDATA/boot/BUILD_KERNELS="$KERNEL"[ $SMP ] && BUILD_KERNELS="$BUILD_KERNELS ${KERNEL}smp"echo "creating initrd image..."for BUILD_KERNEL in $BUILD_KERNELS; docd initrd./initrd_create $BUILD_KERNELif [ "$?" -ne 0 ]; then exit; ficd ..if [ "$BUILD_KERNEL" = "$KERNEL" ]; thenecho "add initrd.gz for kernel $BUILD_KERNEL"cp initrd/$INITRDIMG.gz $CDDATA/boot/initrd.gz # UP Kernelelseecho "add initrd${SMP}.gz for kernel $BUILD_KERNEL"cp initrd/$INITRDIMG.gz $CDDATA/boot/initrd${SMP}.gz # SMP Kernelfirm initrd/$INITRDIMG.gzdoneecho "creating compressed images..."# home not longer in the list, will be created on the fly# opt -> /usr/opt#if [ "$ARCH" = "x86_64" ]; thendirs="bin etc lib lib64 root usr sbin var"elsedirs="bin etc lib root usr sbin var"fifor dir in $dirs; doif [ -d $ROOT/$dir ]; thenecho "base/$dir.mo"create_module $ROOT/$dir $CDDATA/base/$dir.mo -keep-as-directoryif [ $? -ne 0 ]; then exit; fifidone# remove any .svn folders from the CDfind $CDDATA -type d -name .svn -exec rm -f {} \;echo "creating LiveCD ISO image..."cd $CDDATA./make_iso.sh /tmp/livecd.isocd /tmpheader "Your ISO is created in /tmp/livecd.iso"