From d903b8b9af6b99ecd7e0e5f463ba8ef23bdb5c5c Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 10 Jun 2011 18:59:01 +0100 Subject: [PATCH 01/13] 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 From 944188fa4d7cabda91bf82fc9bd6470b0c59048a Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sat, 11 Jun 2011 11:37:14 +0100 Subject: [PATCH 02/13] --packages is being removed, so create a local package list instead --- live-build/auto/config | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/live-build/auto/config b/live-build/auto/config index ba756d6f..c75200a3 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -18,8 +18,19 @@ case $(hostname --fqdn) in *) ;; esac +mkdir -p config/local-packagelists +rm -f config/local-packagelists/livecd-rootfs.list + +add_package () +{ + local pkg + + for pkg; do + echo "$pkg" >> config/local-packagelists/livecd-rootfs.list + done +} + OPTS= -PACKAGES= TASKS= LIVE_TASKS= COMPONENTS= @@ -28,11 +39,11 @@ BINARY_REMOVE_LINUX=true case $IMAGEFORMAT in ext2|ext3) OPTS="${OPTS:+$OPTS }--initramfs none" - PACKAGES="${PACKAGES:+$PACKAGES }jasper" + add_package jasper ;; *) - PACKAGES="${PACKAGES:+$PACKAGES }lupin-casper" + add_package lupin-casper ;; esac @@ -61,7 +72,7 @@ case $PROJECT in xubuntu) TASKS='minimal standard xubuntu-desktop' - PACKAGES="${PACKAGES:+$PACKAGES }xterm" + add_package xterm LIVE_TASKS='edubuntu-live' COMPONENTS='main restricted universe multiverse' ;; @@ -105,11 +116,11 @@ case $ARCH in BINARY_REMOVE_LINUX=false ;; omap) - PACKAGES="${PACKAGES:+$PACKAGES }x-loader-omap3-beagle u-boot-linaro-omap3-beagle" + add_package 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" + add_package x-loader-omap4-panda u-boot-linaro-omap4-panda BINARY_REMOVE_LINUX=false ;; esac @@ -129,7 +140,6 @@ lb config noauto \ --initsystem none \ --bootloader none \ --initramfs-compression lzma \ - ${PACKAGES:+--packages "$PACKAGES"} \ ${TASKS:+--tasks "$TASKS"} \ ${LIVE_TASKS:+--live-tasks "$LIVE_TASKS"} \ $OPTS From e4389e439f42882b6a7aa5043116b12331b78192 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sat, 11 Jun 2011 18:20:32 +0100 Subject: [PATCH 03/13] update for changes in live-build 3.0~a20-1 --- live-build/auto/config | 67 ++++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/live-build/auto/config b/live-build/auto/config index c75200a3..9efa71b1 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -18,82 +18,93 @@ case $(hostname --fqdn) in *) ;; esac -mkdir -p config/local-packagelists -rm -f config/local-packagelists/livecd-rootfs.list +mkdir -p config/local-tasklists config/local-packagelists +rm -f config/local-tasklists/livecd-rootfs.list config/local-packagelists/livecd-rootfs.list + +add_task () +{ + local pass="$1" + shift + local task + + for task; do + echo "$task" >> "config/local-tasklists/livecd-rootfs.list.$pass" + done +} add_package () { + local pass="$1" + shift local pkg for pkg; do - echo "$pkg" >> config/local-packagelists/livecd-rootfs.list + echo "$pkg" >> "config/local-packagelists/livecd-rootfs.list.$pass" done } OPTS= -TASKS= -LIVE_TASKS= COMPONENTS= BINARY_REMOVE_LINUX=true case $IMAGEFORMAT in ext2|ext3) OPTS="${OPTS:+$OPTS }--initramfs none" - add_package jasper + add_package live jasper ;; *) - add_package lupin-casper + add_package live lupin-casper ;; esac case $PROJECT in ubuntu|ubuntu-dvd) - TASKS='minimal standard ubuntu-desktop' - LIVE_TASKS='ubuntu-live' + add_task install minimal standard ubuntu-desktop + add_task live ubuntu-live ;; kubuntu|kubuntu-dvd) - TASKS='minimal standard kubuntu-desktop' - LIVE_TASKS='kubuntu-live' + add_task install minimal standard kubuntu-desktop + add_task live kubuntu-live ;; kubuntu-mobile) - TASKS='minimal standard kubuntu-mobile' - LIVE_TASKS='kubuntu-mobile-live' + add_task install minimal standard kubuntu-mobile + add_task live kubuntu-mobile-live COMPONENTS='main restricted universe' ;; edubuntu|edubuntu-dvd) - TASKS='minimal standard edubuntu-desktop-gnome' - LIVE_TASKS='edubuntu-live' + add_task install minimal standard edubuntu-desktop-gnome + add_task live edubuntu-live COMPONENTS='main restricted universe' ;; xubuntu) - TASKS='minimal standard xubuntu-desktop' - add_package xterm - LIVE_TASKS='edubuntu-live' + add_task install minimal standard xubuntu-desktop + add_package install xterm + add_task live edubuntu-live COMPONENTS='main restricted universe multiverse' ;; ubuntu-netbook) - TASKS='minimal standard ubuntu-netbook' - LIVE_TASKS='netbook-live' + add_task install minimal standard ubuntu-netbook + add_task live netbook-live ;; mythbuntu) - TASKS='minimal standard mythbuntu-desktop' - LIVE_TASKS='mythbuntu-live' + add_task install minimal standard mythbuntu-desktop + add_task live mythbuntu-live COMPONENTS='main restricted universe multiverse' ;; base) - TASKS='minimal standard' + add_task install minimal standard ;; ubuntu-headless) - TASKS='minimal standard' + add_task install minimal standard ;; *) @@ -103,7 +114,7 @@ case $PROJECT in esac case $PROJECT in *-dvd) - LIVE_TASKS="${LIVE_TASKS:+$LIVE_TASKS }$PROJECT-live" + add_task live "$PROJECT-live" ;; esac @@ -116,11 +127,11 @@ case $ARCH in BINARY_REMOVE_LINUX=false ;; omap) - add_package x-loader-omap3-beagle u-boot-linaro-omap3-beagle + add_package install x-loader-omap3-beagle u-boot-linaro-omap3-beagle BINARY_REMOVE_LINUX=false ;; omap4) - add_package x-loader-omap4-panda u-boot-linaro-omap4-panda + add_package install x-loader-omap4-panda u-boot-linaro-omap4-panda BINARY_REMOVE_LINUX=false ;; esac @@ -140,8 +151,6 @@ lb config noauto \ --initsystem none \ --bootloader none \ --initramfs-compression lzma \ - ${TASKS:+--tasks "$TASKS"} \ - ${LIVE_TASKS:+--live-tasks "$LIVE_TASKS"} \ $OPTS case $PROJECT in From 173f96fd68cd769af7a57fdeb24f3a8887f53e8f Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sat, 11 Jun 2011 23:33:39 +0100 Subject: [PATCH 04/13] remove stale TODO --- live-build/auto/config | 1 - 1 file changed, 1 deletion(-) diff --git a/live-build/auto/config b/live-build/auto/config index 9efa71b1..760bf655 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -4,7 +4,6 @@ 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/ ;; From b1754e4352f8bf346e841a124a716f38a2a06b38 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sat, 11 Jun 2011 23:34:13 +0100 Subject: [PATCH 05/13] fix package/task list paths --- live-build/auto/config | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/live-build/auto/config b/live-build/auto/config index 760bf655..eae87b9f 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -17,8 +17,8 @@ case $(hostname --fqdn) in *) ;; esac -mkdir -p config/local-tasklists config/local-packagelists -rm -f config/local-tasklists/livecd-rootfs.list config/local-packagelists/livecd-rootfs.list +mkdir -p config/chroot_local-tasklists config/chroot_local-packagelists +rm -f config/chroot_local-tasklists/livecd-rootfs.list config/chroot_local-packagelists/livecd-rootfs.list add_task () { @@ -27,7 +27,7 @@ add_task () local task for task; do - echo "$task" >> "config/local-tasklists/livecd-rootfs.list.$pass" + echo "$task" >> "config/chroot_local-tasklists/livecd-rootfs.list.$pass" done } @@ -38,7 +38,7 @@ add_package () local pkg for pkg; do - echo "$pkg" >> "config/local-packagelists/livecd-rootfs.list.$pass" + echo "$pkg" >> "config/chroot_local-packagelists/livecd-rootfs.list.$pass" done } From 044c08ce0f3229a41d0863bab24d6573b884444b Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sat, 11 Jun 2011 23:45:06 +0100 Subject: [PATCH 06/13] --package-lists none (we use task lists instead) --- live-build/auto/config | 1 + 1 file changed, 1 insertion(+) diff --git a/live-build/auto/config b/live-build/auto/config index eae87b9f..907d4032 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -147,6 +147,7 @@ lb config noauto \ --build-with-chroot false \ ${MIRROR:+--parent-mirror-bootstrap $MIRROR} \ ${COMPONENTS:+--parent-archive-areas "$COMPONENTS"} \ + --package-lists none \ --initsystem none \ --bootloader none \ --initramfs-compression lzma \ From 98495f7da0a1991e8179041a329ec33885fd7787 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 13 Jun 2011 10:45:52 +0100 Subject: [PATCH 07/13] flash-kernel now handled in live-build --- live-build/auto/config | 1 - 1 file changed, 1 deletion(-) diff --git a/live-build/auto/config b/live-build/auto/config index 907d4032..97d360df 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -119,7 +119,6 @@ esac case $ARCH in armel) - # TODO export FLASH_KERNEL_SKIP=1 KERNEL_FLAVOURS="$SUBARCH" case $SUBARCH in dove) From 2403a1d29ccaf6052f63877eb8d2343d18437e62 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 13 Jun 2011 10:46:26 +0100 Subject: [PATCH 08/13] versioned live-build dependency --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 7d315bba..25f29db7 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, live-build +Depends: ${misc:Depends}, debootstrap, rsync, python-minimal | python, procps, squashfs-tools (>= 1:3.3-1), grep-dctrl, fdupes, lsb-release, lzma, e2fsprogs, live-build (>= 3.0~a20-1ubuntu1) Suggests: partimage Description: construction script for the livecd rootfs livecd-rootfs provides the script used to create the root filesystem From 15e23d2de5c7b4c860d6153c21e816fb1066de21 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 13 Jun 2011 11:50:09 +0100 Subject: [PATCH 09/13] make it easier to use a custom mirror --- live-build/auto/config | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/live-build/auto/config b/live-build/auto/config index 97d360df..08ab3c19 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -1,21 +1,21 @@ #! /bin/sh set -e -MIRROR= -case $(hostname --fqdn) in - bld-*.mmjgroup.com) ;; - *.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 +if [ -z "$MIRROR" ]; then + case $(hostname --fqdn) in + bld-*.mmjgroup.com) ;; + *.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 +fi mkdir -p config/chroot_local-tasklists config/chroot_local-packagelists rm -f config/chroot_local-tasklists/livecd-rootfs.list config/chroot_local-packagelists/livecd-rootfs.list From 97f056d3b608e290cdb88cf9c0d541541e908fe7 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 13 Jun 2011 12:24:12 +0100 Subject: [PATCH 10/13] link output files to BuildLiveCD-compatible locations --- live-build/auto/build | 56 +++++++++++++++++++++++++++++++++++++++++++ live-build/auto/clean | 1 + 2 files changed, 57 insertions(+) diff --git a/live-build/auto/build b/live-build/auto/build index 0499a66d..ac8a7611 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -3,6 +3,13 @@ set -e export LC_ALL=C +. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh + +Arguments "${@}" + +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + ( lb bootstrap "$@" lb chroot "$@" @@ -27,3 +34,52 @@ export LC_ALL=C lb binary "$@" ) 2>&1 | tee binary.log + +# Link output files somewhere BuildLiveCD will be able to find them. +PREFIX="livecd.$PROJECT${SUBARCH:+-$SUBARCH}" + +case $LB_INITRAMFS in + casper) + INITFS="casper" + ;; + + live-boot) + INITFS="live" + ;; + + *) + INITFS="boot" + ;; +esac + +for OUTPUT in ext2 ext3 manifest manifest-remove size squashfs; do + [ -e "binary/$INITFS/filesystem.$OUTPUT" ] || continue + ln "binary/$INITFS/filesystem.$OUTPUT" "$PREFIX.$OUTPUT" + chmod 644 "$PREFIX.$OUTPUT" +done + +for FLAVOUR in $LB_LINUX_FLAVOURS; do + KVERS="$( (cd "binary/$INITFS"; ls vmlinu?-*) | sed -n "s/^vmlinu.-\\([^-]*-[^-]*-$FLAVOUR\\)/\\1/p" )" + if [ -z "$KVERS" ]; then + echo "No kernel output for $FLAVOUR!" >&2 + exit 1 + fi + NUMKVERS="$(set -- $KVERS; echo $#)" + if [ "$NUMKVERS" -gt 1 ]; then + echo "Cannot handle more than one kernel for $FLAVOUR ($KVERS)!" >&2 + exit 1 + fi + ln "binary/$INITFS/"vmlinu?-"$KVERS" "$PREFIX.kernel-$FLAVOUR" + chmod 644 "$PREFIX.kernel-$FLAVOUR" + if [ -e "binary/$INITFS/initrd.img-$KVERS" ]; then + ln "binary/$INITFS/initrd.img-$KVERS" "$PREFIX.initrd-$FLAVOUR" + chmod 644 "$PREFIX.initrd-$FLAVOUR" + fi +done + +NUMFLAVOURS="$(set -- $LB_LINUX_FLAVOURS; echo $#)" +if [ "$NUMFLAVOURS" = 1 ]; then + # only one kernel flavour + ln -sf "$PREFIX.kernel-$LB_LINUX_FLAVOURS" "$PREFIX.kernel" + ln -sf "$PREFIX.initrd-$LB_LINUX_FLAVOURS" "$PREFIX.initrd" +fi diff --git a/live-build/auto/clean b/live-build/auto/clean index 5158f42b..4711f35d 100755 --- a/live-build/auto/clean +++ b/live-build/auto/clean @@ -5,3 +5,4 @@ lb clean noauto "$@" rm -rf config rm -f binary.manifest binary.manifest-desktop binary.log +rm -f livecd.* From 29e4d6c6d31954ee9e503afebca119dabd540970 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 13 Jun 2011 12:24:44 +0100 Subject: [PATCH 11/13] avoid some unnecessary work in lb_binary --- live-build/auto/config | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/live-build/auto/config b/live-build/auto/config index 08ab3c19..aea794ef 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -140,8 +140,9 @@ lb config noauto \ --mode ubuntu \ --distribution "$SUITE" \ --bootstrap-keyring ubuntu-keyring \ - --binary-images tar \ + --binary-images none \ --binary-remove-linux "$BINARY_REMOVE_LINUX" \ + --memtest none \ --source false \ --build-with-chroot false \ ${MIRROR:+--parent-mirror-bootstrap $MIRROR} \ From bc24923689197a1fdd6de7de634cc4dbea28fea2 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 13 Jun 2011 12:25:14 +0100 Subject: [PATCH 12/13] add live-build handling to BuildLiveCD --- BuildLiveCD | 106 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 61 insertions(+), 45 deletions(-) diff --git a/BuildLiveCD b/BuildLiveCD index fbb9a275..43634dc1 100755 --- a/BuildLiveCD +++ b/BuildLiveCD @@ -13,7 +13,7 @@ finish() { fi if [ "$SEND_LOG" = "yes" ]; then exec >/dev/null 2>&1 - mailx -s "LiveCD: $STATUS $STE:$arg${SUBARCH:+-$SUBARCH} build on ${ARCH}" buildd+porters < "$BUILD_LOG" + mailx -s "LiveCD: $STATUS $STE:$FS${SUBARCH:+-$SUBARCH} build on ${ARCH}" buildd+porters < "$BUILD_LOG" fi rm -f ~/buildLiveCD.lock nohup ~/bin/pruneLiveCD >/dev/null 2>&1 & @@ -31,13 +31,15 @@ NEWSUITE="natty" SUITES="" PROPOSED="" IMAGEFORMAT="" +LIVE_BUILD=false -while getopts :s:d:f:pa: name; do case $name in +while getopts :s:d:f:pa:l name; do case $name in s) SUBARCH="$OPTARG";; d) NEWSUITE="$OPTARG";; f) IMAGEFORMAT="-f$OPTARG";; p) PROPOSED="-p";; a) APT_SOURCE="-A $OPTARG";; + l) LIVE_BUILD=:;; esac; done; shift $((OPTIND-1)) @@ -68,7 +70,7 @@ if [ "$new_suite" = "yes" ] && [ "$old_suite" = "yes" ]; then echo "greater than hardy at the same time, please use two invocations" >&2 exit 1 fi -if (( $# == 0 )) || [ "X$1" = "Xall" ]; then +if ([ $# = 0 ] || [ "X$1" = "Xall" ]) && ! $LIVE_BUILD; then set -- ubuntu kubuntu kubuntu-mobile kubuntu-netbook edubuntu xubuntu mythbuntu base if [ "$ARCH" = "i386" ]; then set -- ubuntu ubuntu-dvd ubuntu-lpia ubuntu-netbook kubuntu kubuntu-dvd kubuntu-mobile kubuntu-netbook edubuntu edubuntu-dvd xubuntu mythbuntu base @@ -95,6 +97,8 @@ if [ "`echo $@ | wc -w`" -gt "1" ]; then done exit 0 fi +FS="$1" +shift lockfile ~/buildLiveCD.lock || exit 1 trap "finish" 0 @@ -116,52 +120,64 @@ for STE in $SUITES; do DIR=~/build.live/chroot-${STE}/./build/ fi - for arg in "$@"; do - PUBDIR=~/public_html/LiveCD/${STE}/${arg}${SUBARCH:+-$SUBARCH}/ - mkdir -p ${PUBDIR} + PUBDIR=~/public_html/LiveCD/${STE}/${FS}${SUBARCH:+-$SUBARCH}/ + mkdir -p ${PUBDIR} - NOW=$(date +%Y%m%d) - if [ -d ${PUBDIR}${NOW} ]; then - typeset -i n=1; while [ -d ${PUBDIR}${NOW}.$n ]; do n=n+1; done - NOW=${NOW}.$n - fi - NOW=${NOW} - LOG=${PUBDIR}${NOW}/livecd-${NOW}-${ARCH}.out + NOW=$(date +%Y%m%d) + if [ -d ${PUBDIR}${NOW} ]; then + typeset -i n=1; while [ -d ${PUBDIR}${NOW}.$n ]; do n=n+1; done + NOW=${NOW}.$n + fi + NOW=${NOW} + LOG=${PUBDIR}${NOW}/livecd-${NOW}-${ARCH}.out + > ${LOG} - rm -f ${PUBDIR}latest - ln -sf ${PUBDIR}${NOW} ${PUBDIR}latest - mkdir -p ${PUBDIR}${NOW} - if $LINUX32 sudo chroot ${DIR%/./*} sh -c "cd /${DIR#*/./} && /usr/sbin/livecd.sh ${SUBARCHARG} ${APT_SOURCE} ${PROPOSED} -d${STE} ${IMAGEFORMAT} ${ARCHARG} ${IMAGEARG} $arg" > ${LOG} 2>&1; then - rm -f ${PUBDIR}current - ln -sf ${NOW} ${PUBDIR}current + rm -f ${PUBDIR}latest + ln -sf ${PUBDIR}${NOW} ${PUBDIR}latest + mkdir -p ${PUBDIR}${NOW} + if $LIVE_BUILD; then + mkdir -p "${DIR}/auto" + for f in config build clean; do + ln -s "/usr/share/livecd-rootfs/live-build/auto/$f" "${DIR}/auto/" + done + $LINUX32 sudo chroot ${DIR%/./*} sh -c "cd /${DIR#*/./} && lb clean --purge" >> ${LOG} 2>&1 || true + if ! $LINUX32 sudo chroot ${DIR%/./*} sh -c "cd /${DIR#*/./} && SUITE=${STE} PROJECT=${FS} ARCH=${ARCH} SUBARCH=${SUBARCH} IMAGEFORMAT=${IMAGEFORMAT} lb config" >> ${LOG} 2>&1; then + exit 1 + fi + COMMAND="PROJECT=${FS} SUBARCH=${SUBARCH} lb build" + else + COMMAND="/usr/sbin/livecd.sh ${SUBARCHARG} ${APT_SOURCE} ${PROPOSED} -d${STE} ${IMAGEFORMAT} ${ARCHARG} ${IMAGEARG} ${FS}" + fi + if $LINUX32 sudo chroot ${DIR%/./*} sh -c "cd /${DIR#*/./} && $COMMAND" >> ${LOG} 2>&1; then + rm -f ${PUBDIR}current + ln -sf ${NOW} ${PUBDIR}current - for file in ${DIR}livecd.*; do - if [ -f ${file} ]; then - ext=${file##*.} - base=${file%.*}; base=${base##*/} - sudo chown buildd ${file} - sudo mv ${file} ${PUBDIR}${NOW}/${base}-${NOW}-${ARCH}.${ext} - ln -sf ${base}-${NOW}-${ARCH}.${ext} ${PUBDIR}${NOW}/${base}.${ext} - fi - done + for file in ${DIR}livecd.*; do + if [ -f ${file} ]; then + ext=${file##*.} + base=${file%.*}; base=${base##*/} + sudo chown buildd ${file} + sudo mv ${file} ${PUBDIR}${NOW}/${base}-${NOW}-${ARCH}.${ext} + ln -sf ${base}-${NOW}-${ARCH}.${ext} ${PUBDIR}${NOW}/${base}.${ext} + fi + done - for f in ${PUBDIR}${NOW}/livecd.*.cloop-*; do - target=${f%-*} - if [ ! -f ${target} ]; then - for fsbs in 4096:4096 1024:65536; do - if [ -f ${target}-${fsbs} ]; then - ln -sf ${target##*/}-${fsbs} ${target} - break - fi - done - if [ ! -f ${target} ]; then - best=$(ls -ld ${target}-* | sort -k5,5n| awk '{print $NF; quit}') - ln -sf ${best##*/} ${target} + for f in ${PUBDIR}${NOW}/livecd.*.cloop-*; do + target=${f%-*} + if [ ! -f ${target} ]; then + for fsbs in 4096:4096 1024:65536; do + if [ -f ${target}-${fsbs} ]; then + ln -sf ${target##*/}-${fsbs} ${target} + break fi + done + if [ ! -f ${target} ]; then + best=$(ls -ld ${target}-* | sort -k5,5n| awk '{print $NF; quit}') + ln -sf ${best##*/} ${target} fi - done - else - exit 1 - fi - done + fi + done + else + exit 1 + fi done From b31062605de1fb959ff6cf12ca95f933549c6524 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 13 Jun 2011 12:31:37 +0100 Subject: [PATCH 13/13] build LTSP chroot on edubuntu-dvd/i386 --- BuildLiveCD | 2 +- live-build/auto/build | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/BuildLiveCD b/BuildLiveCD index 43634dc1..d84e6ec1 100755 --- a/BuildLiveCD +++ b/BuildLiveCD @@ -144,7 +144,7 @@ for STE in $SUITES; do if ! $LINUX32 sudo chroot ${DIR%/./*} sh -c "cd /${DIR#*/./} && SUITE=${STE} PROJECT=${FS} ARCH=${ARCH} SUBARCH=${SUBARCH} IMAGEFORMAT=${IMAGEFORMAT} lb config" >> ${LOG} 2>&1; then exit 1 fi - COMMAND="PROJECT=${FS} SUBARCH=${SUBARCH} lb build" + COMMAND="PROJECT=${FS} ARCH=${ARCH} SUBARCH=${SUBARCH} lb build" else COMMAND="/usr/sbin/livecd.sh ${SUBARCHARG} ${APT_SOURCE} ${PROPOSED} -d${STE} ${IMAGEFORMAT} ${ARCHARG} ${IMAGEARG} ${FS}" fi diff --git a/live-build/auto/build b/live-build/auto/build index ac8a7611..19ef2a58 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -83,3 +83,23 @@ if [ "$NUMFLAVOURS" = 1 ]; then ln -sf "$PREFIX.kernel-$LB_LINUX_FLAVOURS" "$PREFIX.kernel" ln -sf "$PREFIX.initrd-$LB_LINUX_FLAVOURS" "$PREFIX.initrd" fi + +# LTSP chroot building (only in 32bit and for Edubuntu (DVD)) +case $PROJECT in + edubuntu-dvd) + if [ "$ARCH" = i386 ]; then + echo "Building LTSP chroot" + ltsp-build-client --base $(pwd) --mirror $LB_PARENT_MIRROR_BOOTSTRAP --arch $ARCH --dist $LB_PARENT_DISTRIBUTION --chroot ltsp-live --late-packages ldm-edubuntu-theme,plymouth-theme-edubuntu --purge-chroot --skipimage + mkdir -p images + mksquashfs ltsp-live images/ltsp-live.img -noF -noD -noI -no-exports -e cdrom + rm -Rf ltsp-live + if [ -f images/ltsp-live.img ]; then + mv images/ltsp-live.img livecd.$PROJECT-ltsp.squashfs + chmod 0644 livecd.$PROJECT-ltsp.squashfs + rmdir --ignore-fail-on-non-empty images + else + echo "LTSP: Unable to build the chroot, see above for details." + fi + fi + ;; +esac