Commits

Uelsk8s committed 0275b58

adding postgresql from joe1962

  • Participants
  • Parent commits a3c2459

Comments (0)

Files changed (29)

File var/vabs/postgresql/src/README

-PostgreSQL is an advanced object-relational database management
-system (ORDBMS) based on POSTGRES. With more than 15 years of
-development history, it is quickly becoming the de facto
-database for enterprise level open source solutions.
-
-Before you can run postgresql you'll need to create the database;
-please see README.SBo.
-
-You need a "postgres" user and group prior to building postgresql.
-Something like this will suffice for most systems:
-  groupadd -g 209 postgres
-  useradd -u 209 -g 209 -d /var/lib/pgsql postgres
-Feel free to use a different uid and gid if desired, but 209 is
-recommended to avoid conflicts with other stuff from SlackBuilds.org.

File var/vabs/postgresql/src/README.SBo

-Before you can run postgresql you'll need to create the
-database files in /var/lib/pgsql. The following should do
-the trick.
-	# su postgres -c "initdb -D /var/lib/pgsql/data"
-
-Additionally, a logrotation script and init script are included.
-For production level log file handling please read
-http://www.postgresql.org/docs/8.4/interactive/logfile-maintenance.html
-
-In order to start postgresql at boot and stop it properly at shutdown, 
-make sure rc.postgresql is executable and add the following lines to 
-the following files:
-
-	/etc/rc.d/rc.local
-	==================
-	# Startup postgresql
-	if [ -x /etc/rc.d/rc.postgresql ]; then
-		/etc/rc.d/rc.postgresql start
-	fi
-
-	/etc/rc.d/rc.local_shutdown
-	===========================
-	# Stop postgres
-	if [ -x /etc/rc.d/rc.postgresql ]; then
-		/etc/rc.d/rc.postgresql stop
-	fi
-
-Additionally, rc.postgresql script has additionalg modes for stop/restart:
-  force-stop|force-restart (i.e. pg_ctl 'fast' mode)
-  unclean-stop|unclean-restart (i.e. pg_ctl 'immediate' mode)
-See http://www.postgresql.org/docs/8.4/static/app-pg-ctl.html
-
-This script builds postgresql with some useful extension modules from
-the contrib directory, see PG_EXTENSIONS in SlackBuild file.
-
-Please note that in order to actually use extension, you must execute
-accompanying SQL scripts located in /usr/share/postgresql/contrib

File var/vabs/postgresql/src/doinst.sh

-config() {
-  NEW="$1"
-  OLD="$(dirname $NEW)/$(basename $NEW .new)"
-  # If there's no config file by that name, mv it over:
-  if [ ! -r $OLD ]; then
-    mv $NEW $OLD
-  elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
-    rm $NEW
-  fi
-  # Otherwise, we leave the .new copy for the admin to consider...
-}
-
-preserve_perms() {
-  NEW="$1"
-  OLD="$(dirname $NEW)/$(basename $NEW .new)"
-  if [ -e $OLD ]; then
-    cp -a $OLD ${NEW}.incoming
-    cat $NEW > ${NEW}.incoming
-    mv ${NEW}.incoming $NEW
-  fi
-  config $NEW
-}
-
-preserve_perms etc/rc.d/rc.postgresql.new
-config etc/logrotate.d/postgresql.new
-
-getent group postgres > /dev/null || sh /var/log/setup/setup.postgresql
-

File var/vabs/postgresql/src/menuitems/etc/xdg/menus/applications-merged/postgresql.menu

+<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
+"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd">
+<Menu>
+	<Name>Applications</Name>
+	<Menu>
+		<Name>Development</Name>
+		<Menu>
+			<Name>PostgreSQL</Name>
+			<Directory>postgresql.directory</Directory>
+			<Include>
+			    <Category>PostgreSQL</Category>
+			</Include>
+		</Menu>
+	</Menu>
+</Menu>

File var/vabs/postgresql/src/menuitems/usr/share/applications/postgresql/pg_first-run.desktop

+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Exec=xterm -hold -e "echo Please input password for user: root ; su - root -c '/usr/share/postgresql/scripts/post-install'"
+Icon=/usr/share/pixmaps/postgresql/pg-48x48.png
+DocPath=
+Comment=First-time PostgreSQL post-install setup
+Terminal=false
+Name=PostgreSQL first-time setup
+GenericName=PostgreSQL DB
+Categories=PostgreSQL;

File var/vabs/postgresql/src/menuitems/usr/share/applications/postgresql/pg_hba.conf.desktop

+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Exec=xterm -e "echo Please input password for user: postgres ; su - postgres -c 'mcedit /home/postgres/pgdata/pg_hba.conf'"
+Icon=/usr/share/pixmaps/postgresql/configure.png
+DocPath=
+Comment=Edit PostgreSQL configuration file
+Terminal=false
+Name=PostgreSQL - edit pg_hba.conf
+GenericName=PostgreSQL DB
+Categories=PostgreSQL;

File var/vabs/postgresql/src/menuitems/usr/share/applications/postgresql/pg_ident.conf.desktop

+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Exec=xterm -e "echo Please input password for user: postgres ; su - postgres -c 'mcedit /home/postgres/pgdata/pg_ident.conf'"
+Icon=/usr/share/pixmaps/postgresql/configure.png
+DocPath=
+Comment=Edit PostgreSQL configuration file
+Terminal=false
+Name=PostgreSQL - edit pg_ident.conf
+GenericName=PostgreSQL DB
+Categories=PostgreSQL;

File var/vabs/postgresql/src/menuitems/usr/share/applications/postgresql/pg_manual.desktop

+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Exec=browser /usr/doc/postgresql/html/index.html
+Icon=/usr/share/pixmaps/postgresql/html.png
+DocPath=
+Comment=PostgreSQL Documentation
+Terminal=false
+Name=PostgreSQL User Manual
+GenericName=PostgreSQL Docs
+Categories=PostgreSQL;

File var/vabs/postgresql/src/menuitems/usr/share/applications/postgresql/pg_postgresql.conf.desktop

+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Exec=xterm -e "echo Please input password for user: postgres ; su - postgres -c 'mcedit /home/postgres/pgdata/postgresql.conf'"
+Icon=/usr/share/pixmaps/postgresql/configure.png
+DocPath=
+Comment=Edit PostgreSQL configuration file
+Terminal=false
+Name=PostgreSQL - edit postgresql.conf
+GenericName=PostgreSQL DB
+Categories=PostgreSQL;

File var/vabs/postgresql/src/menuitems/usr/share/applications/postgresql/pg_reload.desktop

+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Exec=xterm -hold -e "echo Please input password for user: postgres ; su - postgres -c 'pg_ctl reload -w -D /home/postgres/pgdata' ; echo ; echo Close terminal after you check the results..."
+Icon=/usr/share/pixmaps/postgresql/pg-reload-48x48.png
+DocPath=
+Comment=Reload PostgreSQL configuration
+Terminal=false
+Name=PostgreSQL Reload
+GenericName=PostgreSQL DB
+Categories=PostgreSQL;

File var/vabs/postgresql/src/menuitems/usr/share/applications/postgresql/pg_start.desktop

+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Exec=xterm -hold -e "echo Please input password for user: postgres ; su - postgres -c 'pg_ctl start -w -l /home/postgres/pg.log -D /home/postgres/pgdata' ; echo ; echo Close terminal after you check the results..."
+Icon=/usr/share/pixmaps/postgresql/pg-start-48x48.png
+DocPath=
+Comment=Start PostgreSQL database server
+Terminal=false
+Name=PostgreSQL Start
+GenericName=PostgreSQL DB
+Categories=PostgreSQL;

File var/vabs/postgresql/src/menuitems/usr/share/applications/postgresql/pg_stop.desktop

+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Exec=xterm -hold -e "echo Please input password for user: postgres ; su - postgres -c 'pg_ctl stop -m smart -D /home/postgres/pgdata' ; echo ; echo Close terminal after you check the results..."
+Icon=/usr/share/pixmaps/postgresql/pg-stop-48x48.png
+DocPath=
+Comment=Stop PostgreSQL database server
+Terminal=false
+Name=PostgreSQL Stop
+GenericName=PostgreSQL DB
+Categories=PostgreSQL;

File var/vabs/postgresql/src/menuitems/usr/share/desktop-directories/postgresql.directory

+[Desktop Entry]
+Encoding=UTF-8
+Type=Directory
+Icon=/usr/share/pixmaps/postgresql/pg-48x48.png
+Name=PostgreSQL

File var/vabs/postgresql/src/menuitems/usr/share/pixmaps/postgresql/configure.png

Added
New image

File var/vabs/postgresql/src/menuitems/usr/share/pixmaps/postgresql/html.png

Added
New image

File var/vabs/postgresql/src/menuitems/usr/share/pixmaps/postgresql/pg-48x48.png

Added
New image

File var/vabs/postgresql/src/menuitems/usr/share/pixmaps/postgresql/pg-reload-48x48.png

Added
New image

File var/vabs/postgresql/src/menuitems/usr/share/pixmaps/postgresql/pg-start-48x48.png

Added
New image

File var/vabs/postgresql/src/menuitems/usr/share/pixmaps/postgresql/pg-stop-48x48.png

Added
New image

File var/vabs/postgresql/src/notes.txt

+Had to remove these configure switches temporarily in VL64:
+ --with-gssapi  --with-krb5

File var/vabs/postgresql/src/pg_scripts/post-install

+#!/bin/bash
+#
+
+#***********************************************************************
+# First time install, needs to run as root:
+#***********************************************************************
+echo
+echo "---: ADDING USER 'postgres' WITH PASSWORD 'postgres' :---"
+echo
+useradd -m postgres -s /bin/bash && autopasswd postgres postgres postgres
+
+echo
+echo "---: MAKING 'postgres' OWNER OF DB DIRECTORY :---"
+echo
+mkdir /home/postgres/pgdata && chown postgres:users /home/postgres/pgdata
+
+echo
+echo "---: INITIALIZING DEFAULT DATABASE CLUSTER :---"
+echo
+sudo -u postgres initdb -D /home/postgres/pgdata
+
+echo
+echo "---: INSTALLING contrib/adminpack TO DEFAULT DATABASE CLUSTER :---"
+echo
+sudo -u postgres pg_ctl start -w -l /home/postgres/pg.log -D /home/postgres/pgdata
+### 9.x uses different contrib installation methods:
+#psql -U postgres -d postgres -f /usr/share/postgresql/contrib/uninstall_adminpack.sql
+#psql -U postgres -d postgres -f /usr/share/postgresql/contrib/adminpack.sql
+psql -U postgres -d postgres -c "DROP EXTENSION IF EXISTS adminpack;"
+psql -U postgres -d postgres -c "CREATE EXTENSION IF NOT EXISTS adminpack;"
+
+echo
+echo "---: DELETING THIS MENU OPTION :---"
+echo
+rm /usr/share/applications/postgresql/pg_first-run.desktop
+
+echo
+echo "---: POST-INSTALL SCRIPT HAS FINISHED :---"
+echo "---: CLOSE THIS TERMINAL AFTER READING SCRIPT RESULTS :---"
+echo
+

File var/vabs/postgresql/src/postgresql.SlackBuild

-#!/bin/sh
-
-## Slackware build script for PostgreSQL
-## $Revision: 5ad45bfd049c $
-## $Date: 2011/09/27 08:41:46 $
-##
-## Copyright 2007-2011 Adis Nezirovic <adis _at_ linux.org.ba>
-## Licensed under GNU GPL v2
-
-# Modified by the SlackBuilds.org Project
-
-PRGNAM=postgresql
-VERSION=${VERSION:-9.1.4}
-BUILD=${BUILD:-2}
-TAG=${TAG:-"$(ls /var/log/packages/|grep vlconfig2|cut -d "-" -f4|cut -c 2-5)"}
-LINK=${LINK:-"ftp://ftp.postgresql.org/pub/source/v${VERSION}/${PRGNAM}-${VERSION}.tar.bz2"}
-
-
-if [ "$NORUN" != 1 ]; then
-PG_UID=${PG_UID:-209}
-PG_GID=${PG_GID:-209}
-
-if [ -z "$ARCH" ]; then
-  case "$( uname -m )" in
-    i?86) ARCH=i586 ;;
-    arm*) ARCH=arm ;;
-       *) ARCH=$( uname -m ) ;;
-  esac
-fi
+#!/usr/bin/bash
+# This script assumes it will be launched within "/PKGNAME/VERSION/src" dir.
+# With all sources in "src" Your Vector Linux .tlz package, slack-desc,
+# and slack-required will be found in "VERSION" dir. The extraction and
+# build will be in a temp dir created in "PKGNAME" dir, and then removed on exit.
+# Comment out second to last line to keep this dir intact.
+#
+# This Template was compiled from the contributions of many users of the Vector
+# Linux forum at http://forum.vectorlinux.com and from tidbits collected 
+# from all over the internet. 
+#
+# Generated by sbbuilder-0.4.12.3, written by Rodrigo Bistolfi 
+# (rbistolfi) and Raimon Grau Cuscó (Kidd) for VectorLinux.
+#
+# Please put your name below if you add some original scripting lines.
+# AUTHORS = Joe1962 (postgresql scripting)
 
-CWD=$(pwd)
-TMP=${TMP:-/tmp/SBo}
-PKG=$TMP/package-$PRGNAM
-OUTPUT=${OUTPUT:-${CWD}/..}
+PKGNAME="postgresql"         #Enter package Name!
+PKGVERSION=${PKGVERSION:-"9.1.4"}      #Enter package Version!
+VER=$(echo $VERSION|sed 's/-/_/') #this fixes - in version
+TARNAME="$PKGNAME-$PKGVERSION"         #Enter tarball Name!
+DIRNAME="$PKGNAME-$PKGVERSION"            #Enter inner dir Name!
+VL_PACKAGER=${VL_PACKAGER:-"Joe1962"}   #Enter your Name!
+LINK=${LINK:-"http://ftp.postgresql.org/pub/source/v$PKGVERSION/$PKGNAME-$PKGVERSION.tar.bz2"}  #Enter URL for package here!
 
+#SYSTEM VARIABLES
+#----------------------------------------------------------------------------
+BUILDNUM=${BUILDNUM:-"1"}
+VL_VERSION=${VL_VERSION:-"$(ls /var/log/packages/|grep vlconfig2|cut -d "-" -f4|cut -c 2-5)"}
+BUILD=${BUILD:-"$BUILDNUM""$VL_VERSION"}
+ARCH=${ARCH:-"$(uname -m)"}
+CONFIG_OPTIONS=${CONFIG_OPTIONS:-"--enable-nls --with-perl --with-python --with-tcl --with-openssl --with-ldap --enable-thread-safety --with-libxml --with-libxslt --docdir=/usr/doc/ --with-system-tzdata=/usr/share/zoneinfo/"}
+###:  --with-gssapi  --with-krb5
+LDFLAG_OPTIONS=${LDFLAG_OPTIONS:-""}
+ADDRB=${ADDRB:-""} #Add deps that need to be added to the slack-required file here
+EXRB=${EXRB:-""} #Add deps that need to be excluded from the slack-required file here
+MAKEDEPENDS=${MAKEDEPENDS:-""} #Add deps needed TO BUILD this package here.
+#----------------------------------------------------------------------------
 
-# DOWNLOAD SOURCE
-for source in $(echo $LINK); do
-	(
-	cd $CWD
-	wget -c --no-check-certificate $source
-	)
-done
+# DO NOT EXECUTE if NORUN is set to 1
+if [ "$NORUN" != "1" ]; then
+
+#SETUP PACKAGING ENVIRONMENT
+#--------------------------------------------
+CWD=$(pwd)
+cd ../
+RELEASEDIR=$(pwd)
+cd $CWD
+mkdir -p $RELEASEDIR/tmp
+TMP=$RELEASEDIR/tmp
+PKG=$TMP/package-$PKGNAME
+#--------------------------------------------
 
-# Bail out if user or group isn't valid on your system
-# For slackbuilds.org, assigned postgres uid/gid are 209/209
-# See http://slackbuilds.org/uid_gid.txt
-# Other popular choice is 26/26
-if ! grep ^postgres: /etc/group 2>&1 > /dev/null; then
-  echo "  You must have a postgres group to run this script."
-  echo "  Group will be created in 30 seconds"
-  sleep 30
-  groupadd -g $PG_GID postgres || exit 1
+if [ $UID != 0 ]; then
+   echo "You are not authorized to run this script. Please login as root"
+   exit 1
 fi
-if ! grep ^postgres: /etc/passwd 2>&1 > /dev/null; then
-  echo "  You must have a postgres user to run this script."
-  echo "  User will be created in 30 seconds"
-  sleep 30
-  useradd -u $PG_UID -g $PG_GID -d /var/lib/pgsql postgres || exit 1
+
+if [ ! -x /usr/bin/requiredbuilder ]; then
+   echo "Requiredbuilder not installed, or not executable."
+   exit 1
+fi
+
+if [ $VL_PACKAGER = "YOURNAME" ]; then
+   echo 'Who are you?
+   Please edit VL_PACKAGER=${VL_PACKAGER:-YOURNAME} in this script.
+   Change the word "YOURNAME" to your VectorLinux packager name.
+   You may also export VL_PACKAGER, or call this script with
+   VL_PACKAGER="YOUR NAME HERE"'
+   exit 1
 fi
 
 
-if [ "$ARCH" = "i?86" ]; then
+#CFLAGS SETUP
+#--------------------------------------------
+if [[ "$ARCH" = i?86 ]]; then
+  ARCH=i586
   SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+  CONFIGURE_TRIPLET="i486-slackware-linux"
   LIBDIRSUFFIX=""
 elif [ "$ARCH" = "x86_64" ]; then
-  SLKCFLAGS="-O2 -fPIC"
+  SLKCFLAGS="-O2 -fpic"
+  CONFIGURE_TRIPLET="x86_64-slackware-linux"
   LIBDIRSUFFIX="64"
-else
+elif [ "$ARCH" = "powerpc" ]; then
   SLKCFLAGS="-O2"
+  CONFIGURE_TRIPLET="powerpc-vlocity-linux"
   LIBDIRSUFFIX=""
 fi
 
-set -e
+export CFLAGS="$SLKCFLAGS $CFLAG_OPTIONS"
+export CXXFLAGS=$CFLAGS
+export LDFLAGS="$LDFLAGS $LDFLAG_OPTIONS"
+#--------------------------------------------
+
+
+#GET THE SOURCE
+#--------------------------------------------
+for SRC in $(echo $LINK);do
+if [ ! -f $CWD/$(basename $SRC) ]
+then
+        wget -c $SRC
+fi
+done
+#--------------------------------------------
 
-rm -rf $TMP/$PRGNAM-$VERSION $PKG
-mkdir -p $TMP $PKG $OUTPUT
+rm -rf $PKG
+mkdir -p $PKG
 cd $TMP
-tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
-cd $PRGNAM-$VERSION
+rm -rf $DIRNAME
+
+#EXTRACT SOURCES
+#-----------------------------------------------------
+echo "Extracting source..."
+tar xvf $CWD/$TARNAME.tar.* || exit 1
+#-----------------------------------------------------
+
+cd $TMP/$DIRNAME
+
+# Put any Patches into a patches folder in the src dir
+#-----------------------------------------------------
+for i in $CWD/patches/*;do
+  patch -p1 <$i
+  mkdir -p $PKG/usr/doc/$DIRNAME/patches/
+  cp $i $PKG/usr/doc/$DIRNAME/patches/
+done
+#-----------------------------------------------------
+
+#SET PERMISSIONS
+#-----------------------------------------
+echo "Setting permissions..."
 chown -R root:root .
-chmod -R a-s,u+w,go+r-w .
+find . -perm 664 -exec chmod 644 {} \;
+find . -perm 777 -exec chmod 755 {} \;
+find . -perm 2777 -exec chmod 755 {} \;
+find . -perm 775 -exec chmod 755 {} \;
+find . -perm 2755 -exec chmod 755 {} \;
+find . -perm 774 -exec chmod 644 {} \;
+find . -perm 666 -exec chmod 644 {} \;
+find . -perm 600 -exec chmod 644 {} \;
+find . -perm 444 -exec chmod 644 {} \;
+find . -perm 400 -exec chmod 644 {} \;
+find . -perm 440 -exec chmod 644 {} \;
+find . -perm 511 -exec chmod 755 {} \;
+find . -perm 711 -exec chmod 755 {} \;
+find . -perm 555 -exec chmod 755 {} \;
+#-----------------------------------------
+
 
-CFLAGS="$SLKCFLAGS" \
-./configure \
-  --prefix=/usr \
+#CONFIGURE & MAKE
+#----------------------------------------------------------------------
+# If you are building a KDE-related app, then change the following
+# arguments in the script below:
+# --prefix=$(kde-config -prefix) \
+# --sysconfdir=/etc/kde \
+#
+# Making these changes will ensure that your package will build in the
+# correct path and that it will work seamlessly within the KDE environment.
+#
+#-----------------------------------------------------------------------
+
+echo "Configuring source..."
+./configure --prefix=/usr \
   --libdir=/usr/lib${LIBDIRSUFFIX} \
+  --infodir=/usr/info \
   --sysconfdir=/etc \
+  --localstatedir=/var \
   --mandir=/usr/man \
-  --docdir=/usr/doc/$PRGNAM-$VERSION \
-  --with-openssl \
-  --with-tcl \
-  --with-perl \
-  --with-python \
-  --with-ldap \
-  --with-libxml \
-  --with-libxslt \
-  --enable-thread-safety \
-  --build=$ARCH-slackware-linux || exit 1
+  --with-included-gettext \
+  --disable-debug \
+  --program-prefix="" \
+  --program-suffix="" \
+  --build=$CONFIGURE_TRIPLET \
+  $CONFIG_OPTIONS || exit 1
 
 make || exit 1
-make install-strip DESTDIR=$PKG || exit 1
-make install-docs DESTDIR=$PKG || exit 1
 
+make install DESTDIR=$PKG || exit
 
-# Some interesting additional modules:
-#   http://www.postgresql.org/docs/9.0/static/contrib.html
-#
-#  adminpack - helper extension for pgAdmin
-#  pgcrypto - extension for some business applications
-#  hstore, ltree, xml2 - useful extensions for developers
-#  pg_archivecleanup, pg_standby - high availability helpers
-#  pg_upgrade - online upgrade between postgresql versions
-
-PG_EXTENSIONS="adminpack pgcrypto hstore ltree xml2 pg_archivecleanup pg_standby pg_upgrade"
-
-for ext in $PG_EXTENSIONS; do
-  cd $TMP/$PRGNAM-$VERSION/contrib/$ext
-  make
-  make install-strip DESTDIR=$PKG
-done
 
-cd $TMP/$PRGNAM-$VERSION
+#######################################################################
+#Miscellaneous tweaks and things outside a normal ./configure go here #
+#######################################################################
 
+mkdir -p $PKG/install
+
+#if there is a doinst.sh in src dir use it
+if test -f $CWD/doinst.sh.gz; then
+	zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
+fi
+if test -f $CWD/doinst.sh; then
+	cp -a $CWD/doinst.sh > $PKG/install/doinst.sh
+fi
+
+mkdir -p $PKG/usr/doc/$PKGNAME-$PKGVERSION
+
+## Add common docs files:
+cp -a \
+ANNOUNCE* \
+AUTHORS* \
+BUGS* \
+COPYING* \
+ChangeLog* \
+CHANGELOG* \
+COPYRIGHT \
+Credits* \
+DEVELOPERS \
+HISTORY \
+INSTALL \
+LICENSE* \
+MANIFEST \
+MAINTAINER* \
+PROVENANCE \
+Readme* \
+README* \
+TODO* \
+Exception* \
+EXCEPTION* \
+$PKG/usr/doc/$PKGNAME-$PKGVERSION
+
+## Add specific docs files:
+cp -a \
+doc/KNOWN_BUGS \
+doc/MISSING_FEATURES \
+doc/README.mb.big5 \
+doc/README.mb.jp \
+doc/TODO \
+doc/bug.template \
+$PKG/usr/doc/$PKGNAME-$PKGVERSION
+
+cat $CWD/$PKGNAME.SlackBuild > $PKG/usr/doc/$PKGNAME-$PKGVERSION/$PKGNAME.SlackBuild
+
+#----------------------------------------------------------------------
+
+# adding scripts and menuitems:
+echo "Adding scripts and menuitems..."
+cd $CWD
+##cd menuitems
+cp -r menuitems/* $PKG
+##cd ../
+mkdir $PKG/usr/share/$PKGNAME/scripts/
+##cd pg_scripts
+chmod +x pg_scripts/*
+cp -a pg_scripts/* $PKG/usr/share/$PKGNAME/scripts/
+##cd ../
+##cd sys_scripts
+chmod +x sys_scripts/*
+cp -a sys_scripts/* $PKG/usr/share/$PKGNAME/scripts/
+##cd ../
+
+### Now build adminpack:
+#--------------------------------------------------------------
+echo "building adminpack..."
+cd $TMP/$DIRNAME/contrib/adminpack
+make || exit 1
+make install DESTDIR=$PKG/ || exit 1
+
+
+#----------------------------------------------------------------------
+
+if [ -d $PKG/usr/share/man ] ; then
+mkdir -p $PKG/usr/man
+mv $PKG/usr/share/man/* $PKG/usr/man
+rm -rf $PKG/usr/share/man
+fi
 find $PKG/usr/man -type f -exec gzip -9 {} \;
-for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
-
-cp -a COPYRIGHT HISTORY README doc/KNOWN_BUGS doc/MISSING_FEATURES doc/TODO $PKG/usr/doc/$PRGNAM-$VERSION/
-rm -rf $PKG/usr/doc/$PRGNAM-$VERSION/{man.tar.gz,man1,manl,man7,postgres.tar.gz}
-cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
-cat $CWD/README.SBo > $PKG/usr/doc/$PRGNAM-$VERSION/README.SBo
-
-# base database directory
-# assumes you are using /var/lib/pgsql as a homedir for postgres user
-mkdir -p $PKG/var/lib/pgsql/data
-chown -R postgres:postgres $PKG/var/lib/pgsql
-chmod 700 $PKG/var/lib/pgsql
-# permissions for DATADIR should be u=rwx (0700)
-chmod 700 $PKG/var/lib/pgsql/data
-
-# Install init script
-mkdir -p $PKG/etc/rc.d
-cat $CWD/rc.postgresql.new > $PKG/etc/rc.d/rc.postgresql.new
-chmod 0755 $PKG/etc/rc.d/rc.postgresql.new
-
-# Install logrotate script
-mkdir -p $PKG/etc/logrotate.d
-cat $CWD/postgresql.logrotate > $PKG/etc/logrotate.d/postgresql.new
-
-mkdir -p $PKG/var/log/setup
-sed -e "s%@UID@%$PG_UID%" -e "s%@GID@%$PG_GID%" $CWD/setup.$PRGNAM \
-  > $PKG/var/log/setup/setup.$PRGNAM
-chmod 755 $PKG/var/log/setup/setup.$PRGNAM
 
-mkdir -p $PKG/install
-cat $CWD/slack-desc > $PKG/install/slack-desc
-cat $CWD/slack-desc > $OUTPUT/slack-desc
-cat $CWD/doinst.sh > $PKG/install/doinst.sh
+if [ -d $PKG/usr/share/info ] ; then
+mkdir -p $PKG/usr/info
+mv $PKG/usr/share/info/* $PKG/usr/info
+rm -rf $PKG/usr/share/info
+fi 
+
+find $PKG/usr/info -type f -exec gzip -9 {} \;
+
+## THIS DOESN'T SEEM TO WORK>
+#if [ -d $PKG/usr/info ] ; then
+#cat >> $PKG/install/doinst.sh << EOF
+#cd usr/info
+#if [ -f dir ]; then
+#    rm dir
+#fi
+#if [ -f dir.gz ]; then
+#    rm dir.gz
+#fi
+#for i in *.info.gz
+#        do
+#        install-info $i dir
+#    done
+#EOF
+#fi
+## <THIS DOESN'T SEEM TO WORK
 
+#if there is a slack-desc in src dir use it
+if test -f $CWD/slack-desc; then
+	cp -a $CWD/slack-desc $RELEASEDIR/slack-desc
+else
+
+# This creates the white space in front of "handy-ruler" in slack-desc below.
+LENGTH=$(expr length "$PKGNAME")
+SPACES=0
+SHIM=""
+until [ "$SPACES" = "$LENGTH" ]; do
+SHIM="$SHIM "
+let SPACES=$SPACES+1
+done
+
+# Fill in the package summary between the () below.
+# Then package the description, License, Author and Website.
+# There may be no more then 11 $PKGNAME: lines in a valid slack-desc.
+
+cat > $RELEASEDIR/slack-desc << EOF
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.  Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in.  You must
+# make exactly 11 lines for the formatting to be correct.  It's also
+# customary to leave one space after the ':'.
+
+$SHIM|-----handy-ruler------------------------------------------------------|
+$PKGNAME: $PKGNAME (Object-Relational Database Management System)
+$PKGNAME: 
+$PKGNAME: PostgreSQL is an advanced object-relational database management 
+$PKGNAME: system that supports an extended subset of the SQL standard, 
+$PKGNAME: including transactions, foreign keys, subqueries, triggers, 
+$PKGNAME: user-defined types and functions.
+$PKGNAME: 
+$PKGNAME: License: BSD http://www.postgresql.org/about/licence
+$PKGNAME: Authors: PostgreSQL Global Development Group
+$PKGNAME: Website: http://www.postgresql.org
+$PKGNAME: 
+EOF
+fi
+cat >> $RELEASEDIR/slack-desc << EOF
+
+#----------------------------------------
+BUILDDATE: $(date)
+PACKAGER:  $VL_PACKAGER
+HOST:      $(uname -srm)
+DISTRO:    $(cat /etc/vector-version)
+CFLAGS:    $CFLAGS
+LDFLAGS:   $LDFLAGS
+CONFIGURE: $(awk "/\.\/configure\ /" $TMP/$DIRNAME/config.log)
+
+EOF
+
+cp -a $RELEASEDIR/slack-desc $PKG/install/slack-desc
+cat $CWD/$PKGNAME.SlackBuild > $PKG/usr/doc/$PKGNAME-$PKGVERSION/$PKGNAME.SlackBuild
+
+#STRIPPING
+#------------------------------------------------------------------------------------------------------------------
 cd $PKG
+echo " "
+echo "Stripping...."
+echo " "
+find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+#------------------------------------------------------------------------------------------------------------------
+
+#FINISH PACKAGE
+#--------------------------------------------------------------
 echo "Finding dependencies..."
-ADD="$ADDRB" EXCLUDE="$EXRB" requiredbuilder -v -y -s $OUTPUT $PKG
-/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}
+ADD="$ADDRB" EXCLUDE="$EXRB" requiredbuilder -v -y -s $RELEASEDIR $PKG
+
+# append to doinst.sh:
+cat >> $PKG/install/doinst.sh << EOF
+( cd usr/share/postgresql/scripts/ ; cp -a postgresql.logrotate /etc/logrotate.d/postgresql )
+( cd usr/share/postgresql/scripts/ ; cp -a postgresql.service /etc/rc.d/init.d/postgresql )
+EOF
+
+echo "Creating package $PKGNAME-$PKGVERSION-$ARCH-$BUILD.txz"
+makepkg -l y -c n $RELEASEDIR/$PKGNAME-$PKGVERSION-$ARCH-$BUILD.txz
+
+cd $CWD
+echo "Cleaning up temp files..." && rm -rf $TMP
+echo "Package Complete"
+#--------------------------------------------------------------
 fi
+# vim: set tabstop=4 shiftwidth=4 foldmethod=marker : ##

File var/vabs/postgresql/src/postgresql.info

-PRGNAM="postgresql"
-VERSION="9.1.3"
-HOMEPAGE="http://www.postgresql.org"
-DOWNLOAD="ftp://ftp.postgresql.org/pub/source/v9.1.3/postgresql-9.1.3.tar.bz2"
-MD5SUM="641e1915f7ebfdc9f138e4c55b6aec0e"
-DOWNLOAD_x86_64=""
-MD5SUM_x86_64=""
-MAINTAINER="Adis Nezirovic"
-EMAIL="adis_at_linux.org.ba"
-APPROVED="rworkman"

File var/vabs/postgresql/src/postgresql.logrotate

-/var/log/postgresql {
-    daily
-    rotate 7
-    copytruncate
-    delaycompress
-    compress
-    notifempty
-    missingok
-}

File var/vabs/postgresql/src/rc.postgresql.new

-#!/bin/bash
-
-# PostgreSQL startup script for Slackware Linux
-# Copyright 2007 Adis Nezirovic <adis _at_ linux.org.ba>
-# Licensed under GNU GPL v2
-
-# Do not source this script (since it contains exit() calls)
-
-# Before you can run postgresql you'll need to create the
-# database files in /var/lib/pgsql. The following should do
-# the trick.
-#
-#   $ su postgres -c "initdb -D /var/lib/pgsql/data"
-#
-
-LOGFILE=/var/log/postgresql
-DATADIR=/var/lib/pgsql/data
-POSTGRES=/usr/bin/postgres
-PIDFILE=postmaster.pid
-
-# Return values (according to LSB):
-# 0 - success
-# 1 - generic or unspecified error
-# 2 - invalid or excess argument(s)
-# 3 - unimplemented feature (e.g. "reload")
-# 4 - insufficient privilege
-# 5 - program is not installed
-# 6 - program is not configured
-# 7 - program is not running
-
-pg_ctl()
-{
-	CMD="/usr/bin/pg_ctl $@"
-	su - postgres -c "$CMD"
-}
-
-if [ ! -f $POSTGRES ]; then
-	echo "Could not find 'postgres' binary. Maybe PostgreSQL is not installed properly?"
-	exit 5
-fi
-
-case "$1" in
-
-	"start")
-		echo "Starting PostgreSQL"
-		touch $LOGFILE
-		chown postgres:wheel $LOGFILE
-		chmod 0640 $LOGFILE
-	
-		if [ ! -e $DATADIR/PG_VERSION ]; then
-			echo "You should initialize the PostgreSQL database at location $DATADIR"
-			exit 6
-		fi
-	
-		if [ $(pgrep -f $POSTGRES) ]; then
-
-			echo "PostgreSQL daemon already running"
-			if [ ! -f $DATADIR/$PIDFILE ]; then
-				echo "Warning: Missing pid file $DATADIR/$PIDFILE"
-			fi
-			exit 1
-
-		else # remove old socket, if it exists and no daemon is running.
-
-			if [ ! -f $DATADIR/$PIDFILE ]; then
-				rm -f /tmp/.s.PGSQL.5432
-				rm -f /tmp/.s.PGSQL.5432.lock
-				pg_ctl start -w -l $LOGFILE -D $DATADIR
-				exit 0
-			else
-				echo "PostgreSQL daemon was not properly shut down"
-				echo "Please remove stale pid file $DATADIR/$PIDFILE"
-				exit 7
-			fi
-
-		fi	
-	;;
-
-	"stop")
-		echo "Shutting down PostgreSQL..."
-		pg_ctl stop -l $LOGFILE -D $DATADIR -m smart
-	;;
-
-	"force-stop")
-		# Take care! This will kill _all_ client connections
-		# and rollback current transactions.
-		echo "Shutting down PostgreSQL (fast)..."
-		pg_ctl stop -l $LOGFILE -D $DATADIR -m fast
-	;;
-	
-	"unclean-stop")
-		# Take care: This will abort server process itself
-		# resulting with database recovery on next start.
-		echo "Shutting down PostgreSQL (immediate)..."
-		pg_ctl stop -l $LOGFILE -D $DATADIR -m immediate
-	;;
-
-	"restart")
-		echo "Restarting PostgreSQL..."
-		pg_ctl restart -l $LOGFILE -D $DATADIR -m smart
-	;;
-
-	"force-restart")
-		# Take care! This will kill _all_ client connections
-		# and rollback current transactions.
-		echo "Restarting PostgreSQL (fast)..."
-		pg_ctl restart -l $LOGFILE -D $DATADIR -m fast
-	;;
-
-	"unclean-restart")
-		# Take care: This will abort server process itself
-		# resulting with database recovery on start.
-		echo "Restarting PostgreSQL (immediate)..."
-		pg_ctl restart -l $LOGFILE -D $DATADIR -m immediate
-	;;
-
-	"reload")
-		echo "Reloading configuration for PostgreSQL..."
-		pg_ctl reload -l $LOGFILE -D $DATADIR -m smart
-	;;
-
-	"status")
-		if [ $(pgrep -f $POSTGRES) ]; then
-			echo "PostgreSQL is running"
-
-			if [ ! -e $DATADIR/$PIDFILE ]; then
-				echo "Warning: Missing pid file $DATADIR/$PIDFILE"
-			fi
-
-			exit 0
-		else
-			echo "PostgreSQL is stopped"
-
-			if [ -e $DATADIR/$PIDFILE ]; then
-				echo "Detected stale pid file $DATADIR/$PIDFILE"
-			fi
-
-			exit 0
-		fi
-	;;
-
-	*)
-		# unclean-stop and unclean-restart are not documented on purpose.
-		echo "Usage: $0 {start|stop|force-stop|status|restart|force-restart|reload}"
-		exit 1
-	;;
-esac	

File var/vabs/postgresql/src/setup.postgresql

-#!/bin/bash
-#BLURB="PostgreSQL"
-
-PG_HOME=/var/lib/pgsql
-PG_USER=postgres
-PG_USER_ID=209
-PG_GROUP=postgres
-PG_GROUP_ID=209
-
-if [ -d $PG_HOME/data ]; then
-	echo "moving $PG_HOME/data to $PG_HOME/data.old"
-	if [ -d $PG_HOME/data.old ]; then
-		rm -rf $PG_HOME/data.old
-	fi
-	mv $PG_HOME/data $PG_HOME/data.old
-fi
-
-echo "Adding PostgreSQL user and group..."
-groupadd -g $PG_GROUP_ID $PG_GROUP
-useradd -g $PG_GROUP -u $PG_USER_ID -d $PG_HOME -c PostgreSQL $PG_USER
-passwd -l $PG_USER >/dev/null
-mkdir -p $PG_HOME/data
-
-## default permissions
-echo "Setting up permissions..."
-chown -R $PG_USER:$PG_USER $PG_HOME
-chmod 700 $PG_HOME
-chmod 700 $PG_HOME/data
-
-## database cluster
-if [ ! -f $PG_HOME/data/PG_VERSION ]; then
-	echo "Creating database cluster in $PG_HOME/data..."
-	su $PG_USER -c "initdb -D $PG_HOME/data"
-else
-	echo "*** WARNING ***" >&2
-	echo "  There is already a database cluster in $PG_HOME/data." >&2
-	echo "  If you are upgrading from an older version of PostgreSQL" >&2
-	echo "  you will have to 'dump' and 'restore' your database." >&2
-	echo "  See PostgreSQL manual for more details." >&2
-fi
-
-echo "PostgreSQL post-installation setup completed"

File var/vabs/postgresql/src/slack-desc

 # HOW TO EDIT THIS FILE:
 # The "handy ruler" below makes it easier to edit a package description.  Line
-# up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in.  You must
-# make exactly 11 lines for the formatting to be correct.  It's also
-# customary to leave one space after the ':'.
+# up the first '|' above the ':' following the base package name, and the '|' on
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct.  It's also customary to
+# leave one space after the ':'.
 
           |-----handy-ruler------------------------------------------------------|
-postgresql: PostgreSQL (object-relational database management system)
-postgresql:
-postgresql: PostgreSQL is an advanced object-relational database management
-postgresql: system (ORDBMS) based on POSTGRES. With more than 15 years of
-postgresql: development history, it is quickly becoming the de facto
-postgresql: database for enterprise level open source solutions.
-postgresql:
-postgresql: Homepage: http://www.postgresql.org
-postgresql:
-postgresql:
-postgresql:
+postgresql: PostgreSQL (Object-Relational Database Management System)
+postgresql: 
+postgresql: PostgreSQL is an advanced object-relational database management 
+postgresql: system that supports an extended subset of the SQL standard, 
+postgresql: including transactions, foreign keys, subqueries, triggers, 
+postgresql: user-defined types and functions.
+postgresql: 
+postgresql: License: BSD http://www.postgresql.org/about/licence
+postgresql: Authors: PostgreSQL Global Development Group
+postgresql: Website: http://www.postgresql.org
+postgresql: 

File var/vabs/postgresql/src/sys_scripts/postgresql.logrotate

+/var/log/postgresql.log {
+    postrotate
+      /etc/rc.d/rc.postgresql reload 2>&1 > /dev/null
+    endscript
+    size=100k
+    rotate 5
+    create 0640 postgres wheel
+}

File var/vabs/postgresql/src/sys_scripts/postgresql.service

+#! /bin/sh
+
+# 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@rkirkpat.net>
+
+# $PostgreSQL: pgsql/contrib/start-scripts/linux,v 1.7 2004/10/01 18:30:21 tgl Exp $
+
+## EDIT FROM HERE
+
+# Installation prefix
+prefix=/usr
+
+# Data directory
+PGDATA="/home/postgres/pgdata"
+
+# 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="$prefix/bin/postmaster"
+
+# What to use to shut down the postmaster
+PGCTL="$prefix/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