#/bin/bash # # Copyright (C) 2006 Brian Brazil # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Took commands from the debian-live project in July 2006 # It carried the following notice: # # Copyright (C) 2006 Daniel Baumann # Copyright (C) 2006 Marco Amadori # # make-live comes with ABSOLUTELY NO WARRANTY; for details see COPYING. # This is free software, and you are welcome to redistribute it # under certain conditions; see COPYING for details. set -ex . config if [ $UID != 0 ]; then echo 'This script must be run as root' exit 1 fi BASEDIR=`pwd` LIVECDNAME=$DISTRONAME LIVECDNAME_L=$DISTRONAME_L # to create different variables for other Desktop Managers if [ -n "$1" ]; then . livecd-variants/$DISTRONAME_L-$1.variables fi #Various possible customisations LIVECDUSERNAME=${LIVECDUSERNAME:-$RELEASE} LIVECD_ISO_PREFIX=${LIVECD_ISO_PREFIX:-$LIVECDNAME_L} rm -rf $LIVECDDIR mkdir -p $LIVECDDIR cd $LIVECDDIR cp -r /usr/share/cdebootstrap . cat << EOF >> cdebootstrap/suites Suite: $RELEASE Config: $RELEASE EOF chroots () { # Execute commands in chroot chroot ./chroot /usr/bin/env -i HOME=/root TERM=${TERM} \ PATH=/usr/sbin:/usr/bin:/sbin:/bin DEBIAN_PRIORITY=critical ${1} } cp -r cdebootstrap/generic/ cdebootstrap/$RELEASE cdebootstrap -v --allow-unauthenticated --keyring= --arch=i386 --flavour=minimal -c cdebootstrap/ $RELEASE chroot $REPOAPT #Now have full chroot mkdir -p cdroot/image/casper/ cat << EOF > chroot/etc/apt/sources.list deb $REPOAPT $RELEASE main universe deb-src $REPOAPT $RELEASE main universe deb $REPOAPT $RELEASE-security main universe deb-src $REPOAPT $RELEASE-security main universe EOF #Used by gen-cdsource cp chroot/etc/apt/sources.list sources.list trap "umount -f $PWD/chroot/proc" ERR INT TERM mount -t proc proc ./chroot/proc chroots "apt-get update" chroots "apt-get install --yes --force-yes gnupg" gpg -a --export $SIGNINGKEY | chroots "apt-key add -" chroots "apt-get update" echo "do_initrd = Yes" > chroot/etc/kernel-img.conf chroots "apt-get install --yes syslinux linux-image-386 casper udev debconf-utils" #Hack sed -i -e "s#USERNAME=.*#USERNAME=$LIVECDUSERNAME#;" \ -e "s#USERFULLNAME=.*#USERFULLNAME='$LIVECDNAME LiveCD user'#;" \ -e "s#HOST=.*#HOST=$LIVECDNAME_L#;" \ -e "s#BUILD_SYSTEM=.*#BUILD_SYSTEM=Builder#;" \ chroot/etc/casper.conf chroots "dpkg-reconfigure `basename chroot/var/lib/dpkg/info/linux-image-2.6.*.postinst .postinst`" #Preseed some values cat < ./cdroot/image/casper/filesystem.manifest-desktop chroots "apt-get install --yes ${LIVECD_EXTRAS}" chroots "dpkg --get-selections" | sed -ne 's/\t\t*install$//p' | sort > ./cdroot/image/casper/filesystem.manifest chroots "apt-get clean" cat << EOF > chroot/etc/apt/sources.list #From gen-livecd deb http://archive.$DOMAIN/$DISTRONAME_L/ $RELEASE main universe deb-src http://archive.$DOMAIN/$DISTRONAME_L/ $RELEASE main universe deb http://security.$DOMAIN/$DISTRONAME_L/ $RELEASE-security main universe deb-src http://security.$DOMAIN/$DISTRONAME_L/ $RELEASE-security main universe EOF chroots /etc/cron.daily/mlocate #Fix problem with NPTL not being detected rm -f chroot/etc/ld.so.nohwcap # Enable daemons chroots "dpkg -P cdebootstrap-helper-diverts" #Do anything needed with the filesystem above this line umount $PWD/chroot/proc mkdir -p cdroot/image/casper rm -f cdroot/image/casper/filesystem.squashfs mksquashfs chroot cdroot/image/casper/filesystem.squashfs mkdir -p cdroot/image/isolinux cp chroot/usr/lib/syslinux/isolinux.bin cdroot/image/isolinux echo "$LIVECD_VERSION ($LIVECDNAME $RELEASE)" > cdroot/image/LIVECD_VERSION cat < cdroot/image/README $DISTRONAME - $TAGLINE This is a $LIVECDNAME LiveCD and installer for the $DISTRONAME GNU/Linux distribution. More information about $DISTRONAME can be found on our website at http://www.$DOMAIN/ This LiveCD was generated with the gNewSense Builder. EOF #Get the bootsplash etc. for syslinux cp -a $BASEDIR/syslinux/isolinux.{cfg,txt} cdroot/image/isolinux for i in $BASEDIR/syslinux/f*.txt; do sed "s/DISTRONAME/$DISTRONAME/g; s/LIVECDNAME/$LIVECDNAME/g; s/RELEASE/$RELEASE/g; s/LIVECD_VERSION/$LIVECD_VERSION/g; s/DOMAIN/$DOMAIN/g; s/LIVE_DATE/`date +%Y%m%d`/g; " $i > cdroot/image/isolinux/`basename $i` done convert -size 640x320 xc:black -fill $LOGO_COLOUR -gravity SouthWest -draw "text 2,2 'LiveCD $LIVECD_VERSION $DISTRONAME $RELEASE'" -pointsize 24 -gravity Center -draw "text 30,50 '$TAGLINE'" -pointsize 72 -draw "text 0,0 '$LIVECDNAME'" -colors 10 cdroot/image/isolinux/splash.pcx pcxtoppm < cdroot/image/isolinux/splash.pcx | ppmtolss16 "#dddddd=7" > cdroot/image/isolinux/splash.rle rm cdroot/image/isolinux/splash.pcx rm -f chroot/boot/*.bak cp chroot/boot/vmlinuz-* cdroot/image/isolinux/vmlinuz cp chroot/boot/initrd.img-* cdroot/image/isolinux/initrd.gz cp chroot/boot/memtest86+.bin cdroot/image/isolinux/memtest mkisofs -o $REPODST/cdimage/$LIVECD_ISO_PREFIX-livecd-$RELEASE-$LIVECD_VERSION.iso -r -J -l \ -V "$LIVECDNAME LiveCD $LIVECD_VERSION" -b isolinux/isolinux.bin \ -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 \ -boot-info-table cdroot/image # Here we stage the cd image cd $REPODST/cdimage btmakemetafile.bittornado http://torrent.$DOMAIN:6969/announce --announce_list "$BITTORRENT_ANNOUNCE_LIST" $LIVECD_ISO_PREFIX-livecd-$RELEASE-$LIVECD_VERSION.iso sed -i "/ $LIVECD_ISO_PREFIX-livecd-$LIVECD_VERSION.iso$/d" MD5SUMS || true # Might not exist yet md5sum $LIVECD_ISO_PREFIX-livecd-$RELEASE-$LIVECD_VERSION.iso >> MD5SUMS