wok-4.x view postgresql/receipt @ rev 5748

busybox: ensure mod is 4755
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jul 02 12:30:41 2010 +0200 (2010-07-02)
parents d6700680fb11
children d82443087752
line source
1 # SliTaz package receipt.
3 PACKAGE="postgresql"
4 VERSION="8.3.9"
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 rm -f /var/lib/pgsql/.* /var/lib/pgsql/*
62 # ensure not to overload tux user
63 i=1100
64 while grep -q ":$i:" $1/etc/passwd ; do i=$(( $i + 1 )); done
65 sed -i "s/^postgres:x:1000:1000:/postgres:x:$i:$i:/" $1/etc/passwd
66 sed -i "s/^postgres:x:1000:/postgres:x:$i:/" $1/etc/group
67 status
68 fi
69 # addgroup postgres if needed
70 if ! grep -q postgres $1/etc/group; then
71 echo -n "Adding group postgres..."
72 chroot $1/ sh -c 'addgroup postgres && addgroup postgres postgres'
73 status
74 fi
75 chroot $1/ chown -R postgres.postgres /var/lib/pgsql /var/log/postgresql
76 cat <<EOF
77 ----
78 postgres has superuser access.
79 Configure /var/lib/pgsql/*.conf files.
80 To start $PACKAGE server you can run :
82 /etc/init.d/$PACKAGE start
84 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
85 ----
86 EOF
87 }
89 post_remove()
90 {
91 deluser postgres
92 delgroup postgres
93 }