diff --git a/debian/changelog b/debian/changelog index c3206016..530d7451 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,20 @@ +livecd-rootfs (2.19) oneiric; urgency=low + + * Add support for building a pool of packages into the live config: + - define SEEDMIRROR, PREINSTALL_POOL, PREINSTALL_POOL_SEEDS in config + - set PREINSTALL_POOL_SEEDS to "server-ship" for ubuntu-server + - crib seed inheritance logic from cdimage implementation of same + - run germinate against seeds from SEEDMIRROR if to populate + PREINSTALL_POOL with a list of packages from PREINSTALL_POOL_SEEDS + - create a local-hook to download PREINSTALL_POOL packages to rootfs + * And add support to deal with the above pool of packages during build: + - generate a GPG key in the background if we're going to need one + - create a sources.list.d entry pointing at the rootfs pool + - create a Packages file and create and sign a Release file + - add our previously-generated key to the apt keyring and toss it + + -- Adam Conrad Tue, 26 Jul 2011 15:26:01 -0600 + livecd-rootfs (2.18) oneiric; urgency=low * export LB_LINUX_FLAVOURS="none" in auto/clean, so the clean diff --git a/debian/control b/debian/control index cf8d4112..50190713 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 (>= 3.0~a22-1ubuntu1) +Depends: ${misc:Depends}, debootstrap, rsync, python-minimal | python, procps, squashfs-tools (>= 1:3.3-1), grep-dctrl, fdupes, lsb-release, lzma, e2fsprogs, germinate (>= 1.25.1), apt-utils, gnupg, live-build (>= 3.0~a22-1ubuntu1) Suggests: partimage Description: construction script for the livecd rootfs livecd-rootfs provides the script used to create the root filesystem diff --git a/live-build/auto/build b/live-build/auto/build index 2d918568..ff927926 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -12,9 +12,66 @@ Read_conffiles config/all config/common config/bootstrap config/chroot config/bi Set_defaults ( + if [ -d gnupg ]; then + cat << @@EOF > gnupg/NEWKEY +Key-Type: DSA +Key-Length: 1024 +Name-Real: Ubuntu Local Archive One-Time Signing Key +Name-Email: cdimage@ubuntu.com +Expire-Date: 0 +@@EOF + gpg --home gnupg --gen-key --batch < gnupg/NEWKEY \ + > gnupg/generate.log 2>&1 & + GPG_PROCESS=$! + fi + lb bootstrap "$@" lb chroot "$@" + if [ -d chroot/var/lib/preinstalled-pool ]; then + (cd chroot/var/lib/preinstalled-pool/ && apt-ftparchive packages . > Packages) + bzip2 -9 -c chroot/var/lib/preinstalled-pool/Packages \ + > chroot/var/lib/preinstalled-pool/Packages.bz2 + cat << @@EOF > chroot/etc/apt/sources.list.preinstall +# This is a sources.list entry for a small pool of packages +# provided on your preinstalled filesystem for your convenience. +# +# It is perfectly safe to delete both this entry and the directory +# it references, should you want to save disk space and fetch the +# packages remotely instead. +# +deb file:/var/lib/preinstalled-pool/ ./ +# +@@EOF + + cat chroot/etc/apt/sources.list.preinstall chroot/etc/apt/sources.list \ + > chroot/etc/apt/sources.list.new + mv chroot/etc/apt/sources.list.new chroot/etc/apt/sources.list + rm chroot/etc/apt/sources.list.preinstall + + echo "Waiting on gnupg ("$GPG_PROCESS") to finish generating a key." + wait $GPG_PROCESS + + R_ORIGIN=$(lsb_release -i -s) + R_CODENAME=$(lsb_release -c -s) + R_VERSION=$(lsb_release -r -s) + R_PRETTYNAME=$(echo $R_CODENAME | sed -e 's/^\(.\)/\U\1/') + + apt-ftparchive -o APT::FTPArchive::Release::Origin=$R_ORIGIN \ + -o APT::FTPArchive::Release::Label=$R_ORIGIN \ + -o APT::FTPArchive::Release::Suite=$R_CODENAME-local \ + -o APT::FTPArchive::Release::Version=$R_VERSION \ + -o APT::FTPArchive::Release::Codename=$R_CODENAME \ + -o APT::FTPArchive::Release::Description="$R_ORIGIN $R_PRETTYNAME Local" \ + release chroot/var/lib/preinstalled-pool/ > gnupg/Release + + gpg --home gnupg --detach-sign --armor gnupg/Release + mv gnupg/Release chroot/var/lib/preinstalled-pool/Release + mv gnupg/Release.asc chroot/var/lib/preinstalled-pool/Release.gpg + apt-key --keyring chroot/etc/apt/trusted.gpg add gnupg/pubring.gpg + rm chroot/var/lib/preinstalled-pool/Packages + fi + 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) diff --git a/live-build/auto/config b/live-build/auto/config index ea017404..fc85468e 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -3,6 +3,7 @@ set -e rm -rf config +SEEDMIRROR=http://people.canonical.com/~ubuntu-archive/seeds/ if [ -z "$MIRROR" ]; then case $(hostname --fqdn) in bld-*.mmjgroup.com) ;; @@ -18,9 +19,15 @@ if [ -z "$MIRROR" ]; then *) MIRROR=http://mirrors.0c3.net/ubuntu-ports/ ;; esac ;; - *.ubuntu.com) MIRROR=http://ftpmaster.internal/ubuntu/ ;; - *.warthogs.hbd.com) MIRROR=http://ftpmaster.internal/ubuntu/ ;; - *.buildd) MIRROR=http://ftpmaster.internal/ubuntu/ ;; + *.ubuntu.com) MIRROR=http://ftpmaster.internal/ubuntu/ + SEEDMIRROR=http://archive-team.internal/seeds/ + ;; + *.warthogs.hbd.com) MIRROR=http://ftpmaster.internal/ubuntu/ + SEEDMIRROR=http://archive-team.internal/seeds/ + ;; + *.buildd) MIRROR=http://ftpmaster.internal/ubuntu/ + SEEDMIRROR=http://archive-team.internal/seeds/ + ;; esac fi @@ -56,10 +63,14 @@ MEMTEST=none SOURCE='--source false' BOOTLOADER=none LIVE_TASK= +PREINSTALLED=false +PREINSTALL_POOL= +PREINSTALL_POOL_SEEDS= case $IMAGEFORMAT in ext2|ext3|ext4) OPTS="${OPTS:+$OPTS }--initramfs none --chroot-filesystem $IMAGEFORMAT" + PREINSTALLED=true case $SUBPROJECT in wubi) add_package install lupin-support @@ -72,6 +83,7 @@ case $IMAGEFORMAT in plain) OPTS="${OPTS:+$OPTS }--initramfs none --chroot-filesystem $IMAGEFORMAT" + PREINSTALLED=true ;; *) @@ -140,6 +152,7 @@ case $PROJECT in ubuntu-server) add_task install minimal standard + PREINSTALL_POOL_SEEDS='server-ship' ;; ubuntu-core) @@ -237,3 +250,82 @@ deb $LB_PARENT_MIRROR_BINARY_VOLATILE $SUITE-updates universe multiverse EOF ;; esac + +# cribbed from cdimage, perhaps this should be a small helper script in germinate? +add_inheritance () { + case " $inherit " in + *" $1 "*) + ;; + *) + inherit="${inherit:+$inherit }$1" + ;; + esac +} + +expand_inheritance () { + for seed in $(grep "^$1:" germinate-output/structure | cut -d: -f2); do + expand_inheritance "$seed" + done + add_inheritance "$1" +} + +inheritance () { + inherit= + expand_inheritance "$1" + echo "$inherit" +} + +if [ "$PREINSTALLED" = "true" ]; then + if [ -n "$PREINSTALL_POOL_SEEDS" ]; then + rm -rf germinate-output && mkdir germinate-output + case $PROJECT in + kubuntu-mobile*) + SEED=kubuntu-mobile.$SUITE + ;; + kubuntu*) + SEED=kubuntu.$SUITE + ;; + xubuntu*) + SEED=xubuntu.$SUITE + ;; + *) + SEED=ubuntu.$SUITE + ;; + esac + (cd germinate-output && germinate --no-rdepends --no-installer \ + -S $SEEDMIRROR -m $MIRROR -d $SUITE -s $SEED \ + ${COMPONENTS:+-c "$COMPONENTS"} -a $ARCH) + + UNWANTED_SEEDS="${LIVE_TASK:+$LIVE_TASK }boot installer required" + for i in $UNWANTED_SEEDS; do + UNWANTED_SEEDS="${UNWANTED_SEEDS:+$UNWANTED_SEEDS }$(inheritance $i)" + done + + for i in $PREINSTALL_POOL_SEEDS; do + PREINSTALL_POOL_SEEDS="${PREINSTALL_POOL_SEEDS:+$PREINSTALL_POOL_SEEDS }$(inheritance $i)" + done + + for i in $PREINSTALL_POOL_SEEDS; do + case " $UNWANTED_SEEDS " in + *" $i "*) + ;; + *) + PPS_EXP="${PPS_EXP:+$PPS_EXP }$i" + ;; + esac + done + + for i in $PPS_EXP; do + PREINSTALL_POOL="$PREINSTALL_POOL $(awk '{print $1}' \ + germinate-output/$i | egrep -v '^-|^Package|^\|' | tr '\n' ' ')" + done + fi + if [ -n "$PREINSTALL_POOL" ]; then + rm -rf gnupg && mkdir gnupg + PREINSTALL_POOL_HOOK=config/chroot_local-hooks/preinstall-pool.sh + echo "#! /bin/sh" > $PREINSTALL_POOL_HOOK + echo "mkdir -p /var/lib/preinstalled-pool/" >> $PREINSTALL_POOL_HOOK + echo "cd /var/lib/preinstalled-pool/" >> $PREINSTALL_POOL_HOOK + echo "apt-get -y download $PREINSTALL_POOL" >> $PREINSTALL_POOL_HOOK + fi +fi