diff options
author | girgen <girgen@FreeBSD.org> | 2011-04-27 21:28:51 +0800 |
---|---|---|
committer | girgen <girgen@FreeBSD.org> | 2011-04-27 21:28:51 +0800 |
commit | d80456c0854ac6dc6d6d2e4947b0789ca3424c2c (patch) | |
tree | 423277571b8f131f6508299b6b27411cc0ec8427 /databases/postgresql84-server | |
parent | 319f32f1164ce686a733c260e2298afec91bbf1a (diff) | |
download | freebsd-ports-gnome-d80456c0854ac6dc6d6d2e4947b0789ca3424c2c.tar.gz freebsd-ports-gnome-d80456c0854ac6dc6d6d2e4947b0789ca3424c2c.tar.zst freebsd-ports-gnome-d80456c0854ac6dc6d6d2e4947b0789ca3424c2c.zip |
Fix problem creating postgres user when PGUSER was set.
PR: 156662
Diffstat (limited to 'databases/postgresql84-server')
-rw-r--r-- | databases/postgresql84-server/Makefile | 10 | ||||
-rw-r--r-- | databases/postgresql84-server/files/pkg-install-server | 61 | ||||
-rw-r--r-- | databases/postgresql84-server/files/pkg-install-server.in | 66 |
3 files changed, 67 insertions, 70 deletions
diff --git a/databases/postgresql84-server/Makefile b/databases/postgresql84-server/Makefile index d9800aa8e6c7..6bdc5fff0074 100644 --- a/databases/postgresql84-server/Makefile +++ b/databases/postgresql84-server/Makefile @@ -161,6 +161,8 @@ INSTALL_TARGET= install-strip .if (${OSVERSION} >= 700000) && !defined(WITHOUT_GSSAPI) CONFIGURE_ARGS+=--with-gssapi +.else +CONFIGURE_ARGS+=--without-gssapi .endif . if defined(WITH_MIT_KRB5) @@ -253,7 +255,7 @@ MAN7= abort.7 alter_aggregate.7 alter_conversion.7 alter_database.7 \ .if defined(SERVER_ONLY) pre-everything:: - @${SH} ${FILESDIR}/pkg-install${PKGNAMESUFFIX}.in ${PORTNAME} BACKUPWARNING + @${SH} ${FILESDIR}/pkg-install${PKGNAMESUFFIX} ${PORTNAME} BACKUPWARNING .endif .if !defined(NO_BUILD) @@ -276,13 +278,12 @@ SUB_FILES+= pkg-message${PKGNAMESUFFIX} PKGMESSAGE= ${WRKSRC}/pkg-message${PKGNAMESUFFIX} . endif -. if exists(${FILESDIR}/pkg-install${PKGNAMESUFFIX}.in) -SUB_FILES+= pkg-install${PKGNAMESUFFIX} +. if exists(${FILESDIR}/pkg-install${PKGNAMESUFFIX}) SUB_LIST= PG_GROUP=$(PG_GROUP) \ PG_USER=$(PG_USER) \ PG_UID=$(PG_UID) PLIST_SUB+= PG_USER=$(PG_USER) -PKGINSTALL= ${WRKDIR}/pkg-install${PKGNAMESUFFIX} +PKGINSTALL= ${FILESDIR}/pkg-install${PKGNAMESUFFIX} . endif .endif @@ -290,6 +291,7 @@ PKGINSTALL= ${WRKDIR}/pkg-install${PKGNAMESUFFIX} .if defined(SERVER_ONLY) pre-su-install: @ ${SETENV} PKG_PREFIX=${PREFIX} PG_USER=$(PG_USER) PG_GROUP=$(PG_GROUP) \ + PG_UID=$(PG_UID) \ ${SH} ${PKGINSTALL} ${PORTNAME} PRE-INSTALL .endif diff --git a/databases/postgresql84-server/files/pkg-install-server b/databases/postgresql84-server/files/pkg-install-server new file mode 100644 index 000000000000..c1e108162378 --- /dev/null +++ b/databases/postgresql84-server/files/pkg-install-server @@ -0,0 +1,61 @@ +#! /bin/sh + +# $FreeBSD: /tmp/pcvs/ports/databases/postgresql84-server/files/Attic/pkg-install-server,v 1.1 2011-04-27 13:28:51 girgen Exp $ + +PATH=/bin:/usr/bin:/usr/sbin + +backupwarning() { echo " + + =========== BACKUP YOUR DATA! ============= + As always, backup your data before + upgrading. If the upgrade leads to a higher + minor revision (e.g. 7.3.x -> 7.4), a dump + and restore of all databases is + required. This is *NOT* done by the port! + + Press ctrl-C *now* if you need to pg_dump. + =========================================== +" + sleep 5 +} + +case $2 in +PRE-INSTALL) + backupwarning + DB_DIR=${PKG_PREFIX}/${PG_USER} + UID=${PG_UID} + GID=${PG_UID} + + if pw group show "${PG_GROUP}" 2>/dev/null; then + echo "You already have a group \"${PG_GROUP}\", so I will use it." + else + if pw groupadd ${PG_GROUP} -g ${GID}; then + echo "Added group \"${PG_GROUP}\"." + else + echo "Adding group \"${PG_GROUP}\" failed..." + exit 1 + fi + fi + + if pw user show "${PG_USER}" 2>/dev/null; then + echo "You already have a user \"${PG_USER}\", so I will use it." + else + if pw useradd ${PG_USER} -u ${UID} -g ${PG_GROUP} -h - \ + -d ${DB_DIR} -c "PostgreSQL Daemon" + then + echo "Added user \"${PG_USER}\"." + else + echo "Adding user \"${PG_USER}\" failed..." + exit 1 + fi + fi + + if ! [ -x ~${PG_USER} ] ; then + install -m 755 -o ${PG_USER} -g ${PG_GROUP} -d ${DB_DIR} + fi + ;; + +BACKUPWARNING) + backupwarning + ;; +esac diff --git a/databases/postgresql84-server/files/pkg-install-server.in b/databases/postgresql84-server/files/pkg-install-server.in deleted file mode 100644 index a9651cfa6156..000000000000 --- a/databases/postgresql84-server/files/pkg-install-server.in +++ /dev/null @@ -1,66 +0,0 @@ -#! /bin/sh - -# $FreeBSD$ - -PATH=/bin:/usr/bin:/usr/sbin -PG_USER=%%PG_USER%% -PG_GROUP=%%PG_GROUP%% -PG_UID=%%PG_UID%% - -backupwarning() { echo " - - =========== BACKUP YOUR DATA! ============= - As always, backup your data before - upgrading. If the upgrade leads to a higher - minor revision (e.g. 7.3.x -> 7.4), a dump - and restore of all databases is - required. This is *NOT* done by the port! - - Press ctrl-C *now* if you need to pg_dump. - =========================================== -" - sleep 5 -} - -case $2 in -PRE-INSTALL) - backupwarning - PGUSER=${PGUSER:-${PG_USER}} - PGGROUP=${PGGROUP:-${PG_GROUP}} - DB_DIR=${PKG_PREFIX}/${PG_USER} - UID=${PG_UID} - GID=${PG_UID} - - if pw group show "${PGGROUP}" 2>/dev/null; then - echo "You already have a group \"${PGGROUP}\", so I will use it." - else - if pw groupadd ${PGGROUP} -g ${GID}; then - echo "Added group \"${PGGROUP}\"." - else - echo "Adding group \"${PGGROUP}\" failed..." - exit 1 - fi - fi - - if pw user show "${PGUSER}" 2>/dev/null; then - echo "You already have a user \"${PGUSER}\", so I will use it." - else - if pw useradd ${PGUSER} -u ${UID} -g ${PGGROUP} -h - \ - -d ${DB_DIR} -c "PostgreSQL Daemon" - then - echo "Added user \"${PGUSER}\"." - else - echo "Adding user \"${PGUSER}\" failed..." - exit 1 - fi - fi - - if ! [ -x ~${PGUSER} ] ; then - install -m 755 -o ${PGUSER} -g ${PGGROUP} -d ${DB_DIR} - fi - ;; - -BACKUPWARNING) - backupwarning - ;; -esac |