wok-next annotate postgresql/receipt @ rev 1149

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