From 18273b8e2808d1537e0f18813f5a6f45759357a4 Mon Sep 17 00:00:00 2001
From: tteckster <tteckster@gmail.com>
Date: Sat, 27 Nov 2021 23:15:22 -0500
Subject: [PATCH] Update podman_ha_setup.sh

---
 podman_ha_setup.sh | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/podman_ha_setup.sh b/podman_ha_setup.sh
index 9c4eb6eb..e99fd6d9 100644
--- a/podman_ha_setup.sh
+++ b/podman_ha_setup.sh
@@ -53,20 +53,13 @@ podman run -d \
   --net=host \
   homeassistant/home-assistant:stable &>/dev/null
 
-echo "Creating service file podman@.service"
-service_path="/etc/systemd/system/podman@.service"
+podman generate systemd \
+    --new --name homeassistant \
+    > /etc/systemd/system/homeassistant.service &>/dev/null
 
-echo "[Unit]
-Description=podman %I container
+systemctl enable homeassistant
+systemctl start homeassistant
 
-[Service]
-Restart=always
-ExecStart=/usr/bin/podman start -a %i
-ExecStop=/usr/bin/podman stop -t 2 %i
-
-[Install]
-WantedBy=local.target" > $service_path
-systemctl enable --now podman@homeassistant &>/dev/null
 
 msg "Customizing container..."
 rm /etc/motd