wok-next annotate postgresql/receipt @ rev 20143
postgresql: receipt v2
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Nov 01 11:18:25 2017 +0100 (2017-11-01) |
parents | f463de72afe3 |
children | 5b64ca8fb7e1 |
rev | line source |
---|---|
pascal@20143 | 1 # SliTaz package receipt v2. |
pascal@1149 | 2 |
pascal@1149 | 3 PACKAGE="postgresql" |
al@19693 | 4 VERSION="9.5.4" |
pascal@1506 | 5 CATEGORY="misc" |
al@19693 | 6 SHORT_DESC="Advanced object-relational database management system" |
pascal@1149 | 7 MAINTAINER="pascal.bellard@slitaz.org" |
pascal@15375 | 8 LICENSE="BSD" |
al@19693 | 9 WEB_SITE="https://www.postgresql.org/" |
pascal@2347 | 10 DATABASE_FILES="/var/lib/pgsql" |
pascal@1149 | 11 |
al@19693 | 12 TARBALL="$PACKAGE-$VERSION.tar.bz2" |
al@19693 | 13 WGET_URL="http://ftp.postgresql.org/pub/source/v$VERSION/$TARBALL" |
al@19693 | 14 |
pascal@13320 | 15 DEPENDS="postgresql-client slitaz-base-files" |
al@19693 | 16 BUILD_DEPENDS="readline-dev zlib-dev perl python-dev" |
pascal@20143 | 17 SPLIT="libpostgresqlclient postgresql-client postgresql-dev postgresql-doc" |
pascal@13320 | 18 |
pascal@1149 | 19 # Rules to configure and make the package. |
pascal@1149 | 20 compile_rules() |
pascal@1149 | 21 { |
al@19693 | 22 sed -i '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/postgresql@' src/include/pg_config_manual.h && |
al@19693 | 23 |
al@19693 | 24 ./configure \ |
al@19693 | 25 --enable-thread-safety \ |
al@19693 | 26 --docdir=/usr/share/doc/postgresql-$VERSION \ |
al@19693 | 27 --with-system-tzdata=/usr/share/zoneinfo \ |
al@19693 | 28 --with-perl --with-python \ |
al@19693 | 29 $CONFIGURE_ARGS && |
al@19693 | 30 make && make install && make install-docs |
al@19693 | 31 |
slaxemulator@11412 | 32 make -C doc/src/sgml DESTDIR=$DESTDIR install-html |
pascal@1149 | 33 } |
pascal@1149 | 34 |
pascal@1149 | 35 # Rules to gen a SliTaz package suitable for Tazpkg. |
pascal@1149 | 36 genpkg_rules() |
pascal@1149 | 37 { |
pascal@20143 | 38 case $PACKAGE in |
pascal@20143 | 39 postgresql) |
pascal@20143 | 40 copy bin/ postgresql/ *.so* |
al@19693 | 41 |
pascal@20143 | 42 mkdir -p $fs/var/lib/pgsql $fs/var/log/postgresql $fs/etc/pgsql.d |
pascal@20143 | 43 cp -a $stuff/etc $fs |
pascal@20143 | 44 ln -s /var/lib/pgsql/postgresql.conf $fs/etc |
pascal@20143 | 45 chmod 700 $fs/var/lib/pgsql |
al@19693 | 46 |
pascal@20143 | 47 # split |
pascal@20143 | 48 for i in clusterdb createdb createlang createuser dropdb droplang dropuser \ |
pascal@20143 | 49 pg_dump pg_dumpall pg_restore psql reindexdb vacuumdb libpq.so*; do |
pascal@20143 | 50 find $fs -name $i -delete |
pascal@20143 | 51 done |
pascal@20143 | 52 rm -r $fs/usr/include $fs/usr/lib/postgresql/pgxs |
pascal@20143 | 53 ;; |
pascal@20143 | 54 libpostgresqlclient) |
pascal@20143 | 55 CAT="misc|Advanced object-relational database management system (client libraries)" |
pascal@20143 | 56 copy libpq.so* |
pascal@20143 | 57 ;; |
pascal@20143 | 58 postgresql-client) |
pascal@20143 | 59 CAT="misc|Advanced object-relational database management system (client files)" |
pascal@20143 | 60 PROVIDE="mysql_or_postgresql" |
pascal@20143 | 61 DEPENDS="libpostgresqlclient zlib ncurses readline" |
pascal@20143 | 62 copy clusterdb createdb createlang createuser dropdb droplang \ |
pascal@20143 | 63 dropuser pg_dump pg_dumpall pg_restore psql reindexdb vacuumdb |
pascal@20143 | 64 ;; |
pascal@20143 | 65 postgresql-dev) |
pascal@20143 | 66 CAT="development|Advanced object-relational database management system (development files)" |
pascal@20143 | 67 DEPENDS="postgresql" |
pascal@20143 | 68 copy *.h *.a *.pc pgxs/ |
pascal@20143 | 69 ;; |
pascal@20143 | 70 postgresql-doc) |
pascal@20143 | 71 CAT="doc|Advanced object-relational database management system (documentation)" |
pascal@20143 | 72 copy doc/ |
pascal@20143 | 73 ;; |
pascal@20143 | 74 esac |
pascal@1149 | 75 } |
pascal@1149 | 76 |
pascal@1149 | 77 # Pre and post install commands for Tazpkg. |
pascal@20143 | 78 post_install_postgresql() |
pascal@1149 | 79 { |
al@19693 | 80 # adduser postgres if needed |
pascal@18730 | 81 if ! grep -q postgres: "$1/etc/passwd"; then |
al@19693 | 82 action 'Adding user postgres...' |
pascal@18730 | 83 chroot "$1/" adduser postgres -D -H -u 88 -h /var/lib/pgsql |
pascal@18730 | 84 #[ -d "$1/var/lib/pgsql" ] && rm -f "$1/var/lib/pgsql"/.* "$1/var/lib/pgsql"/* |
pascal@1149 | 85 status |
pascal@1149 | 86 fi |
pascal@1149 | 87 # addgroup postgres if needed |
pascal@18730 | 88 if ! grep -q postgres: "$1/etc/group"; then |
al@19693 | 89 action 'Adding group postgres...' |
pascal@18730 | 90 chroot "$1/" sh -c 'addgroup -g 88 postgres' |
pascal@1149 | 91 status |
pascal@1149 | 92 fi |
pascal@18730 | 93 [ ! -d "$1/var/lib/pgsql" ] && mkdir -p "$1/var/lib/pgsql" |
pascal@18730 | 94 chroot "$1/" chown -R postgres.postgres /var/lib/pgsql /var/log/postgresql |
al@19693 | 95 [ -n "$quiet" ] || cat <<EOF |
pascal@1149 | 96 ---- |
pascal@1152 | 97 postgres has superuser access. |
pascal@1152 | 98 Configure /var/lib/pgsql/*.conf files. |
al@19693 | 99 To start $PACKAGE server you can run: |
pascal@1149 | 100 |
pascal@1149 | 101 /etc/init.d/$PACKAGE start |
pascal@1149 | 102 |
pascal@1149 | 103 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf |
pascal@1149 | 104 ---- |
pascal@1149 | 105 EOF |
pascal@1149 | 106 } |
pascal@1149 | 107 |
pascal@20143 | 108 post_remove_postgresql() |
pascal@1149 | 109 { |
slaxemulator@8646 | 110 # when both user and group have the same id# and name |
slaxemulator@8646 | 111 # both group and user will get removed with either delusr/delgroup |
pascal@18730 | 112 chroot "$1/" deluser postgres |
pascal@1149 | 113 } |