- Use USERS and GROUPS
PR: ports/157602 Approved by: rene (mentor, implicit)
This commit is contained in:
parent
35d361ad63
commit
afdcd94b3e
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=277058
3 changed files with 4 additions and 57 deletions
|
@ -21,6 +21,8 @@ LICENSE_FILE= ${WRKSRC}/LICENSE
|
|||
USE_GMAKE= yes
|
||||
GNU_CONFIGURE= yes
|
||||
|
||||
USERS= ${TRIRCD_USER}
|
||||
GROUPS= ${TRIRCD_GROUP}
|
||||
TRIRCD_MAXCLIENTS?= 128
|
||||
|
||||
TRIRCD_USER?= trircd
|
||||
|
@ -45,13 +47,10 @@ CONFIGURE_ENV+= MD5SUMS="\"${MD5} -r\""
|
|||
|
||||
USE_RC_SUBR= trircd
|
||||
|
||||
SUB_LIST+= TRIRCD_USER="${TRIRCD_USER}" TRIRCD_GROUP="${TRIRCD_GROUP}" \
|
||||
TRIRCD_RUNDIR="${TRIRCD_RUNDIR}" TRIRCD_LOGDIR="${TRIRCD_LOGDIR}" \
|
||||
SUB_LIST+= TRIRCD_RUNDIR="${TRIRCD_RUNDIR}" TRIRCD_LOGDIR="${TRIRCD_LOGDIR}" \
|
||||
TRIRCD_CONFDIR="${TRIRCD_CONFDIR}"
|
||||
|
||||
SUB_FILES+= pkg-install pkg-deinstall pkg-message
|
||||
PKGINSTALL= ${WRKDIR}/pkg-install
|
||||
PKGDEINSTALL= ${WRKDIR}/pkg-deinstall
|
||||
SUB_FILES+= pkg-deinstall pkg-message
|
||||
PKGMESSAGE= ${WRKDIR}/pkg-message
|
||||
|
||||
.if !defined(NO_INSTALL_MANPAGES)
|
||||
|
@ -68,9 +67,6 @@ CONFIGURE_ARGS+=--enable-openssl=${OPENSSLBASE}
|
|||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
PW?= /usr/sbin/pw
|
||||
SUB_LIST+= MKDIR="${MKDIR}" PW="${PW}" CHMOD="${CHMOD}" CHOWN="${CHOWN}"
|
||||
|
||||
.if ${ARCH} == "amd64" || ${ARCH} == "ia64"
|
||||
CFLAGS+= -fPIC
|
||||
.endif
|
||||
|
@ -90,9 +86,6 @@ post-patch:
|
|||
post-configure:
|
||||
@${REINPLACE_CMD} -e "s,/var/log/tr-ircd,${TRIRCD_LOGDIR}," ${WRKSRC}/include/ircpath.h
|
||||
|
||||
pre-install:
|
||||
@${SH} ${PKGINSTALL}
|
||||
|
||||
post-install:
|
||||
@${MKDIR} ${TRIRCD_CONFDIR}
|
||||
@${INSTALL_DATA} ${WRKSRC}/doc/configuration/example.conf ${TRIRCD_CONFDIR}/ircd.conf.sample
|
||||
|
|
|
@ -4,19 +4,8 @@ if [ "$2" != "POST-DEINSTALL" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
TRIRCD_USER="%%TRIRCD_USER%%"
|
||||
TRIRCD_GROUP="%%TRIRCD_GROUP%%"
|
||||
TRIRCD_RUNDIR="%%TRIRCD_RUNDIR%%"
|
||||
TRIRCD_LOGDIR="%%TRIRCD_LOGDIR%%"
|
||||
PW="%%PW%%"
|
||||
|
||||
if pw usershow "${TRIRCD_USER}" 2>/dev/null 1>&2; then
|
||||
echo "This port may have created the user: ${TRIRCD_USER}"
|
||||
echo "To delete this user, use '${PW} userdel \"${TRIRCD_USER}\"'"
|
||||
fi
|
||||
if pw usershow "${TRIRCD_GROUP}" 2>/dev/null 1>&2; then
|
||||
echo "This port may have created the group: ${TRIRCD_GROUP}"
|
||||
echo "To delete this group, use '${PW} groupdel \"${TRIRCD_GROUP}\"'"
|
||||
fi
|
||||
echo "You may need to remove ${TRIRCD_RUNDIR} and ${TRIRCD_LOGDIR} manually."
|
||||
exit 0
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
TRIRCD_USER="%%TRIRCD_USER%%"
|
||||
TRIRCD_GROUP="%%TRIRCD_GROUP%%"
|
||||
TRIRCD_RUNDIR="%%TRIRCD_RUNDIR%%"
|
||||
TRIRCD_LOGDIR="%%TRIRCD_LOGDIR%%"
|
||||
TRIRCD_CONFDIR="%%TRIRCD_CONFDIR%%"
|
||||
|
||||
MKDIR="%%MKDIR%%"
|
||||
PW="%%PW%%"
|
||||
|
||||
if ! ${PW} groupshow "${TRIRCD_GROUP}" 2>/dev/null 1>&2; then
|
||||
if pw groupadd ${TRIRCD_GROUP}; then
|
||||
echo "Added group \"${TRIRCD_GROUP}\"."
|
||||
else
|
||||
echo "Adding group \"${TRIRCD_GROUP}\" failed..."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "You already have a group \"${TRIRCD_GROUP}\"."
|
||||
fi
|
||||
|
||||
if ! ${PW} usershow "${TRIRCD_USER}" 2>/dev/null 1>&2; then
|
||||
if pw useradd ${TRIRCD_USER} -g ${TRIRCD_GROUP} -h - \
|
||||
-s "/usr/sbin/nologin" -d "%%TRIRCD_CONFDIR%%" \
|
||||
-c "TR-IRCD pseudo-user"; \
|
||||
then
|
||||
echo "Added user \"${TRIRCD_USER}\"."
|
||||
else
|
||||
echo "Adding user \"${TRIRCD_USER}\" failed..."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "You already have a user \"${TRIRCD_USER}\"."
|
||||
fi
|
Loading…
Reference in a new issue