The @sample keyword can now take two arguments.
Reviewed by: brd, wblock Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D3755
This commit is contained in:
parent
85859125e5
commit
f02de77171
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=47465
1 changed files with 21 additions and 29 deletions
|
@ -211,31 +211,19 @@ PLIST_SUB+= X11I386="@comment "
|
||||||
<note>
|
<note>
|
||||||
<para>The sample configuration files should always have the
|
<para>The sample configuration files should always have the
|
||||||
<filename>.sample</filename> suffix. If for some historical
|
<filename>.sample</filename> suffix. If for some historical
|
||||||
reason using the standard suffix is not possible, use
|
reason using the standard suffix is not possible, or if the
|
||||||
|
sample files come from some other directory, use
|
||||||
this construct:</para>
|
this construct:</para>
|
||||||
|
|
||||||
<programlisting>@unexec if cmp -s %D/etc/orbit.conf-dist %D/etc/orbit.conf; then rm -f %D/etc/orbit.conf; fi
|
<programlisting>@sample etc/orbit.conf-dist etc/orbit.conf</programlisting>
|
||||||
etc/orbit.conf-dist
|
|
||||||
@exec if [ ! -f %D/etc/orbit.conf ] ; then cp -p %D/%F %B/orbit.conf; fi</programlisting>
|
|
||||||
|
|
||||||
<para>The order of these lines is important. On deinstallation,
|
<para>or</para>
|
||||||
the sample file is compared to the actual configuration file.
|
|
||||||
If these files are identical, no changes have been made by the
|
|
||||||
user and the actual file can be safely deleted. Because the
|
|
||||||
sample file must still exist for the comparison, the
|
|
||||||
<literal>@unexec</literal> line comes before the sample
|
|
||||||
configuration file name. On installation, if an actual
|
|
||||||
configuration file is not already present, the sample file is
|
|
||||||
copied to the actual file. The sample file must be present
|
|
||||||
before it can be copied, so the <literal>@exec</literal> line
|
|
||||||
comes after the sample configuration file name.</para>
|
|
||||||
|
|
||||||
<para>To debug any issues, temporarily remove the
|
<programlisting>@sample %%EXAMPLESDIR%%/orbit.conf etc/orbit.conf</programlisting>
|
||||||
<literal>-s</literal> flag to &man.cmp.1; for more
|
|
||||||
output.</para>
|
|
||||||
|
|
||||||
<para>See &man.pkg-create.8; for more information on
|
<para>The format is <literal>@sample
|
||||||
<literal>%D</literal> and related substitution markers.</para>
|
<replaceable>sample-file</replaceable>
|
||||||
|
<replaceable>actual-config-file</replaceable></literal>.</para>
|
||||||
</note>
|
</note>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
@ -408,17 +396,21 @@ etc/orbit.conf-dist
|
||||||
|
|
||||||
<sect2 xml:id="plist-keywords-sample">
|
<sect2 xml:id="plist-keywords-sample">
|
||||||
<title><literal>@sample</literal>
|
<title><literal>@sample</literal>
|
||||||
<replaceable>file</replaceable></title>
|
<replaceable>file</replaceable>
|
||||||
|
[<replaceable>file</replaceable>]</title>
|
||||||
|
|
||||||
<para>Add the file passed as argument to the plist.</para>
|
<para>This is used to handle installation of configuration
|
||||||
|
files, through example files bundled with the package. The
|
||||||
|
<quote>actual</quote>, non-sample, file is either the second
|
||||||
|
filename, if present, or the first filename without the
|
||||||
|
<filename>.sample</filename> extension.</para>
|
||||||
|
|
||||||
<para>On installation, check for a <quote>real</quote> file with
|
<para>This does three things. First, add the first file passed
|
||||||
just the base name (the name without the
|
as argument, the sample file, to the plist. Then, on
|
||||||
<filename>.sample</filename> extension). If the real file is
|
installation, if the actual file is not found, copy the sample
|
||||||
not found, copy the sample file to the base file name. On
|
file to the actual file. And finally, on deinstallation,
|
||||||
deinstallation, remove the configuration file if it has not
|
remove the actual file if it has not been modified. See <xref
|
||||||
been modified. See <xref linkend="plist-config"/> for more
|
linkend="plist-config"/> for more information.</para>
|
||||||
information.</para>
|
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2 xml:id="plist-keywords-shared-mime-info">
|
<sect2 xml:id="plist-keywords-shared-mime-info">
|
||||||
|
|
Loading…
Reference in a new issue