wok-next view postgresql/receipt @ rev 2775

Up: postgresql (8.3.7) [security update]
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Apr 27 09:46:59 2009 +0200 (2009-04-27)
parents 81ec665f8df4
children d6700680fb11
line source
1 # SliTaz package receipt.
3 PACKAGE="postgresql"
4 VERSION="8.3.7"
5 CATEGORY="misc"
6 SHORT_DESC="SQL database system."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 TARBALL="$PACKAGE-$VERSION.tar.bz2"
9 WEB_SITE="http://www.pgsql.com/"
10 WGET_URL="ftp://ftp.fr.postgresql.org/source/v$VERSION/$TARBALL"
11 DEPENDS="postgresql-client zlib slitaz-base-files"
12 BUILD_DEPENDS="zlib-dev readline-dev ncurses-dev"
13 CONFIG_FILES="/var/lib/pgsql/*.conf"
14 DATABASE_FILES="/var/lib/pgsql"
16 # Rules to configure and make the package.
17 compile_rules()
18 {
19 cd $src
20 [ -d ../postgrpsql-$VERSION ] && cp -a ../postgrpsql-$VERSION/* .
21 cp ../stuff/*.files-list .
22 ./configure --prefix=/usr --infodir=/usr/share/info \
23 --sysconfdir=/etc --includedir=/usr/include/postgresql --with-gnu-ld \
24 --with-includes=/usr/include/readline --enable-integer-datetimes \
25 --enable-thread-safety --with-system-tzdata=/usr/share/zoneinfo \
26 --libdir=/usr/lib/postgresql --mandir=/usr/share/man $CONFIGURE_ARGS &&
27 make &&
28 make DESTDIR=$PWD/_pkg install
29 }
31 # Rules to gen a SliTaz package suitable for Tazpkg.
32 genpkg_rules()
33 {
34 mkdir -p $fs/usr/share $fs/usr/lib $fs/var/lib/pgsql \
35 $fs/var/log/postgresql $fs/etc/pgsql.d
36 cp -a $_pkg/usr/bin $fs/usr
37 cp -a $_pkg/usr/lib/postgresql $fs/usr/lib
38 strip -s $fs/usr/lib/postgresql/*.so*
39 rm -f $fs/usr/lib/postgresql/*a
40 cp -a $_pkg/usr/share/postgresql $fs/usr/share
41 cp -a stuff/etc $fs
42 ln -s /var/lib/pgsql/postgresql.conf $fs/etc
43 chmod 700 $fs/var/lib/pgsql
44 cat $src/*.files-list | while read file; do
45 [ -f $fs$file ] && rm -f $fs$file
46 done
47 # Package all pgsql pkgs
48 for i in $(cd $WOK; ls -d postgresql-* libpostgresql* )
49 do
50 tazwok genpkg $i
51 done
52 }
54 # Pre and post install commands for Tazpkg.
55 post_install()
56 {
57 # adduser postgres if needed
58 if ! grep -q postgres $1/etc/passwd; then
59 echo -n "Adding user postgres..."
60 chroot $1/ adduser postgres -D -H -h /var/lib/pgsql
61 # ensure not to overload tux user
62 i=1100
63 while grep -q ":$i:" $1/etc/passwd ; do i=$(( $i + 1 )); done
64 sed -i "s/^postgres:x:1000:1000:/postgres:x:$i:$i:/" $1/etc/passwd
65 sed -i "s/^postgres:x:1000:/postgres:x:$i:/" $1/etc/group
66 status
67 fi
68 # addgroup postgres if needed
69 if ! grep -q postgres $1/etc/group; then
70 echo -n "Adding group postgres..."
71 chroot $1/ sh -c 'addgroup postgres && addgroup postgres postgres'
72 status
73 fi
74 chroot $1/ chown -R postgres.postgres /var/lib/pgsql /var/log/postgresql
75 cat <<EOF
76 ----
77 postgres has superuser access.
78 Configure /var/lib/pgsql/*.conf files.
79 To start $PACKAGE server you can run :
81 /etc/init.d/$PACKAGE start
83 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
84 ----
85 EOF
86 }
88 post_remove()
89 {
90 deluser postgres
91 delgroup postgres
92 }