From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6474925990321586176 X-Received: by 10.80.230.12 with SMTP id y12mr447927edm.6.1508415507705; Thu, 19 Oct 2017 05:18:27 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.80.170.121 with SMTP id p54ls2809291edc.7.gmail; Thu, 19 Oct 2017 05:18:27 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TVfc+n3YYlVH+f6EiW/nkcAh2jd5EBmK6lNZhyLjUjFJR0Q1WAdBnm1UzeROQ3lqDx637T X-Received: by 10.80.204.74 with SMTP id n10mr445840edi.2.1508415507453; Thu, 19 Oct 2017 05:18:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508415507; cv=none; d=google.com; s=arc-20160816; b=ziRxPa0AZHR8PRLxpTxriqDIMKrPqdiFPV+I6+/p2kvlk7mtNIboDKaWjHgCxAzAMr iLG4/L18wHiugq9eTw0JQ888sA+lLfJa0QnqxO88sNkz7mN487T0nVy8JSOz1ZlcQr74 fodSYYG0qwbVLClfPA86x19a2ddu+P+OT9iaztj4YsrNoOa1L6Hpn8/31/zXliz3p6wp 5lDktFSVAoaj57QeSdmPiDeVYWCPL/ULoIJ7APBQwYh7HWIJLbcV0QlklbSciCLt+uDu kUV8OoO0X4xFD3jYLkb5MNyl4a8bhAEKH9GsybYtO4t8SN/UyhQ6L5ckgg01FxgtltSR LP7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=0gN86p8+usyoobsvwqIU3tWorXAnoQ4RVdFJTF83uz8=; b=sACFtaCig2uj5I+CqQsiZkrz4M4VzBTCAccP1eHER18gBbbTdhxzbwcGNqw3iP/8d+ 3+epZoBOiruNRfJFYNcVsBEOOvYvTr/Hr2I+LE2BcUh+LfxLBxtW3MNZ3Jxliug1oWjn WTHHqP3NH4KucYSobT8YbIUVu5HJ/lDgEA23nKZdbdJLmKbh2thdoVZyTvNCJh3xFkHe 7VlplNiJ6zecb49hWOnqtiHEV0R9JIRl+vMqafFfnj6kL3DoCLzyNaij+DUN4QRxVO5g TeFk9ml7lhWdJGnlnnGX3SPrJOHmT2ssePBtYj85a42syU9Uk+81FJFp3dfzXBsC3/LI yDOw== 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 Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id f9si860461edm.1.2017.10.19.05.18.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Oct 2017 05:18:27 -0700 (PDT) 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 Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id v9JCIQvF027349 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Oct 2017 14:18:26 +0200 Received: from md1em3qc.ww002.siemens.net ([139.25.68.40]) by mail1.siemens.de (8.15.2/8.15.2) with ESMTP id v9JCIQV9013774; Thu, 19 Oct 2017 14:18:26 +0200 From: Henning Schild To: isar-users@googlegroups.com Cc: Alexander Smirnov , Henning Schild Subject: [PATCHv3] image: set the root password conditionally Date: Thu, 19 Oct 2017 14:18:25 +0200 Message-Id: <20171019121825.14627-1-henning.schild@siemens.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171018095822.4150-1-henning.schild@siemens.com> References: <20171018095822.4150-1-henning.schild@siemens.com> X-TUID: 6yrp2z3HHEoQ If the root password was set by a hook script of a package, do not set it in the configure script. Add chpasswd to example-raw to demonstrate that. Signed-off-by: Henning Schild --- .../example-raw/{example-raw_0.1.bb => example-raw_0.2.bb} | 7 ++++++- meta-isar/recipes-core/images/files/debian-configscript.sh | 3 ++- meta-isar/recipes-core/images/files/raspbian-configscript.sh | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) rename meta-isar/recipes-app/example-raw/{example-raw_0.1.bb => example-raw_0.2.bb} (80%) diff --git a/meta-isar/recipes-app/example-raw/example-raw_0.1.bb b/meta-isar/recipes-app/example-raw/example-raw_0.2.bb similarity index 80% rename from meta-isar/recipes-app/example-raw/example-raw_0.1.bb rename to meta-isar/recipes-app/example-raw/example-raw_0.2.bb index 08c7277..c431321 100644 --- a/meta-isar/recipes-app/example-raw/example-raw_0.1.bb +++ b/meta-isar/recipes-app/example-raw/example-raw_0.2.bb @@ -5,7 +5,7 @@ DESCRIPTION = "Sample application for ISAR" MAINTAINER = "Your name here " -DEBIAN_DEPENDS = "apt" +DEBIAN_DEPENDS = "apt passwd" SRC_URI = "file://README \ file://postinst" @@ -28,6 +28,11 @@ do_install() { bbnote "Now for a debian hook, see dpkg-deb" install -v -m 755 ${WORKDIR}/postinst ${D}/DEBIAN/postinst + # this wins over meta-isar/recipes-core/images/files/*configscript.sh + # but we take the same password for this example + bbnote "Set the root password" + echo 'echo "root:root" | chpasswd' >> ${D}/DEBIAN/postinst + bbnote "Now for a fake config file" echo "# empty config file" > ${WORKDIR}/${PN}.conf install -v -d ${D}/usr/local/etc/ diff --git a/meta-isar/recipes-core/images/files/debian-configscript.sh b/meta-isar/recipes-core/images/files/debian-configscript.sh index e2c03b5..698277c 100644 --- a/meta-isar/recipes-core/images/files/debian-configscript.sh +++ b/meta-isar/recipes-core/images/files/debian-configscript.sh @@ -49,7 +49,8 @@ mount proc -t proc /proc dpkg --configure -a umount /proc -echo "root:root" | chpasswd +# set the root password if that has not been done before +grep "root:\*:" /etc/shadow && echo "root:root" | chpasswd cat > /etc/fstab << EOF # Begin /etc/fstab diff --git a/meta-isar/recipes-core/images/files/raspbian-configscript.sh b/meta-isar/recipes-core/images/files/raspbian-configscript.sh index b1f8fd6..61a1aa5 100644 --- a/meta-isar/recipes-core/images/files/raspbian-configscript.sh +++ b/meta-isar/recipes-core/images/files/raspbian-configscript.sh @@ -53,7 +53,8 @@ mount proc -t proc /proc dpkg --configure -a umount /proc -echo "root:root" | chpasswd +# set the root password if that has not been done before +grep "root:\*:" /etc/shadow && echo "root:root" | chpasswd cat > /etc/fstab << EOF # Begin /etc/fstab -- 2.13.6