Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates-src > by-pkgid > dda3144afa4876e950ce0f0e9db4263f > files > 7

mailman-2.1.29-1.mga6.src.rpm

%define uid     mail
%define gid     mail
%define email_version   2.5.8

Name:       mailman
Version:    2.1.29
Release:    %mkrel 1
Summary:    The GNU Mailing List Management System
Group:      System/Servers
License:    GPLv2+
URL:        http://www.list.org/
Source0:    http://ftp.gnu.org/gnu/mailman/%{name}-%{version}.tgz
Source1:    README.install.urpmi
Source2:    %{name}.service
Patch0:     %{name}-buildroot-check.patch
Patch1:     %{name}-2.1.12-rename-arch.patch
Patch9:     %{name}-2.1.11-change-default-icons-url.patch
Requires:   mail-server
Requires:   apache
# for /bin/crontab:
Requires(post):  cronie
Requires(post):  rpm-helper
Requires(preun): rpm-helper
BuildRequires:  python
BuildRequires:  python-devel
BuildRequires:  python-dnspython
Requires:       python-GnuPG-Interface
Requires:       gnupg
Requires:       openssl

%description
Mailman -- The GNU Mailing List Management System --
is a mailing list management system written mostly in
Python. Features:

  o Most standard mailing list features, including:
     moderation, mail based commands, digests, etc...
  o An extensive Web interface, customizable on a per-list basis.
  o Web based list administration interface for *all* admin-type tasks
  o Automatic Web based hypermail-style archives (using pipermail or
    other external archiver), including provisions for private archives
  o Integrated mail list to newsgroup gatewaying
  o Integrated newsgroup to mail list gatewaying (polling-based... if you
     have access to the nntp server, you should be able to easily do
     non-polling based news->mail list gatewaying; email viega@list.org,
     I'd like to help get that going and come up
     with instructions)
  o Smart bounce detection and correction
  o Integrated fast bulk mailing
  o Smart spam protection
  o Extensible logging
  o Multiple list owners and moderators are possible
  o Optional MIME-compliant digests

%prep
%setup -q
%autopatch -p1
mv bin/arch bin/rebuildarch

%build
%serverbuild
# As a normal user, we don't have permissions to do this.  %patch0 changes
#   configure so that the directory check will never fail.
autoreconf
./configure \
    --prefix=%{_libdir}/%{name} \
    --with-var-prefix=%{_var}/lib/%{name} \
    --with-mail-gid=%{gid} \
    --with-cgi-gid=apache \
    --with-username=%{uid} \
    --with-groupname=%{gid} \
    --without-permcheck \
    --with-cgi-ext=.cgi \
    --libdir=%{_libdir}

make
# fix encoding typo
perl -pi -e 's/gb2132/gb2312/' misc/email-2.5.6/email/Charset.py

%install
%makeinstall_std

# apache conf
install -d -m 755 %{buildroot}%{_webappconfdir}
cat > %{buildroot}%{_webappconfdir}/%{name}.conf <<EOF
# Mailman Apache configuration file
Alias /%{name}/icons %{_libdir}/%{name}/icons

<IfModule alias_module>
    ScriptAlias /%{name}       %{_libdir}/%{name}/cgi-bin
</IfModule>

Alias /pipermail     %{_var}/lib/%{name}/archives/public


<Directory %{_libdir}/%{name}/cgi-bin>
    Require all granted
    Options ExecCGI
    DirectoryIndex listinfo.cgi
</Directory>

<Directory %{_libdir}/%{name}/icons>
    Require all granted
</Directory>

<Directory %{_var}/lib/mailman/archives/public>
    Require all granted
    Options FollowSymlinks
</Directory>
EOF

# systemd service
install -d -m 755 %{buildroot}%{_unitdir}
install -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/mailman.service
sed -i "s|/usr/lib|%{_libdir}|g" %{buildroot}%{_unitdir}/mailman.service

# move logs directory into /var/log
install -d -m 755 %{buildroot}%{_var}/log
mv %{buildroot}%{_var}/lib/%{name}/logs %{buildroot}%{_var}/log/%{name}
(cd %{buildroot}%{_var}/lib/%{name} && ln -s ../../log/%{name} logs)

# move config file into /etc
install -d -m 755 %{buildroot}%{_sysconfdir}
mv %{buildroot}%{_libdir}/%{name}/Mailman/mm_cfg.py %{buildroot}%{_sysconfdir}/%{name}
(cd %{buildroot}%{_libdir}/%{name}/Mailman && ln -s ../../../..%{_sysconfdir}/%{name} mm_cfg.py)
rm -f %{buildroot}%{_libdir}/%{name}/Mailman/mm_cfg.py.dist

# fix permissions mess - apache (group owner) must be able to write new lists
chmod -R go=u-ws %{buildroot}%{_libdir}/%{name}
chmod 770 %{buildroot}%{_var}/lib/%{name}/archives/private

# logrotate
install -d m 755 %{buildroot}%{_sysconfdir}/logrotate.d
cat > %{buildroot}%{_sysconfdir}/logrotate.d/%{name} <<EOF
# daily rotated log files
%{_var}/log/mailman/smtp-failure %{_var}/log/mailman/smtp %{_var}/log/mailman/locks %{_var}/log/mailman/fromusenet %{_var}/log/mailman/qrunner {
    daily
    missingok
    rotate 7
    sharedscripts
    postrotate
    [ -f '/var/run/mailman/mailman.pid' ] && %{_libdir}/mailman/bin/mailmanctl -q reopen || exit 0
    endscript
}

# weekly rotated log files
%{_var}/log/mailman/bounce %{_var}/log/mailman/error %{_var}/log/mailman/vette %{_var}/log/mailman/mischief {
    weekly
    missingok
    rotate 4
    sharedscripts
    postrotate
    [ -f '/var/run/mailman/mailman.pid' ] && %{_libdir}/mailman/bin/mailmanctl -q reopen || exit 0
    endscript
}

# monthly rotated log files
%{_var}/log/mailman/digest %{_var}/log/mailman/subscribe %{_var}/log/mailman/post {
    monthly
    missingok
    rotate 12
    sharedscripts
    postrotate
    [ -f '/var/run/mailman/mailman.pid' ] && %{_libdir}/mailman/bin/mailmanctl -q reopen || exit 0
    endscript
}
EOF

# binaries symlinks from /usr/sbin
install -d -m 755 %{buildroot}%{_sbindir}
pushd %{buildroot}%{_sbindir}
for bin in ../..%{_libdir}/%{name}/bin/*; do
    ln -s $bin .
done
popd

install -m644 %{SOURCE1} README.install.urpmi

%pre
if [ $1 = "2" ]; then
  if [ ! -L %{_libdir}/%{name}/Mailman/mm_cfg.py ]; then
    mv %{_libdir}/%{name}/Mailman/mm_cfg.py %{_sysconfdir}/%{name}.tmp
  fi
  if [ ! -L %{_var}/lib/%{name}/logs ]; then
    mv %{_var}/lib/%{name}/logs %{_var}/log/%{name}
  fi
fi

%post
%_post_service %{name}

cd %{_libdir}/%{name}

if [ $1 = 1 ] && [ -z "$DURING_INSTALL" ]; then
    # installation

    # generic tasks
    hostname=`hostname`
    domainname=`dnsdomainname`

    if [ -z "$domainname" ]; then
        domainname=localdomain
        # Add fqdn related items to allow installation to complete without error
        # when a fqdn has not been set. This will also permit the creation of the
        # required mailman site list to complete and the mailman service to then
        # start.
        properfqdn=false
    fi
    fqdn=$hostname.$domainname

    # mailman basic configuration
    cat >>Mailman/mm_cfg.py <<EOF
DEFAULT_EMAIL_HOST = '$domainname'
DEFAULT_URL_HOST = '$hostname'
add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
#VIRTUAL_HOST_OVERVIEW=Off
EOF

    # make sure mail user is allowed to use cron
    if [ -f %{_sysconfdir}/cron.allow ]; then
        if ! grep -q %{uid} %{_sysconfdir}/cron.allow; then
            echo "%{uid}" >> %{_sysconfdir}/cron.allow
        fi
    fi

    # add cron task
    crontab -u %{uid} %{_libdir}/%{name}/cron/crontab.in

    # add aliases
    %create_ghostfile %{_var}/lib/%{name}/data/aliases %{uid} %{gid} 660
    mta="`readlink /etc/alternatives/sendmail-command 2>/dev/null | cut -d . -f 2`"
    if [ "$mta" == "postfix" ]; then
        cat >>Mailman/mm_cfg.py <<EOF
MTA = 'Postfix'
EOF
        maps=`/usr/sbin/postconf -h alias_maps`
        postconf -e \
            "recipient_delimiter = +" \
            "unknown_local_recipient_reject_code = 550" \
            "alias_maps = $maps, hash:%{_var}/lib/%{name}/data/aliases"
        /usr/sbin/postalias %{_var}/lib/%{name}/data/aliases
    else
        cat >> %{_sysconfdir}/aliases <<EOF
:include:   %{_var}/lib/%{name}/data/aliases
EOF
        /usr/bin/newaliases
    fi

    # generate random password
    passwd=%_get_password 8

    # site password
    %{_sbindir}/mmsitepass $passwd > /dev/null

    if [ ! -f /var/lib/mailman/lists/mailman/config.pck ]; then
        # initial list creation and configuration
        if [ "$properfqdn" = "false" ]; then
            su %{uid} \
                -c "%{_sbindir}/newlist -a mailman@$fqdn root@$fqdn $passwd" > /dev/null
        else
            su %{uid} \
                -c "%{_sbindir}/newlist mailman root@$hostname $passwd" > /dev/null
        fi
        su %{uid} \
            -c "%{_sbindir}/config_list -i /var/lib/mailman/data/sitelist.cfg mailman"
    fi

else
    # upgrade
    if [ -f %{_sysconfdir}/%{name}.tmp ]; then
        mv -f %{_sysconfdir}/%{name}.tmp %{_sysconfdir}/%{name}
    fi
fi

%preun
%_preun_service %{name}

%postun
if [ $1 = 0 ]; then
    # generic tasks

    # remove cron task and the now empty file in cron.d
    crontab -u %{uid} -r
    rm -f /etc/cron.d/mailman

    # remove aliases
    mta="`readlink /etc/alternatives/sendmail-command 2>/dev/null | cut -d . -f 2`"
    if [ "$mta" == "postfix" ]; then
        database=`/usr/sbin/postconf -h alias_database | \
            sed -e 's|, hash:%{_var}/lib/%{name}/data/aliases||'`
        maps=`/usr/sbin/postconf -h alias_maps | \
            sed -e 's|, hash:%{_var}/lib/%{name}/data/aliases||'`
        postconf -e \
            "alias_database = $database" \
            "alias_maps = $maps"
    else
        sed -i -e '/:include:   %{_var}/lib/%{name}/data/aliases/d' \
            %{_sysconfdir}/aliases
    fi
    /usr/bin/newaliases

    # remove other remaining associated files
    rm -fR %{_libdir}/%{name}
    rm -fR %{_var}/log/%{name}
fi

%files
%doc ACKNOWLEDGMENTS BUGS FAQ INSTALL NEWS* README* TODO* UPGRADING
%doc gnu-COPYING-GPL contrib/README.check_perms_grsecurity
%doc doc/*
%doc README.install.urpmi
# constant files
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/cron
%{_libdir}/%{name}/pythonlib
%{_libdir}/%{name}/scripts
%{_libdir}/%{name}/tests
%{_libdir}/%{name}/messages
%{_libdir}/%{name}/templates
%{_libdir}/%{name}/bin
%{_libdir}/%{name}/Mailman
%{_libdir}/%{name}/icons
%dir %{_libdir}/%{name}/mail
%attr(2755,root,%{gid}) %{_libdir}/%{name}/mail/*
%dir %{_libdir}/%{name}/cgi-bin
%attr(2755,root,%{gid}) %{_libdir}/%{name}/cgi-bin/*
# variable files
%attr(-,%{uid},%{gid}) %{_var}/lib/%{name}
%attr(-,%{uid},apache) %{_var}/lib/%{name}/archives/private
%attr(-,%{uid},%{gid}) %{_var}/log/%{name}
# configuration files
%{_unitdir}/%{name}.service
%config(noreplace) %{_webappconfdir}/%{name}.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/%{name}
%{_sbindir}/*


%changelog
* Thu Aug 09 2018 mrambo3501 <mrambo3501> 2.1.29-1.mga6
  (not released yet)
+ Revision: 1250701
- version 2.1.29 fixes CVE-2018-13796 (mga#23409)
- version 2.1.27 fixes CVE-2018-0618 (mga#23256)
- deleted patch 6 which no longer applies
- deleted patch 10 applied upstream
- add debian patch which fixes CVE-2018-5950 mga#22550

* Wed Jan 25 2017 mrambo3501 <mrambo3501> 2.1.23-2.mga6
+ Revision: 1083439
- fix permissions to allow apache to create a new mail list
- fix buildroot-check.patch to patch the correct file
- fix post installation scriptlet error when a fqdn was not set
- make sure the required admin list is created even without a fqdn
- move user instructions from spec to README.install.urpmi
- make sure straggling installation files are removed upon uninstall

* Fri Sep 16 2016 luigiwalser <luigiwalser> 2.1.23-1.mga6
+ Revision: 1053456
- 2.1.23
- fix license tag
- rediff and regenerate patches
- use spec to rename arch command to rebuildarch

* Tue Feb 09 2016 umeabot <umeabot> 2.1.20-4.mga6
+ Revision: 952708
- Mageia 6 Mass Rebuild

* Mon Feb 01 2016 umeabot <umeabot> 2.1.20-3.mga6
+ Revision: 930503
- Mageia 6 Mass Rebuild

* Sat May 09 2015 spuhler <spuhler> 2.1.20-2.mga5
+ Revision: 821563
- changed Alias /%%{name}  to ScriptAlias /%%{name}
- added comments in the README.mga file
  * This will allow for the cgi-bin scripts to run and provide the WEB interface.

* Tue May 05 2015 spuhler <spuhler> 2.1.20-1.mga5
+ Revision: 821276
- upgrade to version 2.1.20
- removed mailman-2.1.15-CVE-2015-2775.patch
  * it's included in 2.1.20
- removed mailman-2.1.5-build.patch
  * it's done differently in 2.1.20

* Thu Apr 09 2015 luigiwalser <luigiwalser> 2.1.15-8.mga5
+ Revision: 820026
- add patch from debian to fix CVE-2015-2775

* Wed Oct 15 2014 umeabot <umeabot> 2.1.15-7.mga5
+ Revision: 740131
- Second Mageia 5 Mass Rebuild

* Tue Sep 16 2014 umeabot <umeabot> 2.1.15-6.mga5
+ Revision: 682136
- Mageia 5 Mass Rebuild
+ guillomovitch <guillomovitch>
- do not run %%post during installation (fix #9267)

* Fri Oct 18 2013 umeabot <umeabot> 2.1.15-4.mga4
+ Revision: 507710
- Mageia 4 Mass Rebuild
+ tv <tv>
- requires(post) cronie for /bin/crontab

* Sat Jan 12 2013 umeabot <umeabot> 2.1.15-3.mga3
+ Revision: 359315
- Mass Rebuild - https://wiki.mageia.org/en/Feature:Mageia3MassRebuild

* Sun Dec 23 2012 remmy <remmy> 2.1.15-2.mga3
+ Revision: 334261
- The systemd unit file as shipped would not work for several reasons:
- mailman-update-cfg was called which is not shipped by us;
- ownership of logfiles was set to mailman instead of mail;
- on x86_64 it referred to /usr/lib instead of /usr/lib64
  This should close mga#8067

* Sat Sep 08 2012 guillomovitch <guillomovitch> 2.1.15-1.mga3
+ Revision: 290472
- new version
- drop s/mime patch, too much invasive
- drop sysinit support

* Tue May 08 2012 pterjan <pterjan> 2.1.13-9.mga2
+ Revision: 234919
- Fix initscript's LSB header

* Sat Apr 28 2012 tmb <tmb> 2.1.13-8.mga2
+ Revision: 233774
- Require rpm-helper >= 0.24.8-1 for systemd support

* Tue Mar 13 2012 guillomovitch <guillomovitch> 2.1.13-7.mga2
+ Revision: 223243
- systemd support

* Sun Mar 06 2011 ennael <ennael> 2.1.13-6.mga1
+ Revision: 65702
- clean spec file
- imported package mailman