diff options
author | ache <ache@FreeBSD.org> | 2001-10-17 13:53:03 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2001-10-17 13:53:03 +0000 |
commit | 1238343b7de7ba0e702cd4ae6b4eb8bc68c8f6b9 (patch) | |
tree | bc2242f084ecf3a236638e824c7350971643e619 /security/drweb | |
parent | 7be13efa126cd185dff032b905282586c07e0b07 (diff) | |
download | FreeBSD-ports-1238343b7de7ba0e702cd4ae6b4eb8bc68c8f6b9.zip FreeBSD-ports-1238343b7de7ba0e702cd4ae6b4eb8bc68c8f6b9.tar.gz |
Add drweb:drweb automatically
Diffstat (limited to 'security/drweb')
-rw-r--r-- | security/drweb/scripts/post-install | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/security/drweb/scripts/post-install b/security/drweb/scripts/post-install index 796b644..eef1258 100644 --- a/security/drweb/scripts/post-install +++ b/security/drweb/scripts/post-install @@ -1,31 +1,41 @@ #!/bin/sh ex=0 -if ! id -u drweb > /dev/null 2>&1; then - echo "You need an account \"drweb\" to install this package." - echo "Please add it by hand (try \"man vipw\") and try again." - echo "" - echo "An example /etc/master.passwd entry is:" - echo "drweb:*:426:426::0:0:Dr.Web Scanner:/nonexistent:/sbin/nologin" - echo "" - ex=1 +USER=drweb +GROUP=${USER} +UID=426 +GID=${UID} + +if ! pw group show "${GROUP}" 2>/dev/null 1>&2; then + if pw groupadd ${GROUP} -g ${GID}; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + ex=1 + fi fi -if ! grep -q "^drweb:" /etc/group; then - echo "You need a group \"drweb\" to install this package." - echo "" - echo "An example /etc/group entry is:" - echo "drweb:*:426:" - echo "" - ex=1 + +if ! pw user show "${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 + echo "Added user \"${USER}\"." + else + echo "Adding user \"${USER}\" failed..." + ex=1 + fi fi + if ! grep -q "^!drweb" /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 - echo "You may also add this crontab entry to /etc/crontab" - echo "0 12 * * * ${BINOWN} ${PREFIX}/drweb/update/update.pl ${PREFIX}/drweb" - echo "" + if ! crontab -l -u root | grep -q drweb; then + echo "You may also add this crontab entry to /etc/crontab" + echo "0 12 * * * ${BINOWN} ${PREFIX}/drweb/update/update.pl ${PREFIX}/drweb" + echo "" + fi fi [ "$ex" = "1" ] && exit 1 install -dv -m 0755 -o drweb -g ${BINGRP} ${PREFIX}/drweb/run |