|
From: Patrick M. <mo...@us...> - 2001-09-23 21:20:03
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv22478
Modified Files:
configure configure_db
Log Message:
commandline options for configure_db
no need to modify configure_db any more
Index: configure
===================================================================
RCS file: /cvsroot/phpbt/phpbt/configure,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- configure 2001/09/16 15:12:44 1.12
+++ configure 2001/09/23 21:20:00 1.13
@@ -268,12 +268,8 @@
echo "/TBL_PREFIX/s|, '.*'|, '$DB_TBL_PREFIX'|" >> $tempfile
sed -f $tempfile config.php.bak > config.php
- # Change and run the configure_db script
- cat configure_db | sed "
- /TBL_PREFIX/s/'.*'/'$DB_TBL_PREFIX'/
- /DB_TYPE/s/'.*'/'$DB_TYPE'/
- " > configure_db
- ./configure_db
+ # run the configure_db script
+ ./configure_db -t $DB_TYPE -p $DB_TBL_PREFIX
$DIALOG --backtitle "phpBT Configuration" \
--msgbox "Your changes have been saved, and your database creation file is createdb.sql" 0 0
Index: configure_db
===================================================================
RCS file: /cvsroot/phpbt/phpbt/configure_db,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- configure_db 2001/09/22 16:55:33 1.5
+++ configure_db 2001/09/23 21:20:00 1.6
@@ -8,6 +8,12 @@
DB_TYPE='mysql'
#------------------------------------------------------------------------------
+help() {
+ echo "usage $0 -h|--help"
+ echo " $0 [-t <db-type>] [-p <table-prefix>]"
+} #end help()
+
+#------------------------------------------------------------------------------
#parameters:
# $TBL_PREFIX prefix for tablenames
# $1 filename for input
@@ -38,8 +44,33 @@
s/^#\ TEMPLATE:.*$/#/
s/^--\ TEMPLATE:.*$/--/
" > $2
-}
+} #end generate_sql()
#------------------------------------------------------------------------------
+#parse commandline arguments
+while [ $# -gt 0 ]; do
+ case $1
+ in
+ '-t')
+ if [ $# -gt 1 ]; then
+ DB_TYPE=$2
+ shift
+ fi
+ shift;;
+
+ '-p')
+ if [ $# -gt 1 ]; then
+ TBL_PREFIX=$2
+ shift
+ fi
+ shift;;
+ '-h'|'--help')
+ help
+ exit 0;;
+ esac
+done
+
+#------------------------------------------------------------------------------
+#generate SQL file
generate_sql schemas/$DB_TYPE.in createdb.sql
|