6886d9f531287d55fe8cf95ae9648d127ac4a335
[grml-live.git] / etc / grml / fai / config / scripts / GRMLBASE / 95-package-information
1 #!/bin/bash
2 # Filename:      /etc/grml/fai/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 HOSTNAME=''
10 [ -r /etc/grml/grml-live.conf ]  && . /etc/grml/grml-live.conf
11 [ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
12 [ -n "$HOSTNAME" ] || HOSTNAME=grml
13 PACKAGE_LOG=/var/log/fai/"$HOSTNAME"/last/
14
15 # generate the package list and store it on the ISO itself for grml-docs:
16 [ -d $target/usr/share/doc/grml-docs/packages ] || mkdir $target/usr/share/doc/grml-docs/packages
17 COLUMNS=200 $ROOTCMD dpkg --list > $target/usr/share/doc/grml-docs/packages/dpkg_list
18
19 if ! [ -w "$PACKAGE_LOG" ] ; then
20    echo "Error: can not write to ${PACKAGE_LOG}. Exiting.">&2
21    exit 1
22 else
23    # store package list for the build process logs as well:
24    COLUMNS=200 $ROOTCMD dpkg --list > "${PACKAGE_LOG}"/dpkg.list
25    COLUMNS=200 $ROOTCMD dpkg --get-selections > "${PACKAGE_LOG}"/dpkg.selections
26    # store list of packages sorted by size:
27    if [ -x $target/usr/bin/dpkg-query ] ; then
28       $ROOTCMD dpkg-query -W --showformat='${Package}\t${Installed-Size;10}\n' > \
29       "${PACKAGE_LOG}"/packages.size
30    fi
31 fi
32
33 ## END OF FILE #################################################################