Subject: Updating image autobuild script.

From: Daniel Baumann <[email-masked]>
Date: Sat, 20 Feb 2010 14:18:57 +0100

---
 examples/cron/images.sh | 190 ++++++++++++++++++++++++++++++++----------------
 1 file changed, 126 insertions(+), 64 deletions(-)

diff --git a/examples/cron/images.sh b/examples/cron/images.sh
index 9bd85b4..b875e86 100755
--- a/examples/cron/images.sh
+++ b/examples/cron/images.sh
@@ -1,4 +1,6 @@
-#!/bin/sh -e
+#!/bin/sh
+
+set -e
 
 # Static variables
 DISTRIBUTIONS="${DISTRIBUTIONS:-lenny squeeze sid}"
@@ -12,75 +14,130 @@ MIRROR_SECURITY="${MIRROR_SECURITY:-http://security.debian.org/}"
 ARCHITECTURE="$(dpkg --print-architecture)"
 DATE="$(date +%Y%m%d)"
 
+Set_defaults ()
+{
+	# Distribution defaults
+	APT_RECOMMENDS="true"
+	BINARY_INDICES="true"
+	DEBIAN_INSTALLER="live"
+	DEBIAN_INSTALLER_GUI="true"
+	PACKAGES="--packages live-installer-launcher"
+	TASKSEL="tasksel"
+
+	# Distribution specific options (ugly!)
+	case "${DISTRIBUTION}" in
+		lenny)
+			APT_RECOMMENDS="false"
+			BINARY_INDICES="true"
+			DEBIAN_INSTALLER="false"
+			PACKAGES=""
+			TASKSEL="aptitude"
+
+			case "${ARCHITECTURE}" in
+				amd64)
+					case "${FLAVOUR}" in
+						gnome-desktop)
+							BINARY_INDICES="false"
+
+							mkdir -p config/chroot_local-hooks
+							cd config/chroot_local-hooks
+							echo "apt-get remove --yes --purge openoffice.org-help-en-us" > package-removals
+							echo "apt-get remove --yes --purge epiphany-browser epiphany-browser-data epiphany-extensions epiphany-gecko" >> package-removals
+							echo "apt-get remove --yes --purge gnome-user-guide" >> package-removals
+							cd -
+							;;
+
+						kde-desktop)
+							BINARY_INDICES="false"
+							;;
+					esac
+					;;
+
+				i386)
+					case "${FLAVOUR}" in
+						gnome-desktop|kde-desktop)
+							BINARY_INDICES="false"
+							KERNEL="-k 686"
+							;;
+					esac
+					;;
+			esac
+			;;
+
+		squeeze)
+			DEBIAN_INSTALLER_GUI="false"
+
+			LIVE_INSTALLER="16"
+			LIVE_INITRAMFS="1.173.3-1"
+
+			mkdir -p config/binary_local-udebs
+			cd config/binary_local-udebs
+			wget -c http://live.debian.net/archive/packages/live-installer/${LIVE_INSTALLER}/live-installer_${LIVE_INSTALLER}.dsc
+			wget -c http://live.debian.net/archive/packages/live-installer/${LIVE_INSTALLER}/live-installer_${LIVE_INSTALLER}.tar.gz
+			wget -c http://live.debian.net/archive/packages/live-installer/${LIVE_INSTALLER}/live-installer_${LIVE_INSTALLER}_i386.udeb
+			cd -
+
+			mkdir -p config/chroot_local-packages
+			cd config/chroot_local-packages
+			wget -c http://live.debian.net/archive/packages/live-installer/${LIVE_INSTALLER}/live-installer_${LIVE_INSTALLER}.dsc
+			wget -c http://live.debian.net/archive/packages/live-installer/${LIVE_INSTALLER}/live-installer_${LIVE_INSTALLER}.tar.gz
+			wget -c http://live.debian.net/archive/packages/live-installer/${LIVE_INSTALLER}/live-installer-launcher_${LIVE_INSTALLER}_all.deb
+			wget -c http://live.debian.net/archive/packages/live-initramfs/${LIVE_INITRAMFS}/live-initramfs_${LIVE_INITRAMFS}.diff.gz
+			wget -c http://live.debian.net/archive/packages/live-initramfs/${LIVE_INITRAMFS}/live-initramfs_${LIVE_INITRAMFS}.dsc
+			wget -c http://live.debian.net/archive/packages/live-initramfs/${LIVE_INITRAMFS}/live-initramfs_${LIVE_INITRAMFS}_all.deb
+			wget -c http://live.debian.net/archive/packages/live-initramfs/${LIVE_INITRAMFS}/live-initramfs_$(echo ${LIVE_INITRAMFS} | awk -F- '{ print $1 }').orig.tar.gz
+			cd -
+			;;
+		esac
+}
+
+# Build images
 for DISTRIBUTION in ${DISTRIBUTIONS}
 do
 	rm -rf cache/stages*
 
 	for FLAVOUR in ${FLAVOURS}
 	do
-		mkdir -p config
-
 		if [ -e .stage ]
 		then
 			lh clean
 		fi
 
-		rm -rf config
-		rm -rf cache/packages*
-		rm -rf cache/stages_rootfs
-
-		case "${ARCHITECTURE}" in
-			amd64)
-				case "${FLAVOUR}" in
-					gnome-desktop)
-						mkdir -p config/chroot_local-hooks
-						echo "apt-get remove --yes --purge openoffice.org-help-en-us" > config/chroot_local-hooks/package-removals
-						echo "apt-get remove --yes --purge epiphany-browser epiphany-browser-data epiphany-extensions epiphany-gecko" >> config/chroot_local-hooks/package-removals
-						echo "apt-get remove --yes --purge gnome-user-guide" >> config/chroot_local-hooks/package-removals
-
-						INDICES="none"
-						;;
-
-					kde-desktop)
-						INDICES="none"
-						;;
-				esac
-				;;
-
-			i386)
-				case "${FLAVOUR}" in
-					standard|rescue|lxde-desktop|xfce-desktop)
-						INDICES="true"
-						;;
-
-					gnome-desktop|kde-desktop)
-						KERNEL="-k 686"
-						INDICES="none"
-						;;
-				esac
-				;;
-		esac
-
-		if [ "${SOURCE}" = "true" ]
+		if [ -e config ]
 		then
-			lh config -d ${DISTRIBUTION} -p ${FLAVOUR} --cache-stages "bootstrap rootfs" --apt-recommends false --binary-indices ${INDICES} --tasksel aptitude ${KERNEL} --source true --mirror-bootstrap ${MIRROR} --mirror-chroot ${MIRROR} --mirror-chroot-security ${MIRROR_SECURITY}
-		else
-			lh config -d ${DISTRIBUTION} -p ${FLAVOUR} --cache-stages "bootstrap rootfs" --apt-recommends false --binary-indices ${INDICES} --tasksel aptitude ${KERNEL} --source false --mirror-bootstrap ${MIRROR} --mirror-chroot ${MIRROR} --mirror-chroot-security ${MIRROR_SECURITY}
+			rm -f config/* || true
+			rmdir --ignore-fail-on-non-empty config/* || true
 		fi
 
-		if [ "${DISTRIBUTION}" = "sid" ]
-		then
-			echo 'deb http://live.debian.net/ sid/snapshots main' > config/chroot_sources/debian-live_sid-snapshots.chroot
-			echo 'deb http://live.debian.net/ sid/snapshots main' > config/chroot_sources/debian-live_sid-snapshots.boot
-
-			wget http://live.debian.net/debian/project/openpgp/archive-key.asc -O config/chroot_sources/debian-live_sid-snapshots.chroot.gpg
-			wget http://live.debian.net/debian/project/openpgp/archive-key.asc -O config/chroot_sources/debian-live_sid-snapshots.binary.gpg
+		rm -rf cache/packages*
+		rm -rf cache/stages_rootfs
 
+		Set_defaults
+
+		lh config \
+			--apt-recommends ${APT_RECOMMENDS} \
+			--binary-indices ${BINARY_INDICES} \
+			--cache-stages "bootstrap rootfs" \
+			--debian-installer ${DEBIAN_INSTALLER} \
+			--debian-installer-gui ${DEBIAN_INSTALLER_GUI} \
+			--distribution ${DISTRIBUTION} \
+			--mirror-bootstrap ${MIRROR} \
+			--mirror-chroot ${MIRROR} \
+			--mirror-chroot-security ${MIRROR_SECURITY} \
+			${PACKAGES} \
+			--packages-lists ${FLAVOUR} \
+			--source ${SOURCE} \
+			--tasksel ${TASKSEL} ${KERNEL}
+
+		# TEMPORARY HACK until memtest86+ maintainers fixes his package
+		if [ ${FLAVOUR} = rescue ]
+		then
+			lh config --memtest none
 		fi
 
 		lh build 2>&1 | tee debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.iso.log
 
-		mv binary.iso debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.iso
+		mv binary*.iso debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.iso
 		mv binary.list debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.iso.list
 		mv binary.packages debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.iso.packages
 
@@ -90,22 +147,27 @@ do
 			mv source.list debian-live-${DISTRIBUTION}-source-${FLAVOUR}.tar.gz.list
 		fi
 
-		lh clean --binary
-		lh config -b usb-hdd
-		lh binary 2>&1 | tee debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img.log
+		if [ "${DISTRIBUTION}" = "lenny" ]
+		then
+			lh clean --binary
+			lh config -binary-images usb-hdd
+			lh binary 2>&1 | tee debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img.log
+
+			mv binary.img debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img
+			mv binary.list debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img.list
+			mv binary.packages debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img.packages
+		fi
 
-		mv binary.img debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img
-		mv binary.list debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img.list
-		mv binary.packages debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.img.packages
+		lh clean
+		rm -rf cache/stages_rootfs
+		lh config --binary-images net
 
-		lh clean --binary
-		lh config -b net
-		lh binary 2>&1 | tee debian-live-${DISTRIBUTION}-i386-${FLAVOUR}-net.tar.gz.log
+		lh build 2>&1 | tee debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}-net.tar.gz.log
 
-		mv binary-net.tar.gz debian-live-${DISTRIBUTION}-i386-${FLAVOUR}-net.tar.gz
-		mv binary.list debian-live-${DISTRIBUTION}-i386-${FLAVOUR}-net.tar.gz.list
-		mv binary.packages debian-live-${DISTRIBUTION}-i386-${FLAVOUR}-net.tar.gz.packages
+		mv binary-net.tar.gz debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}-net.tar.gz
+		mv binary.list debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}-net.tar.gz.list
+		mv binary.packages debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}-net.tar.gz.packages
 
-		mv binary/*/filesystem.squashfs debian-live-${DISTRIBUTION}-i386-${FLAVOUR}.squashfs
+		mv binary/*/filesystem.squashfs debian-live-${DISTRIBUTION}-${ARCHITECTURE}-${FLAVOUR}.squashfs
 	done
 done
-- 
cgit v1.0