Opened 14 years ago

Closed 13 years ago

#24786 closed enhancement (fixed)

Mailman: preserve configuration file after uninstall

Reported by: mfisher@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: mailman

Description (last modified by ryandesign (Ryan Carsten Schmidt))

This is a hack/enhancement based on PortfileRecipes that causes the mm_cfg.py file to be preserved (the Mailman installer creates it from mm_cfg.py.dist) after port uninstall.

--- Portfile    2010-05-04 16:00:20.000000000 -0400
+++ mailman-portfile    2010-05-04 15:59:59.000000000 -0400
@@ -91,8 +109,7 @@
        reinplace "s|@DATADIR@|${datadir}|" ${destroot}${confdir}/${name}.conf
        reinplace "s|@SHAREDIR@|${sharedir}|" ${destroot}${confdir}/${name}.conf
        reinplace "s|@CONFDIR@|${confdir}|" \
-               ${destroot}${sharedir}/Mailman/mm_cfg.py.dist \
-               ${destroot}${sharedir}/Mailman/mm_cfg.py
+               ${destroot}${sharedir}/Mailman/mm_cfg.py.dist

        # Install documentation files
        xinstall -d -m 0755 ${destroot}${docdir}
@@ -103,6 +120,12 @@
        # Check installation under destroot
        system "cd ${destroot}${sharedir} && \
                DESTDIR=${destroot} PYTHONPATH=.:./pythonlib ./bin/check_perms"
+
+       # Don't pull forward the system-built mm_cfg.py because it'd
+       # be uninstalled, even if modified by the user.
+       if {[file exists ${destroot}${sharedir}/Mailman/mm_cfg.py]} {
+               delete ${destroot}${sharedir}/Mailman/mm_cfg.py
+       }
 }

 post-install {
@@ -141,3 +164,12 @@
        ui_msg "------------------------------------------------------------"
 }

+post-activate {
+       # Check for an existing mm_cfg.py and copy the "dist" version
+       # into place (like the real build does) if there isn't one.
+       if {![file exists ${sharedir}/Mailman/mm_cfg.py]} {
+               file copy ${sharedir}/Mailman/mm_cfg.py.dist \
+                       ${sharedir}/Mailman/mm_cfg.py
+       }
+}

Change History (2)

comment:1 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Port: mailman added; mail/mailman removed
Summary: Mailman -- preserve configuration file after uninstallMailman: preserve configuration file after uninstall

comment:2 Changed 13 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: newclosed
Version: 1.8.2
Note: See TracTickets for help on using tickets.