[OE-core] [PATCH] systemd: quote SYSTEMD_SERVICE in prerm and postinst
ChenQi
Qi.Chen at windriver.com
Fri Jun 22 01:29:37 UTC 2018
Hi Damien,
If some recipe has more than one unit file, this patch will cause
problem for it.
Best Regards,
Chen Qi
On 06/22/2018 04:35 AM, Damien Riegel wrote:
> Systemd mount configuration file must have a name that match the mount
> point directory they control. So for instance, if a mount file contains
>
> [Mount]
> ...
> Where=/mnt/my-data
>
> The file must be named `mnt-my\x2ddata.mount`, or systemd will refuse to
> honour it.
>
> If this config file contains an [Install] section, it will silently fail
> because the unit file is not quoted when systemctl is called. To fix
> that, quote `${SYSTEMD_SERVICE}` in prerm and postinst hooks.
>
> Signed-off-by: Damien Riegel <damien.riegel at savoirfairelinux.com>
> ---
> meta/classes/systemd.bbclass | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
> index 1b134322fb..589e73c855 100644
> --- a/meta/classes/systemd.bbclass
> +++ b/meta/classes/systemd.bbclass
> @@ -34,10 +34,10 @@ if type systemctl >/dev/null 2>/dev/null; then
> systemctl daemon-reload
> fi
>
> - systemctl $OPTS ${SYSTEMD_AUTO_ENABLE} ${SYSTEMD_SERVICE}
> + systemctl $OPTS ${SYSTEMD_AUTO_ENABLE} "${SYSTEMD_SERVICE}"
>
> if [ -z "$D" -a "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
> - systemctl --no-block restart ${SYSTEMD_SERVICE}
> + systemctl --no-block restart "${SYSTEMD_SERVICE}"
> fi
> fi
> }
> @@ -51,10 +51,10 @@ fi
>
> if type systemctl >/dev/null 2>/dev/null; then
> if [ -z "$D" ]; then
> - systemctl stop ${SYSTEMD_SERVICE}
> + systemctl stop "${SYSTEMD_SERVICE}"
> fi
>
> - systemctl $OPTS disable ${SYSTEMD_SERVICE}
> + systemctl $OPTS disable "${SYSTEMD_SERVICE}"
> fi
> }
>
More information about the Openembedded-core
mailing list