public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
To: isar-users@googlegroups.com
Cc: Henning Schild <henning.schild@siemens.com>
Subject: [PATCH 1/3] image-account-extension: Add skeleton dir option
Date: Fri, 19 Jul 2019 14:38:21 +0200	[thread overview]
Message-ID: <20190719123823.5599-1-quirin.gylstorff@siemens.com> (raw)
In-Reply-To: <20190719123628.5500-1-quirin.gylstorff@siemens.com>

Add option to modify a user home directory content with the
--skel option from user add. This allows to create a additional
folder where special home directory layouts are stored.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/classes/image-account-extension.bbclass | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/meta/classes/image-account-extension.bbclass b/meta/classes/image-account-extension.bbclass
index 22754da..b271b8f 100644
--- a/meta/classes/image-account-extension.bbclass
+++ b/meta/classes/image-account-extension.bbclass
@@ -17,6 +17,7 @@ USERS ??= ""
 #USER_root[home] = "/home/root"
 #USER_root[shell] = "/bin/sh"
 #USER_root[groups] = "audio video"
+#USER_root[skel] = ""
 #USER_root[flags] = "no-create-home create-home system allow-empty-password"
 
 GROUPS ??= ""
@@ -49,8 +50,8 @@ def gen_accounts_array(d, listname, entryname, flags, verb_flags=None):
     )
 
 # List of space separated entries, where each entry has the format:
-# username:encryptedpassword:expiredate:inactivenumber:userid:groupid:comment:homedir:shell:group1,group2:flag1,flag2
-IMAGE_ACCOUNTS_USERS =+ "${@gen_accounts_array(d, 'USERS', 'USER', ['password',  'expire', 'inactive', 'uid', 'gid', 'comment', 'home', 'shell', 'groups', 'flags'], ['password', 'comment', 'home', 'shell'])}"
+# username:encryptedpassword:expiredate:inactivenumber:userid:groupid:comment:homedir:shell:group1,group2:skeldir:flag1,flag2
+IMAGE_ACCOUNTS_USERS =+ "${@gen_accounts_array(d, 'USERS', 'USER', ['password',  'expire', 'inactive', 'uid', 'gid', 'comment', 'home', 'shell', 'groups', 'skel', 'flags'], ['password', 'comment', 'home', 'shell', 'skel'])}"
 
 # List of space separated entries, where each entry has the format:
 # groupname:groupid:flag1,flag2
@@ -127,7 +128,7 @@ image_configure_accounts() {
     list='${@" ".join(d.getVar('IMAGE_ACCOUNTS_USERS', True).split())} '
     while true; do
         # Pop first user entry:
-        list_rest="${list#*:*:*:*:*:*:*:*:*:*:* }"
+        list_rest="${list#*:*:*:*:*:*:*:*:*:*:*:* }"
         entry="${list%%${list_rest}}"
         list="${list_rest}"
 
@@ -169,6 +170,9 @@ image_configure_accounts() {
         groups="${entry%%:*}"
         entry="${entry#${groups}:}"
 
+        skel="${entry%%:*}"
+        entry="${entry#${skel}:}"
+
         flags="${entry%%:*}"
         entry="${entry#${flags}:}"
 
@@ -228,6 +232,9 @@ image_configure_accounts() {
                 set -- "$@" --no-create-home
             else
                 if [ "${flags}" != "${flags%*,create-home,*}" ]; then
+                    if [ -n "$skel" ]; then
+                        set -- "$@" --skel "$skel"
+                    fi
                     set -- "$@" --create-home
                 fi
             fi
-- 
2.20.1


  reply	other threads:[~2019-07-19 12:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-19 12:36 [PATCH 0/3] " Quirin Gylstorff
2019-07-19 12:38 ` Quirin Gylstorff [this message]
2019-07-19 12:38   ` [PATCH 2/3] meta-isar: Add example for user settings Quirin Gylstorff
2019-07-23  8:08     ` Henning Schild
2019-07-23 12:00       ` Quirin Gylstorff
2019-07-23 12:03         ` [PATCH 0/3] Add skeleton dir option Quirin Gylstorff
2019-07-23 12:06         ` Quirin Gylstorff
2019-07-23 12:06           ` [PATCH v2 1/3] image-account-extension: " Quirin Gylstorff
2019-07-23 12:06           ` [PATCH v2] ubifs-img: Correct function name Quirin Gylstorff
2019-07-23 12:06           ` [PATCH v2 2/3] meta-isar: Add example for user settings Quirin Gylstorff
2019-07-23 12:06           ` [PATCH v2 3/3] image-account-extension:Move configure_accounts to postprocess Quirin Gylstorff
2019-07-29 21:25           ` [PATCH 0/3] Add skeleton dir option Baurzhan Ismagulov
2019-07-31 11:44             ` Quirin Gylstorff
2019-07-31 12:40               ` Baurzhan Ismagulov
2019-07-31 14:49                 ` Henning Schild
2019-07-31 17:23                   ` Baurzhan Ismagulov
2019-08-01 16:10                   ` Baurzhan Ismagulov
2019-08-01  7:02                 ` Quirin Gylstorff
2019-08-01  9:50                   ` Baurzhan Ismagulov
2019-08-01 14:23                     ` Quirin Gylstorff
2019-07-19 12:38   ` [PATCH 3/3] image-account-extension:Move configure_accounts to postprocess Quirin Gylstorff

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=20190719123823.5599-1-quirin.gylstorff@siemens.com \
    --to=quirin.gylstorff@siemens.com \
    --cc=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.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