summaryrefslogtreecommitdiff
path: root/config-parabola-base-mailman.PKGBUILD
blob: 84472a090a63a4305fcdb9bb83e375c61f507169 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -*- fill-column: 75 -*-
. ${BUILDFILE%/*}/common.sh
pkgver=20180918

package() {
preamble
pkgdesc="Parabola server configuration: Make Mailman 2 play nice with configuration management"

# #### mailman

depends=(mailman)

# The packager of the Mailman 2 package did a poor job, because they put
# the main configuration file in /usr/lib/ instead of /etc/.  They at least
# put in a /etc/mailman/mm_cfg.py → /usr/lib/mailman/Mailman/mm_cfg.py
# symlink so that at least you can find the file if you go looking around
# in /etc/.
#
# However, that symlink it doesn't do anything for you if you'd like to be
# able to back up your system configuration by backing up /etc/, or if you
# track your system configuration by watching /etc/ (like with etckeeper),
# or a number of other things that sysadmins like to do...
#
# The tidy solution would be to swap which path is the real file, and which
# path is the symlink, but pacman would then discard our config when it
# upgrades the mailman package.  So instead, we need to make up a totally
# new path for the real file... like `/etc/mailman/mm_cfg.real.py`.  We
# replace the file in /usr/ with a symlink to that.
#
# To make this all go smoothly, we do it with some slightly clever Holo
# tricks.

# When the default /usr/…/mm_cfg.py changes, save the new default version
# as a .pacnew file in /etc
add-file -m755 usr/share/holo/files/01-"$pkgname"/usr/lib/mailman/Mailman/mm_cfg.py <<-'EOF'
	#!/bin/sh
	tee etc/mailman/mm_cfg.real.py.pacnew
	EOF
# then replace /usr/…/mm_cfg.py with a symlink to /etc/…/mm_cfg.real.py
install -d usr/share/holo/files/02-"$pkgname"/usr/lib/mailman/Mailman
ln -sT /etc/mailman/mm_cfg.real.py usr/share/holo/files/02-"$pkgname"/usr/lib/mailman/Mailman/mm_cfg.py
# and initialize /etc/…/mm_cfg.real.py with the contents of the default
# mm_cfg.py
add-file etc/mailman/mm_cfg.real.py <<<''
add-file -m755 usr/share/holo/files/03-"$pkgname"/etc/mailman/mm_cfg.real.py.holoscript <<-'EOF'
	#!/bin/sh
	cat /usr/lib/mailman/Mailman/mm_cfg.py.dist
	EOF

postamble
}