public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: isar-users@googlegroups.com
Cc: Alexander Smirnov <asmirnov@ilbers.de>,
	Henning Schild <henning.schild@siemens.com>
Subject: [PATCHv3] image: set the root password conditionally
Date: Thu, 19 Oct 2017 14:18:25 +0200	[thread overview]
Message-ID: <20171019121825.14627-1-henning.schild@siemens.com> (raw)
In-Reply-To: <20171018095822.4150-1-henning.schild@siemens.com>

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 <henning.schild@siemens.com>
---
 .../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 <you@domain.com>"
-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


  reply	other threads:[~2017-10-19 12:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09 14:59 [PATCH 0/3] a few changes small changes Henning Schild
2017-10-09 14:59 ` [PATCH 1/3] image: set the root password conditionally Henning Schild
2017-10-18  9:58   ` [PATCHv2] " Henning Schild
2017-10-19 12:18     ` Henning Schild [this message]
2017-10-19 19:36       ` [PATCHv3] " Alexander Smirnov
2017-10-09 14:59 ` [PATCH 2/3] meta-isar: images: mount /proc around multistrap and configscript Henning Schild
2017-10-09 14:59 ` [PATCH 3/3] configscript: remove duplicates of 'dpkg --configure' Henning Schild
2017-10-16 18:47 ` [PATCH 0/3] a few changes small changes Alexander Smirnov
2017-10-18 11:11 ` Alexander Smirnov

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=20171019121825.14627-1-henning.schild@siemens.com \
    --to=henning.schild@siemens.com \
    --cc=asmirnov@ilbers.de \
    --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