Update spec file to 3.4.1
authorDevrim GÜNDÜZ <devrim at gunduz.org>
Tue, 16 Oct 2007 13:02:51 +0000 (13:02 +0000)
committerDevrim GÜNDÜZ <devrim at gunduz.org>
Tue, 16 Oct 2007 13:02:51 +0000 (13:02 +0000)
Added new directory: redhat
Added Red Hat / Fedora init script and sysconfig file for pgpool

pgpool.spec
redhat/pgpool.init [new file with mode: 0755]
redhat/pgpool.sysconfig [new file with mode: 0644]

index daf62a21e673bec5fa1ef9a9f2b176f2e246a537..1fd53111f5709c7082358c199e2a06c50fc9d714 100644 (file)
@@ -2,13 +2,16 @@
 
 Summary:       Pgpool is a connection pooling/replication server for PostgreSQL
 Name:          postgresql-%{short_name}
-Version:       3.4
+Version:       3.4.1
 Release:       1%{?dist}
 License:       BSD
 Group:         Applications/Databases
 URL:           http://pgpool.projects.PostgreSQL.org
-Source0:       http://pgfoundry.org/frs/download.php/1374/%{short_name}-%{version}.tar.gz
+Source0:       http://pgfoundry.org/frs/download.php/1446/%{short_name}-%{version}.tar.gz
+Source1:       %{short_name}.init
+Source2:       %{short_name}.sysconfig
 BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires: initscripts, pam-devel
 
 %description
 pgpool is a connection pooling/replication server for PostgreSQL.
@@ -35,6 +38,10 @@ install -m 644 %{short_name}.8 %{buildroot}%{_mandir}/man8/
 install -d %{buildroot}/%{_docdir}/%{name}-%{version}
 mv %{buildroot}%{_sysconfdir}/pgpool.conf.sample %{buildroot}/%{_docdir}/%{name}-%{version}
 mv %{buildroot}%{_sysconfdir}/pool_hba.conf.sample %{buildroot}/%{_docdir}/%{name}-%{version}
+install -d %{buildroot}%{_initrddir}
+install -m 755 redhat/%{SOURCE1} %{buildroot}%{_initrddir}/%{short_name}
+install -d %{buildroot}%{_sysconfdir}/sysconfig
+install -m 755 redhat/%{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{short_name}
 
 %clean
 rm -rf %{buildroot}
@@ -44,10 +51,18 @@ rm -rf %{buildroot}
 %doc README README.euc_jp TODO COPYING INSTALL AUTHORS ChangeLog NEWS pgpool.conf.sample pool_hba.conf.sample
 %{_datadir}/pgpool/pgpool.pam
 %{_bindir}/pgpool
+%{_initrddir}/pgpool
+%config(noreplace) %{_sysconfdir}/sysconfig/pgpool
 %{_mandir}/man8/*
 
-
 %changelog
+* Tue Oct 16 2007 - Devrim GUNDUZ <devrim@commandprompt.com> 3.4.1-1
+- Update to 3.4.1
+
+* Sun Aug 5 2007 - Devrim GUNDUZ <devrim@commandprompt.com> 3.4-2
+- Added an init script for pgpool
+- Added /etc/sysconfig/pgpool
+
 * Wed Aug 1 2007 - Devrim GUNDUZ <devrim@commandprompt.com> 3.4-1
 - Update to 3.4
 - Removed patches, they are now in upstream
diff --git a/redhat/pgpool.init b/redhat/pgpool.init
new file mode 100755 (executable)
index 0000000..fca65cb
--- /dev/null
@@ -0,0 +1,163 @@
+#!/bin/sh
+# pgpool    This is the init script for starting up pgpool
+#
+# chkconfig: - 64 36
+# description: Starts and stops the pgpool daemon
+# processname: pgpool
+# pidfile:     /var/run/pgpool.pid
+#
+# v1.0.0 Devrim GUNDUZ <devrim@CommandPrompt.com>
+# - Initial version of Red Hat / Fedora init script
+
+if [ -r /etc/sysconfig/pgpool ]; then
+    . /etc/sysconfig/pgpool
+fi
+
+# Source function library.
+INITD=/etc/rc.d/init.d
+. $INITD/functions
+
+# Get function listing for cross-distribution logic.
+TYPESET=`typeset -f|grep "declare"`
+
+# Get config.
+. /etc/sysconfig/network
+
+# Check that networking is up.
+# We need it for pgpool
+[ "${NETWORKING}" = "no" ] && exit 0
+
+# Find the name of the script
+NAME=pgpool
+
+# Set defaults for configuration variables
+PGPOOLENGINE=/usr/bin
+PGPOOLDAEMON=$PGPOOLENGINE/pgpool
+PGPOOLCONF=/etc/pgpool.conf
+PGPOOLPID=/var/run/pgpool.pid
+PGPOOLLOG=/var/log/pgpool.log
+
+test -x $PGPOOLDAEMON || exit 5
+
+# Create the log file if it does not exist
+if [ ! -r $PGPOOLLOG ]
+then
+       touch $PGPOOLLOG
+fi
+
+# Check whether the config file exists or not
+if [ ! -r /etc/pgpool.conf ]
+then
+       echo "$PGPOOLCONF not found"
+       RETVAL=1
+       failure 
+       exit
+fi
+
+script_result=0
+
+start(){
+       PGPOOL_START=$"Starting ${NAME} service: "
+
+       echo -n "$PGPOOL_START"
+       $PGPOOLDAEMON -f $PGPOOLCONF $OPTS & >> "$PGPOOLLOG" 2>&1 < /dev/null
+       sleep 2
+
+       pid=`pidof -s "$PGPOOLDAEMON"`
+       if [ $pid ] 
+       then
+               success "$PGPOOL_START"
+               touch /var/lock/subsys/${NAME}
+               echo
+       else
+               failure "$PSQL_START"
+               echo
+               script_result=1
+       fi
+}
+
+stop(){
+       echo -n $"Stopping ${NAME} service: "
+        if [ $UID -ne 0 ]; then
+                RETVAL=1
+                failure
+        else
+                killproc /usr/bin/pgpool
+                RETVAL=$?
+                [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/${NAME}
+        fi;
+        echo
+        return $RETVAL
+}
+
+switch() {
+       echo -n $"Sending switchover request to $NAME "
+       $PGPOOLDAEMON switch >> "$PGPOOLLOG" 2>&1 < /dev/null
+       RETVAL=$?
+       echo
+       if [ $RETVAL -eq 0 ] 
+       then
+               echo_success
+       else
+               echo_failure
+       fi
+       echo
+}
+
+restart(){
+    stop
+    start
+}
+
+reload(){
+echo -n $"Reloading ${NAME}: "
+   if [ -n "`pidfileofproc $PGPOOLDAEMON`" ] ; then
+      killproc $PGPOOLDAEMON -HUP
+   else
+      failure $"Reloading ${NAME}"
+   fi
+   RETVAL=$?
+   echo
+}
+
+condrestart(){
+    [ -e /var/lock/subsys/${NAME} ] && restart
+}
+
+condstop(){
+    [ -e /var/lock/subsys/${NAME} ] && stop
+}
+
+# See how we were called.
+case "$1" in
+  start)
+        start
+        ;;
+  stop)
+        stop
+        ;;
+  switch)
+        switch
+        ;;
+  status)
+        status pgpool
+        script_result=$?
+        ;;
+  restart)
+        restart
+        ;;
+  reload|force-reload)
+        reload
+        ;;
+  condrestart)
+        condrestart
+        ;;
+  condstop)
+        condstop
+        ;;
+  *)
+        echo $"Usage: $0 {start|stop|switch|status|restart|condrestart|condstop|reload|force-reload}"
+        exit 1
+esac
+
+exit $script_result
diff --git a/redhat/pgpool.sysconfig b/redhat/pgpool.sysconfig
new file mode 100644 (file)
index 0000000..ef8e2e1
--- /dev/null
@@ -0,0 +1,6 @@
+# Options for pgpool
+
+# -n: don't run in daemon mode. does not detatch control tty
+# -d: debug mode. lots of debug information will be printed
+
+#OPTS=" -d -n"