Just make sure things do not happen twice in case the package gets
installed a second time. Not likely to happen but let us spread good
patterns since maintainer scripts should be idempotent.
Signed-off-by: Henning Schild <henning.schild@...>
---
recipes-core/customizations/files/postinst | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/recipes-core/customizations/files/postinst b/recipes-core/customizations/files/postinst
index 6ca309a0bb8e..2b6db1f1fef3 100644
--- a/recipes-core/customizations/files/postinst
+++ b/recipes-core/customizations/files/postinst
@@ -12,12 +12,16 @@
echo "CIP Core Demo & Test Image (login: root/root)" > /etc/issue
-echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
+if ! grep -e "^PermitRootLogin.*yes" -q /etc/ssh/sshd_config; then
+ echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
+fi
HOSTNAME=demo
echo "$HOSTNAME" > /etc/hostname
echo "127.0.0.1 $HOSTNAME" >> /etc/hosts
# needed for read-only rootfs with writable /home
-mv /root /home/
-ln -s /home/root /root
+if [ ! -L /root ]; then
+ mv /root /home/
+ ln -s /home/root /root
+fi
--
2.37.4