wok annotate postgresql/receipt @ rev 25050

Up memtest-efi* (6.00b2)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jun 04 20:41:29 2022 +0000 (2022-06-04)
parents a78610b2eb47
children df63c4ce07f8
rev   line source
pascal@1149 1 # SliTaz package receipt.
pascal@1149 2
pascal@1149 3 PACKAGE="postgresql"
pascal@14029 4 VERSION="9.2.3"
pascal@1506 5 CATEGORY="misc"
pascal@1149 6 SHORT_DESC="SQL database system."
pascal@1149 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@15375 8 LICENSE="BSD"
pascal@1149 9 TARBALL="$PACKAGE-$VERSION.tar.bz2"
pascal@20669 10 WEB_SITE="https://www.postgresql.org/"
slaxemulator@11412 11 WGET_URL="ftp://ftp.postgresql.org/pub/source/v$VERSION/$TARBALL"
pascal@2347 12 CONFIG_FILES="/var/lib/pgsql/*.conf"
pascal@2347 13 DATABASE_FILES="/var/lib/pgsql"
pascal@1149 14
pascal@13320 15 DEPENDS="postgresql-client slitaz-base-files"
pascal@13320 16 BUILD_DEPENDS="zlib-dev readline-dev ncurses-dev bison flex perl libxslt \
pascal@13320 17 python-dev"
pascal@13320 18
pascal@24459 19 # What is the latest version available today?
pascal@24459 20 current_version()
pascal@24459 21 {
pascal@24459 22 wget -O - https://www.postgresql.org/ftp/source/$(\
pascal@24459 23 wget -O - https://www.postgresql.org/ftp/source/ 2>/dev/null | \
pascal@24459 24 sed '/href="v[0-9]/!d;s|.*href="||;s|/.*||;q')/ 2>/dev/null | \
pascal@24459 25 sed '/postgresql-/!d;/news/d;s|.*postgresql-||;s|.tar.*||;q'
pascal@24459 26 }
pascal@24459 27
pascal@1149 28 # Rules to configure and make the package.
pascal@1149 29 compile_rules()
pascal@1149 30 {
pascal@1149 31 [ -d ../postgrpsql-$VERSION ] && cp -a ../postgrpsql-$VERSION/* .
slaxemulator@9700 32 cp $stuff/*.files-list .
pascal@1149 33 ./configure --prefix=/usr --infodir=/usr/share/info \
pascal@1149 34 --sysconfdir=/etc --includedir=/usr/include/postgresql --with-gnu-ld \
pascal@1149 35 --with-includes=/usr/include/readline --enable-integer-datetimes \
pascal@13320 36 --with-perl --with-python \
pascal@1149 37 --enable-thread-safety --with-system-tzdata=/usr/share/zoneinfo \
slaxemulator@6570 38 --libdir=/usr/lib/postgresql --mandir=/usr/share/man \
slaxemulator@6570 39 $CONFIGURE_ARGS &&
pascal@19891 40 make world &&
slaxemulator@11412 41 make DESTDIR=$DESTDIR install
slaxemulator@11412 42 make -C doc/src/sgml DESTDIR=$DESTDIR install-html
pascal@1149 43 }
pascal@1149 44
pascal@1149 45 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@1149 46 genpkg_rules()
pascal@1149 47 {
pascal@1149 48 mkdir -p $fs/usr/share $fs/usr/lib $fs/var/lib/pgsql \
pascal@1967 49 $fs/var/log/postgresql $fs/etc/pgsql.d
pascal@13320 50 cp -a $install/usr/bin $fs/usr
pascal@13320 51 cp -a $install/usr/lib/postgresql $fs/usr/lib
pascal@1149 52 rm -f $fs/usr/lib/postgresql/*a
pascal@13320 53 cp -a $install/usr/share/postgresql $fs/usr/share
slaxemulator@9701 54 cp -a $stuff/etc $fs
pascal@1149 55 ln -s /var/lib/pgsql/postgresql.conf $fs/etc
pascal@1149 56 chmod 700 $fs/var/lib/pgsql
slaxemulator@9701 57 cat $stuff/*.files-list | while read file; do
pascal@1149 58 [ -f $fs$file ] && rm -f $fs$file
pascal@1149 59 done
slaxemulator@8646 60
pascal@1149 61 }
pascal@1149 62
pascal@1149 63 # Pre and post install commands for Tazpkg.
pascal@1149 64 post_install()
pascal@1149 65 {
pascal@1149 66 # adduser postgres if needed
pascal@18730 67 if ! grep -q postgres: "$1/etc/passwd"; then
pascal@20319 68 echo
pascal@1149 69 echo -n "Adding user postgres..."
pascal@18730 70 chroot "$1/" adduser postgres -D -H -u 88 -h /var/lib/pgsql
pascal@18730 71 #[ -d "$1/var/lib/pgsql" ] && rm -f "$1/var/lib/pgsql"/.* "$1/var/lib/pgsql"/*
pascal@1149 72 status
pascal@1149 73 fi
pascal@1149 74 # addgroup postgres if needed
pascal@18730 75 if ! grep -q postgres: "$1/etc/group"; then
pascal@20319 76 echo
pascal@1149 77 echo -n "Adding group postgres..."
pascal@18730 78 chroot "$1/" sh -c 'addgroup -g 88 postgres'
pascal@1149 79 status
pascal@1149 80 fi
pascal@18730 81 [ ! -d "$1/var/lib/pgsql" ] && mkdir -p "$1/var/lib/pgsql"
pascal@18730 82 chroot "$1/" chown -R postgres.postgres /var/lib/pgsql /var/log/postgresql
pascal@1149 83 cat <<EOF
pascal@1149 84 ----
pascal@1152 85 postgres has superuser access.
pascal@1152 86 Configure /var/lib/pgsql/*.conf files.
pascal@1149 87 To start $PACKAGE server you can run :
pascal@1149 88
pascal@1149 89 /etc/init.d/$PACKAGE start
pascal@1149 90
pascal@1149 91 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
pascal@1149 92 ----
pascal@1149 93 EOF
pascal@1149 94 }
pascal@1149 95
pascal@1149 96 post_remove()
pascal@1149 97 {
slaxemulator@8646 98 # when both user and group have the same id# and name
slaxemulator@8646 99 # both group and user will get removed with either delusr/delgroup
pascal@18730 100 chroot "$1/" deluser postgres
pascal@1149 101 }