Support for logging to database via grml-live-db. Changed logic of ZERO_LOGFILE to...
[grml-live.git] / docs / grml-live-db.txt
1 grml-live-db(8)
2 ===============
3
4 Name
5 ----
6 grml-live-db - log package build information of grml-live to database
7
8 Synopsis
9 --------
10 dpkg-to-db  [ options ] || db-to-fai /path/to/grml-live.db <build-id> |
11
12 Introduction
13 ------------
14
15 The grml-live-db Debian package provides a simple way to put build information
16 of grml-live into a database. By default you have to do nothing but install
17 grml-live-db and during each invocation of grml-live you'll get an additional
18 entry in the sqlite3 database /var/log/grml-live.db. If you want to customize
19 the database logging check out the following sections in this manpage.
20
21 Provided scripts
22 ----------------
23
24 /usr/share/grml-live-db/scripts/dpkg-to-db adds grml-live build information
25 (output of 'dpkg --list') and (optionally) a logfile into a sqlite3 database.
26 This script is used by default if grml-live-db is installed (no configuration
27 needed by default).
28
29 /usr/share/grml-live-db/scripts/db-to-fai converts output of grml-live's sqlite
30 database for use within FAI. This script is useful if you want to reproduce a
31 certain build with specific package versions. Please note that you need the
32 according Debian mirrors providing all the specific package versions of course.
33
34 Options
35 -------
36
37 dpkg-to-db supports the following options:
38
39   --help
40
41 Brief help message.
42
43   --db <database>
44
45 Use specified database file.
46
47   --logfile <logfile>
48
49 Logfile thath should be added to the database entry.
50
51   --flavour <flavour>
52
53 Name of the grml-live flavour that was being built.
54
55 db-to-fai does not support any options but needs to be invoked
56 with path to the grml-live database and the build id.
57
58 Configuration and using custom database wrapper scripts
59 -------------------------------------------------------
60
61 The following configuration variables are available and can be adjusted:
62
63   DPKG_DATABASE=/var/log/grml-live.db
64
65 Path to the database file that should be used for storing the build information.
66 This database is ysed within dpkg-to-db by default.
67
68   DPKG_DBSCRIPT=/usr/share/grml-live-db/scripts/dpkg-to-db
69
70 The database wrapper script that's used for storing the build information.
71 If you do not want to log to the sqlite3 database but instead use your own
72 abstraction layer just point this variable to your favourite script.
73
74   DPKG_DBOPTIONS="-d $DPKG_DATABASE --logfile $LOGFILE --flavour $GRML_NAME < $DPKG_LIST"
75
76 If the database script ($DPKG_DBSCRIPT) requires any command line options
77 specifiy it through this variable.
78
79 Usage Examples
80 --------------
81
82 How dpkg-to-db is being used inside grml-live:
83
84   /usr/share/grml-live-db/scripts/dpkg-to-db -d /var/log/grml-live.db --logfile /var/log/grml-live.log --flavour $GRML_NAME < /var/log/fai/$HOSTNAME/last/dpkg.list
85
86 Manually insert data to database:
87
88   # /usr/share/grml-live-db/scripts/dpkg-to-db -d ./grml-live.db --logfile /tmp/logfile --flavour grml-full < ./dpkg.list
89
90   # dpkg -l | ./dpkg-to-db --db ./grml-live.db --logfile /tmp/logfile --flavour grml-full
91
92 Retrieve build information of a specific build for use within FAI:
93
94   # /usr/share/grml-live-db/scripts/db-to-fai /var/log/grml-live.db 6 > /etc/grml/fai/config/package_config/REPRODUCE
95
96 Describe schema of database:
97
98   # echo '.schema' | sqlite3 /var/log/grml-live.db
99
100 Query database:
101
102   # echo 'SELECT package,version,status,build.flavour,build.identifier FROM packages, build WHERE build.identifier = "grml-full-20091213012517" AND packages.build = build.id ; ' | sqlite3 /var/log/grml-live.db
103
104   # echo 'SELECT package,version,status,build.flavour,build.identifier FROM packages, build WHERE build.id = 7 AND packages.build = build.id ; ' | sqlite3 /var/log/grml-live.db