[merged]
authorHeiko Schlittermann (JUMPER) <hs@schlittermann.de>
Wed, 31 Aug 2011 16:51:37 +0200
changeset 9 26608f45a5c6
parent 4 60a9d558f2a9 (current diff)
parent 8 be5b25357026 (diff)
child 10 7fc329e733c5
[merged]
--- a/.hgignore	Wed Aug 31 12:01:21 2011 +0200
+++ b/.hgignore	Wed Aug 31 16:51:37 2011 +0200
@@ -1,3 +1,4 @@
+syntax: glob
 LittleBird
 debian/files
 debian/littlebird-tc-common
@@ -13,3 +14,11 @@
 debian/littlebird-tc/usr/share/doc/littlebird-tc/README.Debian
 debian/littlebird-tc/usr/share/doc/littlebird-tc/changelog.Debian.gz
 debian/littlebird-tc/usr/share/doc/littlebird-tc/copyright
+debian/littlebird-tc-common.debhelper.log
+debian/littlebird-tc-common.postrm.debhelper
+debian/littlebird-tc-common.substvars
+debian/littlebird-tc-core.debhelper.log
+debian/littlebird-tc-core.substvars
+debian/littlebird-tc-sql.debhelper.log
+debian/littlebird-tc-sql.postrm.debhelper
+debian/littlebird-tc-sql.substvars
--- a/debian/changelog	Wed Aug 31 12:01:21 2011 +0200
+++ b/debian/changelog	Wed Aug 31 16:51:37 2011 +0200
@@ -1,38 +1,8 @@
-littlebird (2011072500-8) stable; urgency=low
-
-  * fixed db installation script 
-
- -- Heiko Schlittermann <hs@schlittermann.de>  Wed, 31 Aug 2011 11:43:35 +0200
-
-littlebird (2011072500-7) stable; urgency=low
-
-  * improved dependencies 
-
- -- Heiko Schlittermann <hs@schlittermann.de>  Tue, 30 Aug 2011 16:59:56 +0200
-
-littlebird (2011072500-6) stable; urgency=low
-
-  * new "meta" littlebird-tc
-
- -- Heiko Schlittermann <hs@schlittermann.de>  Tue, 30 Aug 2011 16:49:25 +0200
+littlebird (2011072500-13) stable; urgency=low
 
-littlebird (2011072500-5) stable; urgency=low
-
-  * provide littlebird 
-
- -- Heiko Schlittermann <hs@schlittermann.de>  Tue, 30 Aug 2011 16:29:41 +0200
-
-littlebird (2011072500-4) stable; urgency=low
+  * create the database if not already existing 
 
-  * moved to stable
-
- -- Heiko Schlittermann <hs@schlittermann.de>  Tue, 30 Aug 2011 16:22:50 +0200
-
-littlebird (2011072500-3) unstable; urgency=low
-
-  * autoupdate control file 
-
- -- Heiko Schlittermann <hs@schlittermann.de>  Tue, 30 Aug 2011 15:34:15 +0200
+ -- Heiko Schlittermann <hs@schlittermann.de>  Wed, 31 Aug 2011 16:20:13 +0200
 
 littlebird (2011072500-2) unstable; urgency=low
 
--- a/debian/littlebird-tc-common.config	Wed Aug 31 12:01:21 2011 +0200
+++ b/debian/littlebird-tc-common.config	Wed Aug 31 16:51:37 2011 +0200
@@ -1,24 +1,27 @@
 #! /bin/sh
-
-PKG=littlebird-tc-common
 set -e
-
 . /usr/share/debconf/confmodule
 db_version 2.0
 
+prefix=littlebird-tc
+
+
+# used for testing
 if test "$1" = "clear"; then
-    db_reset $PKG/db/host
-    db_reset $PKG/db/user
-    db_reset $PKG/db/pass
-    db_reset $PKG/db/name
+    db_reset $prefix/db/host
+    db_reset $prefix/db/user
+    db_reset $prefix/db/pass
+    db_reset $prefix/db/name
 fi
 
+db_settitle $prefix-common/TITLE
+
 db_beginblock
-    db_settitle $PKG/TITLE
-    db_input high $PKG/db/host
-    db_input high $PKG/db/user
-    db_input high $PKG/db/pass
-    db_input medium $PKG/db/name
+    db_input medium $prefix/db/name	|| true
+    db_input medium $prefix/db/host	|| true
+    db_input high $prefix/db/user	|| true
+    db_input high $prefix/db/pass	|| true
 db_endblock
 
 db_go || true
+
--- a/debian/littlebird-tc-common.templates	Wed Aug 31 12:01:21 2011 +0200
+++ b/debian/littlebird-tc-common.templates	Wed Aug 31 16:51:37 2011 +0200
@@ -1,25 +1,31 @@
 Template: littlebird-tc-common/TITLE
 Type: title
-Description: This is the Little Bird Trust Center Common package.
+Description: This is the littlebird trust center package.
 
-Template: littlebird-tc-common/db/host
+Template: littlebird-tc/db/host
 Type: string
 Default: localhost
-Description: The name or IP address of the MySQL server.
- Optionally you may append a port number (default port
- used is 3306), separated by a colon ":".
+Description: The name or address of the MySQL server (hostname[:port]).
+ We need to know how to connect to your database server. Please note,
+ that some mysql clients use a local UNIX socket connection if you enter
+ "localhost", but use a local TCP connection, if you enter "127.0.0.1".
+ .
+ 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-common/db/user
+Template: littlebird-tc/db/user
 Type: string
 Default: littlebird
-Description: The user to be used for the database connection.
+Description: The database user to be used for the database connection.
+ This is the user to be used for all normal operations. If this is a
+ fresh installation, we will create the account.
 
-Template: littlebird-tc-common/db/pass
+Template: littlebird-tc/db/pass
 Type: password
 Default:
 Description: The password to be used for the database connection.
 
-Template: littlebird-tc-common/db/name
+Template: littlebird-tc/db/name
 Type: string
 Default: littlebird
 Description: The name of the database we should use.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/littlebird-tc-sql.config	Wed Aug 31 16:51:37 2011 +0200
@@ -0,0 +1,30 @@
+#! /bin/sh
+set -e
+. /usr/share/debconf/confmodule
+db_version 2.0
+
+
+prefix=littlebird-tc
+myaccess_ok() { mysql -h"$1" -u"$2" -p"$3" -e ""; }
+
+
+if test "$1" = "clear"; then
+    for key in 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_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
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/littlebird-tc-sql.postinst	Wed Aug 31 16:51:37 2011 +0200
@@ -0,0 +1,72 @@
+#!/bin/sh
+# postinst script for littlebird
+#
+# see: dh_installdeb(1)
+set -e
+. /usr/share/debconf/confmodule
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+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
+
+	    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;
+EOF
+	    (	set -e
+		cd /usr/share/littlebird/tc-sql
+		./install_test_iteration_2011-06.sh \
+		    "$host" "$name" \
+		    "$adminuser" "$adminpass" \
+		    "$user" "$pass"
+	    )
+	fi
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst 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-sql.templates	Wed Aug 31 16:51:37 2011 +0200
@@ -0,0 +1,32 @@
+Template: littlebird-tc-sql/TITLE
+Type: title
+Description: This is the littlebird trust center SQL package.
+
+Template: littlebird-tc/db/adminuser
+Type: string
+Default: root
+Description: The user to be used for the *administrative* database connection.
+ Some operations during install need administrative privileges, we need
+ the name of the user who is empowered enough.
+
+Template: littlebird-tc/db/adminpass
+Type: password
+Default:
+Description: The password to be used for the *administrative* database connection.
+ Some operations during install need *administrative* privileges, we need
+ the password for the user who is empowered enough. (The password will be securly kept
+ in the debconf database.)
+
+Template: littlebird-tc/db/noadminpass
+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: 
+ .
+ dpkg-reconfigure littlebird-tc-sql
+ .
+ Sorry for the inconvenience.
+ .
+ HINT: Maybe you want to install a mysql server?