diff options
author | Valery Kartel <valery.kartel@gmail.com> | 2015-12-07 18:32:08 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2015-12-08 14:26:59 +0000 |
commit | bedaab5b374d5c54a91e2ce7bf50b95e1dd09183 (patch) | |
tree | 1f28e81c5300fa6aece604d1df712e06dcb27cb8 /main/clamav/clamd.initd | |
parent | 42203a737e081c24bcac87b07346da59893f9968 (diff) | |
download | aports-bedaab5b374d5c54a91e2ce7bf50b95e1dd09183.tar.bz2 aports-bedaab5b374d5c54a91e2ce7bf50b95e1dd09183.tar.xz |
main/clamav: upgrade to 0.99. Minor fixes in APKBUILD, init and logrotate scripts (second release)
Diffstat (limited to 'main/clamav/clamd.initd')
-rwxr-xr-x | main/clamav/clamd.initd | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/main/clamav/clamd.initd b/main/clamav/clamd.initd index 37e29ecd0e..35e6aaf6c9 100755 --- a/main/clamav/clamd.initd +++ b/main/clamav/clamd.initd @@ -1,22 +1,37 @@ #!/sbin/openrc-run -extra_started_commands="reload" -extra_commands="logfix" - NAME=clamd CONF=/etc/clamav/clamd.conf +pidfile=/run/clamav/clamd.pid +command=/usr/sbin/clamd +extra_started_commands="reload" +extra_commands="logfix" +required_files=$CONF + depend() { need net after firewall provide antivirus } +start_pre() { + # fix clamd run permissions + local pid=`awk '$1 == "PidFile" { print $2 }' $CONF` + [ "x$pid" != "x" ] && pidfile=$pid + local socket=`awk '$1 == "LocalSocket" { print $2 }' $CONF` + local socketdir=${socket%/*} + local clamav_user=`awk '$1 == "User" { print $2 }' $CONF` + checkpath --directory --owner -m 750 ${clamav_user:-clamav} \ + ${pidfile%/*} + checkpath --directory --owner -m 750 ${clamav_user:-clamav} \ + ${socketdir:-/run/clamav} +} + start() { local clamd_socket=$(awk '$1 == "LocalSocket" { print $2 }' $CONF) logfix - socketfix if [ -S "${clamd_socket:=/tmp/clamd}" ]; then rm -f ${clamd_socket} @@ -44,24 +59,13 @@ start() { ebegin "Starting ${NAME}" start-stop-daemon --start --quiet \ --nicelevel ${CLAMD_NICELEVEL:-0} \ - --exec /usr/sbin/clamd + --exec $command eend $? "Failed to start ${NAME}" } -stop() { - ebegin "Stopping ${NAME}" - start-stop-daemon --stop --quiet --exec /usr/sbin/clamd - eend $? -} - reload() { - ebegin "Reloading ${NAME}" - if ! service_started "${NAME}" ; then - eend 1 "${NAME} is not started" - return 1 - fi - start-stop-daemon --stop --signal HUP \ - --exec /usr/sbin/clamd + ebegin "Reloading ${SVCNAME}" + start-stop-daemon --signal HUP --pidfile $pidfile --name $SVCNAME eend $? } @@ -78,14 +82,3 @@ logfix() { chmod 640 ${logfile} fi } - -socketfix() { - # fix clamd run permissions - local socket=`awk '$1 == "LocalSocket" { print $2 }' $CONF` - local socketdir=${socket%/*} - local clamav_user=`awk '$1 == "User" { print $2 }' $CONF` - checkpath --directory --owner ${clamav_user:-clamav} \ - ${socketdir:-/var/run/clamav} -} - - |