diff options
author | crees <crees@FreeBSD.org> | 2011-08-15 22:52:31 +0800 |
---|---|---|
committer | crees <crees@FreeBSD.org> | 2011-08-15 22:52:31 +0800 |
commit | 06c2de3ed103e4fac44df7afda454b12199ce744 (patch) | |
tree | 31b8e37fa60a6bfe35609e8fa6e6591ba1d7e5e2 /databases/postgresql84-server | |
parent | 3a3a4b1bd21678724a90ee2a1093952b8431a471 (diff) | |
download | freebsd-ports-gnome-06c2de3ed103e4fac44df7afda454b12199ce744.tar.gz freebsd-ports-gnome-06c2de3ed103e4fac44df7afda454b12199ce744.tar.zst freebsd-ports-gnome-06c2de3ed103e4fac44df7afda454b12199ce744.zip |
Revert previous commit -- appears to cause rc problems as I missed some subs
http://www.mail-archive.com/freebsd-ports@freebsd.org/msg35324.html
PR: ports/157558 ports/157559 ports/157666 ports/157669
Submitted by: rihad@mail.ru
Approved by: maintainer (girgen; implicit -- this reverts a commit I did after maintainer timeout)
Diffstat (limited to 'databases/postgresql84-server')
-rw-r--r-- | databases/postgresql84-server/Makefile | 12 | ||||
-rw-r--r-- | databases/postgresql84-server/files/pkg-install-server.in | 37 | ||||
-rw-r--r-- | databases/postgresql84-server/pkg-plist-server | 3 |
3 files changed, 49 insertions, 3 deletions
diff --git a/databases/postgresql84-server/Makefile b/databases/postgresql84-server/Makefile index da72a935b758..8c6d4972a77b 100644 --- a/databases/postgresql84-server/Makefile +++ b/databases/postgresql84-server/Makefile @@ -37,6 +37,7 @@ GNU_CONFIGURE= YES PG_USER?= pgsql PG_GROUP?= pgsql +PG_UID?= 70 LDFLAGS+= -L${LOCALBASE}/lib INCLUDES+= -I${LOCALBASE}/include @@ -62,8 +63,6 @@ USE_RC_SUBR= postgresql USE_PGSQL= yes WANT_PGSQL_VER= ${PORTVERSION:C/([0-9][0-9]*)\.([0-9][0-9]*).*/\1\2/g} SUB_FILES+= 502.pgsql -USERS= ${PG_USER} -GROUPS= ${PG_GROUP} .endif .if !defined(SLAVE_ONLY) @@ -285,11 +284,20 @@ PKGMESSAGE= ${WRKSRC}/pkg-message${PKGNAMESUFFIX} . if exists(${FILESDIR}/pkg-install${PKGNAMESUFFIX}.in) SUB_FILES+= 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} . endif .endif +.if defined(SERVER_ONLY) +pre-su-install: + @ ${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PORTNAME} PRE-INSTALL +.endif + .if !defined(NO_BUILD) post-patch: @${REINPLACE_CMD} s/@PTHREAD_LIBS@// ${WRKSRC}/src/Makefile.global.in diff --git a/databases/postgresql84-server/files/pkg-install-server.in b/databases/postgresql84-server/files/pkg-install-server.in index e3be291efdc1..da85c73b7e4c 100644 --- a/databases/postgresql84-server/files/pkg-install-server.in +++ b/databases/postgresql84-server/files/pkg-install-server.in @@ -4,6 +4,10 @@ PATH=/bin:/usr/bin:/usr/sbin +PG_USER=%%PG_USER%% +PG_GROUP=%%PG_GROUP%% +PG_UID=%%PG_UID%% + backupwarning() { echo " =========== BACKUP YOUR DATA! ============= @@ -20,6 +24,39 @@ backupwarning() { echo " } case $2 in +PRE-INSTALL) + backupwarning + DB_DIR=${PKG_PREFIX}/${PG_USER} + + 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 ${PG_UID}; 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 ${PG_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 ;; diff --git a/databases/postgresql84-server/pkg-plist-server b/databases/postgresql84-server/pkg-plist-server index 4c64436eef2d..9134bcce6f4e 100644 --- a/databases/postgresql84-server/pkg-plist-server +++ b/databases/postgresql84-server/pkg-plist-server @@ -753,8 +753,9 @@ share/postgresql/tsearch_data/ispell_sample.dict share/postgresql/tsearch_data/synonym_sample.syn share/postgresql/tsearch_data/thesaurus_sample.ths @dirrmtry share/postgresql/tsearch_data +@unexec echo "Warning: If you will *NOT* use this package anymore, please remove the pgsql user manually." @dirrmtry share/postgresql @dirrmtry etc/periodic/daily @dirrmtry etc/periodic @dirrmtry lib/postgresql -@dirrmtry pgsql +@dirrmtry %%PG_USER%% |