Merge pull request #68 from shawniverson/detectsystemd

Better systemd detection
This commit is contained in:
Shawn Iverson 2017-07-24 18:01:07 -04:00 committed by GitHub
commit def0800696
3 changed files with 11 additions and 5 deletions

View file

@ -148,7 +148,7 @@ if [ -f '/lib/systemd/system/mailscanner.service' ]; then
fi
# Check for systemd
if [ -d '/usr/lib/systemd' ]; then
if [ -f '/lib/systemd/systemd' -o -f '/usr/lib/systemd/systemd' ]; then
cp /usr/lib/MailScanner/systemd/ms-systemd /lib/systemd/system/mailscanner.service
# add symlink to init script
elif [ ! -L '/etc/init.d/mailscanner' ]; then
@ -269,7 +269,7 @@ if [ -f '/etc/clamav/clamd.conf' ]; then
sed -i "s/${CAVOLD}/${CAVNEW}/g" /etc/clamav/clamd.conf
fi
if [ -d '/usr/lib/systemd' ]; then
if [ -f '/lib/systemd/systemd' -o -f '/usr/lib/systemd/systemd' ]; then
systemctl enable mailscanner.service
else
update-rc.d mailscanner defaults 80 80

View file

@ -525,7 +525,7 @@ if [ -d '/usr/share/MailScanner/reports' -a ! -L '/etc/MailScanner/reports' ]; t
fi
# RHEL/CentOS7/Fedora >14
if [ -d '/usr/lib/systemd' ]; then
if [ -f '/lib/systemd/systemd' -o -f '/usr/lib/systemd/systemd' ]; then
# copy in systemd wrapper and sendmail services
if [ -d '/usr/lib/systemd/system' -a ! -e '/usr/lib/systemd/system/mailscanner' -a -f '/usr/lib/MailScanner/systemd/ms-systemd' ]; then
cp /usr/lib/MailScanner/systemd/ms-systemd /usr/lib/systemd/system/mailscanner.service
@ -589,7 +589,7 @@ exit 0
%preun
if [ $1 = 0 ]; then
# We are being deleted, not upgraded
if [ -d '/usr/lib/systemd' ]; then
if [ -f '/lib/systemd/systemd' -o -f '/usr/lib/systemd/systemd' ]; then
systemctl stop mailscanner.service >/dev/null 2>&1
systemctl disable mailscanner.service
rm -f /usr/lib/systemd/system/mailscanner.service
@ -1171,6 +1171,9 @@ exit 0
%changelog
* Mon Jul 24 2017 Shawn Iverson <shawniverson@gmail.com>
- Better detection of systemd
* Wed May 3 2017 Shawn Iverson <shawniverson@gmail.com>
- Add RHEL/CentOS 7 systemd support for mailscanner and sendmail

View file

@ -509,7 +509,7 @@ if [ -d '/usr/share/MailScanner/reports' -a ! -L '/etc/MailScanner/reports' ]; t
fi
# Check for systemd
if [ -d '/usr/lib/systemd' -a -f '/usr/lib/MailScanner/systemd/ms-systemd' ]; then
if [ -f '/lib/systemd/systemd' -o -f '/usr/lib/systemd/systemd' ]; then
cp /usr/lib/MailScanner/systemd/ms-systemd /usr/lib/systemd/system/mailscanner.service
# create init.d symlink
elif [ -d '/etc/init.d' -a ! -L '/etc/init.d/mailscanner' -a -f '/usr/lib/MailScanner/init/ms-init' ]; then
@ -1104,6 +1104,9 @@ exit 0
%changelog
* Mon Jul 24 2017 Shawn Iverson <shawniverson@gmail.com>
- Better detection of systemd
* Sun May 28 2017 Shawn Iverson <shawniverson@gmail.com>
- mailscanner systemd support for SuSE Linux