From c0f4ac5750e142a84ba34fc5914a55031c433d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Wed, 24 Dec 2025 14:21:58 +0100 Subject: [PATCH] Refactor (#10258) --- ct/podman-homeassistant.sh | 31 +++++++++++++------------ install/podman-homeassistant-install.sh | 14 ++++------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/ct/podman-homeassistant.sh b/ct/podman-homeassistant.sh index 888250441..7ee0fa860 100644 --- a/ct/podman-homeassistant.sh +++ b/ct/podman-homeassistant.sh @@ -37,7 +37,7 @@ function update_script() { if [ "$UPD" == "1" ]; then msg_info "Updating ${APP} LXC" $STD apt update - $STD apt -y upgrade + $STD apt upgrade -y msg_ok "Updated successfully!" msg_info "Updating All Containers\n" @@ -65,7 +65,7 @@ function update_script() { exit fi if [ "$UPD" == "3" ]; then - IP=$(hostname -I | awk '{print $1}') + import_local_ip msg_info "Installing FileBrowser" $STD curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash $STD filebrowser config init -a '0.0.0.0' @@ -74,23 +74,25 @@ function update_script() { msg_ok "Installed FileBrowser" msg_info "Creating Service" - service_path="/etc/systemd/system/filebrowser.service" - echo "[Unit] - Description=Filebrowser - After=network-online.target - [Service] - User=root - WorkingDirectory=/root/ - ExecStart=/usr/local/bin/filebrowser -r / - [Install] - WantedBy=default.target" >$service_path + cat </etc/systemd/system/filebrowser.service +[Unit] +Description=Filebrowser +After=network-online.target - $STD systemctl enable --now filebrowser +[Service] +User=root +WorkingDirectory=/root/ +ExecStart=/usr/local/bin/filebrowser -r / + +[Install] +WantedBy=default.target +EOF + systemctl enable -q --now filebrowser msg_ok "Created Service" msg_ok "Completed Successfully!\n" echo -e "FileBrowser should be reachable by going to the following URL. - ${BL}http://$IP:8080${CL} admin|helper-scripts.com\n" + ${BL}http://$LOCAL_IP:8080${CL} admin|helper-scripts.com\n" exit fi if [ "$UPD" == "4" ]; then @@ -99,7 +101,6 @@ function update_script() { msg_ok "Removed ALL Unused Images" exit fi - } start diff --git a/install/podman-homeassistant-install.sh b/install/podman-homeassistant-install.sh index 0e89adc40..5bc01a6e5 100644 --- a/install/podman-homeassistant-install.sh +++ b/install/podman-homeassistant-install.sh @@ -13,12 +13,8 @@ setting_up_container network_check update_os -get_latest_release() { - curl -fsSL https://api.github.com/repos/$1/releases/latest | grep '"tag_name":' | cut -d'"' -f4 -} - -PORTAINER_LATEST_VERSION=$(get_latest_release "portainer/portainer") -PORTAINER_AGENT_LATEST_VERSION=$(get_latest_release "portainer/agent") +PORTAINER_LATEST_VERSION=$(get_latest_github_release "portainer/portainer") +PORTAINER_AGENT_LATEST_VERSION=$(get_latest_github_release "portainer/agent") if $STD mount | grep 'on / type zfs' >null && echo "ZFS"; then msg_info "Enabling ZFS support." @@ -44,8 +40,8 @@ EOF fi msg_info "Installing Podman" -$STD apt -y install podman -$STD systemctl enable --now podman.socket +$STD apt install -y podman +systemctl enable -q --now podman.socket echo -e 'unqualified-search-registries=["docker.io"]' >>/etc/containers/registries.conf msg_ok "Installed Podman" @@ -97,7 +93,7 @@ $STD podman run -d \ podman generate systemd \ --new --name homeassistant \ >/etc/systemd/system/homeassistant.service -$STD systemctl enable --now homeassistant +systemctl enable -q --now homeassistant msg_ok "Installed Home Assistant" motd_ssh