From: Henning Schild <henning.schild@siemens.com>
To: <isar-users@googlegroups.com>
Cc: "Q . Gylstorff" <Quirin.Gylstorff@siemens.com>,
Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [PATCHv2] doc: document how to best populate users home dirs and add example
Date: Mon, 27 Jan 2020 16:46:58 +0100 [thread overview]
Message-ID: <20200127164658.34f67e2e@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <20200127154542.25262-1-henning.schild@siemens.com>
The diff to v1 is that it now covers also the combination of a
pre-packages home together with /etc/skel.
Henning
On Mon, 27 Jan 2020 16:45:42 +0100
Henning Schild <henning.schild@siemens.com> wrote:
> From: Henning Schild <henning.schild@siemens.com>
>
> People that create users often also end up wanting to place content in
> their home. Add a short section on how to best do that, including an
> example implementation in example-raw.
>
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
> doc/user_manual.md | 12 ++++++++++++
> .../recipes-app/example-raw/example-raw_0.3.bb | 10 ++++++++++
> meta-isar/recipes-app/example-raw/files/postinst | 16
> ++++++++++++++++ 3 files changed, 38 insertions(+)
>
> diff --git a/doc/user_manual.md b/doc/user_manual.md
> index d501a706..a3a2550a 100644
> --- a/doc/user_manual.md
> +++ b/doc/user_manual.md
> @@ -546,6 +546,18 @@ The `USERS` and `USER_<username>` variable works
> similar to the `GROUPS` and `GR
> - `system` - `useradd` will be called with `--system`.
> - `allow-empty-password` - Even if the `password` flag is empty,
> it will still be set. This results in a login without password.
> +#### Home directory contents prefilling
> +
> +To cover all users simply use `/etc/skel`. Files in there will be
> available in every home directory under correct permissions. +If you
> have just one user you might end up abusing this for large content,
> that is a waste of space. + +To place content into specific homes
> drop those files into position and create the user and possibly group
> in `postinst`. Now you can chown the contents because the user is
> known. +If you want that user to have the prefilled content combined
> with `/etc/skel` you need to either create the user in `preinst` or
> combine in `postinst`. + +The regular user and group configuration
> will still apply later, it will just change an existing user. +
> +meta-isar/recipes-app/example-raw contains an example + ---
>
> ## Create a Custom Image Recipe
> diff --git a/meta-isar/recipes-app/example-raw/example-raw_0.3.bb
> b/meta-isar/recipes-app/example-raw/example-raw_0.3.bb index
> d9f3a2e9..e4921709 100644 ---
> a/meta-isar/recipes-app/example-raw/example-raw_0.3.bb +++
> b/meta-isar/recipes-app/example-raw/example-raw_0.3.bb @@ -31,4
> +31,14 @@ do_install() { echo "# empty config file" >
> ${WORKDIR}/${PN}.conf install -v -d ${D}/etc/
> install -v -m 644 ${WORKDIR}/${PN}.conf ${D}/etc/${PN}.conf
> +
> + bbnote "A HOME entry for everyone ... created after this is
> installed"
> + echo "hello skel" > ${WORKDIR}/${PN}-isar-skel.txt
> + install -v -d ${D}/etc/skel/
> + install -v -m 644 ${WORKDIR}/${PN}-isar-skel.txt
> ${S}/etc/skel/ +
> + bbnote "A user-specific HOME entry"
> + echo "hello isar" > ${WORKDIR}/${PN}-isar.txt
> + install -v -d ${D}/var/lib/isar/
> + install -v -m 644 ${WORKDIR}/${PN}-isar.txt
> ${S}/var/lib/isar/ }
> diff --git a/meta-isar/recipes-app/example-raw/files/postinst
> b/meta-isar/recipes-app/example-raw/files/postinst index
> 416ff349..c32ba956 100644 ---
> a/meta-isar/recipes-app/example-raw/files/postinst +++
> b/meta-isar/recipes-app/example-raw/files/postinst @@ -2,4 +2,20 @@
>
> set -e
>
> +if ! getent group isar >/dev/null; then
> + addgroup --quiet --system isar
> +fi
> +
> +if ! getent passwd isar >/dev/null; then
> + useradd --system --gid isar --create-home \
> + --home /var/lib/isar --no-user-group \
> + --comment "My isar user" \
> + isar
> +fi
> +
> +# since the homedir was part of the package, useradd did not include
> skel +cp -RTn /etc/skel ~isar
> +
> +chown -R isar:isar ~isar
> +
> echo "isar" > /etc/hostname
next prev parent reply other threads:[~2020-01-27 15:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-15 17:09 [PATCH] " Henning Schild
2020-01-16 10:02 ` Jan Kiszka
2020-01-24 19:51 ` Henning Schild
2020-01-27 15:45 ` [PATCHv2] " Henning Schild
2020-01-27 15:46 ` Henning Schild [this message]
2020-03-09 11:04 ` Baurzhan Ismagulov
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=20200127164658.34f67e2e@md1za8fc.ad001.siemens.net \
--to=henning.schild@siemens.com \
--cc=Quirin.Gylstorff@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox