[phpBB] svn: r31 - trunk/phpbb2

jeroen at wolffelaar.nl jeroen at wolffelaar.nl
Wed Feb 4 23:59:01 CET 2004


Author: jeroen
Date: 2004-02-04 23:58:29 +0100 (Wed, 04 Feb 2004)
New Revision: 31

Modified:
   trunk/phpbb2/config
   trunk/phpbb2/control
   trunk/phpbb2/postinst
   trunk/phpbb2/prerm
   trunk/phpbb2/templates
Log:
- Don't ask for rootpass if db is setup
- store whether tables are created, and with which version
- generate random password as promised
- fix quite some minor bugs


Modified: trunk/phpbb2/config
===================================================================
--- trunk/phpbb2/config	2004-02-04 17:14:30 UTC (rev 30)
+++ trunk/phpbb2/config	2004-02-04 22:58:29 UTC (rev 31)
@@ -65,7 +65,7 @@
 			db_reset phpbb2/dbserver
 			db_reset phpbb2/dbname
 			db_reset phpbb2/dbuser
-			db_reset phpbb2/dbpass
+			#db_reset phpbb2/dbpass # don't reset, otherwise we forget
 			db_reset phpbb2/httpd
 			STATE=dbrootpass
 			;;
@@ -125,12 +125,21 @@
 		else
 			STATE=init
 		fi
+		db_get phpbb2/dbpass
+		if [ -z "$RET" ]; then
+			db_set phpbb2/dbpass "`makepasswd --chars 12`"
+		fi
 		;;
 	dbrootpass)
 #		if [ -e /etc/phpbb2/config.php ]; then
 #			STATE=httpd
 #			continue
 #		fi
+		db_get phpbb2/db_created
+		if [ "$RET" = "Yes" ]; then
+			STATE=httpd
+			break
+		fi
 		db_input high phpbb2/dbrootpass || true
 		if db_go; then
 			STATE=httpd

Modified: trunk/phpbb2/control
===================================================================
--- trunk/phpbb2/control	2004-02-04 17:14:30 UTC (rev 30)
+++ trunk/phpbb2/control	2004-02-04 22:58:29 UTC (rev 31)
@@ -7,7 +7,7 @@
 
 Package: phpbb2
 Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}, wwwconfig-common, php4 (>= 4.0.6) | php4-cgi (>= 4.0.6), php4-mysql | php4-pgsql | php4-odbc, apache | httpd
+Depends: ${shlibs:Depends}, ${misc:Depends}, wwwconfig-common (>= 0.0.33), php4 (>= 4.0.6) | php4-cgi (>= 4.0.6), php4-mysql | php4-pgsql | php4-odbc, apache | httpd, makepasswd
 Suggests: apache, mysql-server
 Provides: phpbb
 Description: A fully featured and skinneable flat (non-threaded) webforum

Modified: trunk/phpbb2/postinst
===================================================================
--- trunk/phpbb2/postinst	2004-02-04 17:14:30 UTC (rev 30)
+++ trunk/phpbb2/postinst	2004-02-04 22:58:29 UTC (rev 31)
@@ -1,6 +1,6 @@
 #!/bin/bash
 # postinst script for phpbb2
-# Copyright 2004 Jeroen van Wolffelaar <jeroen at wolffelaar.nl>
+# By Jeroen van Wolffelaar <jeroen at wolffelaar.nl>
 
 set -e
 
@@ -17,6 +17,9 @@
 
 
 db_get phpbb2/detail || true
+# Just to allow breaking out of DB config:
+while true; do
+#
 if [ "$RET" != Manual ]; then
 	# walk though supported apache's, and warn if they are configured but
 	# shouldn't anymore
@@ -32,6 +35,7 @@
 				db_subst phpbb2/dbfailcreate error $(echo "$error"|head -1)
 				db_input high phpbb2/dbfailcreate || true
 				db_go || true
+				break
 			fi
 
 			dballow=localhost
@@ -45,37 +49,56 @@
 				db_subst phpbb2/dbfailcreateuser error $(echo "$error"|head -1) 
 				db_input high phpbb2/dbfailcreateuser || true
 				db_go || true
+				break
 			fi
-		elif [ "$dbms" = PostgreSQL ]; then
-			echo "Creating PostgreSQL database..."
-			. /usr/share/wwwconfig-common/pgsql-createdb.sh 
-			if [ "$status" = "error" ]; then
-				db_reset phpbb2/dbfailcreate
-				db_subst phpbb2/dbfailcreate error $(echo "$error"|head -1)
-				db_input high phpbb2/dbfailcreate || true
-				db_go || true
-			fi
+			db_set phpbb2/db_created true
+#		elif [ "$dbms" = PostgreSQL ]; then
+#			echo "Creating PostgreSQL database..."
+#			. /usr/share/wwwconfig-common/pgsql-createdb.sh 
+#			if [ "$status" = "error" ]; then
+#				db_reset phpbb2/dbfailcreate
+#				db_subst phpbb2/dbfailcreate error $(echo "$error"|head -1)
+#				db_input high phpbb2/dbfailcreate || true
+#				db_go || true
+#			fi
 		fi
 	fi
 	if [ "$dbsetup" = Populate ] || [ "$dbsetup" = Create ]; then
 		if [ "$dbms" = MySQL ]; then
-			dbadmin=root
-			dbadmpass="$dbrootpass"
-			statement='SELECT * FROM phpbb_config WHERE config_id'
+# Okay, being idempotent in creating tables and adding a few rows is extremely
+# hard thing to do. The tables is possible, but those rows? How can one
+# distinguish from not having added a row yet because of a crash, and the row
+# being intermittingly removed/edited by the user
+
+# I'll asume that either the creating/populating of tables succeeds fully or
+# it fails fully
+			dbadmin="$dbuser"
+			dbadmpass="$dbpasswd"
+			statement='SELECT * FROM phpbb_config"'
 			sqlfile=`mktemp -t phpbb2.schema.XXXXXX`
 			zcat /usr/share/doc/phpbb2/schemas/mysql_schema.sql.gz \
 				> $sqlfile
 			zcat /usr/share/doc/phpbb2/schemas/mysql_basic.sql.gz \
 				>> $sqlfile
-			echo "Creating MySQL tables..."
+			echo "Creating MySQL tables if they don't exist yet..."
 			. /usr/share/wwwconfig-common/mysql-ifnot-exec.sh
 			rm -f $sqlfile
-			if [ "$error" != "" ]; then
+			case "$status" in
+			*error)
 				db_reset phpbb2/dbfailcreatetables || true
 				db_subst phpbb2/dbfailcreatetables error $(echo "$error"|head -1)
 				db_input high phpbb2/dbfailcreatetables || true
 				db_go || true
-			fi
+				break 2
+				;;
+			nothing|exec)
+				db_set phpbb2/db_version 2.0.6c-1
+				;;
+			*)
+				echo "Unrecognized status from \
+					wwwconfig-common/mysql-ifnot-exec.sh: $status" >&2
+				exit 1
+			esac
 		elif [ "$dbms" = PostgreSQL ]; then
 			echo "PostgreSQL not supported yet" >&2
 #			dbadmin=postmaster
@@ -102,6 +125,10 @@
 	
 fi
 
+# end for allowing breaking out of DB config
+break
+done
+
 # purge database rootpassword
 db_reset phpbb2/dbrootpass
 
@@ -156,8 +183,8 @@
 
 for webserver in $webservers; do
 	websever=${webserver%,}
-	mkdir -p /etc/$webserver/conf.d
 	if [ -e /etc/$webserver/httpd.conf ] && [ ! -e /etc/$webserver/phpbb2 ]; then
-		ln -sf /etc/phpbb2/apache.conf /etc/$webserver/phpbb2
+		mkdir -p /etc/$webserver/conf.d
+		ln -sf /etc/phpbb2/apache.conf /etc/$webserver/conf.d/phpbb2
 	fi
 done

Modified: trunk/phpbb2/prerm
===================================================================
--- trunk/phpbb2/prerm	2004-02-04 17:14:30 UTC (rev 30)
+++ trunk/phpbb2/prerm	2004-02-04 22:58:29 UTC (rev 31)
@@ -16,7 +16,6 @@
 # for details, see http://www.debian.org/doc/debian-policy/ or
 # the debian-policy package
 
-
 case "$1" in
     remove|deconfigure)
 		for webserver in apache apache-ssl apache-perl apache2; do

Modified: trunk/phpbb2/templates
===================================================================
--- trunk/phpbb2/templates	2004-02-04 17:14:30 UTC (rev 30)
+++ trunk/phpbb2/templates	2004-02-04 22:58:29 UTC (rev 31)
@@ -31,19 +31,24 @@
  An existing configuration file for the database has been found as
  /etc/phpbb2/config.php
  .
- This means, that previously a database for phpbb was fully setup. Select 
- `Yes' if you want to redo this setup. No database will be destroyed,
- but the setting in /etc/phpbb2/config.php will be lost.
+ Select `Yes' if you want to redo this setup. No database will be destroyed,
+ but any customization of /etc/phpbb2/config.php will be lost.
 
 Template: phpbb2/dbms
 Type: select
-Choices: MySQL, PostgreSQL, ODBC
-Default: MySQL
+Choices: mysql, postgresql, odbc
+Default: mysql
 Description: Choose database system
  phpBB works on top of a database.
  .
  What Database Management System do you want me to use?
 
+Template: phpbb2/postgresql_warning
+Type: note
+Description: Creating database/tables for PostgeSQL not supported
+ You'll need to create a database on the PostgeSQL server yourself, and
+ install the correct tables and rows from /usr/share/doc/phpbb2/schemas
+
 Template: phpbb2/odbc_warning
 Type: note
 Description: Creating database/tables for ODBC not supported
@@ -55,7 +60,7 @@
 Choices: Create, Populate, None
 Default: Create
 Description: Want configure to create the database?
- If you haven't created a database yet, and want configure to do so,
+ If you haven't created a database with user yet, and want configure to do so,
  choose `Create'.
  .
  If you have a database, but it has no tables yet, and want configure
@@ -98,13 +103,15 @@
  .
  This password will be temporarily stored by debconf until the configuring
  phase of this install.  If you do not trust debconf to securily manage this
- password, leave this empty, and you'll be asked for it during configuring.
+ password, configuring phpbb2 will fail and you will need to dpkg-reconfigure
+ this package and choose `Manual'
 
 Template: phpbb2/dbfailcreate
 Type: note
 Description: FAILURE: Database not created
  The configuration script failed to create the phpbb database.
- Eiter run dpkg-reconfigure phpbb2, or create the database yourself.
+ Please run dpkg-reconfigure phpbb2, to try with different options,
+ possibly choose "Manual" and create the database yourself.
  .
  Error:
  ${error}
@@ -113,7 +120,8 @@
 Type: note
 Description: FAILURE: Database user not created
  The configuration script failed to create the phpbb database user.
- Eiter run dpkg-reconfigure phpbb2, or create the database user yourself.
+ Please run dpkg-reconfigure phpbb2, to try with different options,
+ possibly choose "Manual" and create the database user yourself.
  .
  Error:
  ${error}
@@ -122,17 +130,32 @@
 Type: note
 Description: FAILURE: Tables not created
  The configuration script failed to create the phpbb tables.
- Eiter run dpkg-reconfigure phpbb2, or create the tables yourself.
+ Please run dpkg-reconfigure phpbb2, to try with different options,
+ possibly choose "Manual" and create the tables yourself.
  .
  Error:
  ${error}
 
+Template: phpbb2/db_created
+Type: select
+Choices: true, false
+Default: false
+Description: [internal] Whether the DB plus user is created
+ phpbb maintainer scripts will not ask for the DB admin password
+ once the db and an accessing user is created
+
+Template: phpbb2/db_version
+Type: string
+Description: [internal] what db_version is currently setup
+ phpbb scripts will set this value to the current version, so to detect
+ whether it is needed to change database layout, and based on what.
+
 Template: phpbb2/nodbpurge
 Type: note
 Description: Database not purged
  The purge script did not drop the database for phpbb, nor the user created
  for it. You will need to do so yourself (but only if you do not want
- to loose all messages and such)
+ to loose all data and board configuration).
 
 Template: phpbb2/httpd
 Type: multiselect





More information about the phpBB-l mailing list