#!/bin/bash # # Copyright (C) 2006 - 2009 Brian Brazil # Copyright (C) 2009 Karl Goetz # # 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. . config if [ $UID != 0 ]; then echo 'This script must be run as root' exit 1 fi BASEDIR=`pwd` LIVECDNAME=$DISTRONAME LIVECDNAME_L=$DISTRONAME_L # Check if the cd build chroot /proc is mounted # If mounted, unmount it if [[ -f $LIVECDDIR/chroot-$ARCHTOBUILD/proc/version ]]; then umount $LIVECDDIR/chroot-$ARCHTOBUILD/proc fi # 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-$ARCHTOBUILD /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=$ARCHTOBUILD --flavour=minimal -c cdebootstrap/ $RELEASE chroot-$ARCHTOBUILD $REPOAPT # Now have full chroot mkdir -p cdroot-$ARCHTOBUILD/image/casper/ cat << EOF > chroot-$ARCHTOBUILD/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-$ARCHTOBUILD/etc/apt/sources.list sources.list trap "umount -f $PWD/chroot-$ARCHTOBUILD/proc" ERR INT TERM mount -t proc proc ./chroot-$ARCHTOBUILD/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-$ARCHTOBUILD/etc/kernel-img.conf chroots "apt-get install --yes syslinux linux-image-generic 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-$ARCHTOBUILD/etc/casper.conf # Add NOPASSWD so livecd user doesn't see password prompts sed -i -e "s/Ubuntu/Builder/" chroot-$ARCHTOBUILD/usr/share/initramfs-tools/scripts/casper-bottom/10adduser chroots "dpkg-reconfigure `basename chroot-$ARCHTOBUILD/var/lib/dpkg/info/linux-image-2.6.*.postinst .postinst`" # Preseed some values cat < ./cdroot-$ARCHTOBUILD/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-$ARCHTOBUILD/image/casper/filesystem.manifest # Provide a default package list for users. chroots "dpkg --get-selections > ./cdroot-$ARCHTOBUILD/root/default-package-selection" chroots "apt-get clean" cat << EOF > chroot-$ARCHTOBUILD/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-$ARCHTOBUILD/etc/ld.so.nohwcap # Enable daemons chroots "dpkg -P cdebootstrap-helper-diverts" # Do anything needed with the filesystem above this line umount $PWD/chroot-$ARCHTOBUILD/proc mkdir -p cdroot-$ARCHTOBUILD/image/casper rm -f cdroot-$ARCHTOBUILD/image/casper/filesystem.squashfs mksquashfs chroot-$ARCHTOBUILD cdroot-$ARCHTOBUILD/image/casper/filesystem.squashfs mkdir -p cdroot-$ARCHTOBUILD/image/isolinux cp chroot-$ARCHTOBUILD/usr/lib/syslinux/isolinux.bin cdroot-$ARCHTOBUILD/image/isolinux echo "$LIVECD_VERSION ($LIVECDNAME $ARCHTOBUILD $RELEASE)" > cdroot-$ARCHTOBUILD/image/LIVECD_VERSION cat < cdroot-$ARCHTOBUILD/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-$ARCHTOBUILD/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-$ARCHTOBUILD/image/isolinux/`basename $i` done convert -size 640x320 xc:black -fill $LOGO_COLOUR -gravity SouthWest -draw "text 2,2 '$DISTRONAME $LIVECD_VERSION ($RELEASE) LiveCD $ARCHTOBUILD'" -pointsize 24 -gravity Center -draw "text 30,50 '$TAGLINE'" -pointsize 72 -draw "text 0,0 '$LIVECDNAME'" -colors 10 cdroot-$ARCHTOBUILD/image/isolinux/splash.pcx pcxtoppm < cdroot-$ARCHTOBUILD/image/isolinux/splash.pcx | ppmtolss16 "#dddddd=7" > cdroot-$ARCHTOBUILD/image/isolinux/splash.rle rm cdroot-$ARCHTOBUILD/image/isolinux/splash.pcx rm -f chroot-$ARCHTOBUILD/boot/*.bak cp chroot-$ARCHTOBUILD/boot/vmlinuz-* cdroot-$ARCHTOBUILD/image/isolinux/vmlinuz cp chroot-$ARCHTOBUILD/boot/initrd.img-* cdroot-$ARCHTOBUILD/image/isolinux/initrd.gz cp chroot-$ARCHTOBUILD/boot/memtest86+.bin cdroot-$ARCHTOBUILD/image/isolinux/memtest mkisofs -o $REPODST/cdimage/$LIVECD_ISO_PREFIX-livecd-$RELEASE-$ARCHTOBUILD-$LIVECD_VERSION.iso -r -J -l \ -V "$LIVECDNAME LiveCD $LIVECD_VERSION $ARCHTOBUILD" -b isolinux/isolinux.bin \ -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 \ -boot-info-table cdroot-$ARCHTOBUILD/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-$ARCHTOBUILD-$LIVECD_VERSION.iso sed -i "/ $LIVECD_ISO_PREFIX-livecd-$RELEASE-$ARCHTOBUILD-$LIVECD_VERSION.iso$/d" MD5SUMS || true # Might not exist yet md5sum $LIVECD_ISO_PREFIX-livecd-$RELEASE-$ARCHTOBUILD-$LIVECD_VERSION.iso >> MD5SUMS sed -i "/ $LIVECD_ISO_PREFIX-livecd-$RELEASE-$ARCHTOBUILD-$LIVECD_VERSION.iso$/d" SHA256SUMS || true # Might not exist yet sha256sum $LIVECD_ISO_PREFIX-livecd-$RELEASE-$ARCHTOBUILD-$LIVECD_VERSION.iso >> SHA256SUMS