This macro can be called inside a build file and easily allows to apply
any kind of users/groups specified in a sysusers file.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
# Install
%{make_install}
+ %{MACRO_APPLY_SYSTEMD_SYSUSERS}
+
# Run custom commands
%{install_cmds}
end
+build
+ export APPLY_SYSUSERS_FILE=
+
+ MACRO_APPLY_SYSTEMD_SYSUSERS
+ if [ -n "$APPLY_SYSUSERS_FILE" ] && [ -x "$(command -v systemd-sysusers)" ]; then
+ mkdir -pv %{sysusersdir}
+
+ for file in ${APPLY_SYSUSERS_FILE}; do
+ [ -e "${file}" ] || continue
+ cat ${file} | \
+ systemd-sysusers --replace=%{sysusersdir}/$(basename ${file%*.*}).conf -
+ done
+ unset file
+ fi
+ end
+end
+
MACRO_INSTALL_SYSTEMD_FILES
for file in %{DIR_SOURCE}/systemd/*; do
[ -e "${file}" ] || continue