From ea196ebb7cd5c6d4541c934cf2b3f153afb81b0f Mon Sep 17 00:00:00 2001 From: tteckster Date: Wed, 9 Feb 2022 02:04:21 -0500 Subject: [PATCH] Update podman_ha_setup.sh --- setup/podman_ha_setup.sh | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/setup/podman_ha_setup.sh b/setup/podman_ha_setup.sh index 9a2f15ad..8414086e 100644 --- a/setup/podman_ha_setup.sh +++ b/setup/podman_ha_setup.sh @@ -49,25 +49,54 @@ echo -e "${CHECKMARK} \e[1;92m Installing Dependencies... \e[0m" apt-get update &>/dev/null apt-get -qqy install \ curl \ + sudo \ runc &>/dev/null echo -e "${CHECKMARK} \e[1;92m Installing Podman... \e[0m" apt-get -y install podman &>/dev/null echo -e "${CHECKMARK} \e[1;92m Pulling Home Assistant Image...\e[0m" -podman pull docker.io/homeassistant/home-assistant:stable &>/dev/null +podman pull homeassistant/home-assistant:stable &>/dev/null echo -e "${CHECKMARK} \e[1;92m Installing Home Assistant... \e[0m" podman volume create hass_config >/dev/null podman run -d \ --name homeassistant \ - --restart=always \ + --privileged \ + --restart unless-stopped \ -v /dev:/dev \ -v hass_config:/config \ -v /etc/localtime:/etc/localtime:ro \ + -v /etc/timezone:/etc/timezone:ro \ --net=host \ homeassistant/home-assistant:stable &>/dev/null +echo -e "${CHECKMARK} \e[1;92m Creating Update Script... \e[0m" +file_path="/root/update.sh" +echo "#!/bin/bash +echo -e '\e[1;33m Pulling New Stable Version... \e[0m' +podman pull homeassistant/home-assistant:stable +echo -e '\e[1;33m Stopping Home Assistant... \e[0m' +podman stop homeassistant +echo -e '\e[1;33m Removing Home Assistant... \e[0m' +podman rm homeassistant +echo -e '\e[1;33m Starting Home Assistant... \e[0m' +podman run -d \ + --name homeassistant \ + --privileged \ + --restart unless-stopped \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v /dev:/dev \ + -v hass_config:/config \ + -v /etc/localtime:/etc/localtime:ro \ + -v /etc/timezone:/etc/timezone:ro \ + --net=host \ + homeassistant/home-assistant:stable +echo -e '\e[1;33m Removing Old Image... \e[0m' +podman image prune -f +echo -e '\e[1;33m Finished Update! \e[0m'" > $file_path +sudo chmod +x /root/update.sh + echo -e "${CHECKMARK} \e[1;92m Customizing LXC... \e[0m" rm /etc/motd rm /etc/update-motd.d/10-uname