[OE-core] [PATCH] systemd: quote SYSTEMD_SERVICE in prerm and postinst

Christopher Larson kergoth at gmail.com
Fri Jun 22 15:32:14 UTC 2018


Have you tried something like this? Might need to shift it to a def'd
python function to ensure shlex gets imported, though.

systemctl $OPTS disable ${@' '.join(shlex.quote(s) for s in
d.getVar('SYSTEMD_SERVICE').split()}

On Thu, Jun 21, 2018 at 1:36 PM Damien Riegel <
damien.riegel at savoirfairelinux.com> 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
>  }
>
> --
> 2.17.1
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>


-- 
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20180622/b6c3d500/attachment-0002.html>


More information about the Openembedded-core mailing list