aboutsummaryrefslogtreecommitdiff
path: root/security/samhain
diff options
context:
space:
mode:
authorSam Lawrance <lawrance@FreeBSD.org>2006-04-09 02:40:09 +0000
committerSam Lawrance <lawrance@FreeBSD.org>2006-04-09 02:40:09 +0000
commitf53abc50e89fcbedcb292caac82b7e9642ab9978 (patch)
tree420d2dd9b2f35c81e6e54e406042a5870c1fe731 /security/samhain
parente836dd5faa770e81abd17c43aa624988240eb893 (diff)
downloadports-f53abc50e89fcbedcb292caac82b7e9642ab9978.tar.gz
ports-f53abc50e89fcbedcb292caac82b7e9642ab9978.zip
When yule is installed, add the yule user and group as well. This is
especially useful for package users since they couldn't run the install-user target. PR: ports/90305 (based on) Submitted by: David Thiel <lx@redundancy.redundancy.org> (maintainer) Approved by: maintainer timeout on feedback (3 months) Committed from: Sydney Linux User Group codefest at UTS
Notes
Notes: svn path=/head/; revision=159184
Diffstat (limited to 'security/samhain')
-rw-r--r--security/samhain/Makefile11
-rw-r--r--security/samhain/files/pkg-install.in54
-rw-r--r--security/samhain/pkg-plist1
3 files changed, 63 insertions, 3 deletions
diff --git a/security/samhain/Makefile b/security/samhain/Makefile
index 2dd1fecb4853..61bac293bd7f 100644
--- a/security/samhain/Makefile
+++ b/security/samhain/Makefile
@@ -6,6 +6,7 @@
PORTNAME= samhain
PORTVERSION= 2.1.2
+PORTREVISION= 1
CATEGORIES= security
MASTER_SITES= http://la-samhna.de/archive/ \
http://cold.darkambient.net/
@@ -22,6 +23,8 @@ OPTIONS= KCHECK "Enable rogue KLD detection" off \
LIBWRAP "Enable TCP wrapper support" on \
PRELUDE "Enable Prelude Framework support" off
+SUB_FILES+= pkg-install
+
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}
CONFLICTS= samhain-client-2*
@@ -71,11 +74,13 @@ MAN5= samhainrc.5
MAN8= samhain.8
.elif defined(WITH_SERVER)
CONFIGURE_ARGS+= --enable-network=server
+SUB_LIST+= WITH_YULE="yes"
PLIST_SUB+= YULE="" SAMHAIN="@comment " SETPWD="@comment "
EXTRA_PATCHES+= ${FILESDIR}/fixyulerc.patch
MAN5= yulerc.5
MAN8= yule.8
.else
+SUB_LIST+= WITH_YULE=""
PLIST_SUB+= SAMHAIN="" YULE="@comment " SETPWD="@comment "
EXTRA_PATCHES+= ${FILESDIR}/fixsamhainrc.patch
MAN5= samhainrc.5
@@ -127,6 +132,9 @@ post-extract:
@${TAR} -C ${WRKDIR} -xzf ${WRKSRC}.tar.gz
@${RM} ${WRKSRC}.tar.gz ${WRKSRC}.tar.gz.asc
+pre-install:
+ @PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
+
post-install:
.if !defined(WITH_SERVER)
@${CP} ${WRKSRC}/init/samhain.startFreeBSD ${PREFIX}/etc/rc.d/samhain.sh.sample
@@ -152,7 +160,4 @@ post-install:
${INSTALL_MAN} ${WRKSRC}/docs/sh_userfiles.txt ${DOCSDIR}
.endif
-install-user:
- @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} install-user)
-
.include <bsd.port.post.mk>
diff --git a/security/samhain/files/pkg-install.in b/security/samhain/files/pkg-install.in
new file mode 100644
index 000000000000..d29d1bbb7d2b
--- /dev/null
+++ b/security/samhain/files/pkg-install.in
@@ -0,0 +1,54 @@
+#! /bin/sh
+
+# $FreeBSD$
+
+WITH_YULE="%%WITH_YULE%%"
+
+make_account() {
+ local u g gcos homeopt
+
+ u=$1
+ g=$2
+ gcos=$3
+ homeopt=${4:+"-d $4"}
+
+ if pw group show "${g}" >/dev/null 2>&1; then
+ echo "You already have a group \"${g}\", so I will use it."
+ else
+ if which -s pw; then
+ pw groupadd ${g} || exit
+ echo "Added group ${g}."
+ else
+ echo "Adding group ${g} failed. Please create it, and try again."
+ if ! grep -q "^${u}:" /etc/passwd; then
+ echo "While you're at it, please create a user \"${u}\" too,"
+ echo "with a default group of \"${g}\"."
+ fi
+ exit 1
+ fi
+ fi
+
+ if pw user show "${u}" >/dev/null 2>&1; then
+ echo "You already have a user \"${u}\", so I will use it."
+ else
+ if which -s pw; then
+ pw useradd ${u} -g ${g} -h - ${homeopt} \
+ -s /nonexistent -c "${gcos}" || exit
+ echo "Added user ${u}."
+ else
+ echo "Adding user ${u} failed. Please create it, and try again."
+ exit 1
+ fi
+ fi
+}
+
+case $2 in
+
+PRE-INSTALL)
+
+ if [ x${WITH_YULE} = xyes ]; then
+ make_account yule yule "yule" "/nonexistent"
+ fi
+
+ ;;
+esac
diff --git a/security/samhain/pkg-plist b/security/samhain/pkg-plist
index a152e8ff7cf3..f8decbf14f7d 100644
--- a/security/samhain/pkg-plist
+++ b/security/samhain/pkg-plist
@@ -4,6 +4,7 @@
%%YULE%%sbin/yule
%%YULE%%sbin/yulectl
%%YULE%%etc/rc.d/yule.sh.sample
+%%YULE%%@unexec echo To delete the yule user permanently, use 'pw userdel ${USER}'"
%%YULE%%@unexec rmdir /var/lib/yule 2>/dev/null || true
%%SAMHAIN%%sbin/samhain
%%SAMHAIN%%etc/rc.d/samhain.sh.sample