only-if-file-present

This commit is contained in:
stephan 2022-07-31 19:30:42 +02:00
parent a379bfc742
commit 55d6e21a1d
4 changed files with 6 additions and 3 deletions

View File

@ -38,7 +38,7 @@ if [ -z "$state_is" ]; then
echo "touch $file"
else
# only bark if the file should exists
if [ -f "$__object/parameter/ifexists" ]; then
if [ -f "$__object/parameter/only-if-file-present" ]; then
exit 0
fi
printf 'The file "%s" is missing. Please create it before using %s on it.\n' "$file" "${__type##*/}" >&2

View File

@ -31,8 +31,9 @@ file
If supplied, use this as the destination file.
Otherwise the object_id is used.
ifexists
Only apply the line if the file exists.
only-if-file-present
Only apply the line if the file exists. This can be used to prevent
adding the line to a non-existent file.
line
Specifies the line which should be absent or present.

View File

@ -0,0 +1,2 @@
create
only-if-file-present