<pre style='margin:0'>
Christopher Nielsen (mascguy) pushed a commit to branch master
in repository macports-guide.
</pre>
<p><a href="https://github.com/macports/macports-guide/commit/f548e1f284d254c76a49ccbb6e5e0a23c973195a">https://github.com/macports/macports-guide/commit/f548e1f284d254c76a49ccbb6e5e0a23c973195a</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new f548e1f Populated development.practices.dont-overwrite section
</span>f548e1f is described below
<span style='display:block; white-space:pre;color:#808000;'>commit f548e1f284d254c76a49ccbb6e5e0a23c973195a
</span>Author: Stephen Reay <stephen@koalephant.com>
AuthorDate: Sun Jul 23 20:44:36 2023 +0700
<span style='display:block; white-space:pre;color:#404040;'> Populated development.practices.dont-overwrite section
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> * Added a brief explanation about config file overwrites, and two source examples to achieve it, using post-destroot and post-activate
</span>---
guide/adoc/portfiledev.adoc | 19 ++++++++++++++++++-
guide/xml/portfiledev.xml | 17 ++++++++++++++++-
2 files changed, 34 insertions(+), 2 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/guide/adoc/portfiledev.adoc b/guide/adoc/portfiledev.adoc
</span><span style='display:block; white-space:pre;color:#808080;'>index 66d616f..42e3e1d 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/guide/adoc/portfiledev.adoc
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/guide/adoc/portfiledev.adoc
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -713,7 +713,24 @@ destroot.keepdirs ${destroot}${prefix}/var/run \
</span> [[development.practices.dont-overwrite]]
=== Don't Overwrite Config Files
<span style='display:block; white-space:pre;background:#ffe0e0;'>-TODO:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+For packages that use a configuration file, it's generally desirable to not overwrite user-changes in the config file when performing an upgrade or reinstall.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+[source]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+----
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+post-destroot {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Move conf file to sample so it does not get overwritten
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file rename ${destroot}${prefix}/etc/apcupsd/apcupsd.conf \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/etc/apcupsd/apcupsd.conf.sample
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+post-activate {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Create initial conf file if needed
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists ${prefix}/etc/apcupsd/apcupsd.conf]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file copy ${prefix}/etc/apcupsd/apcupsd.conf.sample \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${prefix}/etc/apcupsd/apcupsd.conf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+----
</span>
[[development.practices.install-docs]]
=== Install Docs and Examples
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/guide/xml/portfiledev.xml b/guide/xml/portfiledev.xml
</span><span style='display:block; white-space:pre;color:#808080;'>index 6027e9c..f2a4bb4 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/guide/xml/portfiledev.xml
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/guide/xml/portfiledev.xml
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -865,7 +865,22 @@ Ports failed: 0</screen>
</span> <section xml:id="development.practices.dont-overwrite">
<title>Don't Overwrite Config Files</title>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- <para>TODO:</para>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <para>For packages that use a configuration file, it's generally desirable to not overwrite user-changes in the config file when performing an upgrade or reinstall.</para>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <programlisting>post-destroot {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Move conf file to sample so it does not get overwritten
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file rename ${destroot}${prefix}/etc/apcupsd/apcupsd.conf \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/etc/apcupsd/apcupsd.conf.sample
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+post-activate {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Create initial conf file if needed
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists ${prefix}/etc/apcupsd/apcupsd.conf]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file copy ${prefix}/etc/apcupsd/apcupsd.conf.sample \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${prefix}/etc/apcupsd/apcupsd.conf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}</programlisting>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> </section>
<section xml:id="development.practices.install-docs">
</pre><pre style='margin:0'>
</pre>