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 dpkg-query -W -f='${Package}\n' > "${PACKAGE_LIST}"
27 if ! [ -r "${PACKAGE_LIST}" ] ; then
28 echo "Can not read ${PACKAGE_LIST}, can not download source packages as requested." >&2
32 mkdir -p "${target}"/grml-live/sources
34 # needs to be done for each package to get:
35 # | Picking 'acpi-support' as source package instead of 'acpi-fakekey'
37 # | E: Unable to find a source package for acpi-fakekey
38 for package in $(grep -v '^#' ${PACKAGE_LIST}) ; do
39 cat << EOT | chroot "$target" /bin/bash
41 apt-get --download-only source "$package" 2>>/grml-live/sources/errors.log
45 if grep -q '^E:' "${target}/grml-live/sources/errors.log" ; then
46 echo "Errors noticed while retrieving sources:" >&2
47 cat "${target}/grml-live/sources/errors.log" >&2
50 elif grep -q '^W:' "${target}/grml-live/sources/errors.log" ; then
51 echo "Warnings noticed while retrieving sources (not failing the build though):"
52 cat "${target}/grml-live/sources/errors.log"
53 elif grep -q '.' "${target}/grml-live/sources/errors.log" ; then
54 echo "Unclassified problems noticed while retrieving sources:" >&2
55 cat "${target}/grml-live/sources/errors.log" >&2
64 ## END OF FILE #################################################################
65 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2