diff --git a/db/db-to-fai b/db/db-to-fai deleted file mode 100755 index 3cbddb94f..000000000 --- a/db/db-to-fai +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# Filename: db-to-fai -# Purpose: convert output of grml-live's sqlite database for use within FAI -# Authors: grml-team (grml.org) -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2 or any later version. -################################################################################ - -if [ -z "$2" ] ; then - echo "Usage: $0 /path/to/grml-live.db " - exit 1 -fi - -DB="$1" -BUILD_ID="$2" - -if ! [ -r "$DB" ] ; then - echo "Error: can not access database ${DB}.">&2 - bailout 1 -fi - -TMPFILE=$(mktemp) - -bailout() { - rm -f "$TMPFILE" - [ -n "$1" ] && exit "$1" || exit 0 -} - -# get information from db: -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 - echo "Error retrieving values from database ${DB}." >&2 - bailout 1 -else - # make sure we god some matches: - if ! grep -q '^[a-zA-Z]*' "$TMPFILE" ; then - echo "No packages retrieved from build id $BUILD_ID - wrong id?" >&2 - bailout 1 - fi - - # write fai header and package information to stdout: - echo "# package list of build $BUILD_ID from database $DB:" - echo "PACKAGES install" - awk -F\| '{print $1"="$2}' "$TMPFILE" -fi - -# clean exit: -bailout - -## END OF FILE ################################################################# diff --git a/db/dpkg-to-db b/db/dpkg-to-db deleted file mode 100755 index e7c6820e5..000000000 --- a/db/dpkg-to-db +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/perl -w -# Filename: dpkg-to-db -# Purpose: add grml build information into a sqlite database -# Authors: grml-team (grml.org) -# Bug-Reports: see http://grml.org/bugs/ -# License: This file is licensed under the GPL v2 or any later version. -################################################################################ -# Requires the following Debian packages (handled via grml-live-db depends): -# libdbd-sqlite3-perl libdbi-perl libtimedate-perl perl-doc sqlite3 -################################################################################ - -use strict; - -use warnings; -use Getopt::Long; -use Pod::Usage; -use DBI; -use Date::Format; - - -my ($db, $logfile, $flavour, $help, $dpkgfile); -my $rc = GetOptions ( - 'database|db=s' => \$db, - 'dpkg|d=s' => \$dpkgfile, - 'logfile|l=s' => \$logfile, - 'flavour|f=s' => \$flavour, - 'help|h' => \$help, - ); - -pod2usage(1) if $help; - -pod2usage(-message => "$0: Need a sqlite database through --database ....\n") unless $db; -pod2usage(-message => "$0: Need a logfile to insert through --database ...\n") unless $logfile; -pod2usage(-message => "$0: Need the flavour information through --flavour ...\n") unless $flavour; -pod2usage(-message => "$0: Need the dpkg file through --dpkg ...\n") unless $dpkgfile; - -open (my $fh, '<', $logfile) or die "Could not open $logfile: $!"; -open (my $dpkg_handle, '<', $dpkgfile) or die "Could not open $dpkgfile: $!"; - -my $dbh = DBI->connect("dbi:SQLite:dbname=$db","","") or die "Could not connect to database: " . $DBI::err; - -# We use foreign key - beware this needs sqlite > 3.6.19 -$dbh->do("PRAGMA foreign_keys = ON"); - -# read content of log file - please do not try this at home :) -my $log = do { local $/; <$fh> }; - -my $identifier = "$flavour-". time2str('%Y%m%d%H%M%S', time()); - -# Prepare tables if not yet present {{{ -my $create_table_build = $dbh->prepare(" -CREATE TABLE if not exists build ( id integer primary key autoincrement, -identifier varchar(30), -flavour varchar(30), -date varchar(30), -logfile blob); -") - or die "Could not create tables: " . $dbh->errstr."\n"; - -$create_table_build->execute() - or die "Can't execute SQL statement: " . $dbh->errstr."\n"; - -my $create_table_packages = $dbh->prepare(" -CREATE TABLE if not exists packages ( id integer primary key autoincrement, -package varchar(30), -status varchar(2), -version varchar(30), -build integer, -FOREIGN KEY(build) REFERENCES build(id)); -") - or die "Could not create tables: " . $dbh->errstr."\n"; - -$create_table_packages->execute() - or die "Can't execute SQL statement: " . $dbh->errstr."\n"; -# }}} - - -# Write information to database {{{ -my $sth = $dbh->prepare("INSERT into build ('identifier','flavour','date','logfile') VALUES (?,?,?,?)") - or die "Could not prepare db statement: " . $dbh->errstr; - -# Execute the query -$sth->execute($identifier, $flavour, time(), $log) - or die "Could not add build to db: " . $sth->errstr; - -$sth = $dbh->prepare("SELECT id from build where identifier = ?"); -$sth->execute($identifier) or die "Couldn't execute statement: " . $sth->errstr; -my $row = $sth->fetch; -my $id = $row->[0]; - -die "No id?" unless $id; - -$sth = $dbh->prepare("INSERT into packages (package, status, version, build) VALUES (?,?,?,?)") - or die "Could not prepare db statement: " . $dbh->errstr; - -while (my $line = <$dpkg_handle>) { - next unless $line =~ /^[a-z]{2} /; - # remove new lines - my ($status, $package, $version, $desc) = split (/\s+/, $line, 4); - $sth->execute($package, $status, $version, $id) - or die "Couldn't execute statement: " . $sth->errstr; - -} -# }}} - -print "recorded buildinformation with identifier $identifier as id $id\n"; - -# perldoc -F ./dpkg-to-db - -__END__ - -=head1 dpkg-to-db - -dpkg-to-db - add grml build information into a sqlite database - -=head1 SYNOPSIS - -dpkg-to-db - -=head1 OPTIONS - -=over 8 - -=item B<--help> - -Print a brief help message and exits. - -=item B<--database > - -Database file. - -=item B<--dpkg > - -`dpkg --list` output file of grml-live build. - -=item B<--logfile > - -Logfile which should be added. - -=item B<--flavour > - -Name of the grml-flavour the build is. - -=back - -=head1 DESCRIPTION - -B will read the given input file(s) and stores the -information to the specified database. - -=head1 USAGE EXAMPLES - -Please see B for further information. - -=cut diff --git a/debian/control b/debian/control index ef465266c..b4e10c4f5 100644 --- a/debian/control +++ b/debian/control @@ -34,7 +34,6 @@ Depends: xorriso, ${misc:Depends}, Recommends: - grml-live-db, grub-pc-bin, imagemagick, ipxe, @@ -47,20 +46,3 @@ Description: build system for creating a Grml (based) Linux live system This package provides the build system for creating a Debian / Grml based Linux live system (also known as live cd). It is based on the FAI (Fully Automatic Installation) framework. - -Package: grml-live-db -Architecture: all -Depends: - grml-live, - libdbd-sqlite3-perl, - libdbi-perl, - libtimedate-perl, - sqlite3, - ${misc:Depends}, -Recommends: - perl-doc, -Description: log package build information of grml-live to database - This package provides a database layer for storing build - information about grml-live builds in a sqlite3 database. - More details are available in the provided grml-live-db manpage - and /usr/share/doc/grml-live-db/grml-live-db.html diff --git a/debian/grml-live-db.doc-base b/debian/grml-live-db.doc-base deleted file mode 100644 index 2eab61882..000000000 --- a/debian/grml-live-db.doc-base +++ /dev/null @@ -1,10 +0,0 @@ -Document: grml-live-db -Title: Documentation for the database wrapper of grml-live -Author: Michael Prokop -Abstract: grml-live-db provides a database layer for storing build - information about grml-live builds in a sqlite3 database. -Section: Debian - -Format: HTML -Index: /usr/share/doc/grml-live-db/grml-live-db.html -Files: /usr/share/doc/grml-live-db/grml-live-db.html diff --git a/debian/grml-live-db.docs b/debian/grml-live-db.docs deleted file mode 100644 index 1443038a8..000000000 --- a/debian/grml-live-db.docs +++ /dev/null @@ -1 +0,0 @@ -docs/grml-live-db.html diff --git a/debian/grml-live-db.install b/debian/grml-live-db.install deleted file mode 100644 index 7631f556e..000000000 --- a/debian/grml-live-db.install +++ /dev/null @@ -1,2 +0,0 @@ -db/db-to-fai usr/share/grml-live-db/scripts/ -db/dpkg-to-db usr/share/grml-live-db/scripts/ diff --git a/debian/grml-live-db.lintian-overrides b/debian/grml-live-db.lintian-overrides deleted file mode 100644 index 0c19f9e6a..000000000 --- a/debian/grml-live-db.lintian-overrides +++ /dev/null @@ -1,2 +0,0 @@ -grml-live-db: unknown-section grml -grml-live-db: bugs-field-does-not-refer-to-debian-infrastructure mailto:bugs@grml.org diff --git a/debian/grml-live-db.manpages b/debian/grml-live-db.manpages deleted file mode 100644 index 1be5958f4..000000000 --- a/debian/grml-live-db.manpages +++ /dev/null @@ -1 +0,0 @@ -docs/grml-live-db.8 diff --git a/debian/rules b/debian/rules index ac278d382..21f958e50 100755 --- a/debian/rules +++ b/debian/rules @@ -25,7 +25,6 @@ override_dh_install: dh_install etc/zsh/completion.d/_grml-live usr/share/zsh/vendor-completions override_dh_clean: - rm -f docs/grml-live-db.8 docs/grml-live-db.html docs/grml-live-db.xml rm -f docs/grml-live-remaster.8 docs/grml-live-remaster.html docs/grml-live-remaster.xml rm -f docs/grml-live.8 docs/grml-live.html docs/grml-live.xml rm -f docs/html-stamp docs/man-stamp diff --git a/docs/Makefile b/docs/Makefile index 47f514ae1..42bd4bd2e 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -11,10 +11,9 @@ icons: cp /usr/share/asciidoc/icons/note.png images/icons/ cp /usr/share/asciidoc/icons/tip.png images/icons/ -html-stamp: grml-live.txt grml-live-remaster.txt grml-live-db.txt +html-stamp: grml-live.txt grml-live-remaster.txt asciidoc -b xhtml11 -a icons -a toc -a numbered grml-live.txt asciidoc -b xhtml11 -a icons grml-live-remaster.txt - asciidoc -b xhtml11 -a icons grml-live-db.txt touch html-stamp doc_man: man-stamp @@ -24,8 +23,6 @@ man-stamp: grml-live.txt grml-live-remaster.txt xsltproc --novalid /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl grml-live.xml asciidoc -d manpage -b docbook grml-live-remaster.txt xsltproc --novalid /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl grml-live-remaster.xml - asciidoc -d manpage -b docbook grml-live-db.txt - xsltproc --novalid /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl grml-live-db.xml touch man-stamp doc_epub: epub-stamp @@ -52,5 +49,4 @@ clean: rm -rf images/icons rm -f grml-live-remaster.html grml-live-remaster.xml grml-live-remaster.8 rm -f grml-live.html grml-live.xml grml-live.8 grml-live.epub grml-live.pdf - rm -f grml-live-db.html grml-live-db.xml grml-live-db.8 rm -f html-stamp man-stamp epub-stamp pdf-stamp diff --git a/docs/grml-live-db.txt b/docs/grml-live-db.txt deleted file mode 100644 index 88c6bfca8..000000000 --- a/docs/grml-live-db.txt +++ /dev/null @@ -1,107 +0,0 @@ -grml-live-db(8) -=============== - -Name ----- -grml-live-db - log package build information of grml-live to database - -Synopsis --------- -dpkg-to-db [ options ] || db-to-fai /path/to/grml-live.db - -Introduction ------------- - -The grml-live-db Debian package provides a simple way to put build information -of grml-live into a database. By default you have to do nothing but install -grml-live-db and during each invocation of grml-live you'll get an additional -entry in the sqlite3 database /var/log/grml-live.db. If you want to customize -the database logging check out the following sections in this manpage. - -Provided scripts ----------------- - -/usr/share/grml-live-db/scripts/dpkg-to-db adds grml-live build information -(output of 'dpkg --list') and a logfile into a sqlite3 database. This script is -used by default if grml-live-db is installed (no configuration needed by -default). - -/usr/share/grml-live-db/scripts/db-to-fai converts output of grml-live's sqlite -database for use within FAI. This script is useful if you want to reproduce a -certain build with specific package versions. Please note that you need the -according Debian mirrors providing all the specific package versions of course. - -Options -------- - -dpkg-to-db supports the following options (and all except for --help -are mandatory!): - - --help - -Print help message and exit. - - --database - -Use specified database file. - - --dpkg - -Use specified dpkgfile as `dpkg --list` output file of grml-live build. - - --logfile - -Logfile thath should be added to the database entry. - - --flavour - -Name of the grml-live flavour that was being built. - -The db-to-fai script does not support any options but needs to be invoked with -path to the grml-live database and the build id. - -Configuration and using custom database wrapper scripts -------------------------------------------------------- - -The following configuration variables are available and can be adjusted: - - DPKG_DATABASE=/var/log/grml-live.db - -Path to the database file that should be used for storing the build information. -This database is used within dpkg-to-db by default. - - DPKG_DBSCRIPT=/usr/share/grml-live-db/scripts/dpkg-to-db - -The database wrapper script that's used for storing the build information. -If you do not want to log to the sqlite3 database but instead use your own -abstraction layer just point this variable to your favourite script. - - DPKG_DBOPTIONS="--database $DPKG_DATABASE --logfile $LOGFILE --flavour $GRML_NAME --dpkg $DPKG_LIST" - -If the database script ($DPKG_DBSCRIPT) requires any command line options -specify it through this variable. - -Usage Examples --------------- - -How dpkg-to-db is being used inside grml-live: - - /usr/share/grml-live-db/scripts/dpkg-to-db --database /var/log/grml-live.db --logfile /var/log/grml-live.log --flavour $GRML_NAME --dpkg /var/log/fai/$HOSTNAME/last/dpkg.list - -Manually insert data to database: - - # /usr/share/grml-live-db/scripts/dpkg-to-db --database ./grml-live.db --logfile /tmp/logfile --flavour grml-full --dpkg ./dpkg.list - -Retrieve build information of a specific build for use within FAI: - - # /usr/share/grml-live-db/scripts/db-to-fai /var/log/grml-live.db 6 > /etc/grml/fai/config/package_config/REPRODUCE - -Describe schema of database: - - # echo '.schema' | sqlite3 /var/log/grml-live.db - -Database queries: - - # 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 - - # 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 diff --git a/etc/grml/grml-live.conf b/etc/grml/grml-live.conf index ec92d46bb..6bca4686b 100644 --- a/etc/grml/grml-live.conf +++ b/etc/grml/grml-live.conf @@ -28,19 +28,8 @@ # Do you want to preserve the logfile from being cleaned after each execution # of grml-live? By default the logfile is cleaned so the log doesn't fill up. -# If you want to store your logs permanently it's recommended to use grml-live-db. # PRESERVE_LOGFILE='1' -# If package grml-live-db is installed the package selection and grml-live.log -# are being logged to a sqlite database.Defaults to /var/log/grml-live.db -# DPKG_DATABASE=/var/log/grml-live.db - -# Use your own database wrapper script for grml-live-db: -# DPKG_DBSCRIPT=/usr/share/grml-live-db/scripts/dpkg-to-db - -# Use your own database script cmdline options for grml-live-db: -# DPKG_DBOPTIONS="-d $DPKG_DATABASE --logfile $LOGFILE --flavour $GRML_NAME < $DPKG_LIST" - # Do you want to zero / clean up / remove the previous logfiles of FAI # before executing grml-live? Otherwise keep all the logfiles inside # /var/log/fai/$HOSTNAME/... diff --git a/grml-live b/grml-live index a00ba7b1b..8eec07481 100755 --- a/grml-live +++ b/grml-live @@ -587,7 +587,7 @@ chmod 664 $LOGFILE if [ -n "$PRESERVE_LOGFILE" ] ; then echo "Preserving logfile $LOGFILE as requested via \$PRESERVE_LOGFILE" else - # make sure it is empty (as it is e.g. appended to grml-live-db) + # make sure it is empty echo -n > $LOGFILE fi @@ -1830,52 +1830,6 @@ create_netbootpackage() { create_netbootpackage # }}} -# log build information to database if grml-live-db is installed and enabled {{{ -dpkg_to_db() { -if [ -d /usr/share/grml-live-db ] ; then - - # safe defaults - DPKG_LIST="/var/log/fai/$HOSTNAME/last/dpkg.list" # the dpkg --list output of the chroot: - [ -n "$DPKG_DATABASE" ] || DPKG_DATABASE=/var/log/grml-live.db - [ -n "$DPKG_DBSCRIPT" ] || DPKG_DBSCRIPT=/usr/share/grml-live-db/scripts/dpkg-to-db - [ -n "$DPKG_DBOPTIONS" ] || DPKG_DBOPTIONS="--database $DPKG_DATABASE --logfile $LOGFILE --flavour $GRML_NAME --dpkg $DPKG_LIST" - - if ! [ -x "$DPKG_DBSCRIPT" ] ; then - log "Error: $DPKG_DBSCRIPT is not executable, can not log dpkg information." - eerror "Error: $DPKG_DBSCRIPT is not executable, can not log dpkg information." ; eend 1 - bailout 14 - fi - - # disable by default for now, not sure whether really everyone is using a local db file - #if ! touch "$DPKG_DATABASE" ; then - # eerror "Error: can not write to ${DPKG_DATABASE}, can not log dpkg information." ; eend 1 - # bailout 14 - #fi - - if ! [ -r "$DPKG_LIST" ] ; then - log "Warning: can not read $DPKG_LIST - can not provide information to $DPKG_DBSCRIPT (dirty build?)" - ewarn "Warning: can not read $DPKG_LIST - can not provide information to $DPKG_DBSCRIPT (dirty build?)" ; eend 0 - else - einfo "Logging $DPKG_LIST to database $DPKG_DATABASE" - log "Logging $DPKG_LIST to database $DPKG_DATABASE" - log "Executing $DPKG_DBSCRIPT $DPKG_DBOPTIONS" - eindent - - if DB_INFO=$("$DPKG_DBSCRIPT" $DPKG_DBOPTIONS 2>&1) ; then - einfo "$DB_INFO" - eend 0 - else - eerror "$DB_INFO" - eend 1 - fi - - eoutdent - fi - -fi -} -# }}} - # finalize {{{ if [ -n "${start_seconds}" ] ; then end_seconds="$(date +%s)" @@ -1883,8 +1837,6 @@ if [ -n "${start_seconds}" ] ; then fi log "Successfully finished execution of $PN [$(date) - running ${SECONDS} seconds]" -dpkg_to_db # make sure we catch the last log line as well, therefore execute between log + einfo - einfo "Successfully finished execution of $PN [$(date) - running ${SECONDS} seconds]" ; eend 0 bailout 0 # }}}