From b97721f7f383f030396fa41bab2c80e5151cdda1 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 25 Nov 2011 19:18:47 +0100 Subject: [PATCH] retrieve source packages via grml-live using SOURCES class --- docs/grml-live.txt | 3 ++ .../etc/apt/sources.list.d/debian.list/DEBIAN_ETCH | 2 +- .../apt/sources.list.d/debian.list/DEBIAN_LENNY | 4 +- .../etc/apt/sources.list.d/debian.list/DEBIAN_SID | 2 +- .../apt/sources.list.d/debian.list/DEBIAN_SQUEEZE | 4 +- .../apt/sources.list.d/debian.list/DEBIAN_STABLE | 4 +- .../apt/sources.list.d/debian.list/DEBIAN_TESTING | 4 +- .../apt/sources.list.d/debian.list/DEBIAN_WHEEZY | 4 +- .../apt/sources.list.d/grml-stable.list/GRMLBASE | 2 +- .../apt/sources.list.d/grml-testing.list/GRMLBASE | 2 +- .../fai/config/scripts/GRMLBASE/03-get-sources | 60 ++++++++++++++++++++++ grml-live | 15 ++++-- 12 files changed, 89 insertions(+), 17 deletions(-) create mode 100755 etc/grml/fai/config/scripts/GRMLBASE/03-get-sources diff --git a/docs/grml-live.txt b/docs/grml-live.txt index 966f8ac..02b3265 100644 --- a/docs/grml-live.txt +++ b/docs/grml-live.txt @@ -358,6 +358,9 @@ official grml release * REMOVE_DOCS: get rid of documentation directories (like /usr/share/doc, /usr/share/man/, /usr/share/info,...) +* SOURCES: retrieve Debian source packages after installation. Files will be +placed in the output directory under grml_sources. + * XORG: providing important packages for use with a base grml-featured X.org setup diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_ETCH b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_ETCH index 06ce943..1ece67b 100644 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_ETCH +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_ETCH @@ -1,6 +1,6 @@ # official debian repository (mirror selected via geo-ip): deb http://cdn.debian.net/debian/ etch main contrib non-free -# deb-src http://cdn.debian.net/debian/ etch main contrib non-free + deb-src http://cdn.debian.net/debian/ etch main contrib non-free # official debian repository: # deb http://ftp.debian.org/debian/ etch main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_LENNY b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_LENNY index 08a2a79..b6ced67 100644 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_LENNY +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_LENNY @@ -1,10 +1,10 @@ # official debian repository (mirror selected via geo-ip): deb http://cdn.debian.net/debian/ lenny main contrib non-free -# deb-src http://cdn.debian.net/debian/ lenny main contrib non-free + deb-src http://cdn.debian.net/debian/ lenny main contrib non-free # security updates: deb http://security.debian.org/ lenny/updates main contrib -# deb-src http://security.debian.org/ lenny/updates main contrib + deb-src http://security.debian.org/ lenny/updates main contrib # official debian repository: # deb http://ftp.debian.org/debian/ lenny main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SID b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SID index cfef9b3..332a6e7 100644 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SID +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SID @@ -1,6 +1,6 @@ # official debian repository (mirror selected via geo-ip): deb http://cdn.debian.net/debian/ sid main contrib non-free -# deb-src http://cdn.debian.net/debian/ sid main contrib non-free + deb-src http://cdn.debian.net/debian/ sid main contrib non-free # official debian repository: # deb http://ftp.debian.org/debian/ sid main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SQUEEZE b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SQUEEZE index 47615c9..88e6d57 100644 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SQUEEZE +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_SQUEEZE @@ -1,10 +1,10 @@ # official debian repository (mirror selected via geo-ip): deb http://cdn.debian.net/debian/ squeeze main contrib non-free -# deb-src http://cdn.debian.net/debian/ squeeze main contrib non-free + deb-src http://cdn.debian.net/debian/ squeeze main contrib non-free # security updates: deb http://security.debian.org/ squeeze/updates main contrib -# deb-src http://security.debian.org/ squeeze/updates main contrib + deb-src http://security.debian.org/ squeeze/updates main contrib # official debian repository: # deb http://ftp.debian.org/debian/ squeeze main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_STABLE b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_STABLE index 0537b6f..f3c816c 100644 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_STABLE +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_STABLE @@ -1,10 +1,10 @@ # official debian repository (mirror selected via geo-ip): deb http://cdn.debian.net/debian/ stable main contrib non-free -# deb-src http://cdn.debian.net/debian/ stable main contrib non-free + deb-src http://cdn.debian.net/debian/ stable main contrib non-free # security updates: deb http://security.debian.org/ stable/updates main contrib -# deb-src http://security.debian.org/ stable/updates main contrib + deb-src http://security.debian.org/ stable/updates main contrib # official debian repository: # deb http://ftp.debian.org/debian/ stable main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TESTING b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TESTING index 84ee17a..33dc13e 100644 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TESTING +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_TESTING @@ -1,10 +1,10 @@ # official debian repository (mirror selected via geo-ip): deb http://cdn.debian.net/debian/ testing main contrib non-free -# deb-src http://cdn.debian.net/debian/ testing main contrib non-free + deb-src http://cdn.debian.net/debian/ testing main contrib non-free # security updates: deb http://security.debian.org/ testing/updates main contrib -# deb-src http://security.debian.org/ testing/updates main contrib + deb-src http://security.debian.org/ testing/updates main contrib # official debian repository: # deb http://ftp.debian.org/debian/ testing main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_WHEEZY b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_WHEEZY index ca044c4..d850455 100644 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_WHEEZY +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/debian.list/DEBIAN_WHEEZY @@ -1,10 +1,10 @@ # official debian repository (mirror selected via geo-ip): deb http://cdn.debian.net/debian/ wheezy main contrib non-free -# deb-src http://cdn.debian.net/debian/ wheezy main contrib non-free + deb-src http://cdn.debian.net/debian/ wheezy main contrib non-free # security updates: deb http://security.debian.org/ wheezy/updates main contrib -# deb-src http://security.debian.org/ wheezy/updates main contrib + deb-src http://security.debian.org/ wheezy/updates main contrib # official debian repository: # deb http://ftp.debian.org/debian/ wheezy main contrib non-free diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-stable.list/GRMLBASE b/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-stable.list/GRMLBASE index 63b4222..b30b65b 100644 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-stable.list/GRMLBASE +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-stable.list/GRMLBASE @@ -1,3 +1,3 @@ # stable Grml repository: deb http://deb.grml.org/ grml-stable main -# deb-src http://deb.grml.org/ grml-stable main + deb-src http://deb.grml.org/ grml-stable main diff --git a/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-testing.list/GRMLBASE b/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-testing.list/GRMLBASE index 860d528..dad1c90 100644 --- a/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-testing.list/GRMLBASE +++ b/etc/grml/fai/config/files/etc/apt/sources.list.d/grml-testing.list/GRMLBASE @@ -1,3 +1,3 @@ # testing/developer Grml repository: deb http://deb.grml.org/ grml-testing main -# deb-src http://deb.grml.org/ grml-testing main + deb-src http://deb.grml.org/ grml-testing main diff --git a/etc/grml/fai/config/scripts/GRMLBASE/03-get-sources b/etc/grml/fai/config/scripts/GRMLBASE/03-get-sources new file mode 100755 index 0000000..140faf1 --- /dev/null +++ b/etc/grml/fai/config/scripts/GRMLBASE/03-get-sources @@ -0,0 +1,60 @@ +#!/bin/bash +# Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/03-get-sources +# Purpose: download sources of Debian packages +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2 or any later version. +################################################################################ + +[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf +[ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local + +if ifclass SOURCES ; then + echo "Class SOURCES set, retrieving source packages." +else + echo "Class SOURCES not set, nothing to do." + exit 0 +fi + +set -u + +PACKAGE_LIST=$(mktemp) + +bailout() { + rm -f "${target}/grml-live/sources/errors.log" + rm -f "$PACKAGE_LIST" +} + +$ROOTCMD dpkg-query -W -f='${Package}\n' > "${PACKAGE_LIST}" + +if ! [ -r "${PACKAGE_LIST}" ] ; then + echo "Can not read ${PACKAGE_LIST}, can not download source packages as requested." >&2 + bailout + exit 1 +else + mkdir -p "${target}"/grml-live/sources + + # needs to be done for each package to get: + # | Picking 'acpi-support' as source package instead of 'acpi-fakekey' + # instead of: + # | E: Unable to find a source package for acpi-fakekey + for package in $(grep -v '^#' ${PACKAGE_LIST}) ; do + cat << EOT | chroot "$target" /bin/bash +cd /grml-live/sources +apt-get --download-only source "$package" 2>>/grml-live/sources/errors.log +EOT + done + + if grep -q . "${target}/grml-live/sources/errors.log" ; then + echo "Errors noticed while retrieving sources:" >&2 + cat "${target}/grml-live/sources/errors.log" >&2 + bailout + exit 1 + fi + +fi + +bailout + +## END OF FILE ################################################################# +# vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/grml-live b/grml-live index 362f88c..04b30bb 100755 --- a/grml-live +++ b/grml-live @@ -149,6 +149,7 @@ umount_all() { umount $CHROOT_OUTPUT/sys 2>/dev/null || /bin/true umount $CHROOT_OUTPUT/dev/pts 2>/dev/null || /bin/true umount $CHROOT_OUTPUT/dev 2>/dev/null || /bin/true + umount "${CHROOT_OUTPUT}/grml-live/sources/" 2>/dev/null || /bin/true [ -n "$MIRROR_DIRECTORY" ] && umount "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}" } # }}} @@ -538,9 +539,14 @@ $GRML_LIVE_SOURCES" | \ else cat >> "$SOURCES_LIST_OUTPUT" << EOF # generated by grml-live -deb http://deb.grml.org/ grml-stable main -deb http://deb.grml.org/ grml-testing main -deb http://cdn.debian.net/debian $SUITE main contrib non-free +deb http://deb.grml.org/ grml-stable main +deb-src http://deb.grml.org/ grml-stable main + +deb http://deb.grml.org/ grml-testing main +deb-src http://deb.grml.org/ grml-testing main + +deb http://cdn.debian.net/debian $SUITE main contrib non-free +deb-src http://cdn.debian.net/debian $SUITE main contrib non-free EOF fi @@ -626,6 +632,9 @@ else mount --bind "${MIRROR_DIRECTORY}" "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}" fi + mkdir -p "${OUTPUT}/grml_sources/" "${CHROOT_OUTPUT}/grml-live/sources/" + mount --bind "${OUTPUT}/grml_sources/" "${CHROOT_OUTPUT}/grml-live/sources/" + # tell dpkg to use "unsafe io" during the build [ -d "$CHROOT_OUTPUT/etc/dpkg/dpkg.cfg.d" ] || mkdir -p "$CHROOT_OUTPUT/etc/dpkg/dpkg.cfg.d" echo force-unsafe-io > "$CHROOT_OUTPUT/etc/dpkg/dpkg.cfg.d/unsafe-io" -- 2.1.4