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 if ifclass SOURCES ; then
10 echo "Class SOURCES set, retrieving source packages."
12 echo "Class SOURCES not set, nothing to do."
18 PACKAGE_LIST=$(mktemp)
21 rm -f "${target}/grml-live/sources/errors.log"
25 $ROOTCMD apt-get update
27 $ROOTCMD dpkg-query -W -f='${Package}\n' > "${PACKAGE_LIST}"
29 if ! [ -r "${PACKAGE_LIST}" ] ; then
30 echo "Can not read ${PACKAGE_LIST}, can not download source packages as requested." >&2
34 mkdir -p "${target}"/grml-live/sources
36 # needs to be done for each package to get:
37 # | Picking 'acpi-support' as source package instead of 'acpi-fakekey'
39 # | E: Unable to find a source package for acpi-fakekey
40 for package in $(grep -v '^#' ${PACKAGE_LIST}) ; do
41 cat << EOT | chroot "$target" /bin/bash
43 apt-get --download-only source "$package" 2>>/grml-live/sources/errors.log
47 if grep -q '^E:' "${target}/grml-live/sources/errors.log" ; then
48 echo "Errors noticed while retrieving sources:" >&2
49 cat "${target}/grml-live/sources/errors.log" >&2
52 elif grep -q '^W:' "${target}/grml-live/sources/errors.log" ; then
53 echo "Warnings noticed while retrieving sources (not failing the build though):"
54 cat "${target}/grml-live/sources/errors.log"
55 elif grep -q '.' "${target}/grml-live/sources/errors.log" ; then
56 echo "Unclassified problems noticed while retrieving sources:" >&2
57 cat "${target}/grml-live/sources/errors.log" >&2
66 ## END OF FILE #################################################################
67 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2