Move user creation/deletion to pkg-*install
This commit is contained in:
parent
61b690d4e1
commit
3279aeae0f
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=48933
@ -7,7 +7,7 @@
|
||||
|
||||
PORTNAME= drweb
|
||||
PORTVERSION= 4.26
|
||||
PORTREVISION= 5
|
||||
PORTREVISION= 6
|
||||
CATEGORIES= security
|
||||
MASTER_SITES= http://www.drweb.ru/ftp/web_pub/
|
||||
DISTNAME= ${PORTNAME}d-${PORTVERSION}-freebsd4
|
||||
@ -20,8 +20,6 @@ NO_BUILD= YES
|
||||
# Needed for update.pl
|
||||
RUN_DEPENDS= ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/String/CRC32.pm:${PORTSDIR}/devel/p5-String-CRC32
|
||||
|
||||
SCRIPTS_ENV+= BINOWN=${BINOWN} BINGRP=${BINGRP}
|
||||
|
||||
DRWEB_PREFIX= ${PREFIX}/${PORTNAME}
|
||||
|
||||
do-install:
|
||||
@ -57,4 +55,7 @@ do-install:
|
||||
cd ${DRWEB_PREFIX}/update; \
|
||||
${PATCH} -s < ${FILESDIR}/update-patch && ${RM} update.pl.orig
|
||||
|
||||
post-install:
|
||||
PKG_PREFIX=${PREFIX} ./pkg-install ${PKGNAME} POST-INSTALL
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
22
security/drweb/pkg-deinstall
Normal file
22
security/drweb/pkg-deinstall
Normal file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
if [ "$2" != "POST-DEINSTALL" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
USER=drweb
|
||||
ex=0
|
||||
|
||||
if pw usershow "${USER}" 2>/dev/null 1>&2; then
|
||||
if pw userdel ${USER}; then
|
||||
echo "Delete user/group \"${USER}\"."
|
||||
else
|
||||
echo "Deleting user/group \"${USER}\" failed..."
|
||||
ex=1
|
||||
fi
|
||||
fi
|
||||
|
||||
[ "$ex" = "1" ] && exit 1
|
||||
exit 0
|
@ -1,11 +1,20 @@
|
||||
#!/bin/sh
|
||||
ex=0
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
if [ "$2" != "POST-INSTALL" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
USER=drweb
|
||||
GROUP=${USER}
|
||||
UID=426
|
||||
GID=${UID}
|
||||
BINOWN=root
|
||||
BINGRP=wheel
|
||||
ex=0
|
||||
|
||||
if ! pw group show "${GROUP}" 2>/dev/null 1>&2; then
|
||||
if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then
|
||||
if pw groupadd ${GROUP} -g ${GID}; then
|
||||
echo "Added group \"${GROUP}\"."
|
||||
else
|
||||
@ -14,7 +23,7 @@ if ! pw group show "${GROUP}" 2>/dev/null 1>&2; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! pw user show "${USER}" 2>/dev/null 1>&2; then
|
||||
if ! pw usershow "${USER}" 2>/dev/null 1>&2; then
|
||||
if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
|
||||
-s "/sbin/nologin" -d "/nonexistent" -c "Dr. Web Scanner"
|
||||
then
|
||||
@ -25,19 +34,19 @@ if ! pw user show "${USER}" 2>/dev/null 1>&2; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! grep -q "^!drweb" /etc/syslog.conf; then
|
||||
if ! grep -q "^!${USER}" /etc/syslog.conf; then
|
||||
echo "You may also add this lines to your /etc/syslog.conf:"
|
||||
echo "*.* /var/log/drwebd.log"
|
||||
echo ""
|
||||
fi
|
||||
if ! grep -q drweb /etc/crontab; then
|
||||
if ! crontab -l -u root | grep -q drweb; then
|
||||
if ! grep -q ${USER} /etc/crontab; then
|
||||
if ! crontab -l -u ${BINOWN} | grep -q ${USER}; then
|
||||
echo "You may also add this crontab entry to /etc/crontab"
|
||||
echo "0 12 * * * ${BINOWN} ${PREFIX}/drweb/update/update.pl ${PREFIX}/drweb"
|
||||
echo "0 12 * * * ${BINOWN} ${PKG_PREFIX}/drweb/update/update.pl ${PKG_PREFIX}/drweb"
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
[ "$ex" = "1" ] && exit 1
|
||||
install -dv -m 0755 -o drweb -g ${BINGRP} ${PREFIX}/drweb/run
|
||||
install -dv -m 0700 -o drweb -g ${BINGRP} ${PREFIX}/drweb/infected.!!!
|
||||
install -dv -m 0755 -o ${USER} -g ${BINGRP} ${PKG_PREFIX}/drweb/run
|
||||
install -dv -m 0700 -o ${USER} -g ${BINGRP} ${PKG_PREFIX}/drweb/infected.!!!
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user