[Dbconfig-common-devel] dbconfig-common dbconfig-generate-include,1.7,1.8 dbconfig-generate-include.1,1.2,1.3

seanius@haydn.debian.org seanius@haydn.debian.org


Update of /cvsroot/dbconfig-common/dbconfig-common
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv11001

Modified Files:
	dbconfig-generate-include dbconfig-generate-include.1 
Log Message:
bugfixes and a couple enhancements:

  * dbconfig-common now defaults to blank passwords implying the
    admin wants a random password (this makes automatic installations
    even easier) thanks to Tobias Grimm <tobias.grimm@e-tobi.net> for
    the inspiration.
  * the admin is prompted only once if the app. password is blank.  thanks
    to tobias for the idea.
  * added dependency on pwgen for generating passwords.
  * the manpage for dbconfig-generate-include was never built into
    the binary.  d'oh!
  * character encoding fix in the changelog to make lintian happy.
  * limit mysql usernames to 16 characters long, as that's a built
    in limit.
  * the dbc_log functions now always produce output, as it's actually
    helpful to see what's going on.
  * dbconfig-generate-include has changed behavior.  -P/--dbport is now for 
    port and -m/--mode is for mode (was -P/--perms, but i can't think of
    a good name for port otherwise!).
  * forget the host/port responses if reconfigured to use a local connection.
    otherwise that causes confusion.
  * better error notification in the internal mysql code.
  * if something goes wrong in the install process, forget that we've
    seen the relevant debconf questions (so they will be asked again).




Index: dbconfig-generate-include
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dbconfig-generate-include,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dbconfig-generate-include	25 Apr 2005 02:43:23 -0000	1.7
+++ dbconfig-generate-include	28 Apr 2005 03:11:27 -0000	1.8
@@ -6,9 +6,11 @@
 dbpass_varname="dbpass"
 dbname_varname="dbname"
 dbserver_varname="dbserver"
+dbport_varname="dbport"
 dbtype_varname="dbtype"
 
-VERSION="1.6"
+# the version will always be < the package version
+VERSION="1.7"
 
 version(){
 	prog=`basename $0`
@@ -23,7 +25,7 @@
 usage(){
 	version
 	cat << EOF
-usage: $prog [-hv] [-f format] [-a] [-d [varname]] [-u [varname]] [-p [varname]] [-t [varname]] [-O owner[:group]] [-M perms] [-U] infile [outfile]
+usage: $prog [-hv] [-f format] [-a] [-d [varname]] [-u [varname]] [-p [varname]] [-s [varname]] [-P [varname]] [-t [varname]] [-O owner[:group]] [-m mode] [-U] infile [outfile]
 
 	infile            use the given dbconfig-common config file as input
 	outfile           use the given file as input (default: stdout)
@@ -31,11 +33,12 @@
 	-a|--all          include all information in output (default)
 	-d|--dbname       include the dbname in the output
 	-p|--dbpass       include the dbpass in the output
-	-s|--dbserver     include the dbserver and dbport in the output
+	-s|--dbserver     include the dbserver in the output
+	-P|--dbport       include the dbport in the output
 	-u|--dbuser       include the dbuser in the output
 	-t|--dbtype       include the dbtype in the output
 	-O|--owner        set the owner:group of the output file
-	-P|--perms        set the permissions on the output file
+	-m|--mode         set the permissions on the output file
 	-U|--ucf          register the outputfile with ucf
 	-h|--help         display this helpful message
 	-v|--version      output the version and exit
@@ -50,7 +53,7 @@
 EOF
 }
 
-TEMP=`getopt -o af:hd::p::u::s::t::O:P:Uv --long help,dbuser::,dbpass::,dbport::,dbserver::,dbtype::,output:,format:,owner:,perms:,ucf,version -n $0 -- "$@"`
+TEMP=`getopt -o af:hd::m:p::u::s::t::O:P::Uv --long help,dbuser::,dbpass::,dbport::,dbserver::,dbtype::,output:,format:,owner:,mode:,ucf,version -n $0 -- "$@"`
 
 if [ $? != 0 ] ; then usage >&2 ; exit 1 ; fi
 
@@ -90,6 +93,13 @@
 		fi
 		shift 2
 	;;
+	-P|--dbport)
+		use_dbport="yes"
+		if [ ! -z "$2" ]; then
+			dbport_varname="$2"
+		fi
+		shift 2
+	;;
 	-t|--dbtype)
 		use_dbtype="yes"
 		if [ ! -z "$2" ]; then
@@ -105,7 +115,7 @@
 		owner="$2"
 		shift 2
 	;;		
-	-P|--perms)
+	-m|--mode)
 		perms="$2"
 		shift 2
 	;;	
@@ -133,11 +143,12 @@
 done
 
 # if they asked for all vars, or didn't ask for anything (which defaults to all)
-if [ "$use_all" ] || [ ! "$use_dbuser" -a ! "$use_dbpass" -a ! "$use_dbname" -a ! "$use_dbserver" -a ! "$use_dbtype" ]; then
+if [ "$use_all" ] || [ ! "${use_dbuser}${use_dbpass}${use_dbname}${use_dbserver}${use_dbtype}${use_dbport}" ]; then
 		use_dbuser="yes"
 		use_dbpass="yes"
 		use_dbname="yes"
 		use_dbserver="yes"
+		use_dbport="yes"
 		use_dbtype="yes"
 fi
 
@@ -169,10 +180,6 @@
 	exit 1
 fi
 
-if [ "$dbc_dbport" ]; then
-	dbc_dbserver="$dbc_dbserver:$dbc_dbport"
-fi
-
 case $format in
 sh)
 	cat << EOF 
@@ -193,6 +200,7 @@
 	[ "$use_dbpass" ] && echo "$dbpass_varname='$dbc_dbpass'"
 	[ "$use_dbname" ] && echo "$dbname_varname='$dbc_dbname'"
 	[ "$use_dbserver" ] && echo "$dbserver_varname='$dbc_dbserver'"
+	[ "$use_dbport" ] && echo "$dbport_varname='$dbc_dbport'"
 	[ "$use_dbtype" ] && echo "$dbtype_varname='$dbc_dbtype'"
 ;;
 
@@ -215,6 +223,7 @@
 	[ "$use_dbpass" ] && echo "\$$dbpass_varname='$dbc_dbpass';"
 	[ "$use_dbname" ] && echo "\$$dbname_varname='$dbc_dbname';"
 	[ "$use_dbserver" ] && echo "\$$dbserver_varname='$dbc_dbserver';"
+	[ "$use_dbport" ] && echo "\$$dbport_varname='$dbc_dbport';"
 	[ "$use_dbtype" ] && echo "\$$dbtype_varname='$dbc_dbtype';"
 	cat << EOF 
 ?>
@@ -239,6 +248,7 @@
 	[ "$use_dbpass" ] && echo "our \$$dbpass_varname='$dbc_dbpass';"
 	[ "$use_dbname" ] && echo "our \$$dbname_varname='$dbc_dbname';"
 	[ "$use_dbserver" ] && echo "our \$$dbserver_varname='$dbc_dbserver';"
+	[ "$use_dbport" ] && echo "our \$$dbport_varname='$dbc_dbport';"
 	[ "$use_dbtype" ] && echo "our \$$dbtype_varname='$dbc_dbtype';"
 	cat << EOF 
 1;
@@ -266,6 +276,7 @@
 	[ "$use_dbpass" ] && echo " #define $dbpass_varname \"$dbc_dbpass\";"
 	[ "$use_dbname" ] && echo " #define $dbname_varname \"$dbc_dbname\";"
 	[ "$use_dbserver" ] && echo " #define $dbserver_varname \"$dbc_dbserver\";"
+	[ "$use_dbport" ] && echo " #define $dbport_varname \"$dbc_dbport\";"
 	[ "$use_dbtype" ] && echo " #define $dbtype_varname \"$dbc_dbtype\";"
 	cat << EOF 
 #endif /* _DBCONFIG_COMMON_CONFIG_ */

Index: dbconfig-generate-include.1
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dbconfig-generate-include.1,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dbconfig-generate-include.1	24 Apr 2005 04:42:21 -0000	1.2
+++ dbconfig-generate-include.1	28 Apr 2005 03:11:28 -0000	1.3
@@ -3,7 +3,7 @@
 dbconfig-generate-include \- generate custom format db include files
 
 .SH SYNOPSIS
-.B dbconfig\-generate\-include [-hv] [-f format] [\-a] [\-d [varname]] [\-u [varname]] [\-p [varname]] [\-t [varname]] [\-O owner[:group]] [\-P perms] [\-U] infile [outfile]
+.B dbconfig\-generate\-include [-hv] [-f format] [\-a] [\-d [varname]] [\-u [varname]] [\-p [varname]] [\-s [varname]] [\-P [varname]] [\-t [varname]] [\-O owner[:group]] [\-m mode] [\-U] infile [outfile]
 .br
 .Xc
 
@@ -33,7 +33,10 @@
 include the dbpass in the output
 .TP
 \fB\-s\fR|\-\-dbserver
-include the dbserver and dbport in the output
+include the dbserver in the output
+.TP
+\fB\-P\fR|\-\-dbport
+include the dbport in the output
 .TP
 \fB\-u\fR|\-\-dbuser
 include the dbuser in the output
@@ -44,7 +47,7 @@
 \fB\-O\fR|\-\-owner
 set the owner:group of the output file
 .TP
-\fB\-P\fR|\-\-perms
+\fB\-m\fR|\-\-mode
 set the permissions on the output file
 .TP
 \fB\-U\fR|\-\-ucf