--- SPECS/postgresql-8.2.spec.orig 2006-12-05 03:04:10.000000000 -0200 +++ SPECS/postgresql-8.2.spec 2007-01-03 14:27:29.000000000 -0200 @@ -73,6 +73,18 @@ %{!?pgfts:%define pgfts 0} %{!?runselftest:%define runselftest 0} +%define is_suse %(test -e /etc/SuSE-release && echo 1 || echo 0) +%define is_fedora %(test -e /etc/fedora-release && echo 1 || echo 0) + +%if %is_suse +%define dist_require /sbin/ldconfig +%endif + +%if %is_fedora +%define dist_require /sbin/ldconfig initscripts +%endif + + Summary: PostgreSQL client programs and libraries Name: postgresql Version: 8.2.0 @@ -97,7 +109,7 @@ Patch6: postgresql-perl-rpath.patch Buildrequires: perl glibc-devel bison flex autoconf -Requires: /sbin/ldconfig initscripts +Requires: %{dist_require} %if %python BuildPrereq: python-devel @@ -356,11 +368,19 @@ if [ -d /etc/rc.d/init.d ] then - install -d %{buildroot}/etc/rc.d/init.d - sed 's/^PGVERSION=.*$/PGVERSION=%{version}/' <%{SOURCE3} > postgresql.init - install -m 755 postgresql.init %{buildroot}/etc/rc.d/init.d/postgresql + %define initdir /etc/rc.d/init.d + install -d %{buildroot}/%{initdir} +else + %define initdir /etc/rc.d/ + install -d %{buildroot}/%{initdir} + fi +sed 's/^PGVERSION=.*$/PGVERSION=%{version}/' <%{SOURCE3} > postgresql.init.suse +install -m 755 postgresql.init.suse %{buildroot}/%{initdir}/postgresql + + + %if %pam if [ -d /etc/pam.d ] then @@ -423,8 +443,15 @@ %pre server groupadd -g 26 -o -r postgres >/dev/null 2>&1 || : -useradd -M -n -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \ +if [ -f /etc/SuSE-release ] ; then + # -n Does not work on OpenSuse + useradd -M -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \ -c "PostgreSQL Server" -u 26 postgres >/dev/null 2>&1 || : + +else + useradd -M -n -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \ + -c "PostgreSQL Server" -u 26 postgres >/dev/null 2>&1 || : +fi touch /var/log/pgsql chown postgres:postgres /var/log/pgsql chmod 0700 /var/log/pgsql @@ -552,7 +579,7 @@ %files server -f server.lst %defattr(-,root,root) -/etc/rc.d/init.d/postgresql +%{initdir}/postgresql %if %pam %config(noreplace) /etc/pam.d/postgresql %endif @@ -634,6 +661,9 @@ %endif %changelog +* Wed Jan 3 2007 Otavio R. Piske 8.2.0-2PGDG +- Added support for SuSE Linux + * Tue Dec 5 2006 Devrim GUNDUZ 8.2.0-2PGDG - We are not in beta; set beta to 0 --- SOURCES/postgresql.init.orig 2006-12-02 17:28:58.000000000 -0200 +++ SOURCES/postgresql.init 2007-01-03 14:53:32.000000000 -0200 @@ -67,6 +67,9 @@ # Version 8.2 Devrim Gunduz # Set initdb as a seperate option. +# Version 8.2 Otavio R. Piske +# Added support for OpenSuSe 10.2 + # PGVERSION is the full package version, e.g., 8.2.0 # Note: the specfile ordinarily updates this during install PGVERSION=xxxx @@ -74,14 +77,34 @@ PGMAJORVERSION=`echo "$PGVERSION" | sed 's/^\([0-9]*\.[0-9]*\).*$/\1/'` # Source function library. -INITD=/etc/rc.d/init.d -. $INITD/functions +INITD=/etc/rc.d/ +. /lib/lsb/init-functions + + # Get function listing for cross-distribution logic. TYPESET=`typeset -f|grep "declare"` -# Get config. -. /etc/sysconfig/network +# Get config +. /etc/sysconfig/network/config + +function success() { + rc_status -v +} + +function failure() { + rc_status +} + +function echo_success() { + rc_status -v +} + +function echo_failure() { + rc_failed -v +} + + # Find the name of the script NAME=`basename $0` @@ -268,8 +291,8 @@ stop ;; status) - status postmaster - script_result=$? + /sbin/checkproc postmaster + rc_status -v ;; restart) restart