--- a/.hgignore Wed Aug 31 17:20:19 2011 +0200
+++ b/.hgignore Thu Sep 01 12:23:59 2011 +0200
@@ -22,3 +22,4 @@
debian/littlebird-tc-sql.debhelper.log
debian/littlebird-tc-sql.postrm.debhelper
debian/littlebird-tc-sql.substvars
+debian/littlebird-tc-core.postrm.debhelper
--- a/debian/changelog Wed Aug 31 17:20:19 2011 +0200
+++ b/debian/changelog Thu Sep 01 12:23:59 2011 +0200
@@ -1,20 +1,8 @@
-littlebird (2011072500-14) stable; urgency=low
-
- * removed the meta package, the -core just provices littlebird-tc
-
- -- Heiko Schlittermann <hs@schlittermann.de> Wed, 31 Aug 2011 17:06:17 +0200
-
-littlebird (2011072500-13) stable; urgency=low
+littlebird (2011072500-17) stable; urgency=low
- * create the database if not already existing
-
- -- Heiko Schlittermann <hs@schlittermann.de> Wed, 31 Aug 2011 16:20:13 +0200
+ * database handling seems to be better than ever before.
-littlebird (2011072500-2) unstable; urgency=low
-
- * fixed depends, fixed permissions in /srv/www/littlebird/TrustCenter/Data
-
- -- Heiko Schlittermann <hs@schlittermann.de> Tue, 30 Aug 2011 13:57:36 +0200
+ -- Heiko Schlittermann <hs@schlittermann.de> Thu, 01 Sep 2011 12:23:19 +0200
littlebird (2011072500-1) unstable; urgency=low
--- a/debian/littlebird-tc-common.config Wed Aug 31 17:20:19 2011 +0200
+++ b/debian/littlebird-tc-common.config Thu Sep 01 12:23:59 2011 +0200
@@ -1,4 +1,5 @@
#! /bin/sh
+echo "$0: $@" >&2
set -e
. /usr/share/debconf/confmodule
db_version 2.0
--- a/debian/littlebird-tc-common.templates Wed Aug 31 17:20:19 2011 +0200
+++ b/debian/littlebird-tc-common.templates Thu Sep 01 12:23:59 2011 +0200
@@ -13,6 +13,11 @@
You may append (separeted by a colon (":")) a port number, if your
server does not listen on the default (currently 3306) port.
+Template: littlebird-tc/db/name
+Type: string
+Default: littlebird
+Description: The name of the database we should use.
+
Template: littlebird-tc/db/user
Type: string
Default: littlebird
@@ -24,9 +29,3 @@
Type: password
Default:
Description: The password to be used for the database connection.
-
-Template: littlebird-tc/db/name
-Type: string
-Default: littlebird
-Description: The name of the database we should use.
-
--- a/debian/littlebird-tc-core.postinst Wed Aug 31 17:20:19 2011 +0200
+++ b/debian/littlebird-tc-core.postinst Thu Sep 01 12:23:59 2011 +0200
@@ -1,4 +1,5 @@
#!/bin/sh
+echo "$0: $@" >&2
# postinst script for littlebird
#
# see: dh_installdeb(1)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/littlebird-tc-core.postrm Thu Sep 01 12:23:59 2011 +0200
@@ -0,0 +1,46 @@
+#!/bin/sh
+# postrm script for littlebird
+#
+# see: dh_installdeb(1)
+
+set -e
+. /usr/share/debconf/confmodule
+
+# summary of how this script can be called:
+# * <postrm> `remove'
+# * <postrm> `purge'
+# * <old-postrm> `upgrade' <new-version>
+# * <new-postrm> `failed-upgrade' <old-version>
+# * <new-postrm> `abort-install'
+# * <new-postrm> `abort-install' <old-version>
+# * <new-postrm> `abort-upgrade' <old-version>
+# * <disappearer's-postrm> `disappear' <overwriter>
+# <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+
+ case "$1" in
+ purge|remove)
+ db_subst littlebird-tc/removal action ${1%e}ing || true
+ db_input high littlebird-tc/removal || true
+ db_go || true
+ ;;
+ esac
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/littlebird-tc-core.templates Thu Sep 01 12:23:59 2011 +0200
@@ -0,0 +1,9 @@
+Template: littlebird-tc/removal
+Type: note
+Description: The database needs to be cleaned!?
+ You are ${action} the littlebird trustcenter,
+ however we do not purge/empty/clean the database.
+ .
+ Please think about it, if you need to remove ANY traces,
+ you should consider dropping the database. Contact your friendly
+ database admin for doing it :-)
--- a/debian/littlebird-tc-sql.config Wed Aug 31 17:20:19 2011 +0200
+++ b/debian/littlebird-tc-sql.config Thu Sep 01 12:23:59 2011 +0200
@@ -1,4 +1,5 @@
#! /bin/sh
+echo "$0: $@" >&2
set -e
. /usr/share/debconf/confmodule
db_version 2.0
@@ -9,22 +10,20 @@
if test "$1" = "clear"; then
- for key in db/adminuser db/adminpass
+ for key in db/have-admin db/adminuser db/adminpass
do db_reset $prefix/$key; done
fi
db_settitle $prefix-sql/TITLE
-db_beginblock
- db_input medium $prefix/db/adminuser || true
- db_input critical $prefix/db/adminpass || true
-db_endblock
-
+db_input critical $prefix/db/have-admin || true
db_go || true
-db_get $prefix/db/adminpass || true
-if test -z "$RET" ; then
- db_fset $prefix/db/noadminpass seen false
- db_input critical $prefix/db/noadminpass || true
- db_go || true
- exit 1
+db_get $prefix/db/have-admin
+if test "$RET" = "true"; then
+ db_beginblock
+ db_input medium $prefix/db/adminuser || true
+ db_input critical $prefix/db/adminpass || true
+ db_endblock
fi
+
+db_go || true
--- a/debian/littlebird-tc-sql.postinst Wed Aug 31 17:20:19 2011 +0200
+++ b/debian/littlebird-tc-sql.postinst Thu Sep 01 12:23:59 2011 +0200
@@ -1,4 +1,5 @@
#!/bin/sh
+echo "$0: $@" >&2
# postinst script for littlebird
#
# see: dh_installdeb(1)
@@ -17,41 +18,52 @@
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
+_mysql() { mysql -h"$host" -u"$adminuser" -p"$adminpass" "$@"; }
+
case "$1" in
configure)
- db_get littlebird-tc/db/adminuser && adminuser="$RET" || true
- db_get littlebird-tc/db/adminpass && adminpass="$RET" || true
- db_get littlebird-tc/db/user && user="$RET" || true
- db_get littlebird-tc/db/pass && pass="$RET" || true
- db_get littlebird-tc/db/host && host="$RET" || true
- db_get littlebird-tc/db/name && name="$RET" || true
-# cat <<EOF
-#$@
-#adminuser/pass: $adminuser/$adminpass
-#user/pass: $user/$pass
-#db@host: $name@$host
-#EOF
- # only init the db if there is no previous version
- if test -z "$2" && test -n "$adminpass"; then
+ # only if we have admin access to the database
+ db_get littlebird-tc/db/have-admin || true
+ if test "$RET" = "true"; then
+ db_get littlebird-tc/db/adminuser && adminuser="$RET" || true
+ db_get littlebird-tc/db/adminpass && adminpass="$RET" || true
+ db_get littlebird-tc/db/host && host="$RET" || true
+ db_get littlebird-tc/db/name && name="$RET" || true
+
+ # check admin access
+ _mysql -e "" mysql || {
+ echo "Access to mysql database failed!" >&2
+ exit 1
+ }
- if test "$host" = "localhost"; then client="localhost"
- else client="%"
- fi
+ if _mysql -e "" "$name" 2>/dev/null; then
+ db_subst littlebird-tc/db/exists name "$name" || true
+ db_input medium littlebird-tc/db/exists || true
+ db_go || true
+ else
+ # ok, setup the database
+
+ db_get littlebird-tc/db/user && user="$RET" || true
+ db_get littlebird-tc/db/pass && pass="$RET" || true
+ if test "$host" = "localhost"; then client="localhost"
+ else client="%"
+ fi
- mysql -h"$host" -u"$adminuser" -p"$adminpass" <<EOF
- CREATE DATABASE IF NOT EXISTS $name;
- GRANT ALL ON $name.* TO '$user'@'$client' IDENTIFIED BY '$pass';
- FLUSH PRIVILEGES;
+ # create or update the user
+
+ _mysql <<EOF
+ CREATE DATABASE $name;
+ GRANT ALL ON $name.* TO '$user'@'$client' IDENTIFIED BY '$pass';
+ FLUSH PRIVILEGES;
EOF
- ( set -e
- cd /usr/share/littlebird/tc-sql
- ./install_test_iteration_2011-06.sh \
- "$host" "$name" \
- "$adminuser" "$adminpass" \
- "$user" "$pass"
- )
+
+ /usr/share/littlebird/tc-sql/install_test_iteration_2011-06.sh \
+ --host "$host" --db "$name" \
+ --adminuser "$adminuser" --adminpass "$adminpass" \
+ --user "$user" --pass "$pass"
+ fi
fi
;;
--- a/debian/littlebird-tc-sql.templates Wed Aug 31 17:20:19 2011 +0200
+++ b/debian/littlebird-tc-sql.templates Thu Sep 01 12:23:59 2011 +0200
@@ -2,6 +2,18 @@
Type: title
Description: This is the littlebird trust center SQL package.
+Template: littlebird-tc/db/have-admin
+Type: boolean
+Default: yes
+Description: Do you have the data to access your database server as admin?
+ During the package configuration (postinst) we need to connect
+ to your database server and setup the littlebird schema, install
+ a littlebird user etcpp. If you can provide us the data to access
+ this server, please answer "yes", if not,
+ please answer "no" and return later and run
+ .
+ dpkg-reconfigure littlebird-tc-sql
+
Template: littlebird-tc/db/adminuser
Type: string
Default: root
@@ -17,16 +29,10 @@
the password for the user who is empowered enough. (The password will be securly kept
in the debconf database.)
-Template: littlebird-tc/db/noadminpass
+Template: littlebird-tc/db/exists
Type: note
-Description: No password given!
- You didn't tell us a admin password for accessing the database. Since
- we refuse to use any database without any password, you're left
- alone with an unconfigured package. Please, later, run the following
- command:
+Description: The database "${name}" exists already.
+ Since the database "${name}" seems to exist already, we will not
+ start any attempt to do anything.
.
- dpkg-reconfigure littlebird-tc-sql
- .
- Sorry for the inconvenience.
- .
- HINT: Maybe you want to install a mysql server?
+ Sorry, if this is not what you expected.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/littlebird-tc.prerm Thu Sep 01 12:23:59 2011 +0200
@@ -0,0 +1,44 @@
+#!/bin/sh
+# prerm script for littlebird
+#
+# see: dh_installdeb(1)
+. /usr/share/debconf/confmodule
+
+set -e
+
+# summary of how this script can be called:
+# * <prerm> `remove'
+# * <old-prerm> `upgrade' <new-version>
+# * <new-prerm> `failed-upgrade' <old-version>
+# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+# * <deconfigured's-prerm> `deconfigure' `in-favour'
+# <package-being-installed> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ remove)
+ db_input littlebird-tc/remove || true
+ db_go || true
+ ;;
+
+ upgrade|deconfigure)
+ ;;
+
+ failed-upgrade)
+ ;;
+
+ *)
+ echo "prerm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/patches/debian-changes-2011072500-14 Thu Sep 01 12:23:59 2011 +0200
@@ -0,0 +1,111 @@
+Description: Upstream changes introduced in version 2011072500-14
+ This patch has been created by dpkg-source during the package build.
+ Here's the last changelog entry, hopefully it gives details on why
+ those changes were made:
+ .
+ littlebird (2011072500-14) stable; urgency=low
+ .
+ * removed the meta package, the -core just provices littlebird-tc
+ .
+ The person named in the Author field signed this changelog entry.
+Author: Heiko Schlittermann <hs@schlittermann.de>
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: <vendor|upstream|other>, <url of original patch>
+Bug: <url in upstream bugtracker>
+Bug-Debian: http://bugs.debian.org/<bugnumber>
+Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: <YYYY-MM-DD>
+
+--- littlebird-2011072500.orig/LittleBird/encoded/LittleBird-Test/Database/install_test_iteration_2011-06.sh
++++ littlebird-2011072500/LittleBird/encoded/LittleBird-Test/Database/install_test_iteration_2011-06.sh
+@@ -2,30 +2,67 @@
+ # leichte Anpassungen durch hs@schlittermann.de
+ # Aufruf wie immer, dann werden die bisherigen Angaben *root* und das bisherige
+ # Passwort verwendet. Oder
+-# install_test_iteration_2011-06.sh DB_HOST DB_NAME DB_ADMIN DB_ADMINPASS DB_USER DB_USERPASS
++# install_test_iteration_2011-06.sh DB_HOST DB_NAME DB_ADMINUSER DB_ADMINPASS DB_USER DB_PASS
+
+ # ACHTUNG: DIE DATENBANK WIRD KOMPLETT GEERDET!
+
+ #DB Update Dev - Test,
+ #Iteration Mai, Juni
+
+-#Test Stand vor der Iteration
+-DB_HOST=${1-localhost}; shift
+-DB_NAME=${1-trustcenter_history_test}; shift
+-
+-DB_ADMIN=${1-root}; shift
+-DB_ADMINPASS=${1-Pa55w0rd}; shift
++fix_db_name() { sed "s/trustcenter_history_test/$DB_NAME/g"; }
++mysql() { fix_db_name | command mysql "$@" -h"$DB_HOST" -D"$DB_NAME" --default-character-set=utf8; }
++mysql_as_admin() { echo "as admin: $1"; <"$DIR/$1" mysql -u "$DB_ADMINUSER" -p"$DB_ADMINPASS"; }
++mysql_as_user() { echo "as user: $1"; <"$DIR/$1" mysql -u "$DB_USER" -p"$DB_PASS"; }
+
+-DB_USER=${1-$DB_ADMIN}; shift
+-DB_USERPASS=${1-$DB_ADMINPASS}; shift
++#Test Stand vor der Iteration
++DIR=$(dirname $0)
++DB_HOST=localhost
++DB_NAME=trustcenter_history_test
++DB_ADMINUSER=root
++DB_ADMINPASS=Pa55w0rd
++DB_USER="$DB_ADMINUSER"
++DB_PASS="$DB_ADMINPASS"
++REPLACING=
++
++tmp=$(getopt --name $0 --options "" \
++ --long help,replacing:,host:,db:,adminuser:,adminpass:,user:,pass: \
++ -- "$@") || exit 2
++eval set -- "$tmp"
++echo "$@"
++while true; do
++ opt="$1"; shift
++ case "$opt" in
++ --replacing) REPLACING="$1"; shift;;
++ --adminuser) DB_ADMINUSER="$1"; shift;;
++ --adminpass) DB_ADMINPASS="$1"; shift;;
++ --user) DB_USER="$1"; shift;;
++ --pass) DB_PASS="$1"; shift;;
++ --host) DB_HOST="$1"; shift;;
++ --db) DB_NAME="$1"; shift;;
++ --help) cat <<_HELP
++Usage: $0 [options]
++ Options are
++ --host=s The address of the database host ($DB_HOST).
++ --db=s The name of the database to be used ($DB_NAME).
++ --adminuser=s The name of the SUPER user on the db server ($DB_ADMINUSER).
++ --adminpass=s The password for the user above ($DB_ADMINPASS).
++ --user=s The name of the user for NORMAL db operations ($DB_USER).
++ --pass=s The password for the user above ($DB_PASS).
++ --replacing=s The version of the package being replaced ($REPLACING).
++_HELP
++ exit;;
++ *) echo "$0: bad usage" >&2; exit 2;;
++ esac
++done
++
++# for v in ${!DB_*}; do echo $v ${!v}; done
++
++if test -n "$REPLACING"; then
++ echo "This is an update, I'll do noting!" >&2
++ exit 0
++fi
+
+-#echo "$DB_ADMIN $DB_ADMINPASS $DB_NAME"
+-#echo "$DB_USER $DB_USERPASS $DB_NAME"
+-
+-fix_db_name() { sed "s/trustcenter_history_test/$DB_NAME/g"; }
+-mysql() { fix_db_name | command mysql "$@" -h"$DB_HOST" -D"$DB_NAME" --default-character-set=utf8; }
+-mysql_as_admin() { echo "as admin: $1"; <"$1" mysql -u "$DB_ADMIN" -p"$DB_ADMINPASS"; }
+-mysql_as_user() { echo "as user: $1"; <"$1" mysql -u "$DB_USER" -p"$DB_USERPASS"; }
++# The filenames here get the name of the scripts directory prepended!
+
+ mysql_as_admin install_dev_tc_2011-04-30_023.sql
+ mysql_as_admin update_install_dev_tc_2011-04-30_023.sql
--- a/debian/patches/series Wed Aug 31 17:20:19 2011 +0200
+++ b/debian/patches/series Thu Sep 01 12:23:59 2011 +0200
@@ -1,1 +1,2 @@
debian-changes-2011072500-8
+debian-changes-2011072500-14