Use USERS and GROUPS

PR:		ports/157669
Submitted by:	me
Approved by:	maintainer timeout (girgen, 7 weeks)
This commit is contained in:
Chris Rees 2011-08-12 10:11:22 +00:00
parent 5ceaa42ffa
commit 5d74c0654a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=279539
3 changed files with 3 additions and 49 deletions

View file

@ -35,7 +35,6 @@ GNU_CONFIGURE= YES
PG_USER?= pgsql
PG_GROUP?= pgsql
PG_UID?= 70
LDFLAGS+= -L${LOCALBASE}/lib
INCLUDES+= -I${LOCALBASE}/include
@ -62,6 +61,8 @@ 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)
@ -314,19 +315,10 @@ PKGMESSAGE= ${WRKSRC}/pkg-message${PKGNAMESUFFIX}
. endif
. 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

View file

@ -4,10 +4,6 @@
PATH=/bin:/usr/bin:/usr/sbin
PG_USER=%%PG_USER%%
PG_GROUP=%%PG_GROUP%%
PG_UID=%%PG_UID%%
backupwarning() { echo "
=========== BACKUP YOUR DATA! =============
@ -24,39 +20,6 @@ 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
;;

View file

@ -756,9 +756,8 @@ 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 %%PG_USER%%
@dirrmtry pgsql