|
|
|
##
|
|
|
|
## postgresql.spec -- OpenPKG RPM Specification
|
|
|
|
## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
|
|
|
|
## Copyright (c) 2000-2002 The OpenPKG Project <http://www.openpkg.org/>
|
|
|
|
## Copyright (c) 2000-2002 Ralf S. Engelschall <rse@engelschall.com>
|
|
|
|
##
|
|
|
|
## Permission to use, copy, modify, and distribute this software for
|
|
|
|
## any purpose with or without fee is hereby granted, provided that
|
|
|
|
## the above copyright notice and this permission notice appear in all
|
|
|
|
## copies.
|
|
|
|
##
|
|
|
|
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
|
|
|
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
|
|
|
|
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
|
|
|
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
|
|
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
## SUCH DAMAGE.
|
|
|
|
##
|
|
|
|
|
|
|
|
# package information
|
|
|
|
Name: postgresql
|
|
|
|
Summary: PostgreSQL Database
|
|
|
|
URL: http://www.postgresql.org/
|
|
|
|
Vendor: PostgreSQL Group
|
|
|
|
Packager: The OpenPKG Project
|
|
|
|
Distribution: OpenPKG [EXP]
|
|
|
|
Group: Database
|
|
|
|
License: GPL
|
|
|
|
Version: 7.2
|
|
|
|
Release: 20020206
|
|
|
|
|
|
|
|
# list of sources
|
|
|
|
Source0: ftp://ftp.de.postgresql.org/mirror/postgresql/source/v7.2/postgresql-%{version}.tar.gz
|
|
|
|
Source1: rc.postgresql
|
|
|
|
|
|
|
|
# build information
|
|
|
|
Prefix: %{l_prefix}
|
|
|
|
BuildRoot: %{l_buildroot}
|
|
|
|
BuildPreReq: OpenPKG, openpkg >= 20020206, make, gcc, readline, openssl
|
|
|
|
PreReq: OpenPKG, openpkg >= 20020206
|
|
|
|
AutoReq: no
|
|
|
|
AutoReqProv: no
|
|
|
|
|
|
|
|
%description
|
|
|
|
PostgreSQL is a sophisticated Object-Relational DBMS, supporting
|
|
|
|
almost all SQL constructs, including subselects, transactions,
|
|
|
|
and user-defined types and functions. It is the most advanced
|
|
|
|
open-source database available anywhere.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q
|
|
|
|
%{l_shtool} subst \
|
|
|
|
-e 's;\(#define.*DEFAULT_PGSOCKET_DIR[^"]*"\)/tmp\("\);\1%{l_prefix}/var/postgresql/run\2;' \
|
|
|
|
src/include/pg_config.h.in
|
|
|
|
|
|
|
|
%build
|
|
|
|
# configure package
|
|
|
|
PATH="%{l_prefix}/bin:$PATH"; export PATH
|
|
|
|
CC="%{l_cc}" \
|
|
|
|
CFLAGS="%{l_cflags -O}" \
|
|
|
|
./configure \
|
|
|
|
--prefix=%{l_prefix} \
|
|
|
|
--with-openssl=%{l_prefix} \
|
|
|
|
--with-perl \
|
|
|
|
--without-CXX \
|
|
|
|
--disable-syslog
|
|
|
|
|
|
|
|
# build package
|
|
|
|
%{l_make} %{l_mflags -O}
|
|
|
|
|
|
|
|
%install
|
|
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
|
|
|
|
# perform standard installation procedure
|
|
|
|
PATH="%{l_prefix}/bin:$PATH"; export PATH
|
|
|
|
%{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
|
|
|
|
|
|
|
|
# strip down installation
|
|
|
|
rm -rf $RPM_BUILD_ROOT%{l_prefix}/doc
|
|
|
|
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
|
|
|
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/pgaccess.1
|
|
|
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/pgtclsh.1
|
|
|
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/pgtksh.1
|
|
|
|
|
|
|
|
# namespace adjustments to installation
|
|
|
|
for prog in \
|
|
|
|
createdb createlang createuser dropdb droplang \
|
|
|
|
dropuser initdb initlocation ipcclean vacuumdb; do
|
|
|
|
mv $RPM_BUILD_ROOT%{l_prefix}/bin/$prog \
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/bin/pg_$prog
|
|
|
|
mv $RPM_BUILD_ROOT%{l_prefix}/man/man1/$prog.1 \
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/man/man1/pg_$prog.1
|
|
|
|
done
|
|
|
|
( cd $RPM_BUILD_ROOT%{l_prefix}/man/man7
|
|
|
|
for man in *.7; do
|
|
|
|
mv $man pg_$man
|
|
|
|
done
|
|
|
|
)
|
|
|
|
# create additional directories
|
|
|
|
%{l_shtool} mkdir -f -p -m 755 \
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/var/postgresql/db \
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/var/postgresql/run
|
|
|
|
|
|
|
|
# install run-command script
|
|
|
|
%{l_shtool} mkdir -f -p -m 755 \
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
|
|
|
|
%{l_shtool} install -c -m 755 \
|
|
|
|
-e 's;@l_prefix@;%{l_prefix};g' \
|
|
|
|
-e 's;@l_rusr@;%{l_rusr};g' \
|
|
|
|
-e 's;@l_rgrp@;%{l_rgrp};g' \
|
|
|
|
%{SOURCE rc.postgresql} \
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
|
|
|
|
|
|
|
|
# determine installation files
|
|
|
|
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
|
|
|
|
%{l_files_std} \
|
|
|
|
'%attr(700,%{l_rusr},%{l_rgrp}) %dir %{l_prefix}/var/postgresql/db' \
|
|
|
|
'%attr(755,%{l_rusr},%{l_rgrp}) %dir %{l_prefix}/var/postgresql/run'
|
|
|
|
|
|
|
|
%files -f files
|
|
|
|
|
|
|
|
%clean
|
|
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
|
|
|
|
%post
|
|
|
|
if [ ".$1" = .1 ]; then
|
|
|
|
# create initial database
|
|
|
|
su - %{l_rusr} -c \
|
|
|
|
"LC_CTYPE=C; export LC_CTYPE; umask 022; \
|
|
|
|
(echo 'postgresql'; echo 'postgresql') |\
|
|
|
|
$RPM_INSTALL_PREFIX/bin/pg_initdb \
|
|
|
|
-U postgresql -W -D $RPM_INSTALL_PREFIX/var/postgresql/db" 2>&1 |\
|
|
|
|
$RPM_INSTALL_PREFIX/lib/openpkg/shtool prop \
|
|
|
|
-p "Creating initial PostgreSQL DB in $RPM_INSTALL_PREFIX/var/postgresql/db"
|
|
|
|
|
|
|
|
# adjust initial authentication configuration
|
|
|
|
cp $RPM_INSTALL_PREFIX/var/postgresql/db/pg_hba.conf \
|
|
|
|
$RPM_INSTALL_PREFIX/var/postgresql/db/pg_hba.conf.old
|
|
|
|
( cat $RPM_INSTALL_PREFIX/var/postgresql/db/pg_hba.conf.old |\
|
|
|
|
sed -e 's;^\([^#]\);# \1;' -e 's;^$;#;'
|
|
|
|
echo ""
|
|
|
|
echo "# OpenPKG PostgreSQL default access policy"
|
|
|
|
echo "local all md5"
|
|
|
|
echo "host all 127.0.0.1 255.255.255.255 md5"
|
|
|
|
echo ""
|
|
|
|
) >$RPM_INSTALL_PREFIX/var/postgresql/db/pg_hba.conf
|
|
|
|
rm -f $RPM_INSTALL_PREFIX/var/postgresql/db/pg_hba.conf.old
|
|
|
|
|
|
|
|
# display information about next steps
|
|
|
|
echo "An initial PostgreSQL DB was created with the two standard"
|
|
|
|
echo "databases 'template0' and 'template1'. The owner of both"
|
|
|
|
echo "is the DB user 'postgresql'. Its initial password is 'postgresql'."
|
|
|
|
echo "After starting PostgreSQL you should change this as quick as"
|
|
|
|
echo "possible with the following command:"
|
|
|
|
echo "\$ $RPM_INSTALL_PREFIX/bin/psql -U postgresql -d template1 \\"
|
|
|
|
echo " -c \"ALTER USER postgresql WITH PASSWORD '<new-password>'\""
|
|
|
|
fi
|
|
|
|
|