mirror of
https://github.com/systemd/systemd.git
synced 2025-08-25 13:49:55 +03:00
macros: use here-docs instead of echo (#8480)
It's common for sysusers files to contain quotes (in particular around the comment/GECOS field), and using echo "..." is very likely to not work properly in that case. Let's use <<EOF redirection. It's not bulletproof, but should work in general.
This commit is contained in:
committed by
Yu Watanabe
parent
be1bc01d11
commit
dd2490ae12
@ -101,7 +101,9 @@ systemd-sysusers %{?*} >/dev/null 2>&1 || : \
|
||||
%{nil}
|
||||
|
||||
%sysusers_create_inline() \
|
||||
echo %{?*} | systemd-sysusers - >/dev/null 2>&1 || : \
|
||||
systemd-sysusers - <<SYSTEMD_INLINE_EOF >/dev/null 2>&1 || : \
|
||||
%(cat %2) \
|
||||
SYSTEMD_INLINE_EOF \
|
||||
%{nil}
|
||||
|
||||
# This should be used by package installation scripts which require users or
|
||||
@ -118,7 +120,9 @@ echo %{?*} | systemd-sysusers - >/dev/null 2>&1 || : \
|
||||
# %files
|
||||
# %{_sysusersdir}/%{name}.conf
|
||||
%sysusers_create_package() \
|
||||
echo "%(cat %2)" | systemd-sysusers --replace=%_sysusersdir/%1.conf - >/dev/null 2>&1 || : \
|
||||
systemd-sysusers --replace=%_sysusersdir/%1.conf - <<SYSTEMD_INLINE_EOF >/dev/null 2>&1 || : \
|
||||
%(cat %2) \
|
||||
SYSTEMD_INLINE_EOF \
|
||||
%{nil}
|
||||
|
||||
# This may be used by package installation scripts to create files according to
|
||||
@ -135,7 +139,9 @@ echo "%(cat %2)" | systemd-sysusers --replace=%_sysusersdir/%1.conf - >/dev/null
|
||||
# %files
|
||||
# %{_tmpfilesdir}/%{name}.conf
|
||||
%tmpfiles_create_package() \
|
||||
echo "%(cat %2)" | systemd-tmpfiles --replace=%_tmpfilesdir/%1.conf --create - >/dev/null 2>&1 || : \
|
||||
systemd-tmpfiles --replace=%_tmpfilesdir/%1.conf --create - <<SYSTEMD_INLINE_EOF >/dev/null 2>&1 || : \
|
||||
%(cat %2) \
|
||||
SYSTEMD_INLINE_EOF \
|
||||
%{nil}
|
||||
|
||||
%sysctl_apply() \
|
||||
|
Reference in New Issue
Block a user