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