From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6715352290238136320 X-Received: by 2002:a2e:970a:: with SMTP id r10mr37265276lji.115.1563883585348; Tue, 23 Jul 2019 05:06:25 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:9643:: with SMTP id z3ls4846983ljh.7.gmail; Tue, 23 Jul 2019 05:06:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwL0Z5dJGu007RHaYNatTPM9D4+aPwUxcYiHrRJRH81aXBaiIiPW6BDHmEO1KIflWaiJSGI X-Received: by 2002:a2e:9758:: with SMTP id f24mr39745030ljj.58.1563883584895; Tue, 23 Jul 2019 05:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563883584; cv=none; d=google.com; s=arc-20160816; b=VhduUmuIvNkBFHtQRz3e1Y/0r7Q+It8q5GoXVvjeW3M8Qbx2snOxSFp5UJtgH+GnB0 vqG2js67sfU+9x0riexkPCd67Vm+KIpL/wTW2rzMsXn5szs82/6rsZmlUI71V1nMxjS7 l6sNi6l01Iism9dGVE7gLnuFaakVEMwoGTEAHZaNdwFeMXO8jJHVq6vdejEVBwMD9Kyc kJQqtDEgvvu6PbYteym2i+/cGqyS1V1ZDR4Pw6VA+x0Rlr15WUpxFLw/0eXDxbB7A5RN 8bgPseFN5PrTKwDhxoCmWhuxKumBM2mwfuJjgHsHJTTYmHRsaDkM5DAnxDuunpUkp5HB Phhg== 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:date:subject:to:from; bh=r0hP8DgKFFn3RJjyGBlEHRW/zHHJnzOUbvF0XGix4uM=; b=au/aafTL6goL1ZskKZGGcBAEvhAZqZoc+gU8Pw3Ya5KU381hRqYmgEzQgEKVnTbPZK CMBBzhPhrn9G1w1X0qvi/jQoNf0oo+0jrAalaLTYiRIk9D7mixYiB1kvraH17zNxrcbR BWd0zlKI+tdihawDtiGOyiK2tWb28cdFbE1/mjkOOmuJO4xtlWsl0EKL6WRaaF4tg5BY 6DVr0uLPLJldwpWOqRHGoTSHU9SGEVwe4cjt7oNhv13BwnLKHY8XpICBLHdedQgO7c2m 3cyKMO3QG7nuiSXTZoo5fBEv8L3IcENupv8E41tlSOrQ9oKEZY9VyYx/yWiAKJJiKAGJ 3IWA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of quirin.gylstorff@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=quirin.gylstorff@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 s14si2449746ljg.4.2019.07.23.05.06.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jul 2019 05:06:24 -0700 (PDT) Received-SPF: pass (google.com: domain of quirin.gylstorff@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 quirin.gylstorff@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=quirin.gylstorff@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 x6NC6OYd007078 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 23 Jul 2019 14:06:24 +0200 Received: from debian.ad001.siemens.net ([139.25.68.238]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id x6NC6NdZ017550 for ; Tue, 23 Jul 2019 14:06:24 +0200 From: Quirin Gylstorff To: isar-users@googlegroups.com Subject: [PATCH v2 1/3] image-account-extension: Add skeleton dir option Date: Tue, 23 Jul 2019 14:06:10 +0200 Message-Id: <20190723120613.10503-2-quirin.gylstorff@siemens.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190723120613.10503-1-quirin.gylstorff@siemens.com> References: <0eb0e7c4-9a8d-7b5e-cd61-770de934cd43@siemens.com> <20190723120613.10503-1-quirin.gylstorff@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: 2ydMn4PiD0vu 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 --- 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