aboutsummaryrefslogtreecommitdiff
path: root/databases/firebird-devel/scripts
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 /databases/firebird-devel/scripts
parent7b27d09705c2d09a78a107a04ce8d384d51536ab (diff)
downloadports-cca71f50d225f7829cd5f1539338fa678225bd91.tar.gz
ports-cca71f50d225f7829cd5f1539338fa678225bd91.zip
Notes
Diffstat (limited to 'databases/firebird-devel/scripts')
-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
6 files changed, 178 insertions, 0 deletions
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