2 # Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/03-get-sources
3 # Purpose: download sources of Debian packages
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2 or any later version.
7 ################################################################################
9 [ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
10 [ -n "$GRML_LIVE_LOCAL_CONFIG" ] && . "$GRML_LIVE_LOCAL_CONFIG"
12 if ifclass SOURCES ; then
13 echo "Class SOURCES set, retrieving source packages."
15 echo "Class SOURCES not set, nothing to do."
21 PACKAGE_LIST=$(mktemp)
24 rm -f "${target}/grml-live/sources/errors.log"
28 $ROOTCMD dpkg-query -W -f='${Package}\n' > "${PACKAGE_LIST}"
30 if ! [ -r "${PACKAGE_LIST}" ] ; then
31 echo "Can not read ${PACKAGE_LIST}, can not download source packages as requested." >&2
35 mkdir -p "${target}"/grml-live/sources
37 # needs to be done for each package to get:
38 # | Picking 'acpi-support' as source package instead of 'acpi-fakekey'
40 # | E: Unable to find a source package for acpi-fakekey
41 for package in $(grep -v '^#' ${PACKAGE_LIST}) ; do
42 cat << EOT | chroot "$target" /bin/bash
44 apt-get --download-only source "$package" 2>>/grml-live/sources/errors.log
48 if grep -q . "${target}/grml-live/sources/errors.log" ; then
49 echo "Errors noticed while retrieving sources:" >&2
50 cat "${target}/grml-live/sources/errors.log" >&2
59 ## END OF FILE #################################################################
60 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2