|
|
@@ -81,7 +81,24 @@ AutoReqProv: no
|
|
|
# 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 \
|
|
|
@@ -109,20 +126,36 @@ AutoReqProv: no
|
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
|
|
%post
|
|
|
- # create initial database
|
|
|
if [ ".$1" = .1 ]; then
|
|
|
+ # create initial database
|
|
|
su - %{l_rusr} -c \
|
|
|
"LC_CTYPE=C; export LC_CTYPE; umask 022; \
|
|
|
- $RPM_INSTALL_PREFIX/bin/initdb \
|
|
|
- -U postgresql -D $RPM_INSTALL_PREFIX/var/postgresql/db" 2>&1 |\
|
|
|
+ (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
|
|
|
- ( sed -e 's;^\([^#]\);# \1;g' <$RPM_INSTALL_PREFIX/var/postgresql/db/pg_hba.conf.old
|
|
|
- echo "# OpenPKG default: trust nobody"
|
|
|
- echo "local all md5"
|
|
|
+ ( 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 default"
|
|
|
+ echo "database clusters 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
|
|
|
|