From 965178f09ba414cde8cf09548fd58ea219ca0864 Mon Sep 17 00:00:00 2001 From: Florian Asche Date: Mon, 2 Mar 2026 17:41:13 +0100 Subject: [PATCH 1/2] skip hostname change if hostname is already changed by rpi-imager --- .../05-set-hostname/files/configure_hostname.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/01-stage-picompose/05-set-hostname/files/configure_hostname.sh b/01-stage-picompose/05-set-hostname/files/configure_hostname.sh index d916efc..01afc85 100644 --- a/01-stage-picompose/05-set-hostname/files/configure_hostname.sh +++ b/01-stage-picompose/05-set-hostname/files/configure_hostname.sh @@ -1,5 +1,14 @@ #!/bin/bash +# Get current hostname +CURRENT_HOSTNAME=$(hostname) + +# Only proceed if current hostname is "picompose" +if [ "$CURRENT_HOSTNAME" != "picompose" ]; then + echo "Current hostname is $CURRENT_HOSTNAME (not picompose), skipping hostname change" + exit 0 +fi + # Get active interface IFACE=$(ip route | grep default | awk '{print $5}' | head -n 1) From 197a4c7e1096c3962bd1e9d2b70cb26218f07c12 Mon Sep 17 00:00:00 2001 From: Florian Asche Date: Mon, 2 Mar 2026 17:45:13 +0100 Subject: [PATCH 2/2] make sure that systemd set hostname only one time --- .../05-set-hostname/files/configure_hostname.service | 1 + 1 file changed, 1 insertion(+) diff --git a/01-stage-picompose/05-set-hostname/files/configure_hostname.service b/01-stage-picompose/05-set-hostname/files/configure_hostname.service index 00e2414..73e74b1 100644 --- a/01-stage-picompose/05-set-hostname/files/configure_hostname.service +++ b/01-stage-picompose/05-set-hostname/files/configure_hostname.service @@ -6,6 +6,7 @@ Wants=network-online.target [Service] Type=oneshot ExecStart=/usr/bin/configure_hostname.sh +ExecStartPost=/bin/systemctl disable --now %n RemainAfterExit=yes Restart=on-failure RestartSec=30s