mirror of
https://github.com/systemd/systemd.git
synced 2024-10-31 16:21:26 +03:00
rpm macros: add %sysusers_create_package
This is close to %sysusers_create_inline and %sysusers_create that we had already, but expects a file name and uses --replace= to implement proper priority. This is used like: %sysusers_create_package %{name} %SOURCE1 where %SOURCE1 is a file with called %{name}.conf that will be installed into /usr/lib/sysusers.d/. The tough part is that the file needs to be available before %prep, i.e. outside of the source tarball. This is because the spec file is parsed (and any macros expanded), before the sources are unpackaged. v2: - disallow the case case when --config-name= is given but there are no positional args. Most likely this would be a user error, so at least for now forbid it. v3: - replace --config-name= with --target= - drop quotes around %1 and %2 — if necessary, the caller should add those. v4: - replace --target with --replace - add a big comment
This commit is contained in:
parent
4e9fe38dc0
commit
07a7d4a004
@ -100,6 +100,7 @@ journalctl --update-catalog >/dev/null 2>&1 || : \
|
||||
systemd-tmpfiles --create %{?*} >/dev/null 2>&1 || : \
|
||||
%{nil}
|
||||
|
||||
# Deprecated. Use %sysusers_create_package instead
|
||||
%sysusers_create() \
|
||||
systemd-sysusers %{?*} >/dev/null 2>&1 || : \
|
||||
%{nil}
|
||||
@ -108,6 +109,24 @@ systemd-sysusers %{?*} >/dev/null 2>&1 || : \
|
||||
echo %{?*} | systemd-sysusers - >/dev/null 2>&1 || : \
|
||||
%{nil}
|
||||
|
||||
# This should be used by package installation scripts which
|
||||
# require users or groups to be present before the files installed
|
||||
# by the package are present on disk (for example because some files
|
||||
# are owned by those users or groups).
|
||||
#
|
||||
# Example:
|
||||
# Source1: %{name}.conf
|
||||
# ...
|
||||
# %install
|
||||
# install -Dt %{buildroot}%{sysusersdir} %SOURCE1
|
||||
# %pre
|
||||
# %sysusers_create_package %{name} %SOURCE1
|
||||
# %files
|
||||
# %{sysusersdir}/%{name}.conf
|
||||
%sysusers_create_package() \
|
||||
echo "%(cat %2)" | systemd-sysusers --replace=%_sysusersdir/%1.conf - >/dev/null 2>&1 || : \
|
||||
%{nil}
|
||||
|
||||
%sysctl_apply() \
|
||||
@rootlibexecdir@/systemd-sysctl %{?*} >/dev/null 2>&1 || : \
|
||||
%{nil}
|
||||
|
Loading…
Reference in New Issue
Block a user