Module submission - postgresql
dveatch@woh.rr.com
dveatch at woh.rr.com
Wed Aug 3 21:21:29 UTC 2005
module name : postgresql
suggested section : sql
update (y/n) : y
bugfix (y/n) : n
security (y/n) : n
This started out just have this module compile some stuff from the
contribs. I wanted to add some things so that apps like postgis,
grass and other geographical apps can use postgresql.
Well it morphed into more than that.
In a nutshell.
1. checks for pre version 8 databases. Is so, then build stops and
tells you why.
2. Throws an init script in to start/stop postgresql.
3. Initializes the database with postgres as the user.
The code may not be pretty or formatted correctly. But as far as
I can tell, it all works the way I intended. If it don't, let me know.
dveatch
-------------- next part --------------
--- postgresql/BUILD 1969-12-31 19:00:00.000000000 -0500
+++ postgresql/BUILD 2005-08-03 11:38:33.000000000 -0400
@@ -0,0 +1,15 @@
+(
+
+ ./configure --prefix=/usr \
+ $OPTS &&
+
+ default_make &&
+
+# This gives postgresql some additional things like text search, some dbase related utils
+# to name a few. See /usr/share/doc/postgresql/contrib for more info.
+
+ cd contrib &&
+ make all &&
+ make install
+
+) > $C_FIFO 2>&1
--- postgresql/CONFIGURE 1969-12-31 19:00:00.000000000 -0500
+++ postgresql/CONFIGURE 2005-08-03 11:38:34.000000000 -0400
@@ -0,0 +1,9 @@
+
+ if [ -f /var/lib/pgsql/data/PG_VERSION ]
+ then
+ if [ `cat /var/lib/pgsql/data/PG_VERSION` != '8.0' ]
+ then
+ printf "${PROBLEM_COLOR}A pre 8.0 version of the database was found.\nYou need to upgrade the data format to 8.0.\nRefer to the INSTALL file located in the tarball\nfor the upgrade procedure.\nThe install will not continue.""${DEFAULT_COLOR}"
+ exit 1
+ fi
+ fi
--- postgresql/DEPENDS 1969-12-31 19:00:00.000000000 -0500
+++ postgresql/DEPENDS 2005-08-03 11:38:34.000000000 -0400
@@ -0,0 +1,7 @@
+depends ncurses &&
+
+optional_depends "openssl" "--with-openssl" "" "for SSL connections" &&
+optional_depends "tcl" "--with-tcl" "" "for portable scripting" &&
+optional_depends "perl" "--with-perl" "" "for general purpose programming" &&
+optional_depends "Python" "--with-python" "" "for object oriented programming" &&
+optional_depends "Linux-PAM" "--with-pam" "" "for user authentication"
--- postgresql/DETAILS 1969-12-31 19:00:00.000000000 -0500
+++ postgresql/DETAILS 2005-08-03 17:08:46.000000000 -0400
@@ -0,0 +1,52 @@
+ MODULE=postgresql
+ VERSION=8.0.3
+ SOURCE=$MODULE-$VERSION.tar.bz2
+ SOURCE_URL[0]=ftp://ftp.at.postgresql.org/db/www.postgresql.org/pub/source/v${VERSION}/
+ SOURCE_URL[1]=ftp://ftp.be.postgresql.org/postgresql/source/v${VERSION}/
+ SOURCE_URL[2]=ftp://ftp.br.postgresql.org/pub/PostgreSQL/source/v${VERSION}/
+ SOURCE_URL[3]=ftp://ftp3.ca.postgresql.org/pub/source/v${VERSION}/
+ SOURCE_URL[4]=ftp://ftp.cl.postgresql.org/pub/GNU/pgsql/source/v${VERSION}/
+ SOURCE_URL[5]=ftp://ftp2.cr.postgresql.org/pub/Unix/postgres/source/v${VERSION}/
+ SOURCE_URL[6]=ftp://ftp2.cz.postgresql.org/pub/postgresql/source/v${VERSION}/
+ SOURCE_URL[7]=ftp://ftp.dk.postgresql.org/mirrors/postgresql/source/v${VERSION}/
+ SOURCE_URL[8]=ftp://ftp2.dk.postgresql.org/pub/PostgreSQL/source/v${VERSION}/
+ SOURCE_URL[9]=ftp://ftp.ee.postgresql.org/mirrors/postgresql/source/v${VERSION}/
+ SOURCE_URL[10]=ftp://ftp.fr.postgresql.org/source/v${VERSION}/
+ SOURCE_URL[11]=ftp://ftp2.fr.postgresql.org/postgresql/source/v${VERSION}/
+ SOURCE_URL[12]=ftp://ftp.de.postgresql.org/mirror/postgresql/source/v${VERSION}/
+ SOURCE_URL[13]=ftp://ftp2.de.postgresql.org/pub/comp/os/unix/database/postgresql/source/v${VERSION}/
+ SOURCE_URL[14]=ftp://ftp3.de.postgresql.org/pub/Mirrors/ftp.postgresql.org/source/v${VERSION}/
+ SOURCE_URL[15]=ftp://ftp2.is.postgresql.org/pub/postgresql/source/v${VERSION}/
+ SOURCE_URL[16]=ftp://ftp.ie.postgresql.org/mirrors/ftp.postgresql.org/pub/source/v${VERSION}/
+ SOURCE_URL[17]=ftp://ftp2.ie.postgresql.org/mirrors/ftp.postgresql.org/source/v${VERSION}/
+ SOURCE_URL[18]=ftp://ftp6.jp.postgresql.org/postgresql/source/v${VERSION}/
+ SOURCE_URL[19]=ftp://ftp.kr.postgresql.org/mirror/database/postgresql/source/v${VERSION}/
+ SOURCE_URL[20]=ftp://ftp4.nl.postgresql.org/postgresql.zeelandnet.nl/source/v${VERSION}/
+ SOURCE_URL[21]=ftp://ftp.no.postgresql.org/pub/databases/postgresql/source/v${VERSION}/
+ SOURCE_URL[22]=ftp://ftp7.pl.postgresql.org/pub/mirror/ftp.postgresql.org/source/v${VERSION}/
+ SOURCE_URL[23]=ftp://ftp.pt.postgresql.org/vsource/${VERSION}/
+ SOURCE_URL[24]=ftp://ftp6.ro.postgresql.org/pub/mirrors/ftp.postgresql.org/source/v${VERSION}/
+ SOURCE_URL[25]=ftp://ftp.ru.postgresql.org/pub/unix/database/pgsql/source/v${VERSION}/
+ SOURCE_URL[26]=ftp://ftp3.ru.postgresql.org/pub/mirror/postgresql/pub/source/v${VERSION}/
+ SOURCE_URL[27]=ftp://ftp.za.postgresql.org:80/source/v${VERSION}/
+ SOURCE_URL[28]=ftp://ftp5.es.postgresql.org/mirror/postgresql/source/v${VERSION}/
+ SOURCE_URL[29]=ftp://ftp2.ch.postgresql.org/mirror/postgresql/source/v${VERSION}/
+ SOURCE_URL[30]=ftp://ftp5.tw.postgresql.org/pub/Unix/Database/PostgreSQL/source/v${VERSION}/
+ SOURCE_URL[31]=ftp://ftp.tr.postgresql.org/pub/SQL/postgresql/source/v${VERSION}/
+ SOURCE_URL[32]=ftp://ftp5.us.postgresql.org/pub/PostgreSQL/source/v${VERSION}/
+ SOURCE_URL[33]=ftp://ftp8.us.postgresql.org/pub/pgsql/source/v${VERSION}/
+ SOURCE_URL[34]=ftp://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/v${VERSION}/
+ SOURCE_URL[35]=ftp://ftp10.us.postgresql.org/pub/postgresql/source/v${VERSION}/
+ SOURCE_URL[36]=ftp://ftp15.us.postgresql.org/source/v${VERSION}/
+ SOURCE_VFY=sha1:45f9a739e414e617d1e5f43779046546ee1a0d3a
+ WEB_SITE=http://www.postgresql.org
+ ENTERED=20011113
+ UPDATED=20050803
+ FUZZY=off
+ SHORT="postgresql is a sophisticated Object-Relational DBMS"
+
+cat << EOF
+PostgreSQL is a sophsticated Object-Relational DBMS, supporting almost
+all SQL constructs, including subselects, trasactions and user defined
+types and functions.
+EOF
--- postgresql/POST_INSTALL 1969-12-31 19:00:00.000000000 -0500
+++ postgresql/POST_INSTALL 2005-08-03 12:44:42.000000000 -0400
@@ -0,0 +1,30 @@
+# Time to initialize the database
+PGDATA=/var/lib/pgsql/data
+INITDB=/usr/bin/initdb
+
+if [ 'grep postgres /etc/passwd' != 'postgres' ]
+ then
+ add_priv_user postgres \
+ -d /var/lib/pgsql \
+ -s /bin/bash \
+ -g postgres
+ fi
+
+if [ ! -d $PGDATA ]
+ then
+ mkdir -p $PGDATA
+ chown postgres.postgres $PGDATA
+ chmod go-rwx $PGDATA
+ su postgres -c "$INITDB --pgdata=$PGDATA" # > /dev/null 2>&1"
+ printf "Or run /etc/init.d/postgresql start\n"
+ fi
+# Done with database init.
+
+if [ ! -e /etc/init.d/postgresql ]
+ then
+ cp $SCRIPT_DIRECTORY/posgtresql/init.d/postgresql
+ fi
+
+if module_installed DBD-Pg; then lin DBD-Pg; fi
+if module_installed php; then lin -c php; fi
+if module_installed php5; then lin -c php5; fi
--- postgresql/init.d/postgresql 1969-12-31 19:00:00.000000000 -0500
+++ postgresql/init.d/postgresql 2005-08-03 11:38:35.000000000 -0400
@@ -0,0 +1,100 @@
+#! /bin/bash
+
+# chkconfig: 2345 98 02
+# description: PostgreSQL RDBMS
+
+# This is an example of a start/stop script for SysV-style init, such
+# as is used on Linux systems. You should edit some of the variables
+# and maybe the 'echo' commands.
+#
+# Place this file at /etc/init.d/postgresql (or
+# /etc/rc.d/init.d/postgresql) and make symlinks to
+# /etc/rc.d/rc0.d/K02postgresql
+# /etc/rc.d/rc1.d/K02postgresql
+# /etc/rc.d/rc2.d/K02postgresql
+# /etc/rc.d/rc3.d/S98postgresql
+# /etc/rc.d/rc4.d/S98postgresql
+# /etc/rc.d/rc5.d/S98postgresql
+# Or, if you have chkconfig, simply:
+# chkconfig --add postgresql
+#
+# Proper init scripts on Linux systems normally require setting lock
+# and pid files under /var/run as well as reacting to network
+# settings, so you should treat this with care.
+
+# Original author: Ryan Kirkpatrick <pgsql at rkirkpat.net>
+
+# $PostgreSQL: pgsql/contrib/start-scripts/linux,v 1.7 2004/10/01 18:30:21 tgl Exp $
+
+## EDIT FROM HERE
+
+# Data directory
+PGDATA=/var/lib/pgsql/data
+
+# Who to run the postmaster as, usually "postgres". (NOT "root")
+PGUSER=postgres
+
+# Where to keep a log file
+PGLOG=$PGDATA/serverlog
+
+## STOP EDITING HERE
+
+# Check for echo -n vs echo \c
+if echo '\c' | grep -s c >/dev/null 2>&1 ; then
+ ECHO_N="echo -n"
+ ECHO_C=""
+else
+ ECHO_N="echo"
+ ECHO_C='\c'
+fi
+
+# The path that is to be used for the script
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+
+# What to use to start up the postmaster (we do NOT use pg_ctl for this,
+# as it adds no value and can cause the postmaster to misrecognize a stale
+# lock file)
+DAEMON=/usr/bin/postmaster
+
+# What to use to shut down the postmaster
+PGCTL=/usr/bin/pg_ctl
+
+set -e
+
+# Only start if we can find the postmaster.
+test -x $DAEMON || exit 0
+
+# Parse command line parameters.
+case $1 in
+ start)
+ $ECHO_N "Starting PostgreSQL: "$ECHO_C
+ su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
+ echo "ok"
+ ;;
+ stop)
+ echo -n "Stopping PostgreSQL: "
+ su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast"
+ echo "ok"
+ ;;
+ restart)
+ echo -n "Restarting PostgreSQL: "
+ su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w"
+ su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
+ echo "ok"
+ ;;
+ reload)
+ echo -n "Reload PostgreSQL: "
+ su - $PGUSER -c "$PGCTL reload -D '$PGDATA' -s"
+ echo "ok"
+ ;;
+ status)
+ su - $PGUSER -c "$PGCTL status -D '$PGDATA'"
+ ;;
+ *)
+ # Print help
+ echo "Usage: $0 {start|stop|restart|reload|status}" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
-------------- next part --------------
lvu submit postgresql e36efbe7365683dfda96e582eae7c51b -
2.6.12.3 2.6.12 gcc-3.3.3 glibc-2.3.3
More information about the Lunar
mailing list