From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6782218062963671040 X-Received: by 2002:ac2:5e7a:: with SMTP id a26mr8481502lfr.167.1580140023231; Mon, 27 Jan 2020 07:47:03 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:9786:: with SMTP id y6ls1866243lji.4.gmail; Mon, 27 Jan 2020 07:47:02 -0800 (PST) X-Google-Smtp-Source: APXvYqzAdG/pVMVIeQp9QUmhz+RLByZ89mKL4dT67FadmVongCfK1xQVcijqmdYxpkHPZ+cHAd1F X-Received: by 2002:a2e:9806:: with SMTP id a6mr11163260ljj.178.1580140022399; Mon, 27 Jan 2020 07:47:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580140022; cv=none; d=google.com; s=arc-20160816; b=J5Ct5OU7XN8tt3N3CaFKvcEGDpE6SPgBS1AFmMCcwCc41LGRRUkkYcLKr8Tbe564eJ 9cUqKi1cE7BawIhgUuGqy1JhFPGDPMJK1zCwdaeX+neehaQKkDw4f2X0WVSBedUcAcxD tQiq6W2xWeddoGzj50HTa528zZZxKVgs+QGKVj6bj8ZGYj2+KdNfPinm41QiTDDYgosP Qs7KEkTszL9bUGrMZ2OkoO4vvAPq9hLwZTBrLqmj0KSx4SDfIyEXI2mTMJtcAjQn9t0d mUfCWvH24hDPodsHLkvCuwQBDRvQBBbfDvBfoLM9Bn2Qpw8DzR9t038AV18AldMBppli XU+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date; bh=SOn5pbCbpIrXjW5JKvoZyDbhZSW+zDXapGdPwLPTCV0=; b=IKMm/l6bIEEytf4ibuaRTWJpDIMKerPhTxVABgCehMvVzDpjg/FBQQ1s47ufau9cg4 WVmrOHYic/+QwJGp45d4xLS6Pf2djYfacCKzNEtxA2yrNxiJ/5OtgJZP0PqJzA/twdbW 9AFZ9MouT1Osz6HIUJ1fX2nfuus6zT0nbz9QV4CZMm8PuH8MxJW3jGmfZvxRXkFs85A8 c2hEIB3nqWORC6NH8y0rSJT8dUq2f5E8FLaPs7k7XMyLh6Q2ug8N75rXsYNDCxhg5yH6 SNzR+vWQz9ADXqqLbK+DnOdJabLhPz6ftF+EpI7drzWrqgZNbUaw8iGK7M8gEKFWa4uy YuZQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id o24si700426lji.4.2020.01.27.07.47.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jan 2020 07:47:02 -0800 (PST) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.28 as permitted sender) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id 00RFl1w7006556 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 27 Jan 2020 16:47:01 +0100 Received: from md1za8fc.ad001.siemens.net ([139.25.69.193]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id 00RFl1iR031035; Mon, 27 Jan 2020 16:47:01 +0100 Date: Mon, 27 Jan 2020 16:46:58 +0100 From: Henning Schild To: Cc: "Q . Gylstorff" , Jan Kiszka Subject: Re: [PATCHv2] doc: document how to best populate users home dirs and add example Message-ID: <20200127164658.34f67e2e@md1za8fc.ad001.siemens.net> In-Reply-To: <20200127154542.25262-1-henning.schild@siemens.com> References: <20200115170954.20235-1-henning.schild@siemens.com> <20200127154542.25262-1-henning.schild@siemens.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TUID: DrXzwHST5rn0 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 wrote: > From: Henning Schild > > 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 > --- > 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_` 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