public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] doc: document how to best populate users home dirs and add example
@ 2020-01-15 17:09 Henning Schild
  2020-01-16 10:02 ` Jan Kiszka
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Henning Schild @ 2020-01-15 17:09 UTC (permalink / raw)
  To: isar-users; +Cc: Q . Gylstorff, Henning Schild

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                                  | 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_<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.
+
+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
-- 
2.24.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] doc: document how to best populate users home dirs and add example
  2020-01-15 17:09 [PATCH] doc: document how to best populate users home dirs and add example Henning Schild
@ 2020-01-16 10:02 ` Jan Kiszka
  2020-01-24 19:51 ` Henning Schild
  2020-01-27 15:45 ` [PATCHv2] " Henning Schild
  2 siblings, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2020-01-16 10:02 UTC (permalink / raw)
  To: [ext] Henning Schild, isar-users; +Cc: Q . Gylstorff

On 15.01.20 18:09, [ext] Henning Schild 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                                  | 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_<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.
> +
> +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
> 

Looks good to me - valuable information.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] doc: document how to best populate users home dirs and add example
  2020-01-15 17:09 [PATCH] doc: document how to best populate users home dirs and add example Henning Schild
  2020-01-16 10:02 ` Jan Kiszka
@ 2020-01-24 19:51 ` Henning Schild
  2020-01-27 15:45 ` [PATCHv2] " Henning Schild
  2 siblings, 0 replies; 6+ messages in thread
From: Henning Schild @ 2020-01-24 19:51 UTC (permalink / raw)
  To: isar-users; +Cc: Q . Gylstorff

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 <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                                  | 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_<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. + +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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCHv2] doc: document how to best populate users home dirs and add example
  2020-01-15 17:09 [PATCH] doc: document how to best populate users home dirs and add example Henning Schild
  2020-01-16 10:02 ` Jan Kiszka
  2020-01-24 19:51 ` Henning Schild
@ 2020-01-27 15:45 ` Henning Schild
  2020-01-27 15:46   ` Henning Schild
  2020-03-09 11:04   ` Baurzhan Ismagulov
  2 siblings, 2 replies; 6+ messages in thread
From: Henning Schild @ 2020-01-27 15:45 UTC (permalink / raw)
  To: isar-users; +Cc: Q . Gylstorff, Jan Kiszka, Henning Schild

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
-- 
2.24.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCHv2] doc: document how to best populate users home dirs and add example
  2020-01-27 15:45 ` [PATCHv2] " Henning Schild
@ 2020-01-27 15:46   ` Henning Schild
  2020-03-09 11:04   ` Baurzhan Ismagulov
  1 sibling, 0 replies; 6+ messages in thread
From: Henning Schild @ 2020-01-27 15:46 UTC (permalink / raw)
  To: isar-users; +Cc: Q . Gylstorff, Jan Kiszka

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCHv2] doc: document how to best populate users home dirs and add example
  2020-01-27 15:45 ` [PATCHv2] " Henning Schild
  2020-01-27 15:46   ` Henning Schild
@ 2020-03-09 11:04   ` Baurzhan Ismagulov
  1 sibling, 0 replies; 6+ messages in thread
From: Baurzhan Ismagulov @ 2020-03-09 11:04 UTC (permalink / raw)
  To: isar-users

On Mon, Jan 27, 2020 at 04:45:42PM +0100, Henning Schild wrote:
> 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.

Applied to next, thanks.

With kind regards,
Baurzhan.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-09 11:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15 17:09 [PATCH] doc: document how to best populate users home dirs and add example 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
2020-03-09 11:04   ` Baurzhan Ismagulov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox