summaryrefslogtreecommitdiff
path: root/system/clamav/clamav.SlackBuild
diff options
context:
space:
mode:
authorRobby Workman <rworkman@slackbuilds.org>2011-12-20 21:43:09 -0600
committerRobby Workman <rworkman@slackbuilds.org>2011-12-21 08:27:45 -0600
commit87a3c0e0e74763838460e9d8e47fcd8094da42eb (patch)
treeef52c8080e8957c29a6089a257c3aa6607a4efe7 /system/clamav/clamav.SlackBuild
parent026e465cdb115def3586a0c14ca06479407aea40 (diff)
downloadslackbuilds-87a3c0e0e74763838460e9d8e47fcd8094da42eb.tar.gz
system/clamav: Hardcode usage of "clamav" user and group
This makes things much simpler for other scripts that use / depend on clamav. Signed-off-by: Robby Workman <rworkman@slackbuilds.org> Signed-off-by: Matteo Bernardini <matteo.bernardini@gmail.com>
Diffstat (limited to 'system/clamav/clamav.SlackBuild')
-rw-r--r--system/clamav/clamav.SlackBuild32
1 files changed, 13 insertions, 19 deletions
diff --git a/system/clamav/clamav.SlackBuild b/system/clamav/clamav.SlackBuild
index bc9b1d3285..c2ea0df718 100644
--- a/system/clamav/clamav.SlackBuild
+++ b/system/clamav/clamav.SlackBuild
@@ -48,12 +48,6 @@ OUTPUT=${OUTPUT:-/tmp}
# See http://www.iana.org/cctld/cctld-whois.htm for options
COUNTRY=${COUNTRY:-us}
-# Read "README.SLACKWARE" for compatibility with amavisd-new
-CLAMUSR=${CLAMUSR:-clamav}
-CLAMGRP=${CLAMGRP:-clamav}
-CLAMUID=${CLAMUID:-210}
-CLAMGID=${CLAMGID:-210}
-
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
@@ -69,17 +63,17 @@ else
fi
bailout() {
- printf "\n You must have a ${CLAMGRP} group and ${CLAMUSR} user in order
- to run this script. Add them with something like this:
- groupadd -g ${CLAMGID} ${CLAMGRP}
- useradd -u ${CLAMUID} -d /dev/null -s /bin/false -g ${CLAMGRP} ${CLAMUSR}\n"
+ printf "\n You must have a \"clamav\" user and group in order to run this script.
+ Add them with something like this:
+ groupadd -g 210 clamav
+ useradd -u 210 -d /dev/null -s /bin/false -g clamav clamav\n"
exit 1
}
# Check for ClamAV user and group availability
-if ! grep ^${CLAMGRP}: /etc/group 2>&1 > /dev/null; then
+if ! getent group clamav 2>&1 > /dev/null; then
bailout ;
-elif ! grep ^${CLAMUSR}: /etc/passwd 2>&1 > /dev/null; then
+elif ! getent passwd clamav 2>&1 > /dev/null; then
bailout ;
fi
@@ -105,7 +99,7 @@ sed \
-e "s/^\#PidFile.*/PidFile \/var\/run\/clamav\/freshclam.pid/" \
-e "s/^\#UpdateLogFile.*/UpdateLogFile \/var\/log\/clamav\/freshclam.log/" \
-e "s/^\#AllowSupplementaryGroups.*/AllowSupplementaryGroups yes/" \
- -e "s/^\#DatabaseOwner.*/DatabaseOwner ${CLAMUSR}/" \
+ -e "s/^\#DatabaseOwner.*/DatabaseOwner clamav/" \
-e "s/^\#NotifyClamd.*/NotifyClamd \/etc\/clamd.conf/" \
-i etc/freshclam.conf
sed \
@@ -115,10 +109,10 @@ sed \
-e "s/^\#LogFile\ .*/LogFile \/var\/log\/clamav\/clamd.log/" \
-e "s/^\#PidFile.*/PidFile \/var\/run\/clamav\/clamd.pid/" \
-e "s/^\#LocalSocket\ .*/LocalSocket \/var\/run\/clamav\/clamd.socket/" \
- -e "s/^\#LocalSocketGroup.*/LocalSocketGroup ${CLAMGRP}/" \
+ -e "s/^\#LocalSocketGroup.*/LocalSocketGroup clamav/" \
-e "s/^\#LocalSocketMode/LocalSocketMode/" \
-e "s/^\#FixStaleSocket/FixStaleSocket/" \
- -e "s/^\#User.*/User ${CLAMUSR}/" \
+ -e "s/^\#User.*/User clamav/" \
-e "s/^\#AllowSupplementaryGroups.*/AllowSupplementaryGroups yes/" \
-e "s/^\#ExitOnOOM/ExitOnOOM/" \
-i etc/clamd.conf
@@ -131,8 +125,8 @@ CXXFLAGS="$SLKCFLAGS" \
--localstatedir=/var \
--sysconfdir=/etc \
--mandir=/usr/man \
- --with-user=${CLAMUSR} \
- --with-group=${CLAMGRP} \
+ --with-user=clamav \
+ --with-group=clamav \
--with-dbdir=/var/lib/clamav \
--enable-milter \
--enable-id-check \
@@ -155,7 +149,7 @@ install -D -m 0644 $CWD/logrotate.clamav $PKG/etc/logrotate.d/clamav
# Fixup some ownership and permissions issues
chown -R root:root $PKG
chmod -R o-w $PKG
-chown ${CLAMUSR} $PKG/usr/sbin/clamav-milter
+chown clamav $PKG/usr/sbin/clamav-milter
chmod 4700 $PKG/usr/sbin/clamav-milter
chmod 0770 $PKG/var/lib/clamav
chmod 0660 $PKG/var/lib/clamav/*
@@ -168,7 +162,7 @@ chmod 771 $PKG/var/{log,run}/clamav
touch $PKG/var/log/clamav/{clamd,freshclam}.log.new
chmod 660 $PKG/var/log/clamav/{clamd,freshclam}.log.new
-chown -R ${CLAMUSR}:${CLAMGRP} $PKG/var/{lib,log,run}/clamav
+chown -R clamav:clamav $PKG/var/{lib,log,run}/clamav
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true