All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 02/10] package/systemd: add libnss-systemd to name resolution
Date: Sun, 7 Jun 2020 13:40:42 +0200	[thread overview]
Message-ID: <20200607114042.GP13972@scaer> (raw)
In-Reply-To: <20200206093633.251413-3-nolange79@gmail.com>

Nrobert, All,

On 2020-02-06 10:36 +0100, Norbert Lange spake thusly:
> The feature DynamicUser creates users/groups without
> touching the /etc/{passwd,group} files on disk.
> Adding the dynamic resolver to /etc/nsswitch.conf
> ensures the Names are resolved consistently.
> 
> Signed-off-by: Norbert Lange <nolange79@gmail.com>
> ---
>  package/systemd/systemd.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
> index 05b07cfd1b..a390cdd1a9 100644
> --- a/package/systemd/systemd.mk
> +++ b/package/systemd/systemd.mk
> @@ -409,7 +409,15 @@ define SYSTEMD_INSTALL_MACHINEID_HOOK
>  	touch $(TARGET_DIR)/etc/machine-id
>  endef
>  
> +define SYSTEMD_ADD_NSSCONFIG_HOOK
> +	grep >/dev/null '^passwd:.*systemd' $(TARGET_DIR)/etc/nsswitch.conf || \

While this is valid sytx, we customarily put the redirection at the end
of the command.

However, in this case, you would want to use 'grep -q', as that does not
output anything.

> +		sed '/^passwd:/ s/$$/ systemd/' $(TARGET_DIR)/etc/nsswitch.conf

How can that even work? By default, sed will out put to stdout, not
replace in-place.

This clearly has not been tested (or git-commit --amend was forgotten).

In this case, you want to use $(SED) that includes the -i option to do
in-place modifications.

> +	grep >/dev/null '^group:.*systemd' $(TARGET_DIR)/etc/nsswitch.conf || \

Ditto grep -q.

> +		sed '/^group:/ s/$$/ systemd/' $(TARGET_DIR)/etc/nsswitch.conf

Ditto $(SED).

Regards,
Yann E. MORIN.

> +endef
> +
>  SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
> +	SYSTEMD_ADD_NSSCONFIG_HOOK \
>  	SYSTEMD_INSTALL_INIT_HOOK \
>  	SYSTEMD_INSTALL_MACHINEID_HOOK \
>  	SYSTEMD_INSTALL_RESOLVCONF_HOOK
> -- 
> 2.24.1
> 

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  parent reply	other threads:[~2020-06-07 11:40 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06  9:36 [Buildroot] [PATCH 00/10] Improvements to systemd Norbert Lange
2020-02-06  9:36 ` [Buildroot] [PATCH 01/10] package/systemd: move preset-all HOOK to fakeroot stage Norbert Lange
2020-06-07 11:09   ` Jérémy ROSEN
2020-06-07 11:46     ` Yann E. MORIN
2020-06-07 12:07       ` Jérémy ROSEN
2020-06-07 11:47   ` Yann E. MORIN
2020-02-06  9:36 ` [Buildroot] [PATCH 02/10] package/systemd: add libnss-systemd to name resolution Norbert Lange
2020-06-07 11:10   ` Jérémy ROSEN
2020-06-07 11:40   ` Yann E. MORIN [this message]
2020-06-07 19:35     ` Norbert Lange
2020-06-08 10:09       ` Jérémy ROSEN
2020-06-08 10:38         ` Norbert Lange
2020-02-06  9:36 ` [Buildroot] [PATCH 03/10] package/systemd: remove unused user accounts Norbert Lange
2020-02-07  9:11   ` Jérémy ROSEN
2020-02-07 12:41     ` Norbert Lange
2020-02-07 12:43       ` Jérémy ROSEN
2020-02-07 12:52         ` Norbert Lange
2020-02-07 12:57           ` Jérémy ROSEN
2020-02-07 13:07             ` Norbert Lange
2020-02-06  9:36 ` [Buildroot] [PATCH 04/10] package/systemd: create "remote" user if the feature is enabled Norbert Lange
2020-02-07  9:11   ` Jérémy ROSEN
2020-02-06  9:36 ` [Buildroot] [PATCH 05/10] package/systemd: cosmetic rearrange list of users Norbert Lange
2020-02-07  9:13   ` Jérémy ROSEN
2020-02-07 12:47     ` Norbert Lange
2020-02-07 12:53       ` Jérémy ROSEN
2020-02-07 12:59         ` Norbert Lange
2020-02-07 13:07           ` Jérémy ROSEN
2020-02-07 13:11             ` Norbert Lange
2020-02-07 13:22               ` Jérémy ROSEN
2020-02-07 13:32                 ` Norbert Lange
2020-02-06  9:36 ` [Buildroot] [PATCH 06/10] package/systemd: sync user comments to upstream Norbert Lange
2020-02-06  9:36 ` [Buildroot] [PATCH 07/10] Makefile: Handle systemd catalogs in PURGE_LOCALES Norbert Lange
2020-02-06  9:36 ` [Buildroot] [PATCH 08/10] package/systemd: add hook to update journalctl catalogs Norbert Lange
2020-06-07 11:14   ` Jérémy ROSEN
2020-06-07 15:56   ` Yann E. MORIN
2020-06-07 20:05     ` Norbert Lange
2020-02-06  9:36 ` [Buildroot] [PATCH 09/10] package/systemd: option to delete all catalog files Norbert Lange
2020-02-06  9:36 ` [Buildroot] [PATCH 10/10] package/systemd: invoke systemd-tmpfilesd on final image Norbert Lange
2020-06-07 11:15   ` Jérémy ROSEN
2020-06-07 19:26     ` Norbert Lange

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200607114042.GP13972@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.