SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "postgresql"

# SliTaz package receipt.

PACKAGE="postgresql"
VERSION="12.18"
CATEGORY="misc"
SHORT_DESC="SQL database system."
MAINTAINER="pascal.bellard@slitaz.org"
LICENSE="BSD"
TARBALL="$PACKAGE-$VERSION.tar.bz2"
WEB_SITE="https://www.postgresql.org/"
WGET_URL="https://ftp.postgresql.org/pub/source/v$VERSION/$TARBALL"
CONFIG_FILES="/var/lib/pgsql/*.conf"
DATABASE_FILES="/var/lib/pgsql"

DEPENDS="postgresql-client slitaz-base-files"
BUILD_DEPENDS="zlib-dev readline-dev ncurses-dev bison flex perl-dev \
libxslt python-dev"

# What is the latest version available today?
current_version()
{
    wget -O - https://www.postgresql.org/ftp/source/$(\
    wget -O - https://www.postgresql.org/ftp/source/ 2>/dev/null | \
    sed '/href="v[0-9]/!d;s|.*href="||;s|/.*||;q')/ 2>/dev/null | \
    sed '/postgresql-/!d;/news/d;s|.*postgresql-||;s|.tar.*||;q'
}

# Rules to configure and make the package.
compile_rules()
{
    [ -d ../postgrpsql-$VERSION ] && cp -a ../postgrpsql-$VERSION/* .
    cp $stuff/*.files-list .
    ./configure --prefix=/usr --infodir=/usr/share/info \
    --sysconfdir=/etc --includedir=/usr/include/postgresql --with-gnu-ld \
    --with-includes=/usr/include/readline --enable-integer-datetimes \
    --with-perl --with-python \
    --enable-thread-safety --with-system-tzdata=/usr/share/zoneinfo \
    --libdir=/usr/lib/postgresql --mandir=/usr/share/man \
    $CONFIGURE_ARGS &&
    make world &&
    make DESTDIR=$DESTDIR install
    make -C doc/src/sgml DESTDIR=$DESTDIR install-html
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/usr/share $fs/usr/lib $fs/var/lib/pgsql \
         $fs/var/log/postgresql $fs/etc/pgsql.d
    cp -a $install/usr/bin $fs/usr
    cp -a $install/usr/lib/postgresql $fs/usr/lib
    rm -f $fs/usr/lib/postgresql/*a
    cp -a $install/usr/share/postgresql $fs/usr/share
    cp -a $stuff/etc $fs
    ln -s /var/lib/pgsql/postgresql.conf $fs/etc
    chmod 700 $fs/var/lib/pgsql
    cat $stuff/*.files-list | while read file; do
        [ -f $fs$file ] && rm -f $fs$file
    done

}

# Pre and post install commands for Tazpkg.
post_install()
{
        # adduser postgres if needed
    if ! grep -q postgres: "$1/etc/passwd"; then
        echo
        echo -n "Adding user postgres..."
        chroot "$1/" adduser postgres -D -H -u 88 -h /var/lib/pgsql
        #[ -d "$1/var/lib/pgsql" ] && rm -f "$1/var/lib/pgsql"/.* "$1/var/lib/pgsql"/*
        status
    fi
    # addgroup postgres if needed
    if ! grep -q postgres: "$1/etc/group"; then
        echo
        echo -n "Adding group postgres..."
        chroot "$1/" sh -c 'addgroup -g 88 postgres'
        status
    fi
    [ ! -d "$1/var/lib/pgsql" ] && mkdir -p "$1/var/lib/pgsql"
    chroot "$1/" chown -R postgres.postgres /var/lib/pgsql /var/log/postgresql
    cat <<EOF
----
postgres has superuser access.
Configure /var/lib/pgsql/*.conf files.
To start $PACKAGE server you can run :

    /etc/init.d/$PACKAGE start

Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
----
EOF
}

post_remove()
{
    # when both user and group have the same id# and name
    # both group and user will get removed with either delusr/delgroup
    chroot "$1/" deluser postgres
}
6025 packages and 203154 files in current database (Thu Apr 25 06:17:47 2024)