aboutsummaryrefslogtreecommitdiff
path: root/network/amavisd-new
diff options
context:
space:
mode:
authorRobby Workman <rworkman@slackbuilds.org>2021-07-15 23:33:02 -0500
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2021-07-17 09:50:24 +0700
commitb42e55f08c54615182b4bab08e36b8109811f968 (patch)
treefc41793e0cfd352765cc140411d567438bf3a656 /network/amavisd-new
parent7e74048754a841c68494115445900878ade60715 (diff)
network/amavisd-new: Create PIDDIR during init
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/amavisd-new')
-rw-r--r--network/amavisd-new/amavisd-new.SlackBuild16
-rw-r--r--network/amavisd-new/rc.amavisd-new8
2 files changed, 17 insertions, 7 deletions
diff --git a/network/amavisd-new/amavisd-new.SlackBuild b/network/amavisd-new/amavisd-new.SlackBuild
index 01f6b8cfba63c..e14c2c3403dd1 100644
--- a/network/amavisd-new/amavisd-new.SlackBuild
+++ b/network/amavisd-new/amavisd-new.SlackBuild
@@ -56,8 +56,8 @@ if ! grep -q ^amavis: /etc/passwd ; then
exit 1
fi
-USER=${USER:-amavis}
-GROUP=${GROUP:-amavis}
+AMAVIS_USER=${AMAVIS_USER:-amavis}
+AMAVIS_GROUP=${AMAVIS_GROUP:-amavis}
AMAVIS_HOME=${AMAVIS_HOME:-/var/lib/amavis}
QUARANTINE_DIR=${QUARANTINE_DIR:-$AMAVIS_HOME/quarantine}
@@ -84,8 +84,6 @@ done
### amavisd-new home directory
mkdir -p $PKG/$AMAVIS_HOME/{tmp,var,db,home}
-### amavisd-new runtime directory
-mkdir -p $PKG/var/run/amavis
### make and populate quarantine directory with subdirectories
### this is only useful if you wish to spread out
@@ -105,15 +103,19 @@ install -m 0755 amavis-mc amavis-services amavisd-agent \
install -m 0640 -D amavisd.conf $PKG/etc/amavisd.conf.new
# change permissions
-chown $USER:$GROUP $PKG/etc/amavisd.conf.new
-chown -R $USER:$GROUP $PKG/$AMAVIS_HOME $PKG/var/run/amavis $PKG/$QUARANTINE_DIR
-chmod -R 0770 $PKG/$AMAVIS_HOME $PKG/var/run/amavis $PKG/$QUARANTINE_DIR
+chown $AMAVIS_USER:$AMAVIS_GROUP $PKG/etc/amavisd.conf.new
+chown -R $AMAVIS_USER:$AMAVIS_GROUP $PKG/$AMAVIS_HOME $PKG/$QUARANTINE_DIR
+chmod -R 0770 $PKG/$AMAVIS_HOME $PKG/$QUARANTINE_DIR
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
### install rc script
install -m 0755 -D $CWD/rc.amavisd-new $PKG/etc/rc.d/rc.amavisd-new.new
+sed -i \
+ -e "s,@AMAVIS_USER@,$AMAVIS_USER,g" \
+ -e "s,@AMAVIS_GROUP@,$AMAVIS_GROUP,g" \
+ $PKG/etc/rc.d/rc.amavisd-new.new
### install logrotate script
install -D -m 0644 $CWD/amavisd-new.logrotate $PKG/etc/logrotate.d/amavisd-new.new
diff --git a/network/amavisd-new/rc.amavisd-new b/network/amavisd-new/rc.amavisd-new
index f7b7c37adca78..24b6610c8ffb6 100644
--- a/network/amavisd-new/rc.amavisd-new
+++ b/network/amavisd-new/rc.amavisd-new
@@ -22,6 +22,8 @@
MC_PID=/var/run/amavis/amavis-mc.pid
PID=/var/run/amavis/amavisd.pid
+AMAVIS_USER=@AMAVIS_USER@
+AMAVIS_GROUP=@AMAVIS_GROUP@
amavisd_signer_start() {
# start amavisd-signer
@@ -46,6 +48,9 @@ amavis_mc_start() {
/usr/sbin/amavis-mc -P $MC_PID
else
printf "Starting amavis-mc daemon\n"
+ mkdir -p $(dirname $MC_PID)
+ chown $AMAVIS_USER:$AMAVIS_GROUP $(dirname $MC_PID)
+ chmod 0770 $(dirname $MC_PID)
/usr/sbin/amavis-mc -P $MC_PID
fi
}
@@ -70,6 +75,9 @@ amavisd_start() {
/usr/sbin/amavisd start
else
printf "Starting amavisd-new daemon\n"
+ mkdir -p $(dirname $PID)
+ chown $AMAVIS_USER:$AMAVIS_GROUP $(dirname $PID)
+ chmod 0770 $(dirname $PID)
/usr/sbin/amavisd start
fi
}