From d903b8b9af6b99ecd7e0e5f463ba8ef23bdb5c5c Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 10 Jun 2011 18:59:01 +0100 Subject: [PATCH] start live-build configuration --- debian/control | 2 +- debian/install | 1 + live-build/auto/build | 29 ++++++++ live-build/auto/clean | 7 ++ live-build/auto/config | 153 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 191 insertions(+), 1 deletion(-) create mode 100755 live-build/auto/build create mode 100755 live-build/auto/clean create mode 100755 live-build/auto/config diff --git a/debian/control b/debian/control index d0d15536..7d315bba 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-core-dev/livecd-rootfs/trunk Package: livecd-rootfs Architecture: all -Depends: ${misc:Depends}, debootstrap, rsync, python-minimal | python, procps, squashfs-tools (>= 1:3.3-1), grep-dctrl, fdupes, lsb-release, lzma, e2fsprogs +Depends: ${misc:Depends}, debootstrap, rsync, python-minimal | python, procps, squashfs-tools (>= 1:3.3-1), grep-dctrl, fdupes, lsb-release, lzma, e2fsprogs, live-build Suggests: partimage Description: construction script for the livecd rootfs livecd-rootfs provides the script used to create the root filesystem diff --git a/debian/install b/debian/install index f960f4ef..c12d1e96 100644 --- a/debian/install +++ b/debian/install @@ -1 +1,2 @@ livecd.sh e2fs-zero.py usr/sbin +live-build usr/share/livecd-rootfs diff --git a/live-build/auto/build b/live-build/auto/build new file mode 100755 index 00000000..0499a66d --- /dev/null +++ b/live-build/auto/build @@ -0,0 +1,29 @@ +#! /bin/sh +set -e + +export LC_ALL=C + +( + lb bootstrap "$@" + lb chroot "$@" + + echo "===== Checking size of /usr/share/doc =====" + echo BEGIN docdirs + (cd chroot && find usr/share/doc -maxdepth 1 -type d | xargs du -s | sort -nr) + echo END docdirs + + if which fdupes >/dev/null 2>&1; then + echo "===== Checking for duplicate files =====" + echo "first line: " + echo "data lines: [ ...]" + echo BEGIN fdupes + (cd chroot \ + && fdupes --recurse --noempty --sameline --size --quiet usr \ + | awk '/bytes each/ {s=$1} /^usr/ { n+=1; n2+=NF-1; sum+=s*(NF-1); print s*(NF-1), NF-1, s, $0 } END {print sum, n, n2}' \ + | sort -nr + ) + echo END fdupes + fi + + lb binary "$@" +) 2>&1 | tee binary.log diff --git a/live-build/auto/clean b/live-build/auto/clean new file mode 100755 index 00000000..5158f42b --- /dev/null +++ b/live-build/auto/clean @@ -0,0 +1,7 @@ +#! /bin/sh +set -e + +lb clean noauto "$@" + +rm -rf config +rm -f binary.manifest binary.manifest-desktop binary.log diff --git a/live-build/auto/config b/live-build/auto/config new file mode 100755 index 00000000..ba756d6f --- /dev/null +++ b/live-build/auto/config @@ -0,0 +1,153 @@ +#! /bin/sh +set -e + +MIRROR= +case $(hostname --fqdn) in + bld-*.mmjgroup.com) ;; + # TODO suffix is either ubuntu or ubuntu-ports + *.mmjgroup.com) + case $ARCH in + i386|amd64) MIRROR=http://archive.mmjgroup.com/ubuntu/ ;; + *) MIRROR=http://archive.mmjgroup.com/ubuntu-ports/ ;; + esac + ;; + *.0c3.net) MIRROR=http://ftp.iinet.net.au/linux/ubuntu/ ;; + *.ubuntu.com) MIRROR=http://ftpmaster.internal/ubuntu/ ;; + *.warthogs.hbd.com) MIRROR=http://ftpmaster.internal/ubuntu/ ;; + *.buildd) MIRROR=http://ftpmaster.internal/ubuntu/ ;; + *) ;; +esac + +OPTS= +PACKAGES= +TASKS= +LIVE_TASKS= +COMPONENTS= +BINARY_REMOVE_LINUX=true + +case $IMAGEFORMAT in + ext2|ext3) + OPTS="${OPTS:+$OPTS }--initramfs none" + PACKAGES="${PACKAGES:+$PACKAGES }jasper" + ;; + + *) + PACKAGES="${PACKAGES:+$PACKAGES }lupin-casper" + ;; +esac + +case $PROJECT in + ubuntu|ubuntu-dvd) + TASKS='minimal standard ubuntu-desktop' + LIVE_TASKS='ubuntu-live' + ;; + + kubuntu|kubuntu-dvd) + TASKS='minimal standard kubuntu-desktop' + LIVE_TASKS='kubuntu-live' + ;; + + kubuntu-mobile) + TASKS='minimal standard kubuntu-mobile' + LIVE_TASKS='kubuntu-mobile-live' + COMPONENTS='main restricted universe' + ;; + + edubuntu|edubuntu-dvd) + TASKS='minimal standard edubuntu-desktop-gnome' + LIVE_TASKS='edubuntu-live' + COMPONENTS='main restricted universe' + ;; + + xubuntu) + TASKS='minimal standard xubuntu-desktop' + PACKAGES="${PACKAGES:+$PACKAGES }xterm" + LIVE_TASKS='edubuntu-live' + COMPONENTS='main restricted universe multiverse' + ;; + + ubuntu-netbook) + TASKS='minimal standard ubuntu-netbook' + LIVE_TASKS='netbook-live' + ;; + + mythbuntu) + TASKS='minimal standard mythbuntu-desktop' + LIVE_TASKS='mythbuntu-live' + COMPONENTS='main restricted universe multiverse' + ;; + + base) + TASKS='minimal standard' + ;; + + ubuntu-headless) + TASKS='minimal standard' + ;; + + *) + echo "unknown project $PROJECT" >&2 + exit 2 + ;; +esac +case $PROJECT in + *-dvd) + LIVE_TASKS="${LIVE_TASKS:+$LIVE_TASKS }$PROJECT-live" + ;; +esac + +case $ARCH in + armel) + # TODO export FLASH_KERNEL_SKIP=1 + KERNEL_FLAVOURS="$SUBARCH" + case $SUBARCH in + dove) + BINARY_REMOVE_LINUX=false + ;; + omap) + PACKAGES="${PACKAGES:+$PACKAGES }x-loader-omap3-beagle u-boot-linaro-omap3-beagle" + BINARY_REMOVE_LINUX=false + ;; + omap4) + PACKAGES="${PACKAGES:+$PACKAGES }x-loader-omap4-panda u-boot-linaro-omap4-panda" + BINARY_REMOVE_LINUX=false + ;; + esac + ;; +esac + +lb config noauto \ + --mode ubuntu \ + --distribution "$SUITE" \ + --bootstrap-keyring ubuntu-keyring \ + --binary-images tar \ + --binary-remove-linux "$BINARY_REMOVE_LINUX" \ + --source false \ + --build-with-chroot false \ + ${MIRROR:+--parent-mirror-bootstrap $MIRROR} \ + ${COMPONENTS:+--parent-archive-areas "$COMPONENTS"} \ + --initsystem none \ + --bootloader none \ + --initramfs-compression lzma \ + ${PACKAGES:+--packages "$PACKAGES"} \ + ${TASKS:+--tasks "$TASKS"} \ + ${LIVE_TASKS:+--live-tasks "$LIVE_TASKS"} \ + $OPTS + +case $PROJECT in + kubuntu|kubuntu-mobile) + ln -s /usr/share/live/build/examples/hooks/kubuntu_chroot_icon-theme.sh config/chroot_local-hooks/ + ;; +esac + +case $PROJECT in + *-dvd) + . config/bootstrap + + cat > config/chroot_sources/dvd.binary << EOF +deb $LB_PARENT_MIRROR_BINARY $SUITE universe multiverse +deb $LB_PARENT_MIRROR_BINARY_SECURITY $SUITE-security universe multiverse +deb $LB_PARENT_MIRROR_BINARY_VOLATILE $SUITE-updates universe multiverse +EOF + ;; +esac