From: Zbigniew Jędrzejewski-Szmek Date: Mon, 19 Mar 2018 08:07:44 +0000 (+0100) Subject: macros: use here-docs instead of echo (#8480) X-Git-Tag: v239~536 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dd2490ae12ad1e1795ecbf8f8944b950da9c8d06;p=thirdparty%2Fsystemd.git 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 </dev/null 2>&1 || : \ %{nil} %sysusers_create_inline() \ -echo %{?*} | systemd-sysusers - >/dev/null 2>&1 || : \ +systemd-sysusers - </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 - </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 - </dev/null 2>&1 || : \ +%(cat %2) \ +SYSTEMD_INLINE_EOF \ %{nil} %sysctl_apply() \