mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-24 00:45:52 +00:00
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
This commit is contained in:
parent
e836dd5faa
commit
f53abc50e8
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=159184
@ -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>
|
||||
|
54
security/samhain/files/pkg-install.in
Normal file
54
security/samhain/files/pkg-install.in
Normal file
@ -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
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user