#121 Draft: sysusers.generate-pre.sh: Support passing configs inline
Opened 3 months ago by siosm. Modified 2 months ago
rpms/ siosm/systemd parse-inline-configs  into  rawhide

file modified
+7 -3
@@ -90,7 +90,11 @@ 

  }

  

  for fn in "$@"; do

- 	[ -e "$fn" ] || continue

- 	echo "# generated from $(basename "$fn")"

- 	parse <"$fn"

+ 	if [ -e "$fn" ]; then

+ 		echo "# Generated from $(basename "$fn")"

+ 		parse <"$fn"

+ 	else

+ 		echo "# Generated from inline config"

+ 		echo "$fn" | parse

+ 	fi

  done

In some cases, parsing a configuration file is not an option and it
would be preferable to pass the sysusers configuration directly as an
argument to the macro.

Default to reading from a file but if no file with a matching name
exists, try parsing each argument as a config line.

See: https://gitlab.com/libvirt/libvirt/-/merge_requests/319
See: https://bugzilla.redhat.com/show_bug.cgi?id=2095429
See: https://src.fedoraproject.org/rpms/libvirt/pull-request/22

Not tested yet but comments on the approach are welcomed.

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/9b387ee332d3435c84723a12306a7ebd

I think it'd be better to use the usual convention with -, i.e. read stdin if - is encountered as a positional argument.

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/c93dee819cb342d0851a0115c8fcdc8f

@siosm — ping. See comment above.

Thanks for the feedback. Will try to get to it.

Metadata