On 06/01/2010 10:09 AM, Thomas Lange wrote:
On Mon, 24 May 2010 17:11:07 -0500, Rob<[email protected]>  said:
     >  This is because ainsl returns an error (1) if the line is already in the
     >       exit 1 if $found; # nothing to append
I've changed this to 0 in the svn trunk. Thanks for the hint.
Nice. In the days since my post, I thought of the alternative to add an extra option, (similar to some on fcopy) that would cause ainsl to return non-zero only if the line could not be verified in the target file. But I think your fix is better for the long term of FAI, even though some config space changes might be required in the short term.

    >  The return values of ainsl are not documented on the ainsl manpage.
Feel free to send a patch for the man page. I will apply it
immediately.
Patch attached. This patch is for the newly modified ainsl(1) command which returns 0 if the LINE/PATTERN was found in the file (revision 5797).

Thanks.

--
Rob

Index: ainsl.1
===================================================================
--- ainsl.1	(revision 5797)
+++ ainsl.1	(working copy)
@@ -28,6 +28,9 @@
 are used for matching, not when adding the line. Additionaly,
 the following characters are escaped in LINE: ( ) +
 
+The exit code returned by ainsl is 0 on success and non-zero
+on error.  See the section EXIT CODES.
+
 .SH OPTIONS
 .TP
 .B \-a
@@ -64,6 +67,17 @@
 
 Add exports entry without exactly matching spaces.
 
+.SH EXIT CODES
+.TP
+.B 0
+Success: Either FILE contains the LINE/PATTERN or LINE was appended to FILE.
+.TP
+.B 2
+FILE does not exist and the autocreate option (-a) is not present.
+.TP
+.B 13
+FILE cannot be opened for writing and LINE/PATTERN was not found in file.
+
 .SH NOTES
 This is a similar function to AppendIfNoSuchLine from cfengine(8).
 .SH SEE ALSO

Antwort per Email an