[med-svn] r3040 - in trunk/packages/mlstdbnet/trunk/debian: . patches po template

tille at alioth.debian.org tille at alioth.debian.org
Fri Jan 23 07:30:47 UTC 2009


Author: tille
Date: 2009-01-23 07:30:47 +0000 (Fri, 23 Jan 2009)
New Revision: 3040

Added:
   trunk/packages/mlstdbnet/trunk/debian/patches/13_ident_authentication.patch
Modified:
   trunk/packages/mlstdbnet/trunk/debian/config
   trunk/packages/mlstdbnet/trunk/debian/patches/10_config_location.patch
   trunk/packages/mlstdbnet/trunk/debian/patches/10_preconf.patch
   trunk/packages/mlstdbnet/trunk/debian/patches/series
   trunk/packages/mlstdbnet/trunk/debian/po/templates.pot
   trunk/packages/mlstdbnet/trunk/debian/postinst
   trunk/packages/mlstdbnet/trunk/debian/template/mlstdbnet.xml
   trunk/packages/mlstdbnet/trunk/debian/templates
Log:
Enhanced configuration issues


Modified: trunk/packages/mlstdbnet/trunk/debian/config
===================================================================
--- trunk/packages/mlstdbnet/trunk/debian/config	2009-01-23 04:24:07 UTC (rev 3039)
+++ trunk/packages/mlstdbnet/trunk/debian/config	2009-01-23 07:30:47 UTC (rev 3040)
@@ -54,7 +54,7 @@
 	db_set ${pkg}/description "$DESCRIPTION"
     fi
     PUBLICDESCRIPTION=`grep 'description="' /etc/${pkg}/${XMLNAME}.xml | sed 's/.*description="[^"]\+">\([^<]\+\)<.*/\1/'`
-    # verify whether description is set in config file
+    # verify whether public description is set in config file
     if [ "$PUBLICDESCRIPTION" != "##PublicDescription##" -a "$PUBLICDESCRIPTION" != "" ] ; then
 	db_set ${pkg}/publicdescription "$PUBLICDESCRIPTION"
     fi
@@ -68,6 +68,19 @@
     if [ "$LOCUS" != "##Locus##" -a "$LOCUS" != "" ] ; then
 	db_set ${pkg}/locus "$LOCUS"
     fi
+    WEBROOT=`grep 'webroot="' /etc/${pkg}/${XMLNAME}.xml | sed 's/.*webroot="[^"]\+">\([^<]\+\)<.*/\1/'`
+    # verify whether webroot is set in config file
+    if [ "$WEBROOT" != "##webroot##" -a "$WEBROOT" != "" ] ; then
+	db_set ${pkg}/webroot "$WEBROOT"
+    else
+	# set database name as default webroot
+	db_set ${pkg}/webroot "/${XMLNAME}"
+    fi
+    DBPROF=`grep 'dbprof="' /etc/${pkg}/${XMLNAME}.xml | sed 's/.*dbprof="[^"]\+">\([^<]\+\)<.*/\1/'`
+    # verify whether DPPROF is set in config file
+    if [ "$DBPROF" != "##dbprofiles##" -a "$DBPROF" != "" ] ; then
+	db_set ${pkg}/dbprof "$DBPROF"
+    fi
 fi
 
 ## db_input high ${pkg}/pathogen || true
@@ -76,6 +89,11 @@
 db_input high ${pkg}/locus || true
 db_input high ${pkg}/note || true
 
+# set database name as default webroot
+db_set ${pkg}/webroot "/${XMLNAME}"
+# set database name as default dbprof
+db_set ${pkg}/dbprof "${XMLNAME}"
+
 ## Now configure a curator for the curator.pl cgi script
 ## values are stored in
 CURATORCONF=/etc/${pkg}/curator.conf

Modified: trunk/packages/mlstdbnet/trunk/debian/patches/10_config_location.patch
===================================================================
--- trunk/packages/mlstdbnet/trunk/debian/patches/10_config_location.patch	2009-01-23 04:24:07 UTC (rev 3039)
+++ trunk/packages/mlstdbnet/trunk/debian/patches/10_config_location.patch	2009-01-23 07:30:47 UTC (rev 3040)
@@ -1,3 +1,5 @@
+In Debian configuration files have to be located in /etc and not in
+the same directory as the cgi script as upstream suggests.
 --- mlstdbnet_v2.0.0.orig/cgi-bin/mlstdbnet.pl
 +++ mlstdbnet_v2.0.0/cgi-bin/mlstdbnet.pl
 @@ -29,9 +29,11 @@
@@ -46,3 +48,25 @@
  	if ($@) {
  		warn $@ if $config{'debug'};
  		$invalidXML = 1;
+--- mlstdbnet_v2.0.0.orig/cgi-bin/curate.pl
++++ mlstdbnet_v2.0.0/cgi-bin/curate.pl
+@@ -26,7 +26,7 @@
+ #E-mail: keith.jolley at medawar.ox.ac.uk
+ 
+ ###########Local configuration########################
+-local ( our $configfile = '/usr/local/mlstdbnet/mlstdbnet.conf' );
++local ( our $configfile = '/etc/mlstdbnet/mlstdbnet.conf' );
+ #######End Local configuration########################
+ use CGI;
+ use DBI;
+@@ -69,7 +69,9 @@
+ 	if ( $q->param('file') =~ /^([\w\d\-_]+\.xml)$/ ) {
+ 		$instance = $1;
+ 	}
+-	eval { $parser->parse( Source => { SystemId => $instance } ); };
++	my $xmlinstance = $instance;
++	if ( ! -e $xmlinstance ) { $xmlinstance = "/etc/mlstdbnet/$instance" ; }
++	eval { $parser->parse( Source => { SystemId => $xmlinstance } ); };
+ 	if ($@) {
+ 		$invalidXML = 1;
+ 	}

Modified: trunk/packages/mlstdbnet/trunk/debian/patches/10_preconf.patch
===================================================================
--- trunk/packages/mlstdbnet/trunk/debian/patches/10_preconf.patch	2009-01-23 04:24:07 UTC (rev 3039)
+++ trunk/packages/mlstdbnet/trunk/debian/patches/10_preconf.patch	2009-01-23 07:30:47 UTC (rev 3040)
@@ -1,3 +1,5 @@
+This patch adjust some pathes in the upstream suggestion for a 
+configuration file to the locations in Debian. 
 --- mlstdbnet_v2.0.0.orig/conf/mlstdbnet.conf
 +++ mlstdbnet_v2.0.0/conf/mlstdbnet.conf
 @@ -1,11 +1,11 @@

Added: trunk/packages/mlstdbnet/trunk/debian/patches/13_ident_authentication.patch
===================================================================
--- trunk/packages/mlstdbnet/trunk/debian/patches/13_ident_authentication.patch	                        (rev 0)
+++ trunk/packages/mlstdbnet/trunk/debian/patches/13_ident_authentication.patch	2009-01-23 07:30:47 UTC (rev 3040)
@@ -0,0 +1,52 @@
+On Debian GNU Linux systems the suggested way to authenticate to
+a PostgreSQL server on local host is ident authentication.  This
+authentication method requires that the host parameter is left out,
+i.e. if you specify the host localhost password authentication
+is automatically used.  This patch removes host and port from
+the connection string if $host == 'localhost'.
+--- mlstdbnet_v2.0.0.orig/cgi-bin/curate.pl
++++ mlstdbnet_v2.0.0/cgi-bin/curate.pl
+@@ -133,10 +133,19 @@
+ }
+ 
+ sub dbconnect {
+-	$db = DBI->connect(
++	# On Debian GNU/Linux we use ident authentication if host=localhost which
++	# needs and empty string for user and password ...
++	if ( $system{'host'} =~ /^localhost$/ ) {
++		$db = DBI->connect(
++"DBI:Pg:dbname=$system{'longcode'}",
++		'', '', { AutoCommit => 0 }
++		);
++	} else {
++		$db = DBI->connect(
+ "DBI:Pg:host=$system{'host'};port=$system{'port'};dbname=$system{'longcode'}",
+ 		"$system{'user'}", "$system{'pass'}", { AutoCommit => 0 }
+ 	);
++	}
+ }
+ 
+ sub dbdisconnect {
+--- mlstdbnet_v2.0.0.orig/cgi-bin/mlstdbnet.pl
++++ mlstdbnet_v2.0.0/cgi-bin/mlstdbnet.pl
+@@ -376,10 +376,19 @@
+ 
+ ##################DATABASE CONNECTION########################
+ sub db_connect {
+-	$db = DBI->connect(
++	# On Debian GNU/Linux we use ident authentication if host=localhost which
++	# needs and empty string for user and password ...
++	if ( $system{'host'} =~ /^localhost$/ ) {
++		$db = DBI->connect(
++"DBI:Pg:dbname=$system{'longcode'}",
++		'', '', { AutoCommit => 0 }
++		);
++	} else {
++		$db = DBI->connect(
+ "DBI:Pg:host=$system{'host'};port=$system{'port'};dbname=$system{'longcode'}",
+ 		"$system{'user'}", "$system{'pass'}", { AutoCommit => 0 }
+ 	);
++	}
+ 	$db->do("SET session CHARACTERISTICS AS TRANSACTION READ ONLY");
+ 	$db->commit();
+ 	if ( !$profiledb && !$system{'nomlst'} ) {

Modified: trunk/packages/mlstdbnet/trunk/debian/patches/series
===================================================================
--- trunk/packages/mlstdbnet/trunk/debian/patches/series	2009-01-23 04:24:07 UTC (rev 3039)
+++ trunk/packages/mlstdbnet/trunk/debian/patches/series	2009-01-23 07:30:47 UTC (rev 3040)
@@ -1,2 +1,3 @@
 10_preconf.patch
 10_config_location.patch
+13_ident_authentication.patch

Modified: trunk/packages/mlstdbnet/trunk/debian/po/templates.pot
===================================================================
--- trunk/packages/mlstdbnet/trunk/debian/po/templates.pot	2009-01-23 04:24:07 UTC (rev 3039)
+++ trunk/packages/mlstdbnet/trunk/debian/po/templates.pot	2009-01-23 07:30:47 UTC (rev 3040)
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: mlstdbnet at packages.debian.org\n"
-"POT-Creation-Date: 2009-01-20 14:54+0100\n"
+"POT-Creation-Date: 2009-01-22 17:45+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -305,3 +305,31 @@
 "mail address, but once you want to log in as curator only strings containing "
 "at least one '@' and a '.' will be accepted."
 msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:11001
+msgid "Root directory on webserver"
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:11001
+msgid ""
+"Please input the directory where the mlstdbnet CGI script should be "
+"located.  By default this is the same as the database name."
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:12001
+msgid "Database profile"
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:12001
+msgid ""
+"MlstDBNet accepts a database profile.  By default this is the same as the "
+"database name."
+msgstr ""

Modified: trunk/packages/mlstdbnet/trunk/debian/postinst
===================================================================
--- trunk/packages/mlstdbnet/trunk/debian/postinst	2009-01-23 04:24:07 UTC (rev 3039)
+++ trunk/packages/mlstdbnet/trunk/debian/postinst	2009-01-23 07:30:47 UTC (rev 3040)
@@ -34,13 +34,20 @@
 db_get ${pkg}/locus
 LOCUS=${RET}
 
+db_get ${pkg}/webroot
+WEBROOT=${RET}
 
+db_get ${pkg}/dbprof
+DBPROF=${RET}
+
 # Substitute the value ##variables## in the templates and move them
 # right into place
 XMLOUT=/etc/${pkg}/"$XMLNAME".xml
 # if no config file exists, just create one from the template
 if [ ! -e "$XMLOUT" ] ; then
     sed -e "s/##database##/${XMLNAME}/g" \
+        -e "s/##dbprofiles##/${DBPROF}/g" \
+        -e "s?##webroot##?/${DBPROF}?g" \
         -e "s/##Description##/${DESCRIPTION}/g" \
         -e "s/##PublicDescription##/${PUBLICDESCRIPTION}/g" \
         -e "s/##LocusFullName##/${LOCUSFULLNAME}/g" \
@@ -51,6 +58,8 @@
     cp -a "$XMLOUT" "$XMLOUT".old
     sed -i \
         -e "s/longcode=\"[^\"]\+\"/longcode=\"${XMLNAME}\"/g" \
+        -e "s/dbprof=\"[^\"]\+\"/dbprof=\"${DBPROF}\"/g" \
+        -e "s?webroot=\"[^\"]\+\"?webroot=\"${WEBROOT}\"?g" \
         -e "s/description=\"[^\"]\+\"/description=\"${DESCRIPTION}\"/g" \
         -e "s/\(description=\"[^\"]\+\">\)[^<]\+/\1${PUBLICDESCRIPTION}/g" \
         -e "s/<locus fullname=\"[^\"]*\">[^<]\+/<locus fullname=\"${LOCUSFULLNAME}\">${LOCUS}/" \

Modified: trunk/packages/mlstdbnet/trunk/debian/template/mlstdbnet.xml
===================================================================
--- trunk/packages/mlstdbnet/trunk/debian/template/mlstdbnet.xml	2009-01-23 04:24:07 UTC (rev 3039)
+++ trunk/packages/mlstdbnet/trunk/debian/template/mlstdbnet.xml	2009-01-23 07:30:47 UTC (rev 3040)
@@ -16,7 +16,7 @@
  webroot="##webroot##"
  indexpage=""
  dbprof="##dbprofiles##"
- profhome="/cgi-bin/mlstdbnet/mlstdbnet.pl?file=pub-##dbprofiles##.xml"
+ profhome="/cgi-bin/mlstdbnet.pl?file=pub-##dbprofiles##.xml"
  noshow="other_name,Z_number,region"
  view="isolates" dbtype="st"
  description="##Description##">##PublicDescription##</system>

Modified: trunk/packages/mlstdbnet/trunk/debian/templates
===================================================================
--- trunk/packages/mlstdbnet/trunk/debian/templates	2009-01-23 04:24:07 UTC (rev 3039)
+++ trunk/packages/mlstdbnet/trunk/debian/templates	2009-01-23 07:30:47 UTC (rev 3040)
@@ -149,3 +149,15 @@
  curator for mlstdbnet.  Please not that your input is not verified now
  for a valid e-mail address, but once you want to log in as curator
  only strings containing at least one '@' and a '.' will be accepted.
+
+Template: mlstdbnet/webroot
+Type: string
+_Description: Root directory on webserver
+ Please input the directory where the mlstdbnet CGI script should
+ be located.  By default this is the same as the database name.
+
+Template: mlstdbnet/dbprof
+Type: string
+_Description: Database profile
+ MlstDBNet accepts a database profile.  By default this is the same
+ as the database name.




More information about the debian-med-commit mailing list