From 841c20276b7252a76d2e2c4c5e18475d6029cc45 Mon Sep 17 00:00:00 2001 From: Olli Hauer Date: Sun, 28 Nov 2010 23:50:54 +0000 Subject: - give sysutils/radmind its own UID/GID - add pkg-message - add pkg-install script for user/group creation if installed from package since the installation use "chown" - bump portrevision PR: ports/150765 Submitted by: Michael Graziano (maintainer) --- sysutils/radmind/Makefile | 18 +++++++++++---- sysutils/radmind/distinfo | 1 - sysutils/radmind/files/pkg-install.in | 43 +++++++++++++++++++++++++++++++++++ sysutils/radmind/files/pkg-message.in | 16 +++++++++++++ sysutils/radmind/files/radmind.sh.in | 4 +++- sysutils/radmind/pkg-plist | 1 + 6 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 sysutils/radmind/files/pkg-install.in create mode 100644 sysutils/radmind/files/pkg-message.in (limited to 'sysutils') diff --git a/sysutils/radmind/Makefile b/sysutils/radmind/Makefile index 9d1fbbe383c8..824530a42b24 100644 --- a/sysutils/radmind/Makefile +++ b/sysutils/radmind/Makefile @@ -7,24 +7,30 @@ PORTNAME= radmind PORTVERSION= 1.13.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= sysutils -MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${PORTNAME}-${PORTVERSION} +MASTER_SITES= SF +MASTER_SITE_SUBDIR=${PORTNAME}/${PORTNAME}/${PORTNAME}-${PORTVERSION} MAINTAINER= mikeg@bsd-box.net COMMENT= Utility for administering filesystem changes USE_OPENSSL= yes USE_RC_SUBR= radmind.sh -SUB_LIST= RADMIND_BASE_DIR=${RADMIND_BASE_DIR} -PLIST_SUB= RADMIND_BASE_DIR=${RADMIND_BASE_DIR} MAKE_JOBS_UNSAFE= yes GNU_CONFIGURE= yes CONFIGURE_ARGS= --with-radminddir=${RADMIND_BASE_DIR} +RADMINUSER= radmind +USERS= ${RADMINUSER} +GROUPS= ${RADMINUSER} RADMIND_BASE_DIR?= /var/radmind +SUB_LIST= RADMIND_BASE_DIR=${RADMIND_BASE_DIR} RADMINUSER=${RADMINUSER} +PLIST_SUB= RADMIND_BASE_DIR=${RADMIND_BASE_DIR} +SUB_FILES+= pkg-install pkg-message + MAN1= fsdiff.1 ktcheck.1 lapply.1 lcksum.1 lcreate.1 lfdiff.1 \ lmerge.1 lsort.1 twhich.1 rash.1 repo.1 MAN5= applefile.5 @@ -32,12 +38,14 @@ MAN8= radmind.8 DOCS= COPYRIGHT README SPEC post-install: - # Ugly hack to remove generated man pages +# Ugly hack to remove generated man pages ${RM} -rf ${WRKSRC}/tmp .if !defined(NOPORTDOCS) ${MKDIR} ${DOCSDIR} cd ${WRKSRC} && ${INSTALL_DATA} ${DOCS} ${DOCSDIR} .endif + @${CHOWN} -R ${RADMINUSER}:${RADMINUSER} ${RADMIND_BASE_DIR} + @${CAT} ${PKGMESSAGE} .include diff --git a/sysutils/radmind/distinfo b/sysutils/radmind/distinfo index fef3c7ca2cba..e1c9dd02e261 100644 --- a/sysutils/radmind/distinfo +++ b/sysutils/radmind/distinfo @@ -1,3 +1,2 @@ -MD5 (radmind-1.13.0.tar.gz) = 29ce0070b707a47fe0de505ae7d68047 SHA256 (radmind-1.13.0.tar.gz) = 9d23787d8b482ad7cea590a970c40de2e7eec1f59d05b542df7f399679991b7f SIZE (radmind-1.13.0.tar.gz) = 447650 diff --git a/sysutils/radmind/files/pkg-install.in b/sysutils/radmind/files/pkg-install.in new file mode 100644 index 000000000000..1069a0fd5f54 --- /dev/null +++ b/sysutils/radmind/files/pkg-install.in @@ -0,0 +1,43 @@ +#!/bin/sh + +# This script is only needed if we install from package since the creation +# of groups/users are to late executed! The script can be removed if this +# issue is solved in bsd.port.mk. + +USER=%%RADMINUSER%% +GROUP=%%RADMINUSER%% +UID=506 +GID=506 +RADMIND_BASE_DIR=%%RADMIND_BASE_DIR%% + + +if [ "$2" = "PRE-INSTALL" ]; then + if /usr/sbin/pw groupshow "${GROUP}" >/dev/null 2>&1; then + echo "Using existing group \"${GROUP}\"." + else + if /usr/sbin/pw groupadd ${GROUP} -g ${GID}; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + echo "Please create it, and try again." + exit 1 + fi + fi + + if /usr/sbin/pw user show "${USER}" >/dev/null 2>&1; then + echo "Using existing user \"${USER}\"." + else + if /usr/sbin/pw useradd ${USER} -u ${UID} -g ${GROUP} -c "radmind User" -h - -d ${RADMIND_BASE_DIR} -s /usr/sbin/nologin ; then + install -Cp -d -g ${GID} -o ${UID} ${RADMIND_BASE_DIR} + echo "Added user \"${USER}\"." + else + echo "Adding user \"${USER}\" failed..." + echo "Please create it, and try again." + exit 1 + fi + fi +fi + +if [ "$2" = "POST-INSTALL" ]; then + chown -R ${USER}:${GROUP} ${RADMIND_BASE_DIR} +fi diff --git a/sysutils/radmind/files/pkg-message.in b/sysutils/radmind/files/pkg-message.in new file mode 100644 index 000000000000..a048e2160daf --- /dev/null +++ b/sysutils/radmind/files/pkg-message.in @@ -0,0 +1,16 @@ +#################### + +Important Note: +The radmind daemon now runs as user "%%RADMINUSER%%" +by default. +If you have installed an older version of +the radmind port you may need to chown +%%RADMIND_BASE_DIR%% appropriately. + + +You may restore the previous behavior by +setting + radmind_user="root" +in /etc/rc.conf + +#################### diff --git a/sysutils/radmind/files/radmind.sh.in b/sysutils/radmind/files/radmind.sh.in index 1ad10a6ec7fb..97b889f26cfc 100644 --- a/sysutils/radmind/files/radmind.sh.in +++ b/sysutils/radmind/files/radmind.sh.in @@ -12,8 +12,9 @@ # #radmind_enable="YES" # -# You may also override the default flags: +# You may also override the default daemon user & flags: # +#radmind_user="radmind" #radmind_flags="-D /var/radmind -m 5 -u 077 -Llocal7 -w 0" # # See radmind(8) for flags @@ -31,6 +32,7 @@ required_files=%%RADMIND_BASE_DIR%%/config # set defaults radmind_enable=${radmind_enable:-"NO"} +radmind_user=${radmind_user:-"radmind"} radmind_flags=${radmind_flags:-"-D %%RADMIND_BASE_DIR%% -m 5 -u 077 -Llocal7 -w 0"} load_rc_config ${name} diff --git a/sysutils/radmind/pkg-plist b/sysutils/radmind/pkg-plist index d0d25e14095a..c798185b3e04 100644 --- a/sysutils/radmind/pkg-plist +++ b/sysutils/radmind/pkg-plist @@ -19,6 +19,7 @@ sbin/radmind @exec mkdir -p -m 755 %%RADMIND_BASE_DIR%%/client @exec mkdir -p -m 755 %%RADMIND_BASE_DIR%%/preapply @exec mkdir -p -m 755 %%RADMIND_BASE_DIR%%/postapply +@exec chown -R radmind:radmind %%RADMIND_BASE_DIR%% @cwd / @dirrmtry %%RADMIND_BASE_DIR%%/transcript @dirrmtry %%RADMIND_BASE_DIR%%/tmp/transcript -- cgit v1.2.3