All of lore.kernel.org
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: <cip-dev@lists.cip-project.org>
Cc: Wang Jing <wangjing@siemens.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Henning Schild <henning.schild@siemens.com>
Subject: [isar-cip-core][PATCH v2 1/1] change-root-homedir: split root home move into own package
Date: Wed, 4 Jan 2023 14:40:39 +0100	[thread overview]
Message-ID: <20230104134039.11897-2-henning.schild@siemens.com> (raw)
In-Reply-To: <20230104134039.11897-1-henning.schild@siemens.com>

Changing the homedir of root that way is required by any layer that
takes ro rootfs pieces from here. Making it its own package allows
reuse without having to take some other customizations.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 .../change-root-homedir_0.1.bb                | 15 +++++++++++++
 .../change-root-homedir/files/postinst        | 21 +++++++++++++++++++
 recipes-core/customizations/common.inc        |  5 +++--
 recipes-core/customizations/files/postinst    |  8 -------
 4 files changed, 39 insertions(+), 10 deletions(-)
 create mode 100644 recipes-core/change-root-homedir/change-root-homedir_0.1.bb
 create mode 100644 recipes-core/change-root-homedir/files/postinst

diff --git a/recipes-core/change-root-homedir/change-root-homedir_0.1.bb b/recipes-core/change-root-homedir/change-root-homedir_0.1.bb
new file mode 100644
index 000000000000..79c7e67d0d70
--- /dev/null
+++ b/recipes-core/change-root-homedir/change-root-homedir_0.1.bb
@@ -0,0 +1,15 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2021-2023
+#
+# Authors:
+#  Henning Schild <henning.schild@siemens.com>
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg-raw
+
+DESCRIPTION = "Move roots homedir to /home for read-only rootfs"
+
+SRC_URI = "file://postinst"
diff --git a/recipes-core/change-root-homedir/files/postinst b/recipes-core/change-root-homedir/files/postinst
new file mode 100644
index 000000000000..918c5ab79aa4
--- /dev/null
+++ b/recipes-core/change-root-homedir/files/postinst
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2019-2023
+#
+# Authors:
+#  Jan Kiszka <jan.kiszka@siemens.com>
+#
+# SPDX-License-Identifier: MIT
+#
+
+set -e
+
+# needed for read-only rootfs with writable /home
+if [ ! -L /root ]; then
+	# usermod --move-home can not be used while the target user
+	# has running processes, also we keep a symlink here
+	mv /root /home/
+	ln -s /home/root /root
+fi
diff --git a/recipes-core/customizations/common.inc b/recipes-core/customizations/common.inc
index 1124ff2d3590..24c862c32e3b 100644
--- a/recipes-core/customizations/common.inc
+++ b/recipes-core/customizations/common.inc
@@ -22,10 +22,11 @@ SRC_URI = " \
 WIRELESS_FIRMWARE_PACKAGE ?= ""
 INSTALL_WIRELESS_TOOLS ??= "0"
 
-DEPENDS += "sshd-regen-keys"
+DEPENDS += "sshd-regen-keys change-root-homedir"
 
 DEBIAN_DEPENDS = " \
-    ifupdown, isc-dhcp-client, net-tools, iputils-ping, ssh, sshd-regen-keys \
+    ifupdown, isc-dhcp-client, net-tools, iputils-ping, ssh, sshd-regen-keys, \
+    change-root-homedir \
     ${@(', iw, wireless-regdb, ' + d.getVar('WIRELESS_FIRMWARE_PACKAGE')) \
 	if d.getVar('INSTALL_WIRELESS_TOOLS') == '1' else ''}"
 
diff --git a/recipes-core/customizations/files/postinst b/recipes-core/customizations/files/postinst
index 7a0b00d98680..7e7ea3692325 100644
--- a/recipes-core/customizations/files/postinst
+++ b/recipes-core/customizations/files/postinst
@@ -21,11 +21,3 @@ fi
 HOSTNAME=demo
 echo "$HOSTNAME" > /etc/hostname
 echo "127.0.0.1 $HOSTNAME" >> /etc/hosts
-
-# needed for read-only rootfs with writable /home
-if [ ! -L /root ]; then
-	# usermod --move-home can not be used while the target user
-	# has running processes, also we keep a symlink here
-	mv /root /home/
-	ln -s /home/root /root
-fi
-- 
2.38.2



  reply	other threads:[~2023-01-04 13:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 13:40 [isar-cip-core][PATCH v2 0/1] root home dir package Henning Schild
2023-01-04 13:40 ` Henning Schild [this message]
2023-01-04 13:51   ` [isar-cip-core][PATCH v2 1/1] change-root-homedir: split root home move into own package Jan Kiszka

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=20230104134039.11897-2-henning.schild@siemens.com \
    --to=henning.schild@siemens.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=jan.kiszka@siemens.com \
    --cc=wangjing@siemens.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.