[Dbconfig-common-devel] dbconfig-common dbconfig-generate-include,1.3,1.4
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-serv1678
Modified Files:
dbconfig-generate-include
Log Message:
the overall featureset is now more or less complete. what's left to
do is some documentation and testing/bug hunting. then comes the
experimental upload...
Index: dbconfig-generate-include
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dbconfig-generate-include,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dbconfig-generate-include 23 Feb 2005 05:39:56 -0000 1.3
+++ dbconfig-generate-include 25 Feb 2005 05:57:03 -0000 1.4
@@ -6,8 +6,7 @@
dbpass_varname="dbpass"
dbname_varname="dbname"
dbserver_varname="dbserver"
-dbport_varname="dbport"
-dsn_varname="dsn"
+dbtype_varname="dbtype"
usage(){
prog=`basename $0`
@@ -15,17 +14,17 @@
$prog - copyright (c) 2005 sean finney <seanius@debian.org>
-usage: $prog [-h] [-f format] [-a] [-d [varname]] [-u [varname]] [-p [varname]] [-D [varname]] [-O owner[:group]] [-M perms] [-U] infile [outfile]
+usage: $prog [-h] [-f format] [-a] [-d [varname]] [-u [varname]] [-p [varname]] [-t [varname]] [-O owner[:group]] [-M perms] [-U] infile [outfile]
infile use the given dbconfig-common config file as input
outfile use the given file as input (default: stdout)
-f|--format use the given output format (default: sh)
-a|--all include all information in output (default)
-d|--dbname include the dbname in the output
- -u|--dbuser include the dbuser in the output
-p|--dbpass include the dbpass in the output
- -s|--dbserver include the dbserver in the output
- -n|--dsn include all information as a URI-like resource file
+ -s|--dbserver include the dbserver and 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
-M|--mask set the permissions on the output file
-U|--ucf register the outputfile with ucf
@@ -40,7 +39,7 @@
EOF
}
-TEMP=`getopt -o af:hd::p::u::s::O:M:U --long help,dsn::,dbuser::,dbpass::,dbport::,dbserver::,output:,format:,owner:,mask:,ucf -n $0 -- "$@"`
+TEMP=`getopt -o af:hd::p::u::s::t::O:M:U --long help,dbuser::,dbpass::,dbport::,dbserver::,dbtype::,output:,format:,owner:,mask:,ucf -n $0 -- "$@"`
if [ $? != 0 ] ; then usage >&2 ; exit 1 ; fi
@@ -50,11 +49,11 @@
case "$1" in
-a|--all)
use_all="yes"
- use_dsn="yes"
use_dbuser="yes"
use_dbpass="yes"
use_dbname="yes"
use_dbserver="yes"
+ use_dbtype="yes"
shift
;;
-d|--dbname)
@@ -64,13 +63,6 @@
fi
shift 2
;;
- -n|--dsn)
- use_dsn="yes"
- if [ ! -z "$2" ]; then
- dsn_varname="$2"
- fi
- shift 2
- ;;
-u|--dbuser)
use_dbuser="yes"
if [ ! -z "$2" ]; then
@@ -92,6 +84,13 @@
fi
shift 2
;;
+ -t|--dbtype)
+ use_dbtype="yes"
+ if [ ! -z "$2" ]; then
+ dbtype_varname="$2"
+ fi
+ shift 2
+ ;;
-f|--format)
format="$2"
shift 2
@@ -153,11 +152,8 @@
exit 1
fi
-if [ "$use_dsn" ]; then
- dbc_dsn="$dbc_dbtype://${dbc_dbuser}"
- [ "$dbc_dbpass" ] && dbc_dsn="$dbc_dsn:$dbc_dbpass"
- [ "$dbc_dbserver" ] && dbc_dsn="$dbc_dsn@$dbc_dbserver"
- dbc_dsn=$dbc_dsn/$dbc_dbname
+if [ "$dbc_dbport" ]; then
+ dbc_dbserver="$dbc_dbserver:$dbc_dbport"
fi
case $format in
@@ -168,12 +164,19 @@
## automatically generated from $inputfile
## by $0
## `date -R`
+##
+## by default this file is managed via ucf, so you shouldn't have to
+## worry about manual changes being silently discarded. *however*,
+## you'll probably also want to edit the configuration file mentioned
+## above too.
+##
+
EOF
[ "$use_dbuser" ] && echo "$dbuser_varname='$dbc_dbuser'"
[ "$use_dbpass" ] && echo "$dbpass_varname='$dbc_dbpass'"
[ "$use_dbname" ] && echo "$dbname_varname='$dbc_dbname'"
[ "$use_dbserver" ] && echo "$dbserver_varname='$dbc_dbserver'"
- [ "$use_dsn" ] && echo "$dsn_varname='$dbc_dsn'"
+ [ "$use_dbtype" ] && echo "$dbtype_varname='$dbc_dbtype'"
;;
php)
@@ -185,12 +188,17 @@
## by $0
## `date -R`
##
+## by default this file is managed via ucf, so you shouldn't have to
+## worry about manual changes being silently discarded. *however*,
+## you'll probably also want to edit the configuration file mentioned
+## above too.
+##
EOF
[ "$use_dbuser" ] && echo "\$$dbuser_varname='$dbc_dbuser';"
[ "$use_dbpass" ] && echo "\$$dbpass_varname='$dbc_dbpass';"
[ "$use_dbname" ] && echo "\$$dbname_varname='$dbc_dbname';"
[ "$use_dbserver" ] && echo "\$$dbserver_varname='$dbc_dbserver';"
- [ "$use_dsn" ] && echo "\$$dsn_varname='$dbc_dsn';"
+ [ "$use_dbtype" ] && echo "\$$dbtype_varname='$dbc_dbtype';"
cat << EOF
?>
EOF
@@ -204,12 +212,17 @@
## by $0
## `date -R`
##
+## by default this file is managed via ucf, so you shouldn't have to
+## worry about manual changes being silently discarded. *however*,
+## you'll probably also want to edit the configuration file mentioned
+## above too.
+##
EOF
[ "$use_dbuser" ] && echo "our \$$dbuser_varname='$dbc_dbuser';"
[ "$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_dsn" ] && echo "our \$$dsn_varname='$dbc_dsn';"
+ [ "$use_dbtype" ] && echo "our \$$dbtype_varname='$dbc_dbtype';"
cat << EOF
1;
EOF
@@ -222,6 +235,12 @@
* automatically generated from $inputfile
* by $0
* `date -R`
+ *
+ * by default this file is managed via ucf, so you shouldn't have to
+ * worry about manual changes being silently discarded. *however*,
+ * you'll probably also want to edit the configuration file mentioned
+ * above too.
+ *
*/
#ifndef _DBCONFIG_COMMON_CONFIG_
#define _DBCONFIG_COMMON_CONFIG_
@@ -230,7 +249,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_dsn" ] && echo " #define $dsn_varname \"$dbc_dsn\";"
+ [ "$use_dbtype" ] && echo " #define $dbtype_varname \"$dbc_dbtype\";"
cat << EOF
#endif /* _DBCONFIG_COMMON_CONFIG_ */
EOF