aboutsummaryrefslogtreecommitdiff
path: root/network
diff options
context:
space:
mode:
authorRobby Workman <rworkman@slackbuilds.org>2021-07-18 21:22:57 -0500
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2021-07-19 16:23:33 +0700
commit3de874d2564d49bf95012400a0cdf402237b4710 (patch)
tree97e208e04e5ed5e8aa11d8608698c451a2a30608 /network
parent8679fda5afda338255385a3ed9ab6950943e1d50 (diff)
network/opendkim: Fixed piddir creation at init
This commit also stops using $USER within the build script; this should not be set during scripts. Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network')
-rw-r--r--network/opendkim/opendkim.SlackBuild7
-rw-r--r--network/opendkim/rc.opendkim9
2 files changed, 10 insertions, 6 deletions
diff --git a/network/opendkim/opendkim.SlackBuild b/network/opendkim/opendkim.SlackBuild
index 3661a69da93ea..04625cc3deae1 100644
--- a/network/opendkim/opendkim.SlackBuild
+++ b/network/opendkim/opendkim.SlackBuild
@@ -143,10 +143,11 @@ mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a FEATURES INSTALL KNOWNBUGS LICENSE* README* RELEASE_NOTES* $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
-mkdir -p $PKG/var/run/opendkim
-chown $USER:$GROUP $PKG/var/run/opendkim/
+mkdir -p $PKG/etc/rc.d
install -m 0640 -D $PRGNAM/opendkim.conf.simple $PKG/etc/opendkim.conf.new
-install -m 0755 -D $CWD/rc.opendkim $PKG/etc/rc.d/rc.opendkim.new
+sed -e "s,@DKUSER@,$DKUSER,g" -e "s,@DKGROUP@,$DKGROUP,g" \
+ $CWD/rc.opendkim > $PKG/etc/rc.d/rc.opendkim.new
+chmod 0755 $PKG/etc/rc.d/rc.opendkim.new
# Change KeyFile to match rc.opendkim
sed -i 's|^KeyFile.*|KeyFile /etc/opendkim/keys/default.private|' $PKG/etc/opendkim.conf.new
diff --git a/network/opendkim/rc.opendkim b/network/opendkim/rc.opendkim
index 23170a16e6926..ef6e1a6ff5de3 100644
--- a/network/opendkim/rc.opendkim
+++ b/network/opendkim/rc.opendkim
@@ -6,7 +6,8 @@
# Modified from the script by Steve Jenkins (SteveJenkins.com) - 10-29-2012
# Based on a script by Andrew Colin Kissa (TopDog) for dkim-milter - 05-28-2009
-USER="opendkim"
+DKUSER="@DKUSER@"
+DKGROUP="@DKGROUP@"
PROGRAM=/usr/sbin/opendkim
CONF_FILE=/etc/opendkim.conf
PID_FILE=/var/run/opendkim/opendkim.pid
@@ -23,8 +24,8 @@ do_dkim_keygen() {
else
mkdir -p $DKIM_KEYDIR
$KEYGEN -b 2048 -D $DKIM_KEYDIR -s $DKIM_SELECTOR -d "$(hostname -d)"
- chown root:$USER $DKIM_KEYDIR
- chown $USER:$USER $DKIM_KEYDIR/$DKIM_SELECTOR.{private,txt}
+ chown root:$DK_USER $DKIM_KEYDIR
+ chown $DKUSER:$DKGROUP $DKIM_KEYDIR/$DKIM_SELECTOR.{private,txt}
chmod 600 $DKIM_KEYDIR/$DKIM_SELECTOR.private
chmod 644 $DKIM_KEYDIR/$DKIM_SELECTOR.txt
echo
@@ -47,6 +48,8 @@ case "$1" in
echo OpenDKIM already running as pid "$PID"
exit 2;
else
+ mkdir -p $(dirname $PID_FILE)
+ chown $DKUSER:$DKGROUP $(dirname $PID_FILE)
$PROGRAM -l -x $CONF_FILE -P $PID_FILE
fi
;;