diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 2001-10-17 13:53:03 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 2001-10-17 13:53:03 +0000 |
commit | b5fc6c3a250d577f0c5a6539667b718c2bd19f52 (patch) | |
tree | bd187ee236716cdc73eba73253a8d1c74f2fe5be | |
parent | handle NOPORTDOCS (diff) |
Add drweb:drweb automatically
Notes
Notes:
svn path=/head/; revision=48869
-rw-r--r-- | security/drweb-sendmail/scripts/post-install | 38 | ||||
-rw-r--r-- | security/drweb/scripts/post-install | 46 |
2 files changed, 51 insertions, 33 deletions
diff --git a/security/drweb-sendmail/scripts/post-install b/security/drweb-sendmail/scripts/post-install index 7e0a5a7d02db..5d88802e161c 100644 --- a/security/drweb-sendmail/scripts/post-install +++ b/security/drweb-sendmail/scripts/post-install @@ -1,21 +1,29 @@ #!/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 + [ "$ex" = "1" ] && exit 1 exit 0 diff --git a/security/drweb/scripts/post-install b/security/drweb/scripts/post-install index 796b644ce5f3..eef1258c189b 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 |