Use USERS and GROUPS

PR:		ports/157559
Submitted by:	me
Approved by:	maintainer timeout (girgen, 9 weeks)
This commit is contained in:
Chris Rees 2011-08-12 09:51:20 +00:00
parent c81f7cc2af
commit c7d059d51e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=279537
2 changed files with 2 additions and 45 deletions

View file

@ -60,6 +60,8 @@ USE_RC_SUBR= postgresql
SUB_FILES+= dot.cshrc dot.profile
USE_PGSQL= yes
WANT_PGSQL_VER= ${PORTVERSION:C/([0-9][0-9]*)\.([0-9][0-9]*).*/\1\2/g}
USERS= pgsql
GROUPS= ${USERS}
.endif
.if !defined(SLAVE_ONLY)
@ -241,12 +243,6 @@ PKGMESSAGE= ${WRKSRC}/pkg-message${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

@ -3,8 +3,6 @@
# $FreeBSD$
PATH=/bin:/usr/sbin
PGUSER=pgsql
DB_DIR=${PKG_PREFIX}/${PGUSER}
backupwarning() { echo "
@ -22,43 +20,6 @@ backupwarning() { echo "
}
case $2 in
PRE-INSTALL)
backupwarning
USER=${PGUSER}
GROUP=${USER}
UID=70
GID=${UID}
if pw group show "${GROUP}" 2>/dev/null; then
echo "You already have a group \"${GROUP}\", so I will use it."
else
if pw groupadd ${GROUP} -g ${GID}; then
echo "Added group \"${GROUP}\"."
else
echo "Adding group \"${GROUP}\" failed..."
exit 1
fi
fi
if pw user show "${USER}" 2>/dev/null; then
echo "You already have a user \"${USER}\", so I will use it."
else
if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
-d ${DB_DIR} -c "PostgreSQL Daemon"
then
echo "Added user \"${USER}\"."
else
echo "Adding user \"${USER}\" failed..."
exit 1
fi
fi
if ! [ -x ~${PGUSER} ] ; then
mkdir -p ${DB_DIR}
chown pgsql:pgsql ${DB_DIR}
fi
;;
BACKUPWARNING)
backupwarning
;;