From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6782218062963671040 X-Received: by 2002:a19:5013:: with SMTP id e19mr2161627lfb.8.1579895485180; Fri, 24 Jan 2020 11:51:25 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:b5d9:: with SMTP id g25ls732472ljn.9.gmail; Fri, 24 Jan 2020 11:51:24 -0800 (PST) X-Google-Smtp-Source: APXvYqwGZ0H8IFyd9nbbSDnE9TNLddcR9fNxUpSzRiCp4iSF+Ne29kUCpuI2hLKjdMK/kt1+f4fP X-Received: by 2002:a2e:a408:: with SMTP id p8mr3255106ljn.145.1579895484466; Fri, 24 Jan 2020 11:51:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579895484; cv=none; d=google.com; s=arc-20160816; b=nHHUZLfaUShmRoheiCKUt54gllXvMlOoX2sW4Lxsm1RRO6AUBw5YfN4Jirf9T+cV9q wffT2ngxQf6LE8HEVPmkdPuu9wCozIxVjM208U1OrPW/oZ/xfkCAXSFR5O5JhiqpQ0/1 jcxJ15YZouMwxygunF5Am8JTg+F5fdfcgP09yb4BEaCWNUWSRPZYePkgPy9uCXE6Xcgb 82oVYH5Bk5OGCyi9aIFuAM3V6ahj5df/PNPKYiy5Q0xc48mGbcZoL1FlVzcm+J36kwyI I5q1otBmAnbj/NTy+QG09xTq0Ih88cDyPLdlkSzHGjE+hyAu4CAYgwe4uenEUgc2eUBv Jc+w== 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=s/F2aS3IdELwf9A8J7QIvlCh/8y9DXtck9bjwMzCRTE=; b=lPhPIM1DTTfE6BM3OOhEcjA+LuD+dTz4WsO+Wjn+1hmY4KjOfEPtV8xOHHHJk7h3pJ /pu6/DFCMED2YHWwy/ROo8y9V+y/Kkf8GRfsG1tRuw5cXCf+v4oMwPgKvMxihNoewcCy t7BE/NJa5BEe2QNf8dYS8p9ge1KHR1wFmbJ/n7Vpm3rm4rspNJa7N+1VmiAI7BZIkUbR bqgCyzlTIlELYdiczfrc6RjZZvhyXQ8mPqhztDdV8V9AcekMzKuxXgg0Cd7sTuxaueds vyvUOs29yGEa9R7uiP6fI37WOcq6jm+Z/VwXN0LRKuvfz4vVIdE15Btbq4Qsg1i/oYgi FnWA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.39 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 lizzard.sbs.de (lizzard.sbs.de. [194.138.37.39]) by gmr-mx.google.com with ESMTPS id a4si213139lfg.1.2020.01.24.11.51.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jan 2020 11:51:24 -0800 (PST) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.39 as permitted sender) client-ip=194.138.37.39; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by lizzard.sbs.de (8.15.2/8.15.2) with ESMTPS id 00OJpNTa005493 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 24 Jan 2020 20:51:23 +0100 Received: from md1za8fc.ad001.siemens.net ([139.25.69.193]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id 00OJpNBA003317; Fri, 24 Jan 2020 20:51:23 +0100 Date: Fri, 24 Jan 2020 20:51:22 +0100 From: Henning Schild To: Cc: "Q . Gylstorff" Subject: Re: [PATCH] doc: document how to best populate users home dirs and add example Message-ID: <20200124205122.51d7a7a0@md1za8fc.ad001.siemens.net> In-Reply-To: <20200115170954.20235-1-henning.schild@siemens.com> References: <20200115170954.20235-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: +eCijuf/4tA3 Not that anyone seems to care at the moment, but please hold for a while. Henning On Wed, 15 Jan 2020 18:09:54 +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 | 11 +++++++++++ > .../recipes-app/example-raw/example-raw_0.3.bb | 5 +++++ > meta-isar/recipes-app/example-raw/files/postinst | 13 > +++++++++++++ 3 files changed, 29 insertions(+) > > diff --git a/doc/user_manual.md b/doc/user_manual.md > index d501a706..8f5bc936 100644 > --- a/doc/user_manual.md > +++ b/doc/user_manual.md > @@ -546,6 +546,17 @@ 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. + +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..cc0d0591 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,9 > @@ 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 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..f48d993c 100644 --- > a/meta-isar/recipes-app/example-raw/files/postinst +++ > b/meta-isar/recipes-app/example-raw/files/postinst @@ -2,4 +2,17 @@ > > 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 > + > +chown -R isar:isar /var/lib/isar > + > echo "isar" > /etc/hostname