From 643bcd634310909d01e1365cf5f3aaac98f25414 Mon Sep 17 00:00:00 2001
From: Eduardo Minguez <eduardo.minguez@suse.com>
Date: Tue, 11 Nov 2025 17:10:01 +0100
Subject: [PATCH] Fix #808

---
 pkg/combustion/templates/31-elemental-register.sh.tpl | 2 ++
 1 files changed, 2 insertions(+)

diff --git a/pkg/combustion/templates/31-elemental-register.sh.tpl b/pkg/combustion/templates/31-elemental-register.sh.tpl
index c1ff4337..91f8b4c2 100644
--- a/pkg/combustion/templates/31-elemental-register.sh.tpl
+++ b/pkg/combustion/templates/31-elemental-register.sh.tpl
@@ -20,8 +20,10 @@ WantedBy=network-online.target
 [Service]
 EnvironmentFile=-/etc/sysconfig/proxy
 Type=oneshot
+ExecStartPre=/usr/bin/mkdir -p /etc/rancher/elemental/agent
 ExecStart=/usr/sbin/elemental-register --debug --config-path /etc/elemental/config.yaml --state-path /etc/elemental/state.yaml --install --no-toolkit
 ExecStartPost=/usr/bin/cp /var/lib/elemental/agent/elemental_connection.json /etc/rancher/elemental/agent
+ExecStartPost=/usr/bin/systemctl restart elemental-system-agent.service
 Restart=on-failure
 RestartSec=10
 EOF
