migrate from sysv5 to systemd service [release 2.1.39-2mamba;Wed Sep 20 2023]

This commit is contained in:
Silvan Calarco 2024-01-06 06:41:58 +01:00
parent 1ee0bb150a
commit 98c526271e
3 changed files with 49 additions and 94 deletions

View File

@ -1,66 +0,0 @@
#!/bin/sh
#
# mailman This shell script starts and stops GNU Mailman.
#
# Copyright (C) 2001-2003 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Copy this file to /etc/init.d/ (or /etc/rc.d/init.d/ depending on
# your system) and activate it as such:
#
# On Debian, type "update-rc.d mailman defaults"
# On RedHat, and derivatives, install with "chkconfig --add mailman"
#
# chkconfig: 2345 98 12
# description: Mailman is the GNU Mailing List Manager, a program that \
# manages electronic mail discussion groups. For more \
# on GNU Mailman see http://www.list.org
# processname: mailmanctl
# config: /usr/share/mailman/Mailman/mm_cfg.py
# pidfile: /var/mailman/data/master-qrunner.pid
PYTHON=/usr/bin/python
MAILMANHOME=/usr/share/mailman
MAILMANCTL=$MAILMANHOME/bin/mailmanctl
. /etc/sysconfig/rc
. $rc_functions
case "$1" in
'start')
#rm -f $MAILMANHOME/locks/*
echo -n "Starting mailman: "
$PYTHON $MAILMANCTL -s -q start &>/dev/null
evaluate_retval
echo
;;
'stop')
echo -n "Stopping mailman: "
$PYTHON $MAILMANCTL -q stop
evaluate_retval
echo
;;
'restart')
echo -n "Restarting mailman: "
$PYTHON $MAILMANCTL -q restart
evaluate_retval
echo
;;
esac
exit 0

16
mailman.service Normal file
View File

@ -0,0 +1,16 @@
[Unit]
Description=GNU Mailing List Manager
After=network.target
[Service]
ExecStart=/usr/share/mailman/bin/mailmanctl -s start
ExecReload=/usr/share/mailman/bin/mailmanctl restart
ExecStop=/usr/share/mailman/bin/mailmanctl stop
Type=forking
ProtectSystem=full
ProtectHostname=true
MemoryDenyWriteExecute=yes
PrivateDevices=yes
[Install]
WantedBy=multi-user.target

View File

@ -4,20 +4,20 @@
%define pkgver %(echo %version | tr _ -)
Name: mailman
Version: 2.1.34
Release: 1mamba
Version: 2.1.39
Release: 2mamba
Summary: Free software for managing electronic mail discussion and e-newsletter lists
Group: System/Servers
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://mailman.sourceforge.net
URL: https://mailman.sourceforge.io/
Source0: http://downloads.sourceforge.net/sourceforge/mailman/mailman-%{pkgver}.tgz
Source1: %{name}-update_aliases.sh
Source2: %{name}-cron
Source3: %{name}-update_aliases_vmailmgr.sh
Source4: %{name}-apache.conf
Source5: %{name}-initscript
Source5: mailman.service
Patch0: %{name}-2.1.9-fix_buildroot.patch
Patch1: %{name}-2.1.10-template_it_antispam_fix.patch
Patch2: %{name}-2.1.10-cmd_subscribe_fixsyntax.patch
@ -27,14 +27,14 @@ License: GPL
BuildRequires: glibc-devel
## AUTOBUILDREQ-END
BuildRequires: expect
BuildRequires: libpython-devel
BuildRequires: python
BuildRequires: libpython27-devel
BuildRequires: python27
BuildRequires: python-dnspython-py27
Requires(pre): expect >= 8.4.5
Requires: python >= 2.2.3
Requires: apache >= 2.0.45
Requires: vixie-cron >= 3.0.1
Requires: dnspython
Requires: python27 >= 2.7.18
#Requires: apache >= 2.0.45
#Requires: vixie-cron >= 3.0.1
Requires: python-dnspython-py27
Requires: mta
# FIXME: postfix integration is missing
@ -44,6 +44,8 @@ Mailman is free software for managing electronic mail discussion and e-newslette
Mailman is integrated with the web, making it easy for users to manage their accounts and for list owners to administer their lists.
Mailman supports built-in archiving, automatic bounce processing, content filtering, digest delivery, spam filters, and more.
%debug_package
%prep
%setup -q -n %{name}-%{pkgver}
#%patch0 -p1
@ -71,8 +73,8 @@ sed -i "s|/usr/bin/env|/bin/env|" bin/msgfmt.py tests/onebounce.py
--with-mailhost=localhost \
--with-urlhost=localhost \
--with-mail-uid=mailman \
--with-python=%{_bindir}/python \
PYTHON=%{__python}
--with-python=%{__python27} \
PYTHON=%{__python27}
%make
@ -88,7 +90,7 @@ sed -i "s|MAILMAN_USER = ''|MAILMAN_USER = 'mailman'|
install -D %{buildroot}%{_datadir}/mailman/cron/crontab.in \
%{buildroot}%{_sysconfdir}/cron.d/mailman
install -D -m 0755 %{S:5} \
%{buildroot}%{_initrddir}/mailman
%{buildroot}%{_unitdir}/mailman.service
install -m 0755 %{S:1} \
%{buildroot}%{_datadir}/mailman/bin/update_aliases.sh
install -m 0755 %{S:3} \
@ -111,7 +113,7 @@ if [ $1 -ge 1 ]; then
useradd -u %{mailman_uid} -g mailman -d /dev/null mailman \
-s /bin/false 2>/dev/null
fi
exit 0
:
%post
# new install
@ -145,32 +147,32 @@ Use %{_datadir}/mailman/bin/mmsitepass to set mailman administrator password."
}
}
fi
exit 0
%systemd_post mailman
:
%postun
# update
if [ $1 -eq 1 ]; then
/sbin/chkconfig mailman
[ $? -eq 0 ] && %{_initrddir}/mailman restart 2>/dev/null
fi
%systemd_postun_with_restart mailman
if [ $1 -eq 0 ]; then
[ -e /usr/sbin/postconf ] && postconf -e alias_database=hash:/etc/aliases
fi
exit 0
:
%preun
# erase
%systemd_preun mailman.service
if [ $1 -eq 0 ]; then
/sbin/chkconfig --del mailman
%{_initrddir}/mailman stop 2>/dev/null
userdel mailman 2>/dev/null
groupdel mailman 2>/dev/null
fi
exit 0
:
%files
%defattr(-,root,root)
%{_sysconfdir}/cron.d/mailman
%{_sysconfdir}/cron.daily/mailman
%config(noreplace) %{_sysconfdir}/httpd/httpd.d/mailman.conf
%{_unitdir}/mailman.service
%dir %attr(2775,root,root) %{_datadir}/mailman/
%attr(2775,root,mailman) %{_datadir}/mailman/bin/*
%attr(2775,root,mailman) %{_datadir}/mailman/cgi-bin/*
@ -184,9 +186,6 @@ exit 0
%attr(2775,root,mailman) %{_datadir}/mailman/tests/*
%config(noreplace) %{_datadir}/mailman/Mailman/Defaults.py
%config(noreplace) %{_datadir}/mailman/Mailman/mm_cfg.py
%attr(0755,root,root) %{_initrddir}/mailman
%{_sysconfdir}/cron.d/mailman
%{_sysconfdir}/cron.daily/mailman
%dir %attr(2775,root,mailman) /var/mailman
%dir %attr(2770,root,mailman) /var/mailman/archives/private
%dir %attr(2775,root,mailman) /var/mailman/archives/public
@ -202,6 +201,12 @@ exit 0
#%doc README ACKNOWLEDGMENTS FAQ BUGS README.* TODO UPGRADING NEWS
%changelog
* Wed Sep 20 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 2.1.39-2mamba
- migrate from sysv5 to systemd service
* Wed Sep 20 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 2.1.39-1mamba
- update to 2.1.39
* Fri Jul 17 2020 Automatic Build System <autodist@mambasoft.it> 2.1.34-1mamba
- automatic version update by autodist
@ -342,14 +347,14 @@ exit 0
* Wed Jun 30 2004 Silvan Calarco <silvan.calarco@mambasoft.it> 2.1.5-2qilnx
- fixed a /usr/bin/env dependency problem
* Thu May 28 2004 Davide Madrisan <davide.madrisan@qilinux.it> 2.1.5-1qilnx
* Fri May 28 2004 Davide Madrisan <davide.madrisan@qilinux.it> 2.1.5-1qilnx
- new version rebuild
* Wed May 26 2004 Davide Madrisan <davide.madrisan@qilinux.it> 2.1.4-5qilnx
- added security patch for remote password retrieval (CAN-2004-0412)
backported from mailman 2.1.5 by Mark J Cox <mjc@redhat.com>
* Tue May 13 2004 Silvan Calarco <silvan.calarco@mambasoft.it> 2.1.4-4qilnx
* Thu May 13 2004 Silvan Calarco <silvan.calarco@mambasoft.it> 2.1.4-4qilnx
- added update_aliases_vmailmgr.sh script for virtual domain aliases creation
* Mon May 10 2004 Silvan Calarco <silvan.calarco@mambasoft.it> 2.1.4-3qilnx