3 # Purpose: convert output of grml-live's sqlite database for use within FAI
4 # Authors: grml-team (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 ################################################################################
10 echo "Usage: $0 /path/to/grml-live.db <build-id>"
17 if ! [ -r "$DB" ] ; then
18 echo "Error: can not access database ${DB}.">&2
26 [ -n "$1" ] && exit "$1" || exit 0
29 # get information from db:
30 if ! echo "select package,version FROM packages, build WHERE build.id = $BUILD_ID AND packages.build = build.id and status = 'ii';" | sqlite3 $DB > $TMPFILE ; then
31 echo "Error retrieving values from database ${DB}." >&2
34 # make sure we god some matches:
35 if ! grep -q '^[a-zA-Z]*' "$TMPFILE" ; then
36 echo "No packages retrieved from build id $BUILD_ID - wrong id?" >&2
40 # write fai header and package information to stdout:
41 echo "# package list of build $BUILD_ID from database $DB:"
42 echo "PACKAGES aptitude"
43 awk -F\| '{print $1"="$2}' "$TMPFILE"
49 ## END OF FILE #################################################################