Implement -D option to set configuration directory; fai.conf: don't set variables...
[grml-live.git] / etc / grml / fai / config / scripts / GRMLBASE / 95-package-information
1 #!/bin/bash
2 # Filename:      ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/95-package-information
3 # Purpose:       store package information of chroot system
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 ################################################################################
8
9 set -u
10 set -e
11
12 HOSTNAME=''
13 [ -r /etc/grml/grml-live.conf ]  && . /etc/grml/grml-live.conf
14 [ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
15 [ -n "$HOSTNAME" ] || HOSTNAME=grml
16 PACKAGE_LOG=/var/log/fai/"$HOSTNAME"/last/
17
18 # generate the package list and store it on the ISO itself for grml-docs:
19 [ -d $target/usr/share/doc/grml-docs/packages ] || mkdir -p $target/usr/share/doc/grml-docs/packages
20 COLUMNS=200 $ROOTCMD dpkg --list > $target/usr/share/doc/grml-docs/packages/dpkg_list
21
22 if ! [ -w "$PACKAGE_LOG" ] ; then
23    echo "Error: can not write to ${PACKAGE_LOG}. Exiting.">&2
24    exit 1
25 else
26    # store package list for the build process logs as well:
27    COLUMNS=200 $ROOTCMD dpkg --list > "${PACKAGE_LOG}"/dpkg.list
28    COLUMNS=200 $ROOTCMD dpkg --get-selections > "${PACKAGE_LOG}"/dpkg.selections
29    # store list of packages sorted by size:
30    if [ -x $target/usr/bin/dpkg-query ] ; then
31       $ROOTCMD dpkg-query -W --showformat='${Package}\t${Installed-Size;10}\n' > \
32       "${PACKAGE_LOG}"/packages.size
33    fi
34 fi
35
36 ## END OF FILE #################################################################
37 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2