aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Andrews <will@FreeBSD.org>2001-03-10 20:32:33 +0000
committerWill Andrews <will@FreeBSD.org>2001-03-10 20:32:33 +0000
commitcca71f50d225f7829cd5f1539338fa678225bd91 (patch)
treeefa61cf749d57bdf40c5cb6e2fd2dd93fbcb7020
parent7b27d09705c2d09a78a107a04ce8d384d51536ab (diff)
downloadports-cca71f50d225f7829cd5f1539338fa678225bd91.tar.gz
ports-cca71f50d225f7829cd5f1539338fa678225bd91.zip
Notes
-rw-r--r--databases/Makefile1
-rw-r--r--databases/firebird-client/Makefile63
-rw-r--r--databases/firebird-client/distinfo3
-rw-r--r--databases/firebird-client/files/RELNOTES78
-rw-r--r--databases/firebird-client/files/patch-aa11
-rw-r--r--databases/firebird-client/files/patch-ab11
-rw-r--r--databases/firebird-client/files/patch-ac58
-rw-r--r--databases/firebird-client/pkg-comment1
-rw-r--r--databases/firebird-client/pkg-descr22
-rw-r--r--databases/firebird-client/pkg-install145
-rw-r--r--databases/firebird-client/pkg-message19
-rw-r--r--databases/firebird-client/pkg-plist104
-rw-r--r--databases/firebird-client/scripts/addservice9
-rw-r--r--databases/firebird-client/scripts/createuser50
-rw-r--r--databases/firebird-client/scripts/post-install76
-rw-r--r--databases/firebird-client/scripts/pre-build15
-rw-r--r--databases/firebird-client/scripts/pre-install20
-rw-r--r--databases/firebird-client/scripts/rmservice8
-rw-r--r--databases/firebird-devel/Makefile63
-rw-r--r--databases/firebird-devel/distinfo3
-rw-r--r--databases/firebird-devel/files/RELNOTES78
-rw-r--r--databases/firebird-devel/files/patch-aa11
-rw-r--r--databases/firebird-devel/files/patch-ab11
-rw-r--r--databases/firebird-devel/files/patch-ac58
-rw-r--r--databases/firebird-devel/pkg-comment1
-rw-r--r--databases/firebird-devel/pkg-descr22
-rw-r--r--databases/firebird-devel/pkg-install145
-rw-r--r--databases/firebird-devel/pkg-message19
-rw-r--r--databases/firebird-devel/pkg-plist104
-rw-r--r--databases/firebird-devel/scripts/addservice9
-rw-r--r--databases/firebird-devel/scripts/createuser50
-rw-r--r--databases/firebird-devel/scripts/post-install76
-rw-r--r--databases/firebird-devel/scripts/pre-build15
-rw-r--r--databases/firebird-devel/scripts/pre-install20
-rw-r--r--databases/firebird-devel/scripts/rmservice8
-rw-r--r--databases/firebird-server/Makefile63
-rw-r--r--databases/firebird-server/distinfo3
-rw-r--r--databases/firebird-server/files/RELNOTES78
-rw-r--r--databases/firebird-server/files/patch-aa11
-rw-r--r--databases/firebird-server/files/patch-ab11
-rw-r--r--databases/firebird-server/files/patch-ac58
-rw-r--r--databases/firebird-server/pkg-comment1
-rw-r--r--databases/firebird-server/pkg-descr22
-rw-r--r--databases/firebird-server/pkg-install145
-rw-r--r--databases/firebird-server/pkg-message19
-rw-r--r--databases/firebird-server/pkg-plist104
-rw-r--r--databases/firebird-server/scripts/addservice9
-rw-r--r--databases/firebird-server/scripts/createuser50
-rw-r--r--databases/firebird-server/scripts/post-install76
-rw-r--r--databases/firebird-server/scripts/pre-build15
-rw-r--r--databases/firebird-server/scripts/pre-install20
-rw-r--r--databases/firebird-server/scripts/rmservice8
-rw-r--r--databases/firebird/Makefile63
-rw-r--r--databases/firebird/distinfo3
-rw-r--r--databases/firebird/files/RELNOTES78
-rw-r--r--databases/firebird/files/patch-aa11
-rw-r--r--databases/firebird/files/patch-ab11
-rw-r--r--databases/firebird/files/patch-ac58
-rw-r--r--databases/firebird/pkg-comment1
-rw-r--r--databases/firebird/pkg-descr22
-rw-r--r--databases/firebird/pkg-install145
-rw-r--r--databases/firebird/pkg-message19
-rw-r--r--databases/firebird/pkg-plist104
-rw-r--r--databases/firebird/scripts/addservice9
-rw-r--r--databases/firebird/scripts/createuser50
-rw-r--r--databases/firebird/scripts/post-install76
-rw-r--r--databases/firebird/scripts/pre-build15
-rw-r--r--databases/firebird/scripts/pre-install20
-rw-r--r--databases/firebird/scripts/rmservice8
-rw-r--r--databases/firebird2-server/Makefile63
-rw-r--r--databases/firebird2-server/distinfo3
-rw-r--r--databases/firebird2-server/files/RELNOTES78
-rw-r--r--databases/firebird2-server/files/patch-aa11
-rw-r--r--databases/firebird2-server/files/patch-ab11
-rw-r--r--databases/firebird2-server/files/patch-ac58
-rw-r--r--databases/firebird2-server/pkg-comment1
-rw-r--r--databases/firebird2-server/pkg-descr22
-rw-r--r--databases/firebird2-server/pkg-install145
-rw-r--r--databases/firebird2-server/pkg-message19
-rw-r--r--databases/firebird2-server/pkg-plist104
-rw-r--r--databases/firebird2-server/scripts/addservice9
-rw-r--r--databases/firebird2-server/scripts/createuser50
-rw-r--r--databases/firebird2-server/scripts/post-install76
-rw-r--r--databases/firebird2-server/scripts/pre-build15
-rw-r--r--databases/firebird2-server/scripts/pre-install20
-rw-r--r--databases/firebird2-server/scripts/rmservice8
-rw-r--r--databases/firebird20-server/Makefile63
-rw-r--r--databases/firebird20-server/distinfo3
-rw-r--r--databases/firebird20-server/files/RELNOTES78
-rw-r--r--databases/firebird20-server/files/patch-aa11
-rw-r--r--databases/firebird20-server/files/patch-ab11
-rw-r--r--databases/firebird20-server/files/patch-ac58
-rw-r--r--databases/firebird20-server/pkg-comment1
-rw-r--r--databases/firebird20-server/pkg-descr22
-rw-r--r--databases/firebird20-server/pkg-install145
-rw-r--r--databases/firebird20-server/pkg-message19
-rw-r--r--databases/firebird20-server/pkg-plist104
-rw-r--r--databases/firebird20-server/scripts/addservice9
-rw-r--r--databases/firebird20-server/scripts/createuser50
-rw-r--r--databases/firebird20-server/scripts/post-install76
-rw-r--r--databases/firebird20-server/scripts/pre-build15
-rw-r--r--databases/firebird20-server/scripts/pre-install20
-rw-r--r--databases/firebird20-server/scripts/rmservice8
103 files changed, 4159 insertions, 0 deletions
diff --git a/databases/Makefile b/databases/Makefile
index 92028a76c56f..d5bd376f281f 100644
--- a/databases/Makefile
+++ b/databases/Makefile
@@ -9,6 +9,7 @@
SUBDIR += dbview
SUBDIR += edb
SUBDIR += fastdb
+ SUBDIR += firebird
SUBDIR += freetds
SUBDIR += gadfly
SUBDIR += gdbm
diff --git a/databases/firebird-client/Makefile b/databases/firebird-client/Makefile
new file mode 100644
index 000000000000..02cbff7bc2e9
--- /dev/null
+++ b/databases/firebird-client/Makefile
@@ -0,0 +1,63 @@
+# New ports collection makefile for: Firebird
+# Date created: 20 December 2000
+# Whom: Geoffrey C. Speicher <geoff@sea-incorporated.com>
+#
+# $FreeBSD$
+#
+
+PORTNAME= firebird
+PORTVERSION= 0.9
+PORTREVISION= 4
+CATEGORIES= databases
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR=firebird
+DISTFILES= firebird-boot-kit.tar.gz \
+ interbase0.9-4-v5examples.tar.gz \
+ interbase0.9-4src.tar.gz
+
+MAINTAINER= geoff@sea-incorporated.com
+
+WRKSRC= ${WRKDIR}/interbase
+INSTALLS_SHLIB= yes
+LDCONFIG_DIRS= %%PREFIX%%/firebird/lib
+
+ONLY_FOR_ARCHS= i386
+
+do-extract:
+ @${MKDIR} ${WRKDIR}
+ @( \
+ cd ${WRKDIR}; tar zxf ${DISTDIR}/interbase0.9-4src.tar.gz; \
+ cd interbase; tar zxf ${DISTDIR}/firebird-boot-kit.tar.gz; \
+ ${CP} msgs/msg.gbak misc/msg.gbak \
+ )
+
+do-configure:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ INTERBASE=${WRKDIR}/interbase/interbase; export INTERBASE; \
+ REFDBPATH=${WRKDIR}/refDatabases; export REFDBPATH; \
+ ${SH} buildBootDatabases; \
+ ${SH} setup_dirs.boot FREEBSD PROD ${WRKDIR}/refDatabases boot; \
+ )
+
+do-build:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ INTERBASE=${WRKDIR}/interbase/interbase; export INTERBASE; \
+ REFDBPATH=${WRKDIR}/refDatabases; export REFDBPATH; \
+ ${SH} boot.freebsd; \
+ )
+
+do-install:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ ${CP} -Rp interbase ${PREFIX}/firebird; \
+ ${RM} ${PREFIX}/firebird/install; \
+ ${RM} ${PREFIX}/firebird/lib/libgds.so.1.0; \
+ ${LN} -fs gds.so ${PREFIX}/firebird/lib/libgds.so.1; \
+ cd ${PREFIX}/firebird/examples; \
+ tar zxf ${DISTDIR}/interbase0.9-4-v5examples.tar.gz; \
+ ${CP} ${FILESDIR}/RELNOTES ${PREFIX}/firebird/ \
+ )
+
+.include <bsd.port.mk>
diff --git a/databases/firebird-client/distinfo b/databases/firebird-client/distinfo
new file mode 100644
index 000000000000..67c42987376e
--- /dev/null
+++ b/databases/firebird-client/distinfo
@@ -0,0 +1,3 @@
+MD5 (firebird-boot-kit.tar.gz) = 2e18d75539bc4c3d40a1a71509309f64
+MD5 (interbase0.9-4-v5examples.tar.gz) = 17cba82bbf5066d515f2dee97bf8327a
+MD5 (interbase0.9-4src.tar.gz) = d098277ed160e2b6a49d91e1fdb3a652
diff --git a/databases/firebird-client/files/RELNOTES b/databases/firebird-client/files/RELNOTES
new file mode 100644
index 000000000000..3c4e0c62ae58
--- /dev/null
+++ b/databases/firebird-client/files/RELNOTES
@@ -0,0 +1,78 @@
+Firebird 0.9_4 FreeBSD Release Notes 13-Jan-2001
+------------------------------------
+FB-T0.9.4.34 Firebird Test1
+
+Welcome to the FreeBSD Firebird port! Users should note that there
+was a package called `firebird-1.0.tgz' released in mid-August
+2000. Unfortunately, that package was released before Firebird
+version numbering conventions were established, so although the
+version number would suggest that it is newer than the current
+release, it is certainly not. Users of the August 1.0 package
+should upgrade to 0.9_4 or later, which has fixed many bugs and
+security problems, including the recently-discovered back door.
+
+ Firebird originally required a running copy of Firebird (or
+InterBase) in order to build itself. This port uses a boot kit to
+overcome that, so that it does not require itself to build.
+Unfortunately, the side effect of this is that if you have a lock
+manager running from an already-installed version of Firebird or
+InterBase, this port will not build.
+
+ Firebird is installed SUID with owner and group `firebird'.
+This does affect where you can and cannot create databases when
+connecting remotely, as well as which existing databases you can
+access. If you want a database to be available remotely, be sure
+it's readable and writeable to group firebird.
+
+ There may be times when you manage to get your system into a
+state where using any of the Firebird utilites (isql, gbak, gsec,
+etc.) gives you the message "semget failed". One surefire way to
+do this is to build and install the port. :) If this happens,
+make sure that the lock manager is not running and its semaphores
+have been removed. The former can be accomplished with 'ps ax
+|grep gds' and 'kill'; the latter with 'ipcs -s' and 'ipcrm -s'.
+
+ For example, after building and installing the port, you will
+probably go through something like this:
+
+# isql /usr/interbase/isc4.gdb
+Statement failed, SQLCODE = -902
+
+operating system directive semget failed
+-No such file or directory
+
+# ipcs -s
+Semaphores:
+T ID KEY MODE OWNER GROUP
+s 1310720 252034728 --rw-rw-rw- root wheel
+
+# ipcrm -s 1310720
+
+and you should be in business.
+
+ Once this is done, you should be able to connect normally to
+databases. Your first connection will restart the lock manager.
+
+ There may be times, however, when you still get "semget failed"
+even though the lock manager is not running and the semaphores have
+been cleaned up. There seems to be a conflict with this release
+and the PostgreSQL 7 release as installed from the ports collection.
+If you're having trouble with Firebird and you're running PostgreSQL,
+try stopping PostgreSQL:
+
+ /usr/local/etc/rc.d/pgsql.sh stop
+
+and see if that helps.
+
+ Complete documentation for InterBase(tm) is available (free of
+charge) from http://www.interbase.com/ in PDF format. While
+InterBase and Firebird are two distinct entities, all InterBase
+documentation is pertinent to Firebird. More information on Firebird
+and InterBase can be found at the following:
+
+ http://sourceforge.net/projects/firebird/
+ http://www.ibphoenix.com/
+ http://www.interbase2000.org/
+
+Geoff Speicher
+<geoff@sea-incorporated.com>
diff --git a/databases/firebird-client/files/patch-aa b/databases/firebird-client/files/patch-aa
new file mode 100644
index 000000000000..f2db9a68750d
--- /dev/null
+++ b/databases/firebird-client/files/patch-aa
@@ -0,0 +1,11 @@
+--- buildBootDatabases.orig Tue Oct 10 23:00:39 2000
++++ buildBootDatabases Tue Oct 10 23:00:46 2000
+@@ -49,7 +49,7 @@
+ DefaultAns=$2
+ echo -n "${1}"
+ Answer="$DefaultAns"
+- read Answer
++# read Answer
+ }
+
+ #--------------------------------------------------------------------
diff --git a/databases/firebird-client/files/patch-ab b/databases/firebird-client/files/patch-ab
new file mode 100644
index 000000000000..f054a4b23007
--- /dev/null
+++ b/databases/firebird-client/files/patch-ab
@@ -0,0 +1,11 @@
+--- setup_dirs.boot.orig Tue Oct 10 23:00:07 2000
++++ setup_dirs.boot Tue Oct 10 23:00:22 2000
+@@ -49,7 +49,7 @@
+ DefaultAns=$2
+ echo -n "${1}"
+ Answer="$DefaultAns"
+- read Answer
++# read Answer
+ }
+
+
diff --git a/databases/firebird-client/files/patch-ac b/databases/firebird-client/files/patch-ac
new file mode 100644
index 000000000000..bf5de43b75fb
--- /dev/null
+++ b/databases/firebird-client/files/patch-ac
@@ -0,0 +1,58 @@
+--- builds/original/prefix.freebsd 2000/10/08 15:36:25 1.2
++++ builds/original/prefix.freebsd 2001/01/11 19:17:58
+@@ -28,7 +28,7 @@
+
+
+ PROD_DEBUG_OBJECTS= nodebug.o
+-PROD_SHRLIB_DIR=
++PROD_SHRLIB_DIR= -Lsource/jrd
+ PROD_VERSION_FLAG= -DPROD_BUILD
+ PROD_CFLAGS= -O -m486 -fpic -DFLINTSTONE
+
+@@ -48,7 +48,7 @@
+ UDF_LINK_CMD= gcc
+ UDF_CFLAGS= -fPIC -mieee-fp
+ UDF_LFLAGS= -shared
+-UDF_SHRLIBS= -L/usr/local/lib -lgds -lm -lc -mieee-fp -ldescrypt
++UDF_SHRLIBS= $(SHRLIB_DIR) -lgds -lm -lc -mieee-fp -ldescrypt
+
+ #NOTE: PIC_J_CFLAGS is special CFLAGS used to build PIPD_IS_SHRLIB modules
+ # to workaround the Solaris threading problems with signals
+@@ -69,16 +69,14 @@
+ FUNCTIONS= functions.bin
+ FUNCSHR= source/interbase/lib/gdsf.so
+ GDS_LINK= $(GDSSHR_LINK)
+-#GDS_PYXIS=
+ GDS_PYXIS= gds_pyxis.a
+ GDSLIB_BACKEND= source/interbase/lib/gds_b.a
+ GDSLIB_LINK= -Lsource/jrd -lgds_b -lc -ldescrypt
+
+ GDSSHR= source/interbase/lib/gds.so
+ LINUX_GDSSHR= $(GDSSHR)
+-GDSSHR_LINK= $(SHRLIB_DIR) -L/usr/local/lib -lgds -lgds_pyxis -ldescrypt
+-PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -L/usr/local/lib -lgds -lgds_pyxis
+-#PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis
++GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis -ldescrypt
++PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis
+ HLPDIR= source/qli/
+ HOSTNAME= `hostname | cut -d'.' -f1`
+ INCLUDES= include_so include_so_ada
+@@ -106,11 +104,6 @@
+ MUISQL_LINK_OPTS= $(MUISQL_MU_LIB) $(PIPE_GDSSHR_LINK) -lm
+ PIC_FLAGS= $(CFLAGS) -fPIC
+ PIPE= gds.a gds_pipe
+-#PYXIS=
+-#PYXIS_MISC_OBJS=
+-#PYXIS_P_MISC_OBJS=
+-#PYXIS_OBJECTS=
+-#PYXIS_MISC_OBJECTS=
+ PYXIS= pyxis
+ PYXIS_MISC_OBJS= $(PYXIS_MISC)
+ PYXIS_P_MISC_OBJS= $(PYXIS_P_MISC)
+@@ -167,5 +160,8 @@
+ SHRLIB_EXT= .so
+
+ V3PRINTER= source/lock/printv3.o
++
++# Forces library build for FreeBSD
++PYXIS_LIBRARY= libpyxis.a
diff --git a/databases/firebird-client/pkg-comment b/databases/firebird-client/pkg-comment
new file mode 100644
index 000000000000..f8cb5bc1d7b3
--- /dev/null
+++ b/databases/firebird-client/pkg-comment
@@ -0,0 +1 @@
+The open-source InterBase(tm) 6.0 spin-off (Classic version)
diff --git a/databases/firebird-client/pkg-descr b/databases/firebird-client/pkg-descr
new file mode 100644
index 000000000000..5f05e046a387
--- /dev/null
+++ b/databases/firebird-client/pkg-descr
@@ -0,0 +1,22 @@
+The open-source InterBase(tm) 6.0 spin-off (Classic server version)
+
+InterBase is a world-class DBMS with a history too rich to detail
+here. Once selling for several thousands of dollars per license,
+some very big players use it worldwide. Inprise has open-sourced
+InterBase 6.0, and a lively bunch of folks has charged themselves
+with seeing that it lives on through the Firebird project.
+
+Note that as of Firebird 0.9_4, the locksmith back door has
+been closed.
+
+For more information on Firebird and InterBase, see:
+http://www.ibphoenix.com/
+http://www.interbase2000.org/
+http://www.interbase.com/
+
+and of course the firebird page itself:
+WWW: http://sourceforge.net/projects/firebird/
+
+For more information on the locksmith back door, see:
+
+https://www.kb.cert.org/vuls/id/247371
diff --git a/databases/firebird-client/pkg-install b/databases/firebird-client/pkg-install
new file mode 100644
index 000000000000..c40e25e88ffc
--- /dev/null
+++ b/databases/firebird-client/pkg-install
@@ -0,0 +1,145 @@
+#!/bin/sh
+
+# Created in haste by smashing together various
+# files from the port scripts.
+
+if [ "$2" = "PRE-INSTALL" ]; then
+if [ -d $PKG_PREFIX/firebird ]; then
+ if [ -d $PKG_PREFIX/firebird.old ]; then
+ rm -rf $PKG_PREFIX/firebird.old
+ fi
+ mv $PKG_PREFIX/firebird $PKG_PREFIX/firebird.old
+fi
+
+if [ -L /usr/interbase ]; then
+ rm -f /usr/interbase
+fi
+
+if [ -d /usr/interbase ]; then
+ mv /usr/interbase /usr/interbase.old
+fi
+
+ln -fs $PKG_PREFIX/firebird /usr/interbase
+
+perl <<EOF
+eval '(exit \$?0)' && eval 'exec /usr/bin/perl -S \$0 \${1+"\$@"}'
+& eval 'exec /usr/bin/perl -S \$0 \$argv:q'
+if 0;
+
+if( \$> ) {
+ print "\nYou must be root to run this step!\n\n";
+ exit 1;
+}
+
+if( getpwnam( "firebird" ) ) {
+ ( \$null, \$null, \$fbUID ) = getpwnam( "firebird" );
+} else {
+ \$fbUID = 90;
+ while( getpwuid( \$fbUID ) ) {
+ \$fbUID++;
+ }
+}
+
+if( getgrnam( "firebird" ) ) {
+ ( \$null, \$null, \$fbGID ) = getgrnam( "firebird" );
+} else {
+ \$fbGID = 90;
+ while( getgrgid( \$fbGID ) ) {
+ \$fbGID++;
+ }
+ &append_file( "/etc/group", "firebird:*:\$fbGID:" );
+}
+
+print "firebird user using uid \$fbUID\n";
+print "firebird user using gid \$fbGID\n";
+
+system( "/usr/bin/chpass -a \"firebird:*:\$fbUID:\$fbGID\:\:0:0:Firebird pseudo-user:\$ENV{'PKG_PREFIX'}/firebird:/bin/sh\"" );
+
+sub append_file {
+ local(\$file,@list) = @_;
+ local(\$LOCK_EX) = 2;
+ local(\$LOCK_NB) = 4;
+ local(\$LOCK_UN) = 8;
+
+ open(F, ">> \$file") || die "\$file: \$!\n";
+ while( ! flock( F, \$LOCK_EX | \$LOCK_NB ) ) {
+ exit 1;
+ }
+ print F join( "\n", @list) . "\n";
+ close F;
+ flock( F, \$LOCK_UN );
+}
+EOF
+elif [ "$2" = "POST-INSTALL" ]; then
+chown -R firebird:firebird $PKG_PREFIX/firebird
+
+# Turn everybody to read only.
+chmod -R o=r $PKG_PREFIX/firebird
+
+# Now fix up the mess.
+
+# fix up directories
+for i in `find $PKG_PREFIX/firebird -print`
+ do
+ FileName=$i
+ if [ -d $FileName ]
+ then
+ chmod o=rx $FileName
+ fi
+ done
+
+
+
+cd $PKG_PREFIX/firebird/bin
+
+# all users can run everything.
+chmod o=rx *
+
+# SUID is needed for running server programs.
+
+for i in gds_lock_mgr gds_drop gds_inet_server
+ do
+ chmod ug+s $i
+ done
+
+
+# Lock files
+
+cd $PKG_PREFIX/firebird
+
+for i in isc_init1 isc_lock1 isc_event1
+ do
+ FileName=$i.`hostname`
+ touch $FileName
+ chmod uga=rw $FileName
+ chown firebird:firebird $FileName
+ done
+
+
+touch interbase.log
+chmod ugo=rw interbase.log
+
+# make databases writable by all
+chmod ugo=rw examples/v5/*.gdb
+chmod ugo=rw help/*.gdb
+chmod ugo=rw isc4.gdb
+
+# remove any existing gds service
+cp /etc/services /etc/services.old
+cp /etc/inetd.conf /etc/inetd.conf.old
+cat /etc/services |grep -v gds_db >/etc/services.new
+cat /etc/inetd.conf |grep -v gds_db >/etc/inetd.conf.new
+mv /etc/services.new /etc/services
+mv /etc/inetd.conf.new /etc/inetd.conf
+
+# add the gds service and restart inetd
+cat >>/etc/services <<EOF
+gds_db 3050/tcp #InterBase Database Remote Protocol
+EOF
+cat >>/etc/inetd.conf <<EOF
+gds_db stream tcp nowait firebird /usr/interbase/bin/gds_inet_server gds_inet_server
+EOF
+kill -HUP `cat /var/run/inetd.pid`
+kill -HUP `cat /var/run/inetd.pid`
+
+fi
diff --git a/databases/firebird-client/pkg-message b/databases/firebird-client/pkg-message
new file mode 100644
index 000000000000..f15892a06aaa
--- /dev/null
+++ b/databases/firebird-client/pkg-message
@@ -0,0 +1,19 @@
+
+---------------------------------------------------------
+Firebird is now installed. There is a symbolic link from
+/usr/interbase -> %%PREFIX%%/firebird. Firebird needs this
+link for proper operation.
+
+It is STRONGLY recommended that you change the SYSDBA
+password with:
+
+$ cd /usr/interbase
+$ gsec -user SYSDBA -pass masterkey
+GSEC> modify SYSDBA -pw newpassword
+GSEC> quit
+
+before doing anything serious with Firebird.
+
+See %%PREFIX%%/firebird/RELNOTES for more.
+---------------------------------------------------------
+
diff --git a/databases/firebird-client/pkg-plist b/databases/firebird-client/pkg-plist
new file mode 100644
index 000000000000..66150c5bde26
--- /dev/null
+++ b/databases/firebird-client/pkg-plist
@@ -0,0 +1,104 @@
+firebird/intl/gdsintl
+firebird/examples/v5/ib_udf.sql
+firebird/examples/v5/README
+firebird/examples/v5/align.h
+firebird/examples/v5/api1.c
+firebird/examples/v5/api10.c
+firebird/examples/v5/api11.c
+firebird/examples/v5/api12.c
+firebird/examples/v5/api13.c
+firebird/examples/v5/api14.e
+firebird/examples/v5/api15.c
+firebird/examples/v5/api16.c
+firebird/examples/v5/api16t.c
+firebird/examples/v5/api2.c
+firebird/examples/v5/api3.c
+firebird/examples/v5/api4.c
+firebird/examples/v5/api5.c
+firebird/examples/v5/api6.c
+firebird/examples/v5/api7.c
+firebird/examples/v5/api8.c
+firebird/examples/v5/api9.c
+firebird/examples/v5/api9f.c
+firebird/examples/v5/apifull.c
+firebird/examples/v5/employe2.sql
+firebird/examples/v5/dyn1.e
+firebird/examples/v5/dyn2.e
+firebird/examples/v5/dyn3.e
+firebird/examples/v5/dyn4.e
+firebird/examples/v5/dyn5.e
+firebird/examples/v5/dynfull.e
+firebird/examples/v5/employee.gbk
+firebird/examples/v5/employee.gdb
+firebird/examples/v5/example.h
+firebird/examples/v5/api9f.sql
+firebird/examples/v5/intlemp.gbk
+firebird/examples/v5/intlemp.gdb
+firebird/examples/v5/stat1.e
+firebird/examples/v5/stat10.e
+firebird/examples/v5/stat11.e
+firebird/examples/v5/stat12.e
+firebird/examples/v5/stat12t.e
+firebird/examples/v5/stat2.e
+firebird/examples/v5/stat3.e
+firebird/examples/v5/stat4.e
+firebird/examples/v5/stat5.e
+firebird/examples/v5/stat6.e
+firebird/examples/v5/stat7.e
+firebird/examples/v5/stat8.e
+firebird/examples/v5/stat9.e
+firebird/examples/v5/udf.sql
+firebird/examples/v5/udflib.c
+firebird/examples/v5/makefile
+firebird/include/perf.h
+firebird/include/ib_util.h
+firebird/include/gds.hxx
+firebird/include/gds.h
+firebird/include/ibase.h
+firebird/include/iberror.h
+firebird/include/gds.f
+firebird/UDF/ib_udf
+firebird/lib/ib_util.so
+firebird/lib/gds.a
+firebird/lib/gds.so
+firebird/lib/libgds.so
+firebird/lib/libgds.so.1
+firebird/lib/libgds_pyxis.a
+firebird/lib/libgds.a
+firebird/lib/gds_pyxis.a
+firebird/help/help.gbak
+firebird/help/help.gdb
+firebird/bin/isc4.gbak
+firebird/bin/gpre
+firebird/bin/gds_pipe
+firebird/bin/gds_drop
+firebird/bin/gds_lock_mgr
+firebird/bin/gfix
+firebird/bin/gdef
+firebird/bin/isql
+firebird/bin/gds_lock_print
+firebird/bin/qli
+firebird/bin/gds_inet_server
+firebird/bin/gsplit
+firebird/bin/gstat
+firebird/bin/gds_relay
+firebird/bin/gsec
+firebird/bin/gbak
+firebird/services.isc
+firebird/isc_config
+firebird/isc4.gdb
+firebird/interbase.msg
+firebird/interbase.log
+firebird/inetd.conf.isc
+firebird/RELNOTES
+@dirrm firebird
+@dirrm firebird/intl
+@dirrm firebird/examples/v3
+@dirrm firebird/examples/v4
+@dirrm firebird/examples/v5
+@dirrm firebird/examples
+@dirrm firebird/include
+@dirrm firebird/UDF
+@dirrm firebird/lib
+@dirrm firebird/help
+@dirrm firebird/bin
diff --git a/databases/firebird-client/scripts/addservice b/databases/firebird-client/scripts/addservice
new file mode 100644
index 000000000000..df9aea5e91de
--- /dev/null
+++ b/databases/firebird-client/scripts/addservice
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+cat >>/etc/services <<EOF
+gds_db 3050/tcp #InterBase Database Remote Protocol
+EOF
+cat >>/etc/inetd.conf <<EOF
+gds_db stream tcp nowait firebird /usr/interbase/bin/gds_inet_server gds_inet_server
+EOF
+kill -HUP `cat /var/run/inetd.pid`
diff --git a/databases/firebird-client/scripts/createuser b/databases/firebird-client/scripts/createuser
new file mode 100644
index 000000000000..b61d47fd84bd
--- /dev/null
+++ b/databases/firebird-client/scripts/createuser
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+#
+
+eval '(exit $?0)' && eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
+& eval 'exec /usr/bin/perl -S $0 $argv:q'
+if 0;
+
+if( $> ) {
+ print "\nYou must be root to run this step!\n\n";
+ exit 1;
+}
+
+if( getpwnam( "firebird" ) ) {
+ ( $null, $null, $fbUID ) = getpwnam( "firebird" );
+} else {
+ $fbUID = 90;
+ while( getpwuid( $fbUID ) ) {
+ $fbUID++;
+ }
+}
+
+if( getgrnam( "firebird" ) ) {
+ ( $null, $null, $fbGID ) = getgrnam( "firebird" );
+} else {
+ $fbGID = 90;
+ while( getgrgid( $fbGID ) ) {
+ $fbGID++;
+ }
+ &append_file( "/etc/group", "firebird:*:$fbGID:" );
+}
+
+print "firebird user using uid $fbUID\n";
+print "firebird user using gid $fbGID\n";
+
+system( "/usr/bin/chpass -a \"firebird:*:$fbUID:$fbGID\:\:0:0:Firebird pseudo-user:$ENV{'PREFIX'}/firebird:/bin/sh\"" );
+
+sub append_file {
+ local($file,@list) = @_;
+ local($LOCK_EX) = 2;
+ local($LOCK_NB) = 4;
+ local($LOCK_UN) = 8;
+
+ open(F, ">> $file") || die "$file: $!\n";
+ while( ! flock( F, $LOCK_EX | $LOCK_NB ) ) {
+ exit 1;
+ }
+ print F join( "\n", @list) . "\n";
+ close F;
+ flock( F, $LOCK_UN );
+}
diff --git a/databases/firebird-client/scripts/post-install b/databases/firebird-client/scripts/post-install
new file mode 100644
index 000000000000..e4d2d3a9cd07
--- /dev/null
+++ b/databases/firebird-client/scripts/post-install
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+chown -R firebird:firebird $PREFIX/firebird
+
+# Turn everybody to read only.
+chmod -R o=r $PREFIX/firebird
+
+# Now fix up the mess.
+
+# fix up directories
+for i in `find $PREFIX/firebird -print`
+ do
+ FileName=$i
+ if [ -d $FileName ]
+ then
+ chmod o=rx $FileName
+ fi
+ done
+
+
+
+cd $PREFIX/firebird/bin
+
+# all users can run everything.
+chmod o=rx *
+
+# SUID is needed for running server programs.
+
+for i in gds_lock_mgr gds_drop gds_inet_server
+ do
+ chmod ug+s $i
+ done
+
+
+# Lock files
+
+cd $PREFIX/firebird
+
+for i in isc_init1 isc_lock1 isc_event1
+ do
+ FileName=$i.`hostname`
+ touch $FileName
+ chmod uga=rw $FileName
+ chown firebird:firebird $FileName
+ done
+
+
+touch interbase.log
+chmod ugo=rw interbase.log
+
+# make databases writable by all
+chmod ugo=rw examples/v5/*.gdb
+chmod ugo=rw help/*.gdb
+chmod ugo=rw isc4.gdb
+
+# remove any existing gds service
+sh $SCRIPTDIR/rmservice
+
+# add the gds service and restart inetd
+sh $SCRIPTDIR/addservice
+kill -HUP `cat /var/run/inetd.pid`
+
+sed "s|%%PREFIX%%|$PREFIX|" $SCRIPTDIR/../pkg-message
+
+cat <<EOF
+
+==========================================================
+!! NOTE !!
+
+As there are some oddities to the Firebird build process,
+it is likely you WILL NOT BE ABLE TO USE IT until you
+remove the semaphore created during the build process.
+Please read $PREFIX/firebird/RELNOTES for more information.
+==========================================================
+
+EOF
diff --git a/databases/firebird-client/scripts/pre-build b/databases/firebird-client/scripts/pre-build
new file mode 100644
index 000000000000..6605df7770fd
--- /dev/null
+++ b/databases/firebird-client/scripts/pre-build
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+GDS_LOCK_MGR=`ps ax |grep gds_lock_mgr |grep -v grep`;
+
+if [ "$GDS_LOCK_MGR" != "" ]; then
+ echo "It appears you have a gds_lock_manager already running.";
+ echo;
+ echo "You must cease all InterBase operations to build this port.";
+ echo "Make sure nobody is connected to any databases, then use";
+ echo "'gds_drop -a' and manually verify (with ipcs) that the";
+ echo "semaphores were removed.";
+ exit 1;
+fi
+exit 0
+
diff --git a/databases/firebird-client/scripts/pre-install b/databases/firebird-client/scripts/pre-install
new file mode 100644
index 000000000000..a6e1b37a9008
--- /dev/null
+++ b/databases/firebird-client/scripts/pre-install
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+if [ -d $PREFIX/firebird ]; then
+ if [ -d $PREFIX/firebird.old ]; then
+ rm -rf $PREFIX/firebird.old
+ fi
+ mv $PREFIX/firebird $PREFIX/firebird.old
+fi
+
+if [ -L /usr/interbase ]; then
+ rm -f /usr/interbase
+fi
+
+if [ -d /usr/interbase ]; then
+ mv /usr/interbase /usr/interbase.old
+fi
+
+ln -fs $PREFIX/firebird /usr/interbase
+
+perl $SCRIPTDIR/createuser
diff --git a/databases/firebird-client/scripts/rmservice b/databases/firebird-client/scripts/rmservice
new file mode 100644
index 000000000000..58adfc17419d
--- /dev/null
+++ b/databases/firebird-client/scripts/rmservice
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+cp /etc/services /etc/services.old
+cp /etc/inetd.conf /etc/inetd.conf.old
+cat /etc/services |grep -v gds_db >/etc/services.new
+cat /etc/inetd.conf |grep -v gds_db >/etc/inetd.conf.new
+mv /etc/services.new /etc/services
+mv /etc/inetd.conf.new /etc/inetd.conf
diff --git a/databases/firebird-devel/Makefile b/databases/firebird-devel/Makefile
new file mode 100644
index 000000000000..02cbff7bc2e9
--- /dev/null
+++ b/databases/firebird-devel/Makefile
@@ -0,0 +1,63 @@
+# New ports collection makefile for: Firebird
+# Date created: 20 December 2000
+# Whom: Geoffrey C. Speicher <geoff@sea-incorporated.com>
+#
+# $FreeBSD$
+#
+
+PORTNAME= firebird
+PORTVERSION= 0.9
+PORTREVISION= 4
+CATEGORIES= databases
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR=firebird
+DISTFILES= firebird-boot-kit.tar.gz \
+ interbase0.9-4-v5examples.tar.gz \
+ interbase0.9-4src.tar.gz
+
+MAINTAINER= geoff@sea-incorporated.com
+
+WRKSRC= ${WRKDIR}/interbase
+INSTALLS_SHLIB= yes
+LDCONFIG_DIRS= %%PREFIX%%/firebird/lib
+
+ONLY_FOR_ARCHS= i386
+
+do-extract:
+ @${MKDIR} ${WRKDIR}
+ @( \
+ cd ${WRKDIR}; tar zxf ${DISTDIR}/interbase0.9-4src.tar.gz; \
+ cd interbase; tar zxf ${DISTDIR}/firebird-boot-kit.tar.gz; \
+ ${CP} msgs/msg.gbak misc/msg.gbak \
+ )
+
+do-configure:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ INTERBASE=${WRKDIR}/interbase/interbase; export INTERBASE; \
+ REFDBPATH=${WRKDIR}/refDatabases; export REFDBPATH; \
+ ${SH} buildBootDatabases; \
+ ${SH} setup_dirs.boot FREEBSD PROD ${WRKDIR}/refDatabases boot; \
+ )
+
+do-build:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ INTERBASE=${WRKDIR}/interbase/interbase; export INTERBASE; \
+ REFDBPATH=${WRKDIR}/refDatabases; export REFDBPATH; \
+ ${SH} boot.freebsd; \
+ )
+
+do-install:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ ${CP} -Rp interbase ${PREFIX}/firebird; \
+ ${RM} ${PREFIX}/firebird/install; \
+ ${RM} ${PREFIX}/firebird/lib/libgds.so.1.0; \
+ ${LN} -fs gds.so ${PREFIX}/firebird/lib/libgds.so.1; \
+ cd ${PREFIX}/firebird/examples; \
+ tar zxf ${DISTDIR}/interbase0.9-4-v5examples.tar.gz; \
+ ${CP} ${FILESDIR}/RELNOTES ${PREFIX}/firebird/ \
+ )
+
+.include <bsd.port.mk>
diff --git a/databases/firebird-devel/distinfo b/databases/firebird-devel/distinfo
new file mode 100644
index 000000000000..67c42987376e
--- /dev/null
+++ b/databases/firebird-devel/distinfo
@@ -0,0 +1,3 @@
+MD5 (firebird-boot-kit.tar.gz) = 2e18d75539bc4c3d40a1a71509309f64
+MD5 (interbase0.9-4-v5examples.tar.gz) = 17cba82bbf5066d515f2dee97bf8327a
+MD5 (interbase0.9-4src.tar.gz) = d098277ed160e2b6a49d91e1fdb3a652
diff --git a/databases/firebird-devel/files/RELNOTES b/databases/firebird-devel/files/RELNOTES
new file mode 100644
index 000000000000..3c4e0c62ae58
--- /dev/null
+++ b/databases/firebird-devel/files/RELNOTES
@@ -0,0 +1,78 @@
+Firebird 0.9_4 FreeBSD Release Notes 13-Jan-2001
+------------------------------------
+FB-T0.9.4.34 Firebird Test1
+
+Welcome to the FreeBSD Firebird port! Users should note that there
+was a package called `firebird-1.0.tgz' released in mid-August
+2000. Unfortunately, that package was released before Firebird
+version numbering conventions were established, so although the
+version number would suggest that it is newer than the current
+release, it is certainly not. Users of the August 1.0 package
+should upgrade to 0.9_4 or later, which has fixed many bugs and
+security problems, including the recently-discovered back door.
+
+ Firebird originally required a running copy of Firebird (or
+InterBase) in order to build itself. This port uses a boot kit to
+overcome that, so that it does not require itself to build.
+Unfortunately, the side effect of this is that if you have a lock
+manager running from an already-installed version of Firebird or
+InterBase, this port will not build.
+
+ Firebird is installed SUID with owner and group `firebird'.
+This does affect where you can and cannot create databases when
+connecting remotely, as well as which existing databases you can
+access. If you want a database to be available remotely, be sure
+it's readable and writeable to group firebird.
+
+ There may be times when you manage to get your system into a
+state where using any of the Firebird utilites (isql, gbak, gsec,
+etc.) gives you the message "semget failed". One surefire way to
+do this is to build and install the port. :) If this happens,
+make sure that the lock manager is not running and its semaphores
+have been removed. The former can be accomplished with 'ps ax
+|grep gds' and 'kill'; the latter with 'ipcs -s' and 'ipcrm -s'.
+
+ For example, after building and installing the port, you will
+probably go through something like this:
+
+# isql /usr/interbase/isc4.gdb
+Statement failed, SQLCODE = -902
+
+operating system directive semget failed
+-No such file or directory
+
+# ipcs -s
+Semaphores:
+T ID KEY MODE OWNER GROUP
+s 1310720 252034728 --rw-rw-rw- root wheel
+
+# ipcrm -s 1310720
+
+and you should be in business.
+
+ Once this is done, you should be able to connect normally to
+databases. Your first connection will restart the lock manager.
+
+ There may be times, however, when you still get "semget failed"
+even though the lock manager is not running and the semaphores have
+been cleaned up. There seems to be a conflict with this release
+and the PostgreSQL 7 release as installed from the ports collection.
+If you're having trouble with Firebird and you're running PostgreSQL,
+try stopping PostgreSQL:
+
+ /usr/local/etc/rc.d/pgsql.sh stop
+
+and see if that helps.
+
+ Complete documentation for InterBase(tm) is available (free of
+charge) from http://www.interbase.com/ in PDF format. While
+InterBase and Firebird are two distinct entities, all InterBase
+documentation is pertinent to Firebird. More information on Firebird
+and InterBase can be found at the following:
+
+ http://sourceforge.net/projects/firebird/
+ http://www.ibphoenix.com/
+ http://www.interbase2000.org/
+
+Geoff Speicher
+<geoff@sea-incorporated.com>
diff --git a/databases/firebird-devel/files/patch-aa b/databases/firebird-devel/files/patch-aa
new file mode 100644
index 000000000000..f2db9a68750d
--- /dev/null
+++ b/databases/firebird-devel/files/patch-aa
@@ -0,0 +1,11 @@
+--- buildBootDatabases.orig Tue Oct 10 23:00:39 2000
++++ buildBootDatabases Tue Oct 10 23:00:46 2000
+@@ -49,7 +49,7 @@
+ DefaultAns=$2
+ echo -n "${1}"
+ Answer="$DefaultAns"
+- read Answer
++# read Answer
+ }
+
+ #--------------------------------------------------------------------
diff --git a/databases/firebird-devel/files/patch-ab b/databases/firebird-devel/files/patch-ab
new file mode 100644
index 000000000000..f054a4b23007
--- /dev/null
+++ b/databases/firebird-devel/files/patch-ab
@@ -0,0 +1,11 @@
+--- setup_dirs.boot.orig Tue Oct 10 23:00:07 2000
++++ setup_dirs.boot Tue Oct 10 23:00:22 2000
+@@ -49,7 +49,7 @@
+ DefaultAns=$2
+ echo -n "${1}"
+ Answer="$DefaultAns"
+- read Answer
++# read Answer
+ }
+
+
diff --git a/databases/firebird-devel/files/patch-ac b/databases/firebird-devel/files/patch-ac
new file mode 100644
index 000000000000..bf5de43b75fb
--- /dev/null
+++ b/databases/firebird-devel/files/patch-ac
@@ -0,0 +1,58 @@
+--- builds/original/prefix.freebsd 2000/10/08 15:36:25 1.2
++++ builds/original/prefix.freebsd 2001/01/11 19:17:58
+@@ -28,7 +28,7 @@
+
+
+ PROD_DEBUG_OBJECTS= nodebug.o
+-PROD_SHRLIB_DIR=
++PROD_SHRLIB_DIR= -Lsource/jrd
+ PROD_VERSION_FLAG= -DPROD_BUILD
+ PROD_CFLAGS= -O -m486 -fpic -DFLINTSTONE
+
+@@ -48,7 +48,7 @@
+ UDF_LINK_CMD= gcc
+ UDF_CFLAGS= -fPIC -mieee-fp
+ UDF_LFLAGS= -shared
+-UDF_SHRLIBS= -L/usr/local/lib -lgds -lm -lc -mieee-fp -ldescrypt
++UDF_SHRLIBS= $(SHRLIB_DIR) -lgds -lm -lc -mieee-fp -ldescrypt
+
+ #NOTE: PIC_J_CFLAGS is special CFLAGS used to build PIPD_IS_SHRLIB modules
+ # to workaround the Solaris threading problems with signals
+@@ -69,16 +69,14 @@
+ FUNCTIONS= functions.bin
+ FUNCSHR= source/interbase/lib/gdsf.so
+ GDS_LINK= $(GDSSHR_LINK)
+-#GDS_PYXIS=
+ GDS_PYXIS= gds_pyxis.a
+ GDSLIB_BACKEND= source/interbase/lib/gds_b.a
+ GDSLIB_LINK= -Lsource/jrd -lgds_b -lc -ldescrypt
+
+ GDSSHR= source/interbase/lib/gds.so
+ LINUX_GDSSHR= $(GDSSHR)
+-GDSSHR_LINK= $(SHRLIB_DIR) -L/usr/local/lib -lgds -lgds_pyxis -ldescrypt
+-PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -L/usr/local/lib -lgds -lgds_pyxis
+-#PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis
++GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis -ldescrypt
++PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis
+ HLPDIR= source/qli/
+ HOSTNAME= `hostname | cut -d'.' -f1`
+ INCLUDES= include_so include_so_ada
+@@ -106,11 +104,6 @@
+ MUISQL_LINK_OPTS= $(MUISQL_MU_LIB) $(PIPE_GDSSHR_LINK) -lm
+ PIC_FLAGS= $(CFLAGS) -fPIC
+ PIPE= gds.a gds_pipe
+-#PYXIS=
+-#PYXIS_MISC_OBJS=
+-#PYXIS_P_MISC_OBJS=
+-#PYXIS_OBJECTS=
+-#PYXIS_MISC_OBJECTS=
+ PYXIS= pyxis
+ PYXIS_MISC_OBJS= $(PYXIS_MISC)
+ PYXIS_P_MISC_OBJS= $(PYXIS_P_MISC)
+@@ -167,5 +160,8 @@
+ SHRLIB_EXT= .so
+
+ V3PRINTER= source/lock/printv3.o
++
++# Forces library build for FreeBSD
++PYXIS_LIBRARY= libpyxis.a
diff --git a/databases/firebird-devel/pkg-comment b/databases/firebird-devel/pkg-comment
new file mode 100644
index 000000000000..f8cb5bc1d7b3
--- /dev/null
+++ b/databases/firebird-devel/pkg-comment
@@ -0,0 +1 @@
+The open-source InterBase(tm) 6.0 spin-off (Classic version)
diff --git a/databases/firebird-devel/pkg-descr b/databases/firebird-devel/pkg-descr
new file mode 100644
index 000000000000..5f05e046a387
--- /dev/null
+++ b/databases/firebird-devel/pkg-descr
@@ -0,0 +1,22 @@
+The open-source InterBase(tm) 6.0 spin-off (Classic server version)
+
+InterBase is a world-class DBMS with a history too rich to detail
+here. Once selling for several thousands of dollars per license,
+some very big players use it worldwide. Inprise has open-sourced
+InterBase 6.0, and a lively bunch of folks has charged themselves
+with seeing that it lives on through the Firebird project.
+
+Note that as of Firebird 0.9_4, the locksmith back door has
+been closed.
+
+For more information on Firebird and InterBase, see:
+http://www.ibphoenix.com/
+http://www.interbase2000.org/
+http://www.interbase.com/
+
+and of course the firebird page itself:
+WWW: http://sourceforge.net/projects/firebird/
+
+For more information on the locksmith back door, see:
+
+https://www.kb.cert.org/vuls/id/247371
diff --git a/databases/firebird-devel/pkg-install b/databases/firebird-devel/pkg-install
new file mode 100644
index 000000000000..c40e25e88ffc
--- /dev/null
+++ b/databases/firebird-devel/pkg-install
@@ -0,0 +1,145 @@
+#!/bin/sh
+
+# Created in haste by smashing together various
+# files from the port scripts.
+
+if [ "$2" = "PRE-INSTALL" ]; then
+if [ -d $PKG_PREFIX/firebird ]; then
+ if [ -d $PKG_PREFIX/firebird.old ]; then
+ rm -rf $PKG_PREFIX/firebird.old
+ fi
+ mv $PKG_PREFIX/firebird $PKG_PREFIX/firebird.old
+fi
+
+if [ -L /usr/interbase ]; then
+ rm -f /usr/interbase
+fi
+
+if [ -d /usr/interbase ]; then
+ mv /usr/interbase /usr/interbase.old
+fi
+
+ln -fs $PKG_PREFIX/firebird /usr/interbase
+
+perl <<EOF
+eval '(exit \$?0)' && eval 'exec /usr/bin/perl -S \$0 \${1+"\$@"}'
+& eval 'exec /usr/bin/perl -S \$0 \$argv:q'
+if 0;
+
+if( \$> ) {
+ print "\nYou must be root to run this step!\n\n";
+ exit 1;
+}
+
+if( getpwnam( "firebird" ) ) {
+ ( \$null, \$null, \$fbUID ) = getpwnam( "firebird" );
+} else {
+ \$fbUID = 90;
+ while( getpwuid( \$fbUID ) ) {
+ \$fbUID++;
+ }
+}
+
+if( getgrnam( "firebird" ) ) {
+ ( \$null, \$null, \$fbGID ) = getgrnam( "firebird" );
+} else {
+ \$fbGID = 90;
+ while( getgrgid( \$fbGID ) ) {
+ \$fbGID++;
+ }
+ &append_file( "/etc/group", "firebird:*:\$fbGID:" );
+}
+
+print "firebird user using uid \$fbUID\n";
+print "firebird user using gid \$fbGID\n";
+
+system( "/usr/bin/chpass -a \"firebird:*:\$fbUID:\$fbGID\:\:0:0:Firebird pseudo-user:\$ENV{'PKG_PREFIX'}/firebird:/bin/sh\"" );
+
+sub append_file {
+ local(\$file,@list) = @_;
+ local(\$LOCK_EX) = 2;
+ local(\$LOCK_NB) = 4;
+ local(\$LOCK_UN) = 8;
+
+ open(F, ">> \$file") || die "\$file: \$!\n";
+ while( ! flock( F, \$LOCK_EX | \$LOCK_NB ) ) {
+ exit 1;
+ }
+ print F join( "\n", @list) . "\n";
+ close F;
+ flock( F, \$LOCK_UN );
+}
+EOF
+elif [ "$2" = "POST-INSTALL" ]; then
+chown -R firebird:firebird $PKG_PREFIX/firebird
+
+# Turn everybody to read only.
+chmod -R o=r $PKG_PREFIX/firebird
+
+# Now fix up the mess.
+
+# fix up directories
+for i in `find $PKG_PREFIX/firebird -print`
+ do
+ FileName=$i
+ if [ -d $FileName ]
+ then
+ chmod o=rx $FileName
+ fi
+ done
+
+
+
+cd $PKG_PREFIX/firebird/bin
+
+# all users can run everything.
+chmod o=rx *
+
+# SUID is needed for running server programs.
+
+for i in gds_lock_mgr gds_drop gds_inet_server
+ do
+ chmod ug+s $i
+ done
+
+
+# Lock files
+
+cd $PKG_PREFIX/firebird
+
+for i in isc_init1 isc_lock1 isc_event1
+ do
+ FileName=$i.`hostname`
+ touch $FileName
+ chmod uga=rw $FileName
+ chown firebird:firebird $FileName
+ done
+
+
+touch interbase.log
+chmod ugo=rw interbase.log
+
+# make databases writable by all
+chmod ugo=rw examples/v5/*.gdb
+chmod ugo=rw help/*.gdb
+chmod ugo=rw isc4.gdb
+
+# remove any existing gds service
+cp /etc/services /etc/services.old
+cp /etc/inetd.conf /etc/inetd.conf.old
+cat /etc/services |grep -v gds_db >/etc/services.new
+cat /etc/inetd.conf |grep -v gds_db >/etc/inetd.conf.new
+mv /etc/services.new /etc/services
+mv /etc/inetd.conf.new /etc/inetd.conf
+
+# add the gds service and restart inetd
+cat >>/etc/services <<EOF
+gds_db 3050/tcp #InterBase Database Remote Protocol
+EOF
+cat >>/etc/inetd.conf <<EOF
+gds_db stream tcp nowait firebird /usr/interbase/bin/gds_inet_server gds_inet_server
+EOF
+kill -HUP `cat /var/run/inetd.pid`
+kill -HUP `cat /var/run/inetd.pid`
+
+fi
diff --git a/databases/firebird-devel/pkg-message b/databases/firebird-devel/pkg-message
new file mode 100644
index 000000000000..f15892a06aaa
--- /dev/null
+++ b/databases/firebird-devel/pkg-message
@@ -0,0 +1,19 @@
+
+---------------------------------------------------------
+Firebird is now installed. There is a symbolic link from
+/usr/interbase -> %%PREFIX%%/firebird. Firebird needs this
+link for proper operation.
+
+It is STRONGLY recommended that you change the SYSDBA
+password with:
+
+$ cd /usr/interbase
+$ gsec -user SYSDBA -pass masterkey
+GSEC> modify SYSDBA -pw newpassword
+GSEC> quit
+
+before doing anything serious with Firebird.
+
+See %%PREFIX%%/firebird/RELNOTES for more.
+---------------------------------------------------------
+
diff --git a/databases/firebird-devel/pkg-plist b/databases/firebird-devel/pkg-plist
new file mode 100644
index 000000000000..66150c5bde26
--- /dev/null
+++ b/databases/firebird-devel/pkg-plist
@@ -0,0 +1,104 @@
+firebird/intl/gdsintl
+firebird/examples/v5/ib_udf.sql
+firebird/examples/v5/README
+firebird/examples/v5/align.h
+firebird/examples/v5/api1.c
+firebird/examples/v5/api10.c
+firebird/examples/v5/api11.c
+firebird/examples/v5/api12.c
+firebird/examples/v5/api13.c
+firebird/examples/v5/api14.e
+firebird/examples/v5/api15.c
+firebird/examples/v5/api16.c
+firebird/examples/v5/api16t.c
+firebird/examples/v5/api2.c
+firebird/examples/v5/api3.c
+firebird/examples/v5/api4.c
+firebird/examples/v5/api5.c
+firebird/examples/v5/api6.c
+firebird/examples/v5/api7.c
+firebird/examples/v5/api8.c
+firebird/examples/v5/api9.c
+firebird/examples/v5/api9f.c
+firebird/examples/v5/apifull.c
+firebird/examples/v5/employe2.sql
+firebird/examples/v5/dyn1.e
+firebird/examples/v5/dyn2.e
+firebird/examples/v5/dyn3.e
+firebird/examples/v5/dyn4.e
+firebird/examples/v5/dyn5.e
+firebird/examples/v5/dynfull.e
+firebird/examples/v5/employee.gbk
+firebird/examples/v5/employee.gdb
+firebird/examples/v5/example.h
+firebird/examples/v5/api9f.sql
+firebird/examples/v5/intlemp.gbk
+firebird/examples/v5/intlemp.gdb
+firebird/examples/v5/stat1.e
+firebird/examples/v5/stat10.e
+firebird/examples/v5/stat11.e
+firebird/examples/v5/stat12.e
+firebird/examples/v5/stat12t.e
+firebird/examples/v5/stat2.e
+firebird/examples/v5/stat3.e
+firebird/examples/v5/stat4.e
+firebird/examples/v5/stat5.e
+firebird/examples/v5/stat6.e
+firebird/examples/v5/stat7.e
+firebird/examples/v5/stat8.e
+firebird/examples/v5/stat9.e
+firebird/examples/v5/udf.sql
+firebird/examples/v5/udflib.c
+firebird/examples/v5/makefile
+firebird/include/perf.h
+firebird/include/ib_util.h
+firebird/include/gds.hxx
+firebird/include/gds.h
+firebird/include/ibase.h
+firebird/include/iberror.h
+firebird/include/gds.f
+firebird/UDF/ib_udf
+firebird/lib/ib_util.so
+firebird/lib/gds.a
+firebird/lib/gds.so
+firebird/lib/libgds.so
+firebird/lib/libgds.so.1
+firebird/lib/libgds_pyxis.a
+firebird/lib/libgds.a
+firebird/lib/gds_pyxis.a
+firebird/help/help.gbak
+firebird/help/help.gdb
+firebird/bin/isc4.gbak
+firebird/bin/gpre
+firebird/bin/gds_pipe
+firebird/bin/gds_drop
+firebird/bin/gds_lock_mgr
+firebird/bin/gfix
+firebird/bin/gdef
+firebird/bin/isql
+firebird/bin/gds_lock_print
+firebird/bin/qli
+firebird/bin/gds_inet_server
+firebird/bin/gsplit
+firebird/bin/gstat
+firebird/bin/gds_relay
+firebird/bin/gsec
+firebird/bin/gbak
+firebird/services.isc
+firebird/isc_config
+firebird/isc4.gdb
+firebird/interbase.msg
+firebird/interbase.log
+firebird/inetd.conf.isc
+firebird/RELNOTES
+@dirrm firebird
+@dirrm firebird/intl
+@dirrm firebird/examples/v3
+@dirrm firebird/examples/v4
+@dirrm firebird/examples/v5
+@dirrm firebird/examples
+@dirrm firebird/include
+@dirrm firebird/UDF
+@dirrm firebird/lib
+@dirrm firebird/help
+@dirrm firebird/bin
diff --git a/databases/firebird-devel/scripts/addservice b/databases/firebird-devel/scripts/addservice
new file mode 100644
index 000000000000..df9aea5e91de
--- /dev/null
+++ b/databases/firebird-devel/scripts/addservice
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+cat >>/etc/services <<EOF
+gds_db 3050/tcp #InterBase Database Remote Protocol
+EOF
+cat >>/etc/inetd.conf <<EOF
+gds_db stream tcp nowait firebird /usr/interbase/bin/gds_inet_server gds_inet_server
+EOF
+kill -HUP `cat /var/run/inetd.pid`
diff --git a/databases/firebird-devel/scripts/createuser b/databases/firebird-devel/scripts/createuser
new file mode 100644
index 000000000000..b61d47fd84bd
--- /dev/null
+++ b/databases/firebird-devel/scripts/createuser
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+#
+
+eval '(exit $?0)' && eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
+& eval 'exec /usr/bin/perl -S $0 $argv:q'
+if 0;
+
+if( $> ) {
+ print "\nYou must be root to run this step!\n\n";
+ exit 1;
+}
+
+if( getpwnam( "firebird" ) ) {
+ ( $null, $null, $fbUID ) = getpwnam( "firebird" );
+} else {
+ $fbUID = 90;
+ while( getpwuid( $fbUID ) ) {
+ $fbUID++;
+ }
+}
+
+if( getgrnam( "firebird" ) ) {
+ ( $null, $null, $fbGID ) = getgrnam( "firebird" );
+} else {
+ $fbGID = 90;
+ while( getgrgid( $fbGID ) ) {
+ $fbGID++;
+ }
+ &append_file( "/etc/group", "firebird:*:$fbGID:" );
+}
+
+print "firebird user using uid $fbUID\n";
+print "firebird user using gid $fbGID\n";
+
+system( "/usr/bin/chpass -a \"firebird:*:$fbUID:$fbGID\:\:0:0:Firebird pseudo-user:$ENV{'PREFIX'}/firebird:/bin/sh\"" );
+
+sub append_file {
+ local($file,@list) = @_;
+ local($LOCK_EX) = 2;
+ local($LOCK_NB) = 4;
+ local($LOCK_UN) = 8;
+
+ open(F, ">> $file") || die "$file: $!\n";
+ while( ! flock( F, $LOCK_EX | $LOCK_NB ) ) {
+ exit 1;
+ }
+ print F join( "\n", @list) . "\n";
+ close F;
+ flock( F, $LOCK_UN );
+}
diff --git a/databases/firebird-devel/scripts/post-install b/databases/firebird-devel/scripts/post-install
new file mode 100644
index 000000000000..e4d2d3a9cd07
--- /dev/null
+++ b/databases/firebird-devel/scripts/post-install
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+chown -R firebird:firebird $PREFIX/firebird
+
+# Turn everybody to read only.
+chmod -R o=r $PREFIX/firebird
+
+# Now fix up the mess.
+
+# fix up directories
+for i in `find $PREFIX/firebird -print`
+ do
+ FileName=$i
+ if [ -d $FileName ]
+ then
+ chmod o=rx $FileName
+ fi
+ done
+
+
+
+cd $PREFIX/firebird/bin
+
+# all users can run everything.
+chmod o=rx *
+
+# SUID is needed for running server programs.
+
+for i in gds_lock_mgr gds_drop gds_inet_server
+ do
+ chmod ug+s $i
+ done
+
+
+# Lock files
+
+cd $PREFIX/firebird
+
+for i in isc_init1 isc_lock1 isc_event1
+ do
+ FileName=$i.`hostname`
+ touch $FileName
+ chmod uga=rw $FileName
+ chown firebird:firebird $FileName
+ done
+
+
+touch interbase.log
+chmod ugo=rw interbase.log
+
+# make databases writable by all
+chmod ugo=rw examples/v5/*.gdb
+chmod ugo=rw help/*.gdb
+chmod ugo=rw isc4.gdb
+
+# remove any existing gds service
+sh $SCRIPTDIR/rmservice
+
+# add the gds service and restart inetd
+sh $SCRIPTDIR/addservice
+kill -HUP `cat /var/run/inetd.pid`
+
+sed "s|%%PREFIX%%|$PREFIX|" $SCRIPTDIR/../pkg-message
+
+cat <<EOF
+
+==========================================================
+!! NOTE !!
+
+As there are some oddities to the Firebird build process,
+it is likely you WILL NOT BE ABLE TO USE IT until you
+remove the semaphore created during the build process.
+Please read $PREFIX/firebird/RELNOTES for more information.
+==========================================================
+
+EOF
diff --git a/databases/firebird-devel/scripts/pre-build b/databases/firebird-devel/scripts/pre-build
new file mode 100644
index 000000000000..6605df7770fd
--- /dev/null
+++ b/databases/firebird-devel/scripts/pre-build
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+GDS_LOCK_MGR=`ps ax |grep gds_lock_mgr |grep -v grep`;
+
+if [ "$GDS_LOCK_MGR" != "" ]; then
+ echo "It appears you have a gds_lock_manager already running.";
+ echo;
+ echo "You must cease all InterBase operations to build this port.";
+ echo "Make sure nobody is connected to any databases, then use";
+ echo "'gds_drop -a' and manually verify (with ipcs) that the";
+ echo "semaphores were removed.";
+ exit 1;
+fi
+exit 0
+
diff --git a/databases/firebird-devel/scripts/pre-install b/databases/firebird-devel/scripts/pre-install
new file mode 100644
index 000000000000..a6e1b37a9008
--- /dev/null
+++ b/databases/firebird-devel/scripts/pre-install
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+if [ -d $PREFIX/firebird ]; then
+ if [ -d $PREFIX/firebird.old ]; then
+ rm -rf $PREFIX/firebird.old
+ fi
+ mv $PREFIX/firebird $PREFIX/firebird.old
+fi
+
+if [ -L /usr/interbase ]; then
+ rm -f /usr/interbase
+fi
+
+if [ -d /usr/interbase ]; then
+ mv /usr/interbase /usr/interbase.old
+fi
+
+ln -fs $PREFIX/firebird /usr/interbase
+
+perl $SCRIPTDIR/createuser
diff --git a/databases/firebird-devel/scripts/rmservice b/databases/firebird-devel/scripts/rmservice
new file mode 100644
index 000000000000..58adfc17419d
--- /dev/null
+++ b/databases/firebird-devel/scripts/rmservice
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+cp /etc/services /etc/services.old
+cp /etc/inetd.conf /etc/inetd.conf.old
+cat /etc/services |grep -v gds_db >/etc/services.new
+cat /etc/inetd.conf |grep -v gds_db >/etc/inetd.conf.new
+mv /etc/services.new /etc/services
+mv /etc/inetd.conf.new /etc/inetd.conf
diff --git a/databases/firebird-server/Makefile b/databases/firebird-server/Makefile
new file mode 100644
index 000000000000..02cbff7bc2e9
--- /dev/null
+++ b/databases/firebird-server/Makefile
@@ -0,0 +1,63 @@
+# New ports collection makefile for: Firebird
+# Date created: 20 December 2000
+# Whom: Geoffrey C. Speicher <geoff@sea-incorporated.com>
+#
+# $FreeBSD$
+#
+
+PORTNAME= firebird
+PORTVERSION= 0.9
+PORTREVISION= 4
+CATEGORIES= databases
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR=firebird
+DISTFILES= firebird-boot-kit.tar.gz \
+ interbase0.9-4-v5examples.tar.gz \
+ interbase0.9-4src.tar.gz
+
+MAINTAINER= geoff@sea-incorporated.com
+
+WRKSRC= ${WRKDIR}/interbase
+INSTALLS_SHLIB= yes
+LDCONFIG_DIRS= %%PREFIX%%/firebird/lib
+
+ONLY_FOR_ARCHS= i386
+
+do-extract:
+ @${MKDIR} ${WRKDIR}
+ @( \
+ cd ${WRKDIR}; tar zxf ${DISTDIR}/interbase0.9-4src.tar.gz; \
+ cd interbase; tar zxf ${DISTDIR}/firebird-boot-kit.tar.gz; \
+ ${CP} msgs/msg.gbak misc/msg.gbak \
+ )
+
+do-configure:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ INTERBASE=${WRKDIR}/interbase/interbase; export INTERBASE; \
+ REFDBPATH=${WRKDIR}/refDatabases; export REFDBPATH; \
+ ${SH} buildBootDatabases; \
+ ${SH} setup_dirs.boot FREEBSD PROD ${WRKDIR}/refDatabases boot; \
+ )
+
+do-build:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ INTERBASE=${WRKDIR}/interbase/interbase; export INTERBASE; \
+ REFDBPATH=${WRKDIR}/refDatabases; export REFDBPATH; \
+ ${SH} boot.freebsd; \
+ )
+
+do-install:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ ${CP} -Rp interbase ${PREFIX}/firebird; \
+ ${RM} ${PREFIX}/firebird/install; \
+ ${RM} ${PREFIX}/firebird/lib/libgds.so.1.0; \
+ ${LN} -fs gds.so ${PREFIX}/firebird/lib/libgds.so.1; \
+ cd ${PREFIX}/firebird/examples; \
+ tar zxf ${DISTDIR}/interbase0.9-4-v5examples.tar.gz; \
+ ${CP} ${FILESDIR}/RELNOTES ${PREFIX}/firebird/ \
+ )
+
+.include <bsd.port.mk>
diff --git a/databases/firebird-server/distinfo b/databases/firebird-server/distinfo
new file mode 100644
index 000000000000..67c42987376e
--- /dev/null
+++ b/databases/firebird-server/distinfo
@@ -0,0 +1,3 @@
+MD5 (firebird-boot-kit.tar.gz) = 2e18d75539bc4c3d40a1a71509309f64
+MD5 (interbase0.9-4-v5examples.tar.gz) = 17cba82bbf5066d515f2dee97bf8327a
+MD5 (interbase0.9-4src.tar.gz) = d098277ed160e2b6a49d91e1fdb3a652
diff --git a/databases/firebird-server/files/RELNOTES b/databases/firebird-server/files/RELNOTES
new file mode 100644
index 000000000000..3c4e0c62ae58
--- /dev/null
+++ b/databases/firebird-server/files/RELNOTES
@@ -0,0 +1,78 @@
+Firebird 0.9_4 FreeBSD Release Notes 13-Jan-2001
+------------------------------------
+FB-T0.9.4.34 Firebird Test1
+
+Welcome to the FreeBSD Firebird port! Users should note that there
+was a package called `firebird-1.0.tgz' released in mid-August
+2000. Unfortunately, that package was released before Firebird
+version numbering conventions were established, so although the
+version number would suggest that it is newer than the current
+release, it is certainly not. Users of the August 1.0 package
+should upgrade to 0.9_4 or later, which has fixed many bugs and
+security problems, including the recently-discovered back door.
+
+ Firebird originally required a running copy of Firebird (or
+InterBase) in order to build itself. This port uses a boot kit to
+overcome that, so that it does not require itself to build.
+Unfortunately, the side effect of this is that if you have a lock
+manager running from an already-installed version of Firebird or
+InterBase, this port will not build.
+
+ Firebird is installed SUID with owner and group `firebird'.
+This does affect where you can and cannot create databases when
+connecting remotely, as well as which existing databases you can
+access. If you want a database to be available remotely, be sure
+it's readable and writeable to group firebird.
+
+ There may be times when you manage to get your system into a
+state where using any of the Firebird utilites (isql, gbak, gsec,
+etc.) gives you the message "semget failed". One surefire way to
+do this is to build and install the port. :) If this happens,
+make sure that the lock manager is not running and its semaphores
+have been removed. The former can be accomplished with 'ps ax
+|grep gds' and 'kill'; the latter with 'ipcs -s' and 'ipcrm -s'.
+
+ For example, after building and installing the port, you will
+probably go through something like this:
+
+# isql /usr/interbase/isc4.gdb
+Statement failed, SQLCODE = -902
+
+operating system directive semget failed
+-No such file or directory
+
+# ipcs -s
+Semaphores:
+T ID KEY MODE OWNER GROUP
+s 1310720 252034728 --rw-rw-rw- root wheel
+
+# ipcrm -s 1310720
+
+and you should be in business.
+
+ Once this is done, you should be able to connect normally to
+databases. Your first connection will restart the lock manager.
+
+ There may be times, however, when you still get "semget failed"
+even though the lock manager is not running and the semaphores have
+been cleaned up. There seems to be a conflict with this release
+and the PostgreSQL 7 release as installed from the ports collection.
+If you're having trouble with Firebird and you're running PostgreSQL,
+try stopping PostgreSQL:
+
+ /usr/local/etc/rc.d/pgsql.sh stop
+
+and see if that helps.
+
+ Complete documentation for InterBase(tm) is available (free of
+charge) from http://www.interbase.com/ in PDF format. While
+InterBase and Firebird are two distinct entities, all InterBase
+documentation is pertinent to Firebird. More information on Firebird
+and InterBase can be found at the following:
+
+ http://sourceforge.net/projects/firebird/
+ http://www.ibphoenix.com/
+ http://www.interbase2000.org/
+
+Geoff Speicher
+<geoff@sea-incorporated.com>
diff --git a/databases/firebird-server/files/patch-aa b/databases/firebird-server/files/patch-aa
new file mode 100644
index 000000000000..f2db9a68750d
--- /dev/null
+++ b/databases/firebird-server/files/patch-aa
@@ -0,0 +1,11 @@
+--- buildBootDatabases.orig Tue Oct 10 23:00:39 2000
++++ buildBootDatabases Tue Oct 10 23:00:46 2000
+@@ -49,7 +49,7 @@
+ DefaultAns=$2
+ echo -n "${1}"
+ Answer="$DefaultAns"
+- read Answer
++# read Answer
+ }
+
+ #--------------------------------------------------------------------
diff --git a/databases/firebird-server/files/patch-ab b/databases/firebird-server/files/patch-ab
new file mode 100644
index 000000000000..f054a4b23007
--- /dev/null
+++ b/databases/firebird-server/files/patch-ab
@@ -0,0 +1,11 @@
+--- setup_dirs.boot.orig Tue Oct 10 23:00:07 2000
++++ setup_dirs.boot Tue Oct 10 23:00:22 2000
+@@ -49,7 +49,7 @@
+ DefaultAns=$2
+ echo -n "${1}"
+ Answer="$DefaultAns"
+- read Answer
++# read Answer
+ }
+
+
diff --git a/databases/firebird-server/files/patch-ac b/databases/firebird-server/files/patch-ac
new file mode 100644
index 000000000000..bf5de43b75fb
--- /dev/null
+++ b/databases/firebird-server/files/patch-ac
@@ -0,0 +1,58 @@
+--- builds/original/prefix.freebsd 2000/10/08 15:36:25 1.2
++++ builds/original/prefix.freebsd 2001/01/11 19:17:58
+@@ -28,7 +28,7 @@
+
+
+ PROD_DEBUG_OBJECTS= nodebug.o
+-PROD_SHRLIB_DIR=
++PROD_SHRLIB_DIR= -Lsource/jrd
+ PROD_VERSION_FLAG= -DPROD_BUILD
+ PROD_CFLAGS= -O -m486 -fpic -DFLINTSTONE
+
+@@ -48,7 +48,7 @@
+ UDF_LINK_CMD= gcc
+ UDF_CFLAGS= -fPIC -mieee-fp
+ UDF_LFLAGS= -shared
+-UDF_SHRLIBS= -L/usr/local/lib -lgds -lm -lc -mieee-fp -ldescrypt
++UDF_SHRLIBS= $(SHRLIB_DIR) -lgds -lm -lc -mieee-fp -ldescrypt
+
+ #NOTE: PIC_J_CFLAGS is special CFLAGS used to build PIPD_IS_SHRLIB modules
+ # to workaround the Solaris threading problems with signals
+@@ -69,16 +69,14 @@
+ FUNCTIONS= functions.bin
+ FUNCSHR= source/interbase/lib/gdsf.so
+ GDS_LINK= $(GDSSHR_LINK)
+-#GDS_PYXIS=
+ GDS_PYXIS= gds_pyxis.a
+ GDSLIB_BACKEND= source/interbase/lib/gds_b.a
+ GDSLIB_LINK= -Lsource/jrd -lgds_b -lc -ldescrypt
+
+ GDSSHR= source/interbase/lib/gds.so
+ LINUX_GDSSHR= $(GDSSHR)
+-GDSSHR_LINK= $(SHRLIB_DIR) -L/usr/local/lib -lgds -lgds_pyxis -ldescrypt
+-PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -L/usr/local/lib -lgds -lgds_pyxis
+-#PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis
++GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis -ldescrypt
++PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis
+ HLPDIR= source/qli/
+ HOSTNAME= `hostname | cut -d'.' -f1`
+ INCLUDES= include_so include_so_ada
+@@ -106,11 +104,6 @@
+ MUISQL_LINK_OPTS= $(MUISQL_MU_LIB) $(PIPE_GDSSHR_LINK) -lm
+ PIC_FLAGS= $(CFLAGS) -fPIC
+ PIPE= gds.a gds_pipe
+-#PYXIS=
+-#PYXIS_MISC_OBJS=
+-#PYXIS_P_MISC_OBJS=
+-#PYXIS_OBJECTS=
+-#PYXIS_MISC_OBJECTS=
+ PYXIS= pyxis
+ PYXIS_MISC_OBJS= $(PYXIS_MISC)
+ PYXIS_P_MISC_OBJS= $(PYXIS_P_MISC)
+@@ -167,5 +160,8 @@
+ SHRLIB_EXT= .so
+
+ V3PRINTER= source/lock/printv3.o
++
++# Forces library build for FreeBSD
++PYXIS_LIBRARY= libpyxis.a
diff --git a/databases/firebird-server/pkg-comment b/databases/firebird-server/pkg-comment
new file mode 100644
index 000000000000..f8cb5bc1d7b3
--- /dev/null
+++ b/databases/firebird-server/pkg-comment
@@ -0,0 +1 @@
+The open-source InterBase(tm) 6.0 spin-off (Classic version)
diff --git a/databases/firebird-server/pkg-descr b/databases/firebird-server/pkg-descr
new file mode 100644
index 000000000000..5f05e046a387
--- /dev/null
+++ b/databases/firebird-server/pkg-descr
@@ -0,0 +1,22 @@
+The open-source InterBase(tm) 6.0 spin-off (Classic server version)
+
+InterBase is a world-class DBMS with a history too rich to detail
+here. Once selling for several thousands of dollars per license,
+some very big players use it worldwide. Inprise has open-sourced
+InterBase 6.0, and a lively bunch of folks has charged themselves
+with seeing that it lives on through the Firebird project.
+
+Note that as of Firebird 0.9_4, the locksmith back door has
+been closed.
+
+For more information on Firebird and InterBase, see:
+http://www.ibphoenix.com/
+http://www.interbase2000.org/
+http://www.interbase.com/
+
+and of course the firebird page itself:
+WWW: http://sourceforge.net/projects/firebird/
+
+For more information on the locksmith back door, see:
+
+https://www.kb.cert.org/vuls/id/247371
diff --git a/databases/firebird-server/pkg-install b/databases/firebird-server/pkg-install
new file mode 100644
index 000000000000..c40e25e88ffc
--- /dev/null
+++ b/databases/firebird-server/pkg-install
@@ -0,0 +1,145 @@
+#!/bin/sh
+
+# Created in haste by smashing together various
+# files from the port scripts.
+
+if [ "$2" = "PRE-INSTALL" ]; then
+if [ -d $PKG_PREFIX/firebird ]; then
+ if [ -d $PKG_PREFIX/firebird.old ]; then
+ rm -rf $PKG_PREFIX/firebird.old
+ fi
+ mv $PKG_PREFIX/firebird $PKG_PREFIX/firebird.old
+fi
+
+if [ -L /usr/interbase ]; then
+ rm -f /usr/interbase
+fi
+
+if [ -d /usr/interbase ]; then
+ mv /usr/interbase /usr/interbase.old
+fi
+
+ln -fs $PKG_PREFIX/firebird /usr/interbase
+
+perl <<EOF
+eval '(exit \$?0)' && eval 'exec /usr/bin/perl -S \$0 \${1+"\$@"}'
+& eval 'exec /usr/bin/perl -S \$0 \$argv:q'
+if 0;
+
+if( \$> ) {
+ print "\nYou must be root to run this step!\n\n";
+ exit 1;
+}
+
+if( getpwnam( "firebird" ) ) {
+ ( \$null, \$null, \$fbUID ) = getpwnam( "firebird" );
+} else {
+ \$fbUID = 90;
+ while( getpwuid( \$fbUID ) ) {
+ \$fbUID++;
+ }
+}
+
+if( getgrnam( "firebird" ) ) {
+ ( \$null, \$null, \$fbGID ) = getgrnam( "firebird" );
+} else {
+ \$fbGID = 90;
+ while( getgrgid( \$fbGID ) ) {
+ \$fbGID++;
+ }
+ &append_file( "/etc/group", "firebird:*:\$fbGID:" );
+}
+
+print "firebird user using uid \$fbUID\n";
+print "firebird user using gid \$fbGID\n";
+
+system( "/usr/bin/chpass -a \"firebird:*:\$fbUID:\$fbGID\:\:0:0:Firebird pseudo-user:\$ENV{'PKG_PREFIX'}/firebird:/bin/sh\"" );
+
+sub append_file {
+ local(\$file,@list) = @_;
+ local(\$LOCK_EX) = 2;
+ local(\$LOCK_NB) = 4;
+ local(\$LOCK_UN) = 8;
+
+ open(F, ">> \$file") || die "\$file: \$!\n";
+ while( ! flock( F, \$LOCK_EX | \$LOCK_NB ) ) {
+ exit 1;
+ }
+ print F join( "\n", @list) . "\n";
+ close F;
+ flock( F, \$LOCK_UN );
+}
+EOF
+elif [ "$2" = "POST-INSTALL" ]; then
+chown -R firebird:firebird $PKG_PREFIX/firebird
+
+# Turn everybody to read only.
+chmod -R o=r $PKG_PREFIX/firebird
+
+# Now fix up the mess.
+
+# fix up directories
+for i in `find $PKG_PREFIX/firebird -print`
+ do
+ FileName=$i
+ if [ -d $FileName ]
+ then
+ chmod o=rx $FileName
+ fi
+ done
+
+
+
+cd $PKG_PREFIX/firebird/bin
+
+# all users can run everything.
+chmod o=rx *
+
+# SUID is needed for running server programs.
+
+for i in gds_lock_mgr gds_drop gds_inet_server
+ do
+ chmod ug+s $i
+ done
+
+
+# Lock files
+
+cd $PKG_PREFIX/firebird
+
+for i in isc_init1 isc_lock1 isc_event1
+ do
+ FileName=$i.`hostname`
+ touch $FileName
+ chmod uga=rw $FileName
+ chown firebird:firebird $FileName
+ done
+
+
+touch interbase.log
+chmod ugo=rw interbase.log
+
+# make databases writable by all
+chmod ugo=rw examples/v5/*.gdb
+chmod ugo=rw help/*.gdb
+chmod ugo=rw isc4.gdb
+
+# remove any existing gds service
+cp /etc/services /etc/services.old
+cp /etc/inetd.conf /etc/inetd.conf.old
+cat /etc/services |grep -v gds_db >/etc/services.new
+cat /etc/inetd.conf |grep -v gds_db >/etc/inetd.conf.new
+mv /etc/services.new /etc/services
+mv /etc/inetd.conf.new /etc/inetd.conf
+
+# add the gds service and restart inetd
+cat >>/etc/services <<EOF
+gds_db 3050/tcp #InterBase Database Remote Protocol
+EOF
+cat >>/etc/inetd.conf <<EOF
+gds_db stream tcp nowait firebird /usr/interbase/bin/gds_inet_server gds_inet_server
+EOF
+kill -HUP `cat /var/run/inetd.pid`
+kill -HUP `cat /var/run/inetd.pid`
+
+fi
diff --git a/databases/firebird-server/pkg-message b/databases/firebird-server/pkg-message
new file mode 100644
index 000000000000..f15892a06aaa
--- /dev/null
+++ b/databases/firebird-server/pkg-message
@@ -0,0 +1,19 @@
+
+---------------------------------------------------------
+Firebird is now installed. There is a symbolic link from
+/usr/interbase -> %%PREFIX%%/firebird. Firebird needs this
+link for proper operation.
+
+It is STRONGLY recommended that you change the SYSDBA
+password with:
+
+$ cd /usr/interbase
+$ gsec -user SYSDBA -pass masterkey
+GSEC> modify SYSDBA -pw newpassword
+GSEC> quit
+
+before doing anything serious with Firebird.
+
+See %%PREFIX%%/firebird/RELNOTES for more.
+---------------------------------------------------------
+
diff --git a/databases/firebird-server/pkg-plist b/databases/firebird-server/pkg-plist
new file mode 100644
index 000000000000..66150c5bde26
--- /dev/null
+++ b/databases/firebird-server/pkg-plist
@@ -0,0 +1,104 @@
+firebird/intl/gdsintl
+firebird/examples/v5/ib_udf.sql
+firebird/examples/v5/README
+firebird/examples/v5/align.h
+firebird/examples/v5/api1.c
+firebird/examples/v5/api10.c
+firebird/examples/v5/api11.c
+firebird/examples/v5/api12.c
+firebird/examples/v5/api13.c
+firebird/examples/v5/api14.e
+firebird/examples/v5/api15.c
+firebird/examples/v5/api16.c
+firebird/examples/v5/api16t.c
+firebird/examples/v5/api2.c
+firebird/examples/v5/api3.c
+firebird/examples/v5/api4.c
+firebird/examples/v5/api5.c
+firebird/examples/v5/api6.c
+firebird/examples/v5/api7.c
+firebird/examples/v5/api8.c
+firebird/examples/v5/api9.c
+firebird/examples/v5/api9f.c
+firebird/examples/v5/apifull.c
+firebird/examples/v5/employe2.sql
+firebird/examples/v5/dyn1.e
+firebird/examples/v5/dyn2.e
+firebird/examples/v5/dyn3.e
+firebird/examples/v5/dyn4.e
+firebird/examples/v5/dyn5.e
+firebird/examples/v5/dynfull.e
+firebird/examples/v5/employee.gbk
+firebird/examples/v5/employee.gdb
+firebird/examples/v5/example.h
+firebird/examples/v5/api9f.sql
+firebird/examples/v5/intlemp.gbk
+firebird/examples/v5/intlemp.gdb
+firebird/examples/v5/stat1.e
+firebird/examples/v5/stat10.e
+firebird/examples/v5/stat11.e
+firebird/examples/v5/stat12.e
+firebird/examples/v5/stat12t.e
+firebird/examples/v5/stat2.e
+firebird/examples/v5/stat3.e
+firebird/examples/v5/stat4.e
+firebird/examples/v5/stat5.e
+firebird/examples/v5/stat6.e
+firebird/examples/v5/stat7.e
+firebird/examples/v5/stat8.e
+firebird/examples/v5/stat9.e
+firebird/examples/v5/udf.sql
+firebird/examples/v5/udflib.c
+firebird/examples/v5/makefile
+firebird/include/perf.h
+firebird/include/ib_util.h
+firebird/include/gds.hxx
+firebird/include/gds.h
+firebird/include/ibase.h
+firebird/include/iberror.h
+firebird/include/gds.f
+firebird/UDF/ib_udf
+firebird/lib/ib_util.so
+firebird/lib/gds.a
+firebird/lib/gds.so
+firebird/lib/libgds.so
+firebird/lib/libgds.so.1
+firebird/lib/libgds_pyxis.a
+firebird/lib/libgds.a
+firebird/lib/gds_pyxis.a
+firebird/help/help.gbak
+firebird/help/help.gdb
+firebird/bin/isc4.gbak
+firebird/bin/gpre
+firebird/bin/gds_pipe
+firebird/bin/gds_drop
+firebird/bin/gds_lock_mgr
+firebird/bin/gfix
+firebird/bin/gdef
+firebird/bin/isql
+firebird/bin/gds_lock_print
+firebird/bin/qli
+firebird/bin/gds_inet_server
+firebird/bin/gsplit
+firebird/bin/gstat
+firebird/bin/gds_relay
+firebird/bin/gsec
+firebird/bin/gbak
+firebird/services.isc
+firebird/isc_config
+firebird/isc4.gdb
+firebird/interbase.msg
+firebird/interbase.log
+firebird/inetd.conf.isc
+firebird/RELNOTES
+@dirrm firebird
+@dirrm firebird/intl
+@dirrm firebird/examples/v3
+@dirrm firebird/examples/v4
+@dirrm firebird/examples/v5
+@dirrm firebird/examples
+@dirrm firebird/include
+@dirrm firebird/UDF
+@dirrm firebird/lib
+@dirrm firebird/help
+@dirrm firebird/bin
diff --git a/databases/firebird-server/scripts/addservice b/databases/firebird-server/scripts/addservice
new file mode 100644
index 000000000000..df9aea5e91de
--- /dev/null
+++ b/databases/firebird-server/scripts/addservice
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+cat >>/etc/services <<EOF
+gds_db 3050/tcp #InterBase Database Remote Protocol
+EOF
+cat >>/etc/inetd.conf <<EOF
+gds_db stream tcp nowait firebird /usr/interbase/bin/gds_inet_server gds_inet_server
+EOF
+kill -HUP `cat /var/run/inetd.pid`
diff --git a/databases/firebird-server/scripts/createuser b/databases/firebird-server/scripts/createuser
new file mode 100644
index 000000000000..b61d47fd84bd
--- /dev/null
+++ b/databases/firebird-server/scripts/createuser
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+#
+
+eval '(exit $?0)' && eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
+& eval 'exec /usr/bin/perl -S $0 $argv:q'
+if 0;
+
+if( $> ) {
+ print "\nYou must be root to run this step!\n\n";
+ exit 1;
+}
+
+if( getpwnam( "firebird" ) ) {
+ ( $null, $null, $fbUID ) = getpwnam( "firebird" );
+} else {
+ $fbUID = 90;
+ while( getpwuid( $fbUID ) ) {
+ $fbUID++;
+ }
+}
+
+if( getgrnam( "firebird" ) ) {
+ ( $null, $null, $fbGID ) = getgrnam( "firebird" );
+} else {
+ $fbGID = 90;
+ while( getgrgid( $fbGID ) ) {
+ $fbGID++;
+ }
+ &append_file( "/etc/group", "firebird:*:$fbGID:" );
+}
+
+print "firebird user using uid $fbUID\n";
+print "firebird user using gid $fbGID\n";
+
+system( "/usr/bin/chpass -a \"firebird:*:$fbUID:$fbGID\:\:0:0:Firebird pseudo-user:$ENV{'PREFIX'}/firebird:/bin/sh\"" );
+
+sub append_file {
+ local($file,@list) = @_;
+ local($LOCK_EX) = 2;
+ local($LOCK_NB) = 4;
+ local($LOCK_UN) = 8;
+
+ open(F, ">> $file") || die "$file: $!\n";
+ while( ! flock( F, $LOCK_EX | $LOCK_NB ) ) {
+ exit 1;
+ }
+ print F join( "\n", @list) . "\n";
+ close F;
+ flock( F, $LOCK_UN );
+}
diff --git a/databases/firebird-server/scripts/post-install b/databases/firebird-server/scripts/post-install
new file mode 100644
index 000000000000..e4d2d3a9cd07
--- /dev/null
+++ b/databases/firebird-server/scripts/post-install
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+chown -R firebird:firebird $PREFIX/firebird
+
+# Turn everybody to read only.
+chmod -R o=r $PREFIX/firebird
+
+# Now fix up the mess.
+
+# fix up directories
+for i in `find $PREFIX/firebird -print`
+ do
+ FileName=$i
+ if [ -d $FileName ]
+ then
+ chmod o=rx $FileName
+ fi
+ done
+
+
+
+cd $PREFIX/firebird/bin
+
+# all users can run everything.
+chmod o=rx *
+
+# SUID is needed for running server programs.
+
+for i in gds_lock_mgr gds_drop gds_inet_server
+ do
+ chmod ug+s $i
+ done
+
+
+# Lock files
+
+cd $PREFIX/firebird
+
+for i in isc_init1 isc_lock1 isc_event1
+ do
+ FileName=$i.`hostname`
+ touch $FileName
+ chmod uga=rw $FileName
+ chown firebird:firebird $FileName
+ done
+
+
+touch interbase.log
+chmod ugo=rw interbase.log
+
+# make databases writable by all
+chmod ugo=rw examples/v5/*.gdb
+chmod ugo=rw help/*.gdb
+chmod ugo=rw isc4.gdb
+
+# remove any existing gds service
+sh $SCRIPTDIR/rmservice
+
+# add the gds service and restart inetd
+sh $SCRIPTDIR/addservice
+kill -HUP `cat /var/run/inetd.pid`
+
+sed "s|%%PREFIX%%|$PREFIX|" $SCRIPTDIR/../pkg-message
+
+cat <<EOF
+
+==========================================================
+!! NOTE !!
+
+As there are some oddities to the Firebird build process,
+it is likely you WILL NOT BE ABLE TO USE IT until you
+remove the semaphore created during the build process.
+Please read $PREFIX/firebird/RELNOTES for more information.
+==========================================================
+
+EOF
diff --git a/databases/firebird-server/scripts/pre-build b/databases/firebird-server/scripts/pre-build
new file mode 100644
index 000000000000..6605df7770fd
--- /dev/null
+++ b/databases/firebird-server/scripts/pre-build
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+GDS_LOCK_MGR=`ps ax |grep gds_lock_mgr |grep -v grep`;
+
+if [ "$GDS_LOCK_MGR" != "" ]; then
+ echo "It appears you have a gds_lock_manager already running.";
+ echo;
+ echo "You must cease all InterBase operations to build this port.";
+ echo "Make sure nobody is connected to any databases, then use";
+ echo "'gds_drop -a' and manually verify (with ipcs) that the";
+ echo "semaphores were removed.";
+ exit 1;
+fi
+exit 0
+
diff --git a/databases/firebird-server/scripts/pre-install b/databases/firebird-server/scripts/pre-install
new file mode 100644
index 000000000000..a6e1b37a9008
--- /dev/null
+++ b/databases/firebird-server/scripts/pre-install
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+if [ -d $PREFIX/firebird ]; then
+ if [ -d $PREFIX/firebird.old ]; then
+ rm -rf $PREFIX/firebird.old
+ fi
+ mv $PREFIX/firebird $PREFIX/firebird.old
+fi
+
+if [ -L /usr/interbase ]; then
+ rm -f /usr/interbase
+fi
+
+if [ -d /usr/interbase ]; then
+ mv /usr/interbase /usr/interbase.old
+fi
+
+ln -fs $PREFIX/firebird /usr/interbase
+
+perl $SCRIPTDIR/createuser
diff --git a/databases/firebird-server/scripts/rmservice b/databases/firebird-server/scripts/rmservice
new file mode 100644
index 000000000000..58adfc17419d
--- /dev/null
+++ b/databases/firebird-server/scripts/rmservice
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+cp /etc/services /etc/services.old
+cp /etc/inetd.conf /etc/inetd.conf.old
+cat /etc/services |grep -v gds_db >/etc/services.new
+cat /etc/inetd.conf |grep -v gds_db >/etc/inetd.conf.new
+mv /etc/services.new /etc/services
+mv /etc/inetd.conf.new /etc/inetd.conf
diff --git a/databases/firebird/Makefile b/databases/firebird/Makefile
new file mode 100644
index 000000000000..02cbff7bc2e9
--- /dev/null
+++ b/databases/firebird/Makefile
@@ -0,0 +1,63 @@
+# New ports collection makefile for: Firebird
+# Date created: 20 December 2000
+# Whom: Geoffrey C. Speicher <geoff@sea-incorporated.com>
+#
+# $FreeBSD$
+#
+
+PORTNAME= firebird
+PORTVERSION= 0.9
+PORTREVISION= 4
+CATEGORIES= databases
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR=firebird
+DISTFILES= firebird-boot-kit.tar.gz \
+ interbase0.9-4-v5examples.tar.gz \
+ interbase0.9-4src.tar.gz
+
+MAINTAINER= geoff@sea-incorporated.com
+
+WRKSRC= ${WRKDIR}/interbase
+INSTALLS_SHLIB= yes
+LDCONFIG_DIRS= %%PREFIX%%/firebird/lib
+
+ONLY_FOR_ARCHS= i386
+
+do-extract:
+ @${MKDIR} ${WRKDIR}
+ @( \
+ cd ${WRKDIR}; tar zxf ${DISTDIR}/interbase0.9-4src.tar.gz; \
+ cd interbase; tar zxf ${DISTDIR}/firebird-boot-kit.tar.gz; \
+ ${CP} msgs/msg.gbak misc/msg.gbak \
+ )
+
+do-configure:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ INTERBASE=${WRKDIR}/interbase/interbase; export INTERBASE; \
+ REFDBPATH=${WRKDIR}/refDatabases; export REFDBPATH; \
+ ${SH} buildBootDatabases; \
+ ${SH} setup_dirs.boot FREEBSD PROD ${WRKDIR}/refDatabases boot; \
+ )
+
+do-build:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ INTERBASE=${WRKDIR}/interbase/interbase; export INTERBASE; \
+ REFDBPATH=${WRKDIR}/refDatabases; export REFDBPATH; \
+ ${SH} boot.freebsd; \
+ )
+
+do-install:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ ${CP} -Rp interbase ${PREFIX}/firebird; \
+ ${RM} ${PREFIX}/firebird/install; \
+ ${RM} ${PREFIX}/firebird/lib/libgds.so.1.0; \
+ ${LN} -fs gds.so ${PREFIX}/firebird/lib/libgds.so.1; \
+ cd ${PREFIX}/firebird/examples; \
+ tar zxf ${DISTDIR}/interbase0.9-4-v5examples.tar.gz; \
+ ${CP} ${FILESDIR}/RELNOTES ${PREFIX}/firebird/ \
+ )
+
+.include <bsd.port.mk>
diff --git a/databases/firebird/distinfo b/databases/firebird/distinfo
new file mode 100644
index 000000000000..67c42987376e
--- /dev/null
+++ b/databases/firebird/distinfo
@@ -0,0 +1,3 @@
+MD5 (firebird-boot-kit.tar.gz) = 2e18d75539bc4c3d40a1a71509309f64
+MD5 (interbase0.9-4-v5examples.tar.gz) = 17cba82bbf5066d515f2dee97bf8327a
+MD5 (interbase0.9-4src.tar.gz) = d098277ed160e2b6a49d91e1fdb3a652
diff --git a/databases/firebird/files/RELNOTES b/databases/firebird/files/RELNOTES
new file mode 100644
index 000000000000..3c4e0c62ae58
--- /dev/null
+++ b/databases/firebird/files/RELNOTES
@@ -0,0 +1,78 @@
+Firebird 0.9_4 FreeBSD Release Notes 13-Jan-2001
+------------------------------------
+FB-T0.9.4.34 Firebird Test1
+
+Welcome to the FreeBSD Firebird port! Users should note that there
+was a package called `firebird-1.0.tgz' released in mid-August
+2000. Unfortunately, that package was released before Firebird
+version numbering conventions were established, so although the
+version number would suggest that it is newer than the current
+release, it is certainly not. Users of the August 1.0 package
+should upgrade to 0.9_4 or later, which has fixed many bugs and
+security problems, including the recently-discovered back door.
+
+ Firebird originally required a running copy of Firebird (or
+InterBase) in order to build itself. This port uses a boot kit to
+overcome that, so that it does not require itself to build.
+Unfortunately, the side effect of this is that if you have a lock
+manager running from an already-installed version of Firebird or
+InterBase, this port will not build.
+
+ Firebird is installed SUID with owner and group `firebird'.
+This does affect where you can and cannot create databases when
+connecting remotely, as well as which existing databases you can
+access. If you want a database to be available remotely, be sure
+it's readable and writeable to group firebird.
+
+ There may be times when you manage to get your system into a
+state where using any of the Firebird utilites (isql, gbak, gsec,
+etc.) gives you the message "semget failed". One surefire way to
+do this is to build and install the port. :) If this happens,
+make sure that the lock manager is not running and its semaphores
+have been removed. The former can be accomplished with 'ps ax
+|grep gds' and 'kill'; the latter with 'ipcs -s' and 'ipcrm -s'.
+
+ For example, after building and installing the port, you will
+probably go through something like this:
+
+# isql /usr/interbase/isc4.gdb
+Statement failed, SQLCODE = -902
+
+operating system directive semget failed
+-No such file or directory
+
+# ipcs -s
+Semaphores:
+T ID KEY MODE OWNER GROUP
+s 1310720 252034728 --rw-rw-rw- root wheel
+
+# ipcrm -s 1310720
+
+and you should be in business.
+
+ Once this is done, you should be able to connect normally to
+databases. Your first connection will restart the lock manager.
+
+ There may be times, however, when you still get "semget failed"
+even though the lock manager is not running and the semaphores have
+been cleaned up. There seems to be a conflict with this release
+and the PostgreSQL 7 release as installed from the ports collection.
+If you're having trouble with Firebird and you're running PostgreSQL,
+try stopping PostgreSQL:
+
+ /usr/local/etc/rc.d/pgsql.sh stop
+
+and see if that helps.
+
+ Complete documentation for InterBase(tm) is available (free of
+charge) from http://www.interbase.com/ in PDF format. While
+InterBase and Firebird are two distinct entities, all InterBase
+documentation is pertinent to Firebird. More information on Firebird
+and InterBase can be found at the following:
+
+ http://sourceforge.net/projects/firebird/
+ http://www.ibphoenix.com/
+ http://www.interbase2000.org/
+
+Geoff Speicher
+<geoff@sea-incorporated.com>
diff --git a/databases/firebird/files/patch-aa b/databases/firebird/files/patch-aa
new file mode 100644
index 000000000000..f2db9a68750d
--- /dev/null
+++ b/databases/firebird/files/patch-aa
@@ -0,0 +1,11 @@
+--- buildBootDatabases.orig Tue Oct 10 23:00:39 2000
++++ buildBootDatabases Tue Oct 10 23:00:46 2000
+@@ -49,7 +49,7 @@
+ DefaultAns=$2
+ echo -n "${1}"
+ Answer="$DefaultAns"
+- read Answer
++# read Answer
+ }
+
+ #--------------------------------------------------------------------
diff --git a/databases/firebird/files/patch-ab b/databases/firebird/files/patch-ab
new file mode 100644
index 000000000000..f054a4b23007
--- /dev/null
+++ b/databases/firebird/files/patch-ab
@@ -0,0 +1,11 @@
+--- setup_dirs.boot.orig Tue Oct 10 23:00:07 2000
++++ setup_dirs.boot Tue Oct 10 23:00:22 2000
+@@ -49,7 +49,7 @@
+ DefaultAns=$2
+ echo -n "${1}"
+ Answer="$DefaultAns"
+- read Answer
++# read Answer
+ }
+
+
diff --git a/databases/firebird/files/patch-ac b/databases/firebird/files/patch-ac
new file mode 100644
index 000000000000..bf5de43b75fb
--- /dev/null
+++ b/databases/firebird/files/patch-ac
@@ -0,0 +1,58 @@
+--- builds/original/prefix.freebsd 2000/10/08 15:36:25 1.2
++++ builds/original/prefix.freebsd 2001/01/11 19:17:58
+@@ -28,7 +28,7 @@
+
+
+ PROD_DEBUG_OBJECTS= nodebug.o
+-PROD_SHRLIB_DIR=
++PROD_SHRLIB_DIR= -Lsource/jrd
+ PROD_VERSION_FLAG= -DPROD_BUILD
+ PROD_CFLAGS= -O -m486 -fpic -DFLINTSTONE
+
+@@ -48,7 +48,7 @@
+ UDF_LINK_CMD= gcc
+ UDF_CFLAGS= -fPIC -mieee-fp
+ UDF_LFLAGS= -shared
+-UDF_SHRLIBS= -L/usr/local/lib -lgds -lm -lc -mieee-fp -ldescrypt
++UDF_SHRLIBS= $(SHRLIB_DIR) -lgds -lm -lc -mieee-fp -ldescrypt
+
+ #NOTE: PIC_J_CFLAGS is special CFLAGS used to build PIPD_IS_SHRLIB modules
+ # to workaround the Solaris threading problems with signals
+@@ -69,16 +69,14 @@
+ FUNCTIONS= functions.bin
+ FUNCSHR= source/interbase/lib/gdsf.so
+ GDS_LINK= $(GDSSHR_LINK)
+-#GDS_PYXIS=
+ GDS_PYXIS= gds_pyxis.a
+ GDSLIB_BACKEND= source/interbase/lib/gds_b.a
+ GDSLIB_LINK= -Lsource/jrd -lgds_b -lc -ldescrypt
+
+ GDSSHR= source/interbase/lib/gds.so
+ LINUX_GDSSHR= $(GDSSHR)
+-GDSSHR_LINK= $(SHRLIB_DIR) -L/usr/local/lib -lgds -lgds_pyxis -ldescrypt
+-PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -L/usr/local/lib -lgds -lgds_pyxis
+-#PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis
++GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis -ldescrypt
++PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis
+ HLPDIR= source/qli/
+ HOSTNAME= `hostname | cut -d'.' -f1`
+ INCLUDES= include_so include_so_ada
+@@ -106,11 +104,6 @@
+ MUISQL_LINK_OPTS= $(MUISQL_MU_LIB) $(PIPE_GDSSHR_LINK) -lm
+ PIC_FLAGS= $(CFLAGS) -fPIC
+ PIPE= gds.a gds_pipe
+-#PYXIS=
+-#PYXIS_MISC_OBJS=
+-#PYXIS_P_MISC_OBJS=
+-#PYXIS_OBJECTS=
+-#PYXIS_MISC_OBJECTS=
+ PYXIS= pyxis
+ PYXIS_MISC_OBJS= $(PYXIS_MISC)
+ PYXIS_P_MISC_OBJS= $(PYXIS_P_MISC)
+@@ -167,5 +160,8 @@
+ SHRLIB_EXT= .so
+
+ V3PRINTER= source/lock/printv3.o
++
++# Forces library build for FreeBSD
++PYXIS_LIBRARY= libpyxis.a
diff --git a/databases/firebird/pkg-comment b/databases/firebird/pkg-comment
new file mode 100644
index 000000000000..f8cb5bc1d7b3
--- /dev/null
+++ b/databases/firebird/pkg-comment
@@ -0,0 +1 @@
+The open-source InterBase(tm) 6.0 spin-off (Classic version)
diff --git a/databases/firebird/pkg-descr b/databases/firebird/pkg-descr
new file mode 100644
index 000000000000..5f05e046a387
--- /dev/null
+++ b/databases/firebird/pkg-descr
@@ -0,0 +1,22 @@
+The open-source InterBase(tm) 6.0 spin-off (Classic server version)
+
+InterBase is a world-class DBMS with a history too rich to detail
+here. Once selling for several thousands of dollars per license,
+some very big players use it worldwide. Inprise has open-sourced
+InterBase 6.0, and a lively bunch of folks has charged themselves
+with seeing that it lives on through the Firebird project.
+
+Note that as of Firebird 0.9_4, the locksmith back door has
+been closed.
+
+For more information on Firebird and InterBase, see:
+http://www.ibphoenix.com/
+http://www.interbase2000.org/
+http://www.interbase.com/
+
+and of course the firebird page itself:
+WWW: http://sourceforge.net/projects/firebird/
+
+For more information on the locksmith back door, see:
+
+https://www.kb.cert.org/vuls/id/247371
diff --git a/databases/firebird/pkg-install b/databases/firebird/pkg-install
new file mode 100644
index 000000000000..c40e25e88ffc
--- /dev/null
+++ b/databases/firebird/pkg-install
@@ -0,0 +1,145 @@
+#!/bin/sh
+
+# Created in haste by smashing together various
+# files from the port scripts.
+
+if [ "$2" = "PRE-INSTALL" ]; then
+if [ -d $PKG_PREFIX/firebird ]; then
+ if [ -d $PKG_PREFIX/firebird.old ]; then
+ rm -rf $PKG_PREFIX/firebird.old
+ fi
+ mv $PKG_PREFIX/firebird $PKG_PREFIX/firebird.old
+fi
+
+if [ -L /usr/interbase ]; then
+ rm -f /usr/interbase
+fi
+
+if [ -d /usr/interbase ]; then
+ mv /usr/interbase /usr/interbase.old
+fi
+
+ln -fs $PKG_PREFIX/firebird /usr/interbase
+
+perl <<EOF
+eval '(exit \$?0)' && eval 'exec /usr/bin/perl -S \$0 \${1+"\$@"}'
+& eval 'exec /usr/bin/perl -S \$0 \$argv:q'
+if 0;
+
+if( \$> ) {
+ print "\nYou must be root to run this step!\n\n";
+ exit 1;
+}
+
+if( getpwnam( "firebird" ) ) {
+ ( \$null, \$null, \$fbUID ) = getpwnam( "firebird" );
+} else {
+ \$fbUID = 90;
+ while( getpwuid( \$fbUID ) ) {
+ \$fbUID++;
+ }
+}
+
+if( getgrnam( "firebird" ) ) {
+ ( \$null, \$null, \$fbGID ) = getgrnam( "firebird" );
+} else {
+ \$fbGID = 90;
+ while( getgrgid( \$fbGID ) ) {
+ \$fbGID++;
+ }
+ &append_file( "/etc/group", "firebird:*:\$fbGID:" );
+}
+
+print "firebird user using uid \$fbUID\n";
+print "firebird user using gid \$fbGID\n";
+
+system( "/usr/bin/chpass -a \"firebird:*:\$fbUID:\$fbGID\:\:0:0:Firebird pseudo-user:\$ENV{'PKG_PREFIX'}/firebird:/bin/sh\"" );
+
+sub append_file {
+ local(\$file,@list) = @_;
+ local(\$LOCK_EX) = 2;
+ local(\$LOCK_NB) = 4;
+ local(\$LOCK_UN) = 8;
+
+ open(F, ">> \$file") || die "\$file: \$!\n";
+ while( ! flock( F, \$LOCK_EX | \$LOCK_NB ) ) {
+ exit 1;
+ }
+ print F join( "\n", @list) . "\n";
+ close F;
+ flock( F, \$LOCK_UN );
+}
+EOF
+elif [ "$2" = "POST-INSTALL" ]; then
+chown -R firebird:firebird $PKG_PREFIX/firebird
+
+# Turn everybody to read only.
+chmod -R o=r $PKG_PREFIX/firebird
+
+# Now fix up the mess.
+
+# fix up directories
+for i in `find $PKG_PREFIX/firebird -print`
+ do
+ FileName=$i
+ if [ -d $FileName ]
+ then
+ chmod o=rx $FileName
+ fi
+ done
+
+
+
+cd $PKG_PREFIX/firebird/bin
+
+# all users can run everything.
+chmod o=rx *
+
+# SUID is needed for running server programs.
+
+for i in gds_lock_mgr gds_drop gds_inet_server
+ do
+ chmod ug+s $i
+ done
+
+
+# Lock files
+
+cd $PKG_PREFIX/firebird
+
+for i in isc_init1 isc_lock1 isc_event1
+ do
+ FileName=$i.`hostname`
+ touch $FileName
+ chmod uga=rw $FileName
+ chown firebird:firebird $FileName
+ done
+
+
+touch interbase.log
+chmod ugo=rw interbase.log
+
+# make databases writable by all
+chmod ugo=rw examples/v5/*.gdb
+chmod ugo=rw help/*.gdb
+chmod ugo=rw isc4.gdb
+
+# remove any existing gds service
+cp /etc/services /etc/services.old
+cp /etc/inetd.conf /etc/inetd.conf.old
+cat /etc/services |grep -v gds_db >/etc/services.new
+cat /etc/inetd.conf |grep -v gds_db >/etc/inetd.conf.new
+mv /etc/services.new /etc/services
+mv /etc/inetd.conf.new /etc/inetd.conf
+
+# add the gds service and restart inetd
+cat >>/etc/services <<EOF
+gds_db 3050/tcp #InterBase Database Remote Protocol
+EOF
+cat >>/etc/inetd.conf <<EOF
+gds_db stream tcp nowait firebird /usr/interbase/bin/gds_inet_server gds_inet_server
+EOF
+kill -HUP `cat /var/run/inetd.pid`
+kill -HUP `cat /var/run/inetd.pid`
+
+fi
diff --git a/databases/firebird/pkg-message b/databases/firebird/pkg-message
new file mode 100644
index 000000000000..f15892a06aaa
--- /dev/null
+++ b/databases/firebird/pkg-message
@@ -0,0 +1,19 @@
+
+---------------------------------------------------------
+Firebird is now installed. There is a symbolic link from
+/usr/interbase -> %%PREFIX%%/firebird. Firebird needs this
+link for proper operation.
+
+It is STRONGLY recommended that you change the SYSDBA
+password with:
+
+$ cd /usr/interbase
+$ gsec -user SYSDBA -pass masterkey
+GSEC> modify SYSDBA -pw newpassword
+GSEC> quit
+
+before doing anything serious with Firebird.
+
+See %%PREFIX%%/firebird/RELNOTES for more.
+---------------------------------------------------------
+
diff --git a/databases/firebird/pkg-plist b/databases/firebird/pkg-plist
new file mode 100644
index 000000000000..66150c5bde26
--- /dev/null
+++ b/databases/firebird/pkg-plist
@@ -0,0 +1,104 @@
+firebird/intl/gdsintl
+firebird/examples/v5/ib_udf.sql
+firebird/examples/v5/README
+firebird/examples/v5/align.h
+firebird/examples/v5/api1.c
+firebird/examples/v5/api10.c
+firebird/examples/v5/api11.c
+firebird/examples/v5/api12.c
+firebird/examples/v5/api13.c
+firebird/examples/v5/api14.e
+firebird/examples/v5/api15.c
+firebird/examples/v5/api16.c
+firebird/examples/v5/api16t.c
+firebird/examples/v5/api2.c
+firebird/examples/v5/api3.c
+firebird/examples/v5/api4.c
+firebird/examples/v5/api5.c
+firebird/examples/v5/api6.c
+firebird/examples/v5/api7.c
+firebird/examples/v5/api8.c
+firebird/examples/v5/api9.c
+firebird/examples/v5/api9f.c
+firebird/examples/v5/apifull.c
+firebird/examples/v5/employe2.sql
+firebird/examples/v5/dyn1.e
+firebird/examples/v5/dyn2.e
+firebird/examples/v5/dyn3.e
+firebird/examples/v5/dyn4.e
+firebird/examples/v5/dyn5.e
+firebird/examples/v5/dynfull.e
+firebird/examples/v5/employee.gbk
+firebird/examples/v5/employee.gdb
+firebird/examples/v5/example.h
+firebird/examples/v5/api9f.sql
+firebird/examples/v5/intlemp.gbk
+firebird/examples/v5/intlemp.gdb
+firebird/examples/v5/stat1.e
+firebird/examples/v5/stat10.e
+firebird/examples/v5/stat11.e
+firebird/examples/v5/stat12.e
+firebird/examples/v5/stat12t.e
+firebird/examples/v5/stat2.e
+firebird/examples/v5/stat3.e
+firebird/examples/v5/stat4.e
+firebird/examples/v5/stat5.e
+firebird/examples/v5/stat6.e
+firebird/examples/v5/stat7.e
+firebird/examples/v5/stat8.e
+firebird/examples/v5/stat9.e
+firebird/examples/v5/udf.sql
+firebird/examples/v5/udflib.c
+firebird/examples/v5/makefile
+firebird/include/perf.h
+firebird/include/ib_util.h
+firebird/include/gds.hxx
+firebird/include/gds.h
+firebird/include/ibase.h
+firebird/include/iberror.h
+firebird/include/gds.f
+firebird/UDF/ib_udf
+firebird/lib/ib_util.so
+firebird/lib/gds.a
+firebird/lib/gds.so
+firebird/lib/libgds.so
+firebird/lib/libgds.so.1
+firebird/lib/libgds_pyxis.a
+firebird/lib/libgds.a
+firebird/lib/gds_pyxis.a
+firebird/help/help.gbak
+firebird/help/help.gdb
+firebird/bin/isc4.gbak
+firebird/bin/gpre
+firebird/bin/gds_pipe
+firebird/bin/gds_drop
+firebird/bin/gds_lock_mgr
+firebird/bin/gfix
+firebird/bin/gdef
+firebird/bin/isql
+firebird/bin/gds_lock_print
+firebird/bin/qli
+firebird/bin/gds_inet_server
+firebird/bin/gsplit
+firebird/bin/gstat
+firebird/bin/gds_relay
+firebird/bin/gsec
+firebird/bin/gbak
+firebird/services.isc
+firebird/isc_config
+firebird/isc4.gdb
+firebird/interbase.msg
+firebird/interbase.log
+firebird/inetd.conf.isc
+firebird/RELNOTES
+@dirrm firebird
+@dirrm firebird/intl
+@dirrm firebird/examples/v3
+@dirrm firebird/examples/v4
+@dirrm firebird/examples/v5
+@dirrm firebird/examples
+@dirrm firebird/include
+@dirrm firebird/UDF
+@dirrm firebird/lib
+@dirrm firebird/help
+@dirrm firebird/bin
diff --git a/databases/firebird/scripts/addservice b/databases/firebird/scripts/addservice
new file mode 100644
index 000000000000..df9aea5e91de
--- /dev/null
+++ b/databases/firebird/scripts/addservice
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+cat >>/etc/services <<EOF
+gds_db 3050/tcp #InterBase Database Remote Protocol
+EOF
+cat >>/etc/inetd.conf <<EOF
+gds_db stream tcp nowait firebird /usr/interbase/bin/gds_inet_server gds_inet_server
+EOF
+kill -HUP `cat /var/run/inetd.pid`
diff --git a/databases/firebird/scripts/createuser b/databases/firebird/scripts/createuser
new file mode 100644
index 000000000000..b61d47fd84bd
--- /dev/null
+++ b/databases/firebird/scripts/createuser
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+#
+
+eval '(exit $?0)' && eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
+& eval 'exec /usr/bin/perl -S $0 $argv:q'
+if 0;
+
+if( $> ) {
+ print "\nYou must be root to run this step!\n\n";
+ exit 1;
+}
+
+if( getpwnam( "firebird" ) ) {
+ ( $null, $null, $fbUID ) = getpwnam( "firebird" );
+} else {
+ $fbUID = 90;
+ while( getpwuid( $fbUID ) ) {
+ $fbUID++;
+ }
+}
+
+if( getgrnam( "firebird" ) ) {
+ ( $null, $null, $fbGID ) = getgrnam( "firebird" );
+} else {
+ $fbGID = 90;
+ while( getgrgid( $fbGID ) ) {
+ $fbGID++;
+ }
+ &append_file( "/etc/group", "firebird:*:$fbGID:" );
+}
+
+print "firebird user using uid $fbUID\n";
+print "firebird user using gid $fbGID\n";
+
+system( "/usr/bin/chpass -a \"firebird:*:$fbUID:$fbGID\:\:0:0:Firebird pseudo-user:$ENV{'PREFIX'}/firebird:/bin/sh\"" );
+
+sub append_file {
+ local($file,@list) = @_;
+ local($LOCK_EX) = 2;
+ local($LOCK_NB) = 4;
+ local($LOCK_UN) = 8;
+
+ open(F, ">> $file") || die "$file: $!\n";
+ while( ! flock( F, $LOCK_EX | $LOCK_NB ) ) {
+ exit 1;
+ }
+ print F join( "\n", @list) . "\n";
+ close F;
+ flock( F, $LOCK_UN );
+}
diff --git a/databases/firebird/scripts/post-install b/databases/firebird/scripts/post-install
new file mode 100644
index 000000000000..e4d2d3a9cd07
--- /dev/null
+++ b/databases/firebird/scripts/post-install
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+chown -R firebird:firebird $PREFIX/firebird
+
+# Turn everybody to read only.
+chmod -R o=r $PREFIX/firebird
+
+# Now fix up the mess.
+
+# fix up directories
+for i in `find $PREFIX/firebird -print`
+ do
+ FileName=$i
+ if [ -d $FileName ]
+ then
+ chmod o=rx $FileName
+ fi
+ done
+
+
+
+cd $PREFIX/firebird/bin
+
+# all users can run everything.
+chmod o=rx *
+
+# SUID is needed for running server programs.
+
+for i in gds_lock_mgr gds_drop gds_inet_server
+ do
+ chmod ug+s $i
+ done
+
+
+# Lock files
+
+cd $PREFIX/firebird
+
+for i in isc_init1 isc_lock1 isc_event1
+ do
+ FileName=$i.`hostname`
+ touch $FileName
+ chmod uga=rw $FileName
+ chown firebird:firebird $FileName
+ done
+
+
+touch interbase.log
+chmod ugo=rw interbase.log
+
+# make databases writable by all
+chmod ugo=rw examples/v5/*.gdb
+chmod ugo=rw help/*.gdb
+chmod ugo=rw isc4.gdb
+
+# remove any existing gds service
+sh $SCRIPTDIR/rmservice
+
+# add the gds service and restart inetd
+sh $SCRIPTDIR/addservice
+kill -HUP `cat /var/run/inetd.pid`
+
+sed "s|%%PREFIX%%|$PREFIX|" $SCRIPTDIR/../pkg-message
+
+cat <<EOF
+
+==========================================================
+!! NOTE !!
+
+As there are some oddities to the Firebird build process,
+it is likely you WILL NOT BE ABLE TO USE IT until you
+remove the semaphore created during the build process.
+Please read $PREFIX/firebird/RELNOTES for more information.
+==========================================================
+
+EOF
diff --git a/databases/firebird/scripts/pre-build b/databases/firebird/scripts/pre-build
new file mode 100644
index 000000000000..6605df7770fd
--- /dev/null
+++ b/databases/firebird/scripts/pre-build
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+GDS_LOCK_MGR=`ps ax |grep gds_lock_mgr |grep -v grep`;
+
+if [ "$GDS_LOCK_MGR" != "" ]; then
+ echo "It appears you have a gds_lock_manager already running.";
+ echo;
+ echo "You must cease all InterBase operations to build this port.";
+ echo "Make sure nobody is connected to any databases, then use";
+ echo "'gds_drop -a' and manually verify (with ipcs) that the";
+ echo "semaphores were removed.";
+ exit 1;
+fi
+exit 0
+
diff --git a/databases/firebird/scripts/pre-install b/databases/firebird/scripts/pre-install
new file mode 100644
index 000000000000..a6e1b37a9008
--- /dev/null
+++ b/databases/firebird/scripts/pre-install
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+if [ -d $PREFIX/firebird ]; then
+ if [ -d $PREFIX/firebird.old ]; then
+ rm -rf $PREFIX/firebird.old
+ fi
+ mv $PREFIX/firebird $PREFIX/firebird.old
+fi
+
+if [ -L /usr/interbase ]; then
+ rm -f /usr/interbase
+fi
+
+if [ -d /usr/interbase ]; then
+ mv /usr/interbase /usr/interbase.old
+fi
+
+ln -fs $PREFIX/firebird /usr/interbase
+
+perl $SCRIPTDIR/createuser
diff --git a/databases/firebird/scripts/rmservice b/databases/firebird/scripts/rmservice
new file mode 100644
index 000000000000..58adfc17419d
--- /dev/null
+++ b/databases/firebird/scripts/rmservice
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+cp /etc/services /etc/services.old
+cp /etc/inetd.conf /etc/inetd.conf.old
+cat /etc/services |grep -v gds_db >/etc/services.new
+cat /etc/inetd.conf |grep -v gds_db >/etc/inetd.conf.new
+mv /etc/services.new /etc/services
+mv /etc/inetd.conf.new /etc/inetd.conf
diff --git a/databases/firebird2-server/Makefile b/databases/firebird2-server/Makefile
new file mode 100644
index 000000000000..02cbff7bc2e9
--- /dev/null
+++ b/databases/firebird2-server/Makefile
@@ -0,0 +1,63 @@
+# New ports collection makefile for: Firebird
+# Date created: 20 December 2000
+# Whom: Geoffrey C. Speicher <geoff@sea-incorporated.com>
+#
+# $FreeBSD$
+#
+
+PORTNAME= firebird
+PORTVERSION= 0.9
+PORTREVISION= 4
+CATEGORIES= databases
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR=firebird
+DISTFILES= firebird-boot-kit.tar.gz \
+ interbase0.9-4-v5examples.tar.gz \
+ interbase0.9-4src.tar.gz
+
+MAINTAINER= geoff@sea-incorporated.com
+
+WRKSRC= ${WRKDIR}/interbase
+INSTALLS_SHLIB= yes
+LDCONFIG_DIRS= %%PREFIX%%/firebird/lib
+
+ONLY_FOR_ARCHS= i386
+
+do-extract:
+ @${MKDIR} ${WRKDIR}
+ @( \
+ cd ${WRKDIR}; tar zxf ${DISTDIR}/interbase0.9-4src.tar.gz; \
+ cd interbase; tar zxf ${DISTDIR}/firebird-boot-kit.tar.gz; \
+ ${CP} msgs/msg.gbak misc/msg.gbak \
+ )
+
+do-configure:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ INTERBASE=${WRKDIR}/interbase/interbase; export INTERBASE; \
+ REFDBPATH=${WRKDIR}/refDatabases; export REFDBPATH; \
+ ${SH} buildBootDatabases; \
+ ${SH} setup_dirs.boot FREEBSD PROD ${WRKDIR}/refDatabases boot; \
+ )
+
+do-build:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ INTERBASE=${WRKDIR}/interbase/interbase; export INTERBASE; \
+ REFDBPATH=${WRKDIR}/refDatabases; export REFDBPATH; \
+ ${SH} boot.freebsd; \
+ )
+
+do-install:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ ${CP} -Rp interbase ${PREFIX}/firebird; \
+ ${RM} ${PREFIX}/firebird/install; \
+ ${RM} ${PREFIX}/firebird/lib/libgds.so.1.0; \
+ ${LN} -fs gds.so ${PREFIX}/firebird/lib/libgds.so.1; \
+ cd ${PREFIX}/firebird/examples; \
+ tar zxf ${DISTDIR}/interbase0.9-4-v5examples.tar.gz; \
+ ${CP} ${FILESDIR}/RELNOTES ${PREFIX}/firebird/ \
+ )
+
+.include <bsd.port.mk>
diff --git a/databases/firebird2-server/distinfo b/databases/firebird2-server/distinfo
new file mode 100644
index 000000000000..67c42987376e
--- /dev/null
+++ b/databases/firebird2-server/distinfo
@@ -0,0 +1,3 @@
+MD5 (firebird-boot-kit.tar.gz) = 2e18d75539bc4c3d40a1a71509309f64
+MD5 (interbase0.9-4-v5examples.tar.gz) = 17cba82bbf5066d515f2dee97bf8327a
+MD5 (interbase0.9-4src.tar.gz) = d098277ed160e2b6a49d91e1fdb3a652
diff --git a/databases/firebird2-server/files/RELNOTES b/databases/firebird2-server/files/RELNOTES
new file mode 100644
index 000000000000..3c4e0c62ae58
--- /dev/null
+++ b/databases/firebird2-server/files/RELNOTES
@@ -0,0 +1,78 @@
+Firebird 0.9_4 FreeBSD Release Notes 13-Jan-2001
+------------------------------------
+FB-T0.9.4.34 Firebird Test1
+
+Welcome to the FreeBSD Firebird port! Users should note that there
+was a package called `firebird-1.0.tgz' released in mid-August
+2000. Unfortunately, that package was released before Firebird
+version numbering conventions were established, so although the
+version number would suggest that it is newer than the current
+release, it is certainly not. Users of the August 1.0 package
+should upgrade to 0.9_4 or later, which has fixed many bugs and
+security problems, including the recently-discovered back door.
+
+ Firebird originally required a running copy of Firebird (or
+InterBase) in order to build itself. This port uses a boot kit to
+overcome that, so that it does not require itself to build.
+Unfortunately, the side effect of this is that if you have a lock
+manager running from an already-installed version of Firebird or
+InterBase, this port will not build.
+
+ Firebird is installed SUID with owner and group `firebird'.
+This does affect where you can and cannot create databases when
+connecting remotely, as well as which existing databases you can
+access. If you want a database to be available remotely, be sure
+it's readable and writeable to group firebird.
+
+ There may be times when you manage to get your system into a
+state where using any of the Firebird utilites (isql, gbak, gsec,
+etc.) gives you the message "semget failed". One surefire way to
+do this is to build and install the port. :) If this happens,
+make sure that the lock manager is not running and its semaphores
+have been removed. The former can be accomplished with 'ps ax
+|grep gds' and 'kill'; the latter with 'ipcs -s' and 'ipcrm -s'.
+
+ For example, after building and installing the port, you will
+probably go through something like this:
+
+# isql /usr/interbase/isc4.gdb
+Statement failed, SQLCODE = -902
+
+operating system directive semget failed
+-No such file or directory
+
+# ipcs -s
+Semaphores:
+T ID KEY MODE OWNER GROUP
+s 1310720 252034728 --rw-rw-rw- root wheel
+
+# ipcrm -s 1310720
+
+and you should be in business.
+
+ Once this is done, you should be able to connect normally to
+databases. Your first connection will restart the lock manager.
+
+ There may be times, however, when you still get "semget failed"
+even though the lock manager is not running and the semaphores have
+been cleaned up. There seems to be a conflict with this release
+and the PostgreSQL 7 release as installed from the ports collection.
+If you're having trouble with Firebird and you're running PostgreSQL,
+try stopping PostgreSQL:
+
+ /usr/local/etc/rc.d/pgsql.sh stop
+
+and see if that helps.
+
+ Complete documentation for InterBase(tm) is available (free of
+charge) from http://www.interbase.com/ in PDF format. While
+InterBase and Firebird are two distinct entities, all InterBase
+documentation is pertinent to Firebird. More information on Firebird
+and InterBase can be found at the following:
+
+ http://sourceforge.net/projects/firebird/
+ http://www.ibphoenix.com/
+ http://www.interbase2000.org/
+
+Geoff Speicher
+<geoff@sea-incorporated.com>
diff --git a/databases/firebird2-server/files/patch-aa b/databases/firebird2-server/files/patch-aa
new file mode 100644
index 000000000000..f2db9a68750d
--- /dev/null
+++ b/databases/firebird2-server/files/patch-aa
@@ -0,0 +1,11 @@
+--- buildBootDatabases.orig Tue Oct 10 23:00:39 2000
++++ buildBootDatabases Tue Oct 10 23:00:46 2000
+@@ -49,7 +49,7 @@
+ DefaultAns=$2
+ echo -n "${1}"
+ Answer="$DefaultAns"
+- read Answer
++# read Answer
+ }
+
+ #--------------------------------------------------------------------
diff --git a/databases/firebird2-server/files/patch-ab b/databases/firebird2-server/files/patch-ab
new file mode 100644
index 000000000000..f054a4b23007
--- /dev/null
+++ b/databases/firebird2-server/files/patch-ab
@@ -0,0 +1,11 @@
+--- setup_dirs.boot.orig Tue Oct 10 23:00:07 2000
++++ setup_dirs.boot Tue Oct 10 23:00:22 2000
+@@ -49,7 +49,7 @@
+ DefaultAns=$2
+ echo -n "${1}"
+ Answer="$DefaultAns"
+- read Answer
++# read Answer
+ }
+
+
diff --git a/databases/firebird2-server/files/patch-ac b/databases/firebird2-server/files/patch-ac
new file mode 100644
index 000000000000..bf5de43b75fb
--- /dev/null
+++ b/databases/firebird2-server/files/patch-ac
@@ -0,0 +1,58 @@
+--- builds/original/prefix.freebsd 2000/10/08 15:36:25 1.2
++++ builds/original/prefix.freebsd 2001/01/11 19:17:58
+@@ -28,7 +28,7 @@
+
+
+ PROD_DEBUG_OBJECTS= nodebug.o
+-PROD_SHRLIB_DIR=
++PROD_SHRLIB_DIR= -Lsource/jrd
+ PROD_VERSION_FLAG= -DPROD_BUILD
+ PROD_CFLAGS= -O -m486 -fpic -DFLINTSTONE
+
+@@ -48,7 +48,7 @@
+ UDF_LINK_CMD= gcc
+ UDF_CFLAGS= -fPIC -mieee-fp
+ UDF_LFLAGS= -shared
+-UDF_SHRLIBS= -L/usr/local/lib -lgds -lm -lc -mieee-fp -ldescrypt
++UDF_SHRLIBS= $(SHRLIB_DIR) -lgds -lm -lc -mieee-fp -ldescrypt
+
+ #NOTE: PIC_J_CFLAGS is special CFLAGS used to build PIPD_IS_SHRLIB modules
+ # to workaround the Solaris threading problems with signals
+@@ -69,16 +69,14 @@
+ FUNCTIONS= functions.bin
+ FUNCSHR= source/interbase/lib/gdsf.so
+ GDS_LINK= $(GDSSHR_LINK)
+-#GDS_PYXIS=
+ GDS_PYXIS= gds_pyxis.a
+ GDSLIB_BACKEND= source/interbase/lib/gds_b.a
+ GDSLIB_LINK= -Lsource/jrd -lgds_b -lc -ldescrypt
+
+ GDSSHR= source/interbase/lib/gds.so
+ LINUX_GDSSHR= $(GDSSHR)
+-GDSSHR_LINK= $(SHRLIB_DIR) -L/usr/local/lib -lgds -lgds_pyxis -ldescrypt
+-PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -L/usr/local/lib -lgds -lgds_pyxis
+-#PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis
++GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis -ldescrypt
++PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis
+ HLPDIR= source/qli/
+ HOSTNAME= `hostname | cut -d'.' -f1`
+ INCLUDES= include_so include_so_ada
+@@ -106,11 +104,6 @@
+ MUISQL_LINK_OPTS= $(MUISQL_MU_LIB) $(PIPE_GDSSHR_LINK) -lm
+ PIC_FLAGS= $(CFLAGS) -fPIC
+ PIPE= gds.a gds_pipe
+-#PYXIS=
+-#PYXIS_MISC_OBJS=
+-#PYXIS_P_MISC_OBJS=
+-#PYXIS_OBJECTS=
+-#PYXIS_MISC_OBJECTS=
+ PYXIS= pyxis
+ PYXIS_MISC_OBJS= $(PYXIS_MISC)
+ PYXIS_P_MISC_OBJS= $(PYXIS_P_MISC)
+@@ -167,5 +160,8 @@
+ SHRLIB_EXT= .so
+
+ V3PRINTER= source/lock/printv3.o
++
++# Forces library build for FreeBSD
++PYXIS_LIBRARY= libpyxis.a
diff --git a/databases/firebird2-server/pkg-comment b/databases/firebird2-server/pkg-comment
new file mode 100644
index 000000000000..f8cb5bc1d7b3
--- /dev/null
+++ b/databases/firebird2-server/pkg-comment
@@ -0,0 +1 @@
+The open-source InterBase(tm) 6.0 spin-off (Classic version)
diff --git a/databases/firebird2-server/pkg-descr b/databases/firebird2-server/pkg-descr
new file mode 100644
index 000000000000..5f05e046a387
--- /dev/null
+++ b/databases/firebird2-server/pkg-descr
@@ -0,0 +1,22 @@
+The open-source InterBase(tm) 6.0 spin-off (Classic server version)
+
+InterBase is a world-class DBMS with a history too rich to detail
+here. Once selling for several thousands of dollars per license,
+some very big players use it worldwide. Inprise has open-sourced
+InterBase 6.0, and a lively bunch of folks has charged themselves
+with seeing that it lives on through the Firebird project.
+
+Note that as of Firebird 0.9_4, the locksmith back door has
+been closed.
+
+For more information on Firebird and InterBase, see:
+http://www.ibphoenix.com/
+http://www.interbase2000.org/
+http://www.interbase.com/
+
+and of course the firebird page itself:
+WWW: http://sourceforge.net/projects/firebird/
+
+For more information on the locksmith back door, see:
+
+https://www.kb.cert.org/vuls/id/247371
diff --git a/databases/firebird2-server/pkg-install b/databases/firebird2-server/pkg-install
new file mode 100644
index 000000000000..c40e25e88ffc
--- /dev/null
+++ b/databases/firebird2-server/pkg-install
@@ -0,0 +1,145 @@
+#!/bin/sh
+
+# Created in haste by smashing together various
+# files from the port scripts.
+
+if [ "$2" = "PRE-INSTALL" ]; then
+if [ -d $PKG_PREFIX/firebird ]; then
+ if [ -d $PKG_PREFIX/firebird.old ]; then
+ rm -rf $PKG_PREFIX/firebird.old
+ fi
+ mv $PKG_PREFIX/firebird $PKG_PREFIX/firebird.old
+fi
+
+if [ -L /usr/interbase ]; then
+ rm -f /usr/interbase
+fi
+
+if [ -d /usr/interbase ]; then
+ mv /usr/interbase /usr/interbase.old
+fi
+
+ln -fs $PKG_PREFIX/firebird /usr/interbase
+
+perl <<EOF
+eval '(exit \$?0)' && eval 'exec /usr/bin/perl -S \$0 \${1+"\$@"}'
+& eval 'exec /usr/bin/perl -S \$0 \$argv:q'
+if 0;
+
+if( \$> ) {
+ print "\nYou must be root to run this step!\n\n";
+ exit 1;
+}
+
+if( getpwnam( "firebird" ) ) {
+ ( \$null, \$null, \$fbUID ) = getpwnam( "firebird" );
+} else {
+ \$fbUID = 90;
+ while( getpwuid( \$fbUID ) ) {
+ \$fbUID++;
+ }
+}
+
+if( getgrnam( "firebird" ) ) {
+ ( \$null, \$null, \$fbGID ) = getgrnam( "firebird" );
+} else {
+ \$fbGID = 90;
+ while( getgrgid( \$fbGID ) ) {
+ \$fbGID++;
+ }
+ &append_file( "/etc/group", "firebird:*:\$fbGID:" );
+}
+
+print "firebird user using uid \$fbUID\n";
+print "firebird user using gid \$fbGID\n";
+
+system( "/usr/bin/chpass -a \"firebird:*:\$fbUID:\$fbGID\:\:0:0:Firebird pseudo-user:\$ENV{'PKG_PREFIX'}/firebird:/bin/sh\"" );
+
+sub append_file {
+ local(\$file,@list) = @_;
+ local(\$LOCK_EX) = 2;
+ local(\$LOCK_NB) = 4;
+ local(\$LOCK_UN) = 8;
+
+ open(F, ">> \$file") || die "\$file: \$!\n";
+ while( ! flock( F, \$LOCK_EX | \$LOCK_NB ) ) {
+ exit 1;
+ }
+ print F join( "\n", @list) . "\n";
+ close F;
+ flock( F, \$LOCK_UN );
+}
+EOF
+elif [ "$2" = "POST-INSTALL" ]; then
+chown -R firebird:firebird $PKG_PREFIX/firebird
+
+# Turn everybody to read only.
+chmod -R o=r $PKG_PREFIX/firebird
+
+# Now fix up the mess.
+
+# fix up directories
+for i in `find $PKG_PREFIX/firebird -print`
+ do
+ FileName=$i
+ if [ -d $FileName ]
+ then
+ chmod o=rx $FileName
+ fi
+ done
+
+
+
+cd $PKG_PREFIX/firebird/bin
+
+# all users can run everything.
+chmod o=rx *
+
+# SUID is needed for running server programs.
+
+for i in gds_lock_mgr gds_drop gds_inet_server
+ do
+ chmod ug+s $i
+ done
+
+
+# Lock files
+
+cd $PKG_PREFIX/firebird
+
+for i in isc_init1 isc_lock1 isc_event1
+ do
+ FileName=$i.`hostname`
+ touch $FileName
+ chmod uga=rw $FileName
+ chown firebird:firebird $FileName
+ done
+
+
+touch interbase.log
+chmod ugo=rw interbase.log
+
+# make databases writable by all
+chmod ugo=rw examples/v5/*.gdb
+chmod ugo=rw help/*.gdb
+chmod ugo=rw isc4.gdb
+
+# remove any existing gds service
+cp /etc/services /etc/services.old
+cp /etc/inetd.conf /etc/inetd.conf.old
+cat /etc/services |grep -v gds_db >/etc/services.new
+cat /etc/inetd.conf |grep -v gds_db >/etc/inetd.conf.new
+mv /etc/services.new /etc/services
+mv /etc/inetd.conf.new /etc/inetd.conf
+
+# add the gds service and restart inetd
+cat >>/etc/services <<EOF
+gds_db 3050/tcp #InterBase Database Remote Protocol
+EOF
+cat >>/etc/inetd.conf <<EOF
+gds_db stream tcp nowait firebird /usr/interbase/bin/gds_inet_server gds_inet_server
+EOF
+kill -HUP `cat /var/run/inetd.pid`
+kill -HUP `cat /var/run/inetd.pid`
+
+fi
diff --git a/databases/firebird2-server/pkg-message b/databases/firebird2-server/pkg-message
new file mode 100644
index 000000000000..f15892a06aaa
--- /dev/null
+++ b/databases/firebird2-server/pkg-message
@@ -0,0 +1,19 @@
+
+---------------------------------------------------------
+Firebird is now installed. There is a symbolic link from
+/usr/interbase -> %%PREFIX%%/firebird. Firebird needs this
+link for proper operation.
+
+It is STRONGLY recommended that you change the SYSDBA
+password with:
+
+$ cd /usr/interbase
+$ gsec -user SYSDBA -pass masterkey
+GSEC> modify SYSDBA -pw newpassword
+GSEC> quit
+
+before doing anything serious with Firebird.
+
+See %%PREFIX%%/firebird/RELNOTES for more.
+---------------------------------------------------------
+
diff --git a/databases/firebird2-server/pkg-plist b/databases/firebird2-server/pkg-plist
new file mode 100644
index 000000000000..66150c5bde26
--- /dev/null
+++ b/databases/firebird2-server/pkg-plist
@@ -0,0 +1,104 @@
+firebird/intl/gdsintl
+firebird/examples/v5/ib_udf.sql
+firebird/examples/v5/README
+firebird/examples/v5/align.h
+firebird/examples/v5/api1.c
+firebird/examples/v5/api10.c
+firebird/examples/v5/api11.c
+firebird/examples/v5/api12.c
+firebird/examples/v5/api13.c
+firebird/examples/v5/api14.e
+firebird/examples/v5/api15.c
+firebird/examples/v5/api16.c
+firebird/examples/v5/api16t.c
+firebird/examples/v5/api2.c
+firebird/examples/v5/api3.c
+firebird/examples/v5/api4.c
+firebird/examples/v5/api5.c
+firebird/examples/v5/api6.c
+firebird/examples/v5/api7.c
+firebird/examples/v5/api8.c
+firebird/examples/v5/api9.c
+firebird/examples/v5/api9f.c
+firebird/examples/v5/apifull.c
+firebird/examples/v5/employe2.sql
+firebird/examples/v5/dyn1.e
+firebird/examples/v5/dyn2.e
+firebird/examples/v5/dyn3.e
+firebird/examples/v5/dyn4.e
+firebird/examples/v5/dyn5.e
+firebird/examples/v5/dynfull.e
+firebird/examples/v5/employee.gbk
+firebird/examples/v5/employee.gdb
+firebird/examples/v5/example.h
+firebird/examples/v5/api9f.sql
+firebird/examples/v5/intlemp.gbk
+firebird/examples/v5/intlemp.gdb
+firebird/examples/v5/stat1.e
+firebird/examples/v5/stat10.e
+firebird/examples/v5/stat11.e
+firebird/examples/v5/stat12.e
+firebird/examples/v5/stat12t.e
+firebird/examples/v5/stat2.e
+firebird/examples/v5/stat3.e
+firebird/examples/v5/stat4.e
+firebird/examples/v5/stat5.e
+firebird/examples/v5/stat6.e
+firebird/examples/v5/stat7.e
+firebird/examples/v5/stat8.e
+firebird/examples/v5/stat9.e
+firebird/examples/v5/udf.sql
+firebird/examples/v5/udflib.c
+firebird/examples/v5/makefile
+firebird/include/perf.h
+firebird/include/ib_util.h
+firebird/include/gds.hxx
+firebird/include/gds.h
+firebird/include/ibase.h
+firebird/include/iberror.h
+firebird/include/gds.f
+firebird/UDF/ib_udf
+firebird/lib/ib_util.so
+firebird/lib/gds.a
+firebird/lib/gds.so
+firebird/lib/libgds.so
+firebird/lib/libgds.so.1
+firebird/lib/libgds_pyxis.a
+firebird/lib/libgds.a
+firebird/lib/gds_pyxis.a
+firebird/help/help.gbak
+firebird/help/help.gdb
+firebird/bin/isc4.gbak
+firebird/bin/gpre
+firebird/bin/gds_pipe
+firebird/bin/gds_drop
+firebird/bin/gds_lock_mgr
+firebird/bin/gfix
+firebird/bin/gdef
+firebird/bin/isql
+firebird/bin/gds_lock_print
+firebird/bin/qli
+firebird/bin/gds_inet_server
+firebird/bin/gsplit
+firebird/bin/gstat
+firebird/bin/gds_relay
+firebird/bin/gsec
+firebird/bin/gbak
+firebird/services.isc
+firebird/isc_config
+firebird/isc4.gdb
+firebird/interbase.msg
+firebird/interbase.log
+firebird/inetd.conf.isc
+firebird/RELNOTES
+@dirrm firebird
+@dirrm firebird/intl
+@dirrm firebird/examples/v3
+@dirrm firebird/examples/v4
+@dirrm firebird/examples/v5
+@dirrm firebird/examples
+@dirrm firebird/include
+@dirrm firebird/UDF
+@dirrm firebird/lib
+@dirrm firebird/help
+@dirrm firebird/bin
diff --git a/databases/firebird2-server/scripts/addservice b/databases/firebird2-server/scripts/addservice
new file mode 100644
index 000000000000..df9aea5e91de
--- /dev/null
+++ b/databases/firebird2-server/scripts/addservice
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+cat >>/etc/services <<EOF
+gds_db 3050/tcp #InterBase Database Remote Protocol
+EOF
+cat >>/etc/inetd.conf <<EOF
+gds_db stream tcp nowait firebird /usr/interbase/bin/gds_inet_server gds_inet_server
+EOF
+kill -HUP `cat /var/run/inetd.pid`
diff --git a/databases/firebird2-server/scripts/createuser b/databases/firebird2-server/scripts/createuser
new file mode 100644
index 000000000000..b61d47fd84bd
--- /dev/null
+++ b/databases/firebird2-server/scripts/createuser
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+#
+
+eval '(exit $?0)' && eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
+& eval 'exec /usr/bin/perl -S $0 $argv:q'
+if 0;
+
+if( $> ) {
+ print "\nYou must be root to run this step!\n\n";
+ exit 1;
+}
+
+if( getpwnam( "firebird" ) ) {
+ ( $null, $null, $fbUID ) = getpwnam( "firebird" );
+} else {
+ $fbUID = 90;
+ while( getpwuid( $fbUID ) ) {
+ $fbUID++;
+ }
+}
+
+if( getgrnam( "firebird" ) ) {
+ ( $null, $null, $fbGID ) = getgrnam( "firebird" );
+} else {
+ $fbGID = 90;
+ while( getgrgid( $fbGID ) ) {
+ $fbGID++;
+ }
+ &append_file( "/etc/group", "firebird:*:$fbGID:" );
+}
+
+print "firebird user using uid $fbUID\n";
+print "firebird user using gid $fbGID\n";
+
+system( "/usr/bin/chpass -a \"firebird:*:$fbUID:$fbGID\:\:0:0:Firebird pseudo-user:$ENV{'PREFIX'}/firebird:/bin/sh\"" );
+
+sub append_file {
+ local($file,@list) = @_;
+ local($LOCK_EX) = 2;
+ local($LOCK_NB) = 4;
+ local($LOCK_UN) = 8;
+
+ open(F, ">> $file") || die "$file: $!\n";
+ while( ! flock( F, $LOCK_EX | $LOCK_NB ) ) {
+ exit 1;
+ }
+ print F join( "\n", @list) . "\n";
+ close F;
+ flock( F, $LOCK_UN );
+}
diff --git a/databases/firebird2-server/scripts/post-install b/databases/firebird2-server/scripts/post-install
new file mode 100644
index 000000000000..e4d2d3a9cd07
--- /dev/null
+++ b/databases/firebird2-server/scripts/post-install
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+chown -R firebird:firebird $PREFIX/firebird
+
+# Turn everybody to read only.
+chmod -R o=r $PREFIX/firebird
+
+# Now fix up the mess.
+
+# fix up directories
+for i in `find $PREFIX/firebird -print`
+ do
+ FileName=$i
+ if [ -d $FileName ]
+ then
+ chmod o=rx $FileName
+ fi
+ done
+
+
+
+cd $PREFIX/firebird/bin
+
+# all users can run everything.
+chmod o=rx *
+
+# SUID is needed for running server programs.
+
+for i in gds_lock_mgr gds_drop gds_inet_server
+ do
+ chmod ug+s $i
+ done
+
+
+# Lock files
+
+cd $PREFIX/firebird
+
+for i in isc_init1 isc_lock1 isc_event1
+ do
+ FileName=$i.`hostname`
+ touch $FileName
+ chmod uga=rw $FileName
+ chown firebird:firebird $FileName
+ done
+
+
+touch interbase.log
+chmod ugo=rw interbase.log
+
+# make databases writable by all
+chmod ugo=rw examples/v5/*.gdb
+chmod ugo=rw help/*.gdb
+chmod ugo=rw isc4.gdb
+
+# remove any existing gds service
+sh $SCRIPTDIR/rmservice
+
+# add the gds service and restart inetd
+sh $SCRIPTDIR/addservice
+kill -HUP `cat /var/run/inetd.pid`
+
+sed "s|%%PREFIX%%|$PREFIX|" $SCRIPTDIR/../pkg-message
+
+cat <<EOF
+
+==========================================================
+!! NOTE !!
+
+As there are some oddities to the Firebird build process,
+it is likely you WILL NOT BE ABLE TO USE IT until you
+remove the semaphore created during the build process.
+Please read $PREFIX/firebird/RELNOTES for more information.
+==========================================================
+
+EOF
diff --git a/databases/firebird2-server/scripts/pre-build b/databases/firebird2-server/scripts/pre-build
new file mode 100644
index 000000000000..6605df7770fd
--- /dev/null
+++ b/databases/firebird2-server/scripts/pre-build
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+GDS_LOCK_MGR=`ps ax |grep gds_lock_mgr |grep -v grep`;
+
+if [ "$GDS_LOCK_MGR" != "" ]; then
+ echo "It appears you have a gds_lock_manager already running.";
+ echo;
+ echo "You must cease all InterBase operations to build this port.";
+ echo "Make sure nobody is connected to any databases, then use";
+ echo "'gds_drop -a' and manually verify (with ipcs) that the";
+ echo "semaphores were removed.";
+ exit 1;
+fi
+exit 0
+
diff --git a/databases/firebird2-server/scripts/pre-install b/databases/firebird2-server/scripts/pre-install
new file mode 100644
index 000000000000..a6e1b37a9008
--- /dev/null
+++ b/databases/firebird2-server/scripts/pre-install
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+if [ -d $PREFIX/firebird ]; then
+ if [ -d $PREFIX/firebird.old ]; then
+ rm -rf $PREFIX/firebird.old
+ fi
+ mv $PREFIX/firebird $PREFIX/firebird.old
+fi
+
+if [ -L /usr/interbase ]; then
+ rm -f /usr/interbase
+fi
+
+if [ -d /usr/interbase ]; then
+ mv /usr/interbase /usr/interbase.old
+fi
+
+ln -fs $PREFIX/firebird /usr/interbase
+
+perl $SCRIPTDIR/createuser
diff --git a/databases/firebird2-server/scripts/rmservice b/databases/firebird2-server/scripts/rmservice
new file mode 100644
index 000000000000..58adfc17419d
--- /dev/null
+++ b/databases/firebird2-server/scripts/rmservice
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+cp /etc/services /etc/services.old
+cp /etc/inetd.conf /etc/inetd.conf.old
+cat /etc/services |grep -v gds_db >/etc/services.new
+cat /etc/inetd.conf |grep -v gds_db >/etc/inetd.conf.new
+mv /etc/services.new /etc/services
+mv /etc/inetd.conf.new /etc/inetd.conf
diff --git a/databases/firebird20-server/Makefile b/databases/firebird20-server/Makefile
new file mode 100644
index 000000000000..02cbff7bc2e9
--- /dev/null
+++ b/databases/firebird20-server/Makefile
@@ -0,0 +1,63 @@
+# New ports collection makefile for: Firebird
+# Date created: 20 December 2000
+# Whom: Geoffrey C. Speicher <geoff@sea-incorporated.com>
+#
+# $FreeBSD$
+#
+
+PORTNAME= firebird
+PORTVERSION= 0.9
+PORTREVISION= 4
+CATEGORIES= databases
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR=firebird
+DISTFILES= firebird-boot-kit.tar.gz \
+ interbase0.9-4-v5examples.tar.gz \
+ interbase0.9-4src.tar.gz
+
+MAINTAINER= geoff@sea-incorporated.com
+
+WRKSRC= ${WRKDIR}/interbase
+INSTALLS_SHLIB= yes
+LDCONFIG_DIRS= %%PREFIX%%/firebird/lib
+
+ONLY_FOR_ARCHS= i386
+
+do-extract:
+ @${MKDIR} ${WRKDIR}
+ @( \
+ cd ${WRKDIR}; tar zxf ${DISTDIR}/interbase0.9-4src.tar.gz; \
+ cd interbase; tar zxf ${DISTDIR}/firebird-boot-kit.tar.gz; \
+ ${CP} msgs/msg.gbak misc/msg.gbak \
+ )
+
+do-configure:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ INTERBASE=${WRKDIR}/interbase/interbase; export INTERBASE; \
+ REFDBPATH=${WRKDIR}/refDatabases; export REFDBPATH; \
+ ${SH} buildBootDatabases; \
+ ${SH} setup_dirs.boot FREEBSD PROD ${WRKDIR}/refDatabases boot; \
+ )
+
+do-build:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ INTERBASE=${WRKDIR}/interbase/interbase; export INTERBASE; \
+ REFDBPATH=${WRKDIR}/refDatabases; export REFDBPATH; \
+ ${SH} boot.freebsd; \
+ )
+
+do-install:
+ @( \
+ cd ${WRKDIR}/interbase; \
+ ${CP} -Rp interbase ${PREFIX}/firebird; \
+ ${RM} ${PREFIX}/firebird/install; \
+ ${RM} ${PREFIX}/firebird/lib/libgds.so.1.0; \
+ ${LN} -fs gds.so ${PREFIX}/firebird/lib/libgds.so.1; \
+ cd ${PREFIX}/firebird/examples; \
+ tar zxf ${DISTDIR}/interbase0.9-4-v5examples.tar.gz; \
+ ${CP} ${FILESDIR}/RELNOTES ${PREFIX}/firebird/ \
+ )
+
+.include <bsd.port.mk>
diff --git a/databases/firebird20-server/distinfo b/databases/firebird20-server/distinfo
new file mode 100644
index 000000000000..67c42987376e
--- /dev/null
+++ b/databases/firebird20-server/distinfo
@@ -0,0 +1,3 @@
+MD5 (firebird-boot-kit.tar.gz) = 2e18d75539bc4c3d40a1a71509309f64
+MD5 (interbase0.9-4-v5examples.tar.gz) = 17cba82bbf5066d515f2dee97bf8327a
+MD5 (interbase0.9-4src.tar.gz) = d098277ed160e2b6a49d91e1fdb3a652
diff --git a/databases/firebird20-server/files/RELNOTES b/databases/firebird20-server/files/RELNOTES
new file mode 100644
index 000000000000..3c4e0c62ae58
--- /dev/null
+++ b/databases/firebird20-server/files/RELNOTES
@@ -0,0 +1,78 @@
+Firebird 0.9_4 FreeBSD Release Notes 13-Jan-2001
+------------------------------------
+FB-T0.9.4.34 Firebird Test1
+
+Welcome to the FreeBSD Firebird port! Users should note that there
+was a package called `firebird-1.0.tgz' released in mid-August
+2000. Unfortunately, that package was released before Firebird
+version numbering conventions were established, so although the
+version number would suggest that it is newer than the current
+release, it is certainly not. Users of the August 1.0 package
+should upgrade to 0.9_4 or later, which has fixed many bugs and
+security problems, including the recently-discovered back door.
+
+ Firebird originally required a running copy of Firebird (or
+InterBase) in order to build itself. This port uses a boot kit to
+overcome that, so that it does not require itself to build.
+Unfortunately, the side effect of this is that if you have a lock
+manager running from an already-installed version of Firebird or
+InterBase, this port will not build.
+
+ Firebird is installed SUID with owner and group `firebird'.
+This does affect where you can and cannot create databases when
+connecting remotely, as well as which existing databases you can
+access. If you want a database to be available remotely, be sure
+it's readable and writeable to group firebird.
+
+ There may be times when you manage to get your system into a
+state where using any of the Firebird utilites (isql, gbak, gsec,
+etc.) gives you the message "semget failed". One surefire way to
+do this is to build and install the port. :) If this happens,
+make sure that the lock manager is not running and its semaphores
+have been removed. The former can be accomplished with 'ps ax
+|grep gds' and 'kill'; the latter with 'ipcs -s' and 'ipcrm -s'.
+
+ For example, after building and installing the port, you will
+probably go through something like this:
+
+# isql /usr/interbase/isc4.gdb
+Statement failed, SQLCODE = -902
+
+operating system directive semget failed
+-No such file or directory
+
+# ipcs -s
+Semaphores:
+T ID KEY MODE OWNER GROUP
+s 1310720 252034728 --rw-rw-rw- root wheel
+
+# ipcrm -s 1310720
+
+and you should be in business.
+
+ Once this is done, you should be able to connect normally to
+databases. Your first connection will restart the lock manager.
+
+ There may be times, however, when you still get "semget failed"
+even though the lock manager is not running and the semaphores have
+been cleaned up. There seems to be a conflict with this release
+and the PostgreSQL 7 release as installed from the ports collection.
+If you're having trouble with Firebird and you're running PostgreSQL,
+try stopping PostgreSQL:
+
+ /usr/local/etc/rc.d/pgsql.sh stop
+
+and see if that helps.
+
+ Complete documentation for InterBase(tm) is available (free of
+charge) from http://www.interbase.com/ in PDF format. While
+InterBase and Firebird are two distinct entities, all InterBase
+documentation is pertinent to Firebird. More information on Firebird
+and InterBase can be found at the following:
+
+ http://sourceforge.net/projects/firebird/
+ http://www.ibphoenix.com/
+ http://www.interbase2000.org/
+
+Geoff Speicher
+<geoff@sea-incorporated.com>
diff --git a/databases/firebird20-server/files/patch-aa b/databases/firebird20-server/files/patch-aa
new file mode 100644
index 000000000000..f2db9a68750d
--- /dev/null
+++ b/databases/firebird20-server/files/patch-aa
@@ -0,0 +1,11 @@
+--- buildBootDatabases.orig Tue Oct 10 23:00:39 2000
++++ buildBootDatabases Tue Oct 10 23:00:46 2000
+@@ -49,7 +49,7 @@
+ DefaultAns=$2
+ echo -n "${1}"
+ Answer="$DefaultAns"
+- read Answer
++# read Answer
+ }
+
+ #--------------------------------------------------------------------
diff --git a/databases/firebird20-server/files/patch-ab b/databases/firebird20-server/files/patch-ab
new file mode 100644
index 000000000000..f054a4b23007
--- /dev/null
+++ b/databases/firebird20-server/files/patch-ab
@@ -0,0 +1,11 @@
+--- setup_dirs.boot.orig Tue Oct 10 23:00:07 2000
++++ setup_dirs.boot Tue Oct 10 23:00:22 2000
+@@ -49,7 +49,7 @@
+ DefaultAns=$2
+ echo -n "${1}"
+ Answer="$DefaultAns"
+- read Answer
++# read Answer
+ }
+
+
diff --git a/databases/firebird20-server/files/patch-ac b/databases/firebird20-server/files/patch-ac
new file mode 100644
index 000000000000..bf5de43b75fb
--- /dev/null
+++ b/databases/firebird20-server/files/patch-ac
@@ -0,0 +1,58 @@
+--- builds/original/prefix.freebsd 2000/10/08 15:36:25 1.2
++++ builds/original/prefix.freebsd 2001/01/11 19:17:58
+@@ -28,7 +28,7 @@
+
+
+ PROD_DEBUG_OBJECTS= nodebug.o
+-PROD_SHRLIB_DIR=
++PROD_SHRLIB_DIR= -Lsource/jrd
+ PROD_VERSION_FLAG= -DPROD_BUILD
+ PROD_CFLAGS= -O -m486 -fpic -DFLINTSTONE
+
+@@ -48,7 +48,7 @@
+ UDF_LINK_CMD= gcc
+ UDF_CFLAGS= -fPIC -mieee-fp
+ UDF_LFLAGS= -shared
+-UDF_SHRLIBS= -L/usr/local/lib -lgds -lm -lc -mieee-fp -ldescrypt
++UDF_SHRLIBS= $(SHRLIB_DIR) -lgds -lm -lc -mieee-fp -ldescrypt
+
+ #NOTE: PIC_J_CFLAGS is special CFLAGS used to build PIPD_IS_SHRLIB modules
+ # to workaround the Solaris threading problems with signals
+@@ -69,16 +69,14 @@
+ FUNCTIONS= functions.bin
+ FUNCSHR= source/interbase/lib/gdsf.so
+ GDS_LINK= $(GDSSHR_LINK)
+-#GDS_PYXIS=
+ GDS_PYXIS= gds_pyxis.a
+ GDSLIB_BACKEND= source/interbase/lib/gds_b.a
+ GDSLIB_LINK= -Lsource/jrd -lgds_b -lc -ldescrypt
+
+ GDSSHR= source/interbase/lib/gds.so
+ LINUX_GDSSHR= $(GDSSHR)
+-GDSSHR_LINK= $(SHRLIB_DIR) -L/usr/local/lib -lgds -lgds_pyxis -ldescrypt
+-PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -L/usr/local/lib -lgds -lgds_pyxis
+-#PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis
++GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis -ldescrypt
++PIPE_GDSSHR_LINK= $(SHRLIB_DIR) -lgds -lgds_pyxis
+ HLPDIR= source/qli/
+ HOSTNAME= `hostname | cut -d'.' -f1`
+ INCLUDES= include_so include_so_ada
+@@ -106,11 +104,6 @@
+ MUISQL_LINK_OPTS= $(MUISQL_MU_LIB) $(PIPE_GDSSHR_LINK) -lm
+ PIC_FLAGS= $(CFLAGS) -fPIC
+ PIPE= gds.a gds_pipe
+-#PYXIS=
+-#PYXIS_MISC_OBJS=
+-#PYXIS_P_MISC_OBJS=
+-#PYXIS_OBJECTS=
+-#PYXIS_MISC_OBJECTS=
+ PYXIS= pyxis
+ PYXIS_MISC_OBJS= $(PYXIS_MISC)
+ PYXIS_P_MISC_OBJS= $(PYXIS_P_MISC)
+@@ -167,5 +160,8 @@
+ SHRLIB_EXT= .so
+
+ V3PRINTER= source/lock/printv3.o
++
++# Forces library build for FreeBSD
++PYXIS_LIBRARY= libpyxis.a
diff --git a/databases/firebird20-server/pkg-comment b/databases/firebird20-server/pkg-comment
new file mode 100644
index 000000000000..f8cb5bc1d7b3
--- /dev/null
+++ b/databases/firebird20-server/pkg-comment
@@ -0,0 +1 @@
+The open-source InterBase(tm) 6.0 spin-off (Classic version)
diff --git a/databases/firebird20-server/pkg-descr b/databases/firebird20-server/pkg-descr
new file mode 100644
index 000000000000..5f05e046a387
--- /dev/null
+++ b/databases/firebird20-server/pkg-descr
@@ -0,0 +1,22 @@
+The open-source InterBase(tm) 6.0 spin-off (Classic server version)
+
+InterBase is a world-class DBMS with a history too rich to detail
+here. Once selling for several thousands of dollars per license,
+some very big players use it worldwide. Inprise has open-sourced
+InterBase 6.0, and a lively bunch of folks has charged themselves
+with seeing that it lives on through the Firebird project.
+
+Note that as of Firebird 0.9_4, the locksmith back door has
+been closed.
+
+For more information on Firebird and InterBase, see:
+http://www.ibphoenix.com/
+http://www.interbase2000.org/
+http://www.interbase.com/
+
+and of course the firebird page itself:
+WWW: http://sourceforge.net/projects/firebird/
+
+For more information on the locksmith back door, see:
+
+https://www.kb.cert.org/vuls/id/247371
diff --git a/databases/firebird20-server/pkg-install b/databases/firebird20-server/pkg-install
new file mode 100644
index 000000000000..c40e25e88ffc
--- /dev/null
+++ b/databases/firebird20-server/pkg-install
@@ -0,0 +1,145 @@
+#!/bin/sh
+
+# Created in haste by smashing together various
+# files from the port scripts.
+
+if [ "$2" = "PRE-INSTALL" ]; then
+if [ -d $PKG_PREFIX/firebird ]; then
+ if [ -d $PKG_PREFIX/firebird.old ]; then
+ rm -rf $PKG_PREFIX/firebird.old
+ fi
+ mv $PKG_PREFIX/firebird $PKG_PREFIX/firebird.old
+fi
+
+if [ -L /usr/interbase ]; then
+ rm -f /usr/interbase
+fi
+
+if [ -d /usr/interbase ]; then
+ mv /usr/interbase /usr/interbase.old
+fi
+
+ln -fs $PKG_PREFIX/firebird /usr/interbase
+
+perl <<EOF
+eval '(exit \$?0)' && eval 'exec /usr/bin/perl -S \$0 \${1+"\$@"}'
+& eval 'exec /usr/bin/perl -S \$0 \$argv:q'
+if 0;
+
+if( \$> ) {
+ print "\nYou must be root to run this step!\n\n";
+ exit 1;
+}
+
+if( getpwnam( "firebird" ) ) {
+ ( \$null, \$null, \$fbUID ) = getpwnam( "firebird" );
+} else {
+ \$fbUID = 90;
+ while( getpwuid( \$fbUID ) ) {
+ \$fbUID++;
+ }
+}
+
+if( getgrnam( "firebird" ) ) {
+ ( \$null, \$null, \$fbGID ) = getgrnam( "firebird" );
+} else {
+ \$fbGID = 90;
+ while( getgrgid( \$fbGID ) ) {
+ \$fbGID++;
+ }
+ &append_file( "/etc/group", "firebird:*:\$fbGID:" );
+}
+
+print "firebird user using uid \$fbUID\n";
+print "firebird user using gid \$fbGID\n";
+
+system( "/usr/bin/chpass -a \"firebird:*:\$fbUID:\$fbGID\:\:0:0:Firebird pseudo-user:\$ENV{'PKG_PREFIX'}/firebird:/bin/sh\"" );
+
+sub append_file {
+ local(\$file,@list) = @_;
+ local(\$LOCK_EX) = 2;
+ local(\$LOCK_NB) = 4;
+ local(\$LOCK_UN) = 8;
+
+ open(F, ">> \$file") || die "\$file: \$!\n";
+ while( ! flock( F, \$LOCK_EX | \$LOCK_NB ) ) {
+ exit 1;
+ }
+ print F join( "\n", @list) . "\n";
+ close F;
+ flock( F, \$LOCK_UN );
+}
+EOF
+elif [ "$2" = "POST-INSTALL" ]; then
+chown -R firebird:firebird $PKG_PREFIX/firebird
+
+# Turn everybody to read only.
+chmod -R o=r $PKG_PREFIX/firebird
+
+# Now fix up the mess.
+
+# fix up directories
+for i in `find $PKG_PREFIX/firebird -print`
+ do
+ FileName=$i
+ if [ -d $FileName ]
+ then
+ chmod o=rx $FileName
+ fi
+ done
+
+
+
+cd $PKG_PREFIX/firebird/bin
+
+# all users can run everything.
+chmod o=rx *
+
+# SUID is needed for running server programs.
+
+for i in gds_lock_mgr gds_drop gds_inet_server
+ do
+ chmod ug+s $i
+ done
+
+
+# Lock files
+
+cd $PKG_PREFIX/firebird
+
+for i in isc_init1 isc_lock1 isc_event1
+ do
+ FileName=$i.`hostname`
+ touch $FileName
+ chmod uga=rw $FileName
+ chown firebird:firebird $FileName
+ done
+
+
+touch interbase.log
+chmod ugo=rw interbase.log
+
+# make databases writable by all
+chmod ugo=rw examples/v5/*.gdb
+chmod ugo=rw help/*.gdb
+chmod ugo=rw isc4.gdb
+
+# remove any existing gds service
+cp /etc/services /etc/services.old
+cp /etc/inetd.conf /etc/inetd.conf.old
+cat /etc/services |grep -v gds_db >/etc/services.new
+cat /etc/inetd.conf |grep -v gds_db >/etc/inetd.conf.new
+mv /etc/services.new /etc/services
+mv /etc/inetd.conf.new /etc/inetd.conf
+
+# add the gds service and restart inetd
+cat >>/etc/services <<EOF
+gds_db 3050/tcp #InterBase Database Remote Protocol
+EOF
+cat >>/etc/inetd.conf <<EOF
+gds_db stream tcp nowait firebird /usr/interbase/bin/gds_inet_server gds_inet_server
+EOF
+kill -HUP `cat /var/run/inetd.pid`
+kill -HUP `cat /var/run/inetd.pid`
+
+fi
diff --git a/databases/firebird20-server/pkg-message b/databases/firebird20-server/pkg-message
new file mode 100644
index 000000000000..f15892a06aaa
--- /dev/null
+++ b/databases/firebird20-server/pkg-message
@@ -0,0 +1,19 @@
+
+---------------------------------------------------------
+Firebird is now installed. There is a symbolic link from
+/usr/interbase -> %%PREFIX%%/firebird. Firebird needs this
+link for proper operation.
+
+It is STRONGLY recommended that you change the SYSDBA
+password with:
+
+$ cd /usr/interbase
+$ gsec -user SYSDBA -pass masterkey
+GSEC> modify SYSDBA -pw newpassword
+GSEC> quit
+
+before doing anything serious with Firebird.
+
+See %%PREFIX%%/firebird/RELNOTES for more.
+---------------------------------------------------------
+
diff --git a/databases/firebird20-server/pkg-plist b/databases/firebird20-server/pkg-plist
new file mode 100644
index 000000000000..66150c5bde26
--- /dev/null
+++ b/databases/firebird20-server/pkg-plist
@@ -0,0 +1,104 @@
+firebird/intl/gdsintl
+firebird/examples/v5/ib_udf.sql
+firebird/examples/v5/README
+firebird/examples/v5/align.h
+firebird/examples/v5/api1.c
+firebird/examples/v5/api10.c
+firebird/examples/v5/api11.c
+firebird/examples/v5/api12.c
+firebird/examples/v5/api13.c
+firebird/examples/v5/api14.e
+firebird/examples/v5/api15.c
+firebird/examples/v5/api16.c
+firebird/examples/v5/api16t.c
+firebird/examples/v5/api2.c
+firebird/examples/v5/api3.c
+firebird/examples/v5/api4.c
+firebird/examples/v5/api5.c
+firebird/examples/v5/api6.c
+firebird/examples/v5/api7.c
+firebird/examples/v5/api8.c
+firebird/examples/v5/api9.c
+firebird/examples/v5/api9f.c
+firebird/examples/v5/apifull.c
+firebird/examples/v5/employe2.sql
+firebird/examples/v5/dyn1.e
+firebird/examples/v5/dyn2.e
+firebird/examples/v5/dyn3.e
+firebird/examples/v5/dyn4.e
+firebird/examples/v5/dyn5.e
+firebird/examples/v5/dynfull.e
+firebird/examples/v5/employee.gbk
+firebird/examples/v5/employee.gdb
+firebird/examples/v5/example.h
+firebird/examples/v5/api9f.sql
+firebird/examples/v5/intlemp.gbk
+firebird/examples/v5/intlemp.gdb
+firebird/examples/v5/stat1.e
+firebird/examples/v5/stat10.e
+firebird/examples/v5/stat11.e
+firebird/examples/v5/stat12.e
+firebird/examples/v5/stat12t.e
+firebird/examples/v5/stat2.e
+firebird/examples/v5/stat3.e
+firebird/examples/v5/stat4.e
+firebird/examples/v5/stat5.e
+firebird/examples/v5/stat6.e
+firebird/examples/v5/stat7.e
+firebird/examples/v5/stat8.e
+firebird/examples/v5/stat9.e
+firebird/examples/v5/udf.sql
+firebird/examples/v5/udflib.c
+firebird/examples/v5/makefile
+firebird/include/perf.h
+firebird/include/ib_util.h
+firebird/include/gds.hxx
+firebird/include/gds.h
+firebird/include/ibase.h
+firebird/include/iberror.h
+firebird/include/gds.f
+firebird/UDF/ib_udf
+firebird/lib/ib_util.so
+firebird/lib/gds.a
+firebird/lib/gds.so
+firebird/lib/libgds.so
+firebird/lib/libgds.so.1
+firebird/lib/libgds_pyxis.a
+firebird/lib/libgds.a
+firebird/lib/gds_pyxis.a
+firebird/help/help.gbak
+firebird/help/help.gdb
+firebird/bin/isc4.gbak
+firebird/bin/gpre
+firebird/bin/gds_pipe
+firebird/bin/gds_drop
+firebird/bin/gds_lock_mgr
+firebird/bin/gfix
+firebird/bin/gdef
+firebird/bin/isql
+firebird/bin/gds_lock_print
+firebird/bin/qli
+firebird/bin/gds_inet_server
+firebird/bin/gsplit
+firebird/bin/gstat
+firebird/bin/gds_relay
+firebird/bin/gsec
+firebird/bin/gbak
+firebird/services.isc
+firebird/isc_config
+firebird/isc4.gdb
+firebird/interbase.msg
+firebird/interbase.log
+firebird/inetd.conf.isc
+firebird/RELNOTES
+@dirrm firebird
+@dirrm firebird/intl
+@dirrm firebird/examples/v3
+@dirrm firebird/examples/v4
+@dirrm firebird/examples/v5
+@dirrm firebird/examples
+@dirrm firebird/include
+@dirrm firebird/UDF
+@dirrm firebird/lib
+@dirrm firebird/help
+@dirrm firebird/bin
diff --git a/databases/firebird20-server/scripts/addservice b/databases/firebird20-server/scripts/addservice
new file mode 100644
index 000000000000..df9aea5e91de
--- /dev/null
+++ b/databases/firebird20-server/scripts/addservice
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+cat >>/etc/services <<EOF
+gds_db 3050/tcp #InterBase Database Remote Protocol
+EOF
+cat >>/etc/inetd.conf <<EOF
+gds_db stream tcp nowait firebird /usr/interbase/bin/gds_inet_server gds_inet_server
+EOF
+kill -HUP `cat /var/run/inetd.pid`
diff --git a/databases/firebird20-server/scripts/createuser b/databases/firebird20-server/scripts/createuser
new file mode 100644
index 000000000000..b61d47fd84bd
--- /dev/null
+++ b/databases/firebird20-server/scripts/createuser
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+#
+
+eval '(exit $?0)' && eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
+& eval 'exec /usr/bin/perl -S $0 $argv:q'
+if 0;
+
+if( $> ) {
+ print "\nYou must be root to run this step!\n\n";
+ exit 1;
+}
+
+if( getpwnam( "firebird" ) ) {
+ ( $null, $null, $fbUID ) = getpwnam( "firebird" );
+} else {
+ $fbUID = 90;
+ while( getpwuid( $fbUID ) ) {
+ $fbUID++;
+ }
+}
+
+if( getgrnam( "firebird" ) ) {
+ ( $null, $null, $fbGID ) = getgrnam( "firebird" );
+} else {
+ $fbGID = 90;
+ while( getgrgid( $fbGID ) ) {
+ $fbGID++;
+ }
+ &append_file( "/etc/group", "firebird:*:$fbGID:" );
+}
+
+print "firebird user using uid $fbUID\n";
+print "firebird user using gid $fbGID\n";
+
+system( "/usr/bin/chpass -a \"firebird:*:$fbUID:$fbGID\:\:0:0:Firebird pseudo-user:$ENV{'PREFIX'}/firebird:/bin/sh\"" );
+
+sub append_file {
+ local($file,@list) = @_;
+ local($LOCK_EX) = 2;
+ local($LOCK_NB) = 4;
+ local($LOCK_UN) = 8;
+
+ open(F, ">> $file") || die "$file: $!\n";
+ while( ! flock( F, $LOCK_EX | $LOCK_NB ) ) {
+ exit 1;
+ }
+ print F join( "\n", @list) . "\n";
+ close F;
+ flock( F, $LOCK_UN );
+}
diff --git a/databases/firebird20-server/scripts/post-install b/databases/firebird20-server/scripts/post-install
new file mode 100644
index 000000000000..e4d2d3a9cd07
--- /dev/null
+++ b/databases/firebird20-server/scripts/post-install
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+chown -R firebird:firebird $PREFIX/firebird
+
+# Turn everybody to read only.
+chmod -R o=r $PREFIX/firebird
+
+# Now fix up the mess.
+
+# fix up directories
+for i in `find $PREFIX/firebird -print`
+ do
+ FileName=$i
+ if [ -d $FileName ]
+ then
+ chmod o=rx $FileName
+ fi
+ done
+
+
+
+cd $PREFIX/firebird/bin
+
+# all users can run everything.
+chmod o=rx *
+
+# SUID is needed for running server programs.
+
+for i in gds_lock_mgr gds_drop gds_inet_server
+ do
+ chmod ug+s $i
+ done
+
+
+# Lock files
+
+cd $PREFIX/firebird
+
+for i in isc_init1 isc_lock1 isc_event1
+ do
+ FileName=$i.`hostname`
+ touch $FileName
+ chmod uga=rw $FileName
+ chown firebird:firebird $FileName
+ done
+
+
+touch interbase.log
+chmod ugo=rw interbase.log
+
+# make databases writable by all
+chmod ugo=rw examples/v5/*.gdb
+chmod ugo=rw help/*.gdb
+chmod ugo=rw isc4.gdb
+
+# remove any existing gds service
+sh $SCRIPTDIR/rmservice
+
+# add the gds service and restart inetd
+sh $SCRIPTDIR/addservice
+kill -HUP `cat /var/run/inetd.pid`
+
+sed "s|%%PREFIX%%|$PREFIX|" $SCRIPTDIR/../pkg-message
+
+cat <<EOF
+
+==========================================================
+!! NOTE !!
+
+As there are some oddities to the Firebird build process,
+it is likely you WILL NOT BE ABLE TO USE IT until you
+remove the semaphore created during the build process.
+Please read $PREFIX/firebird/RELNOTES for more information.
+==========================================================
+
+EOF
diff --git a/databases/firebird20-server/scripts/pre-build b/databases/firebird20-server/scripts/pre-build
new file mode 100644
index 000000000000..6605df7770fd
--- /dev/null
+++ b/databases/firebird20-server/scripts/pre-build
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+GDS_LOCK_MGR=`ps ax |grep gds_lock_mgr |grep -v grep`;
+
+if [ "$GDS_LOCK_MGR" != "" ]; then
+ echo "It appears you have a gds_lock_manager already running.";
+ echo;
+ echo "You must cease all InterBase operations to build this port.";
+ echo "Make sure nobody is connected to any databases, then use";
+ echo "'gds_drop -a' and manually verify (with ipcs) that the";
+ echo "semaphores were removed.";
+ exit 1;
+fi
+exit 0
+
diff --git a/databases/firebird20-server/scripts/pre-install b/databases/firebird20-server/scripts/pre-install
new file mode 100644
index 000000000000..a6e1b37a9008
--- /dev/null
+++ b/databases/firebird20-server/scripts/pre-install
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+if [ -d $PREFIX/firebird ]; then
+ if [ -d $PREFIX/firebird.old ]; then
+ rm -rf $PREFIX/firebird.old
+ fi
+ mv $PREFIX/firebird $PREFIX/firebird.old
+fi
+
+if [ -L /usr/interbase ]; then
+ rm -f /usr/interbase
+fi
+
+if [ -d /usr/interbase ]; then
+ mv /usr/interbase /usr/interbase.old
+fi
+
+ln -fs $PREFIX/firebird /usr/interbase
+
+perl $SCRIPTDIR/createuser
diff --git a/databases/firebird20-server/scripts/rmservice b/databases/firebird20-server/scripts/rmservice
new file mode 100644
index 000000000000..58adfc17419d
--- /dev/null
+++ b/databases/firebird20-server/scripts/rmservice
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+cp /etc/services /etc/services.old
+cp /etc/inetd.conf /etc/inetd.conf.old
+cat /etc/services |grep -v gds_db >/etc/services.new
+cat /etc/inetd.conf |grep -v gds_db >/etc/inetd.conf.new
+mv /etc/services.new /etc/services
+mv /etc/inetd.conf.new /etc/inetd.conf