Refactor: Homer (#10698)

* Refactor

* Update
This commit is contained in:
Slaviša Arežina
2026-01-11 14:14:19 +01:00
committed by GitHub
parent d43899d5ad
commit 932079a9f6
2 changed files with 28 additions and 40 deletions

View File

@@ -11,7 +11,7 @@ var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-512}" var_ram="${var_ram:-512}"
var_disk="${var_disk:-2}" var_disk="${var_disk:-2}"
var_os="${var_os:-debian}" var_os="${var_os:-debian}"
var_version="${var_version:-12}" var_version="${var_version:-13}"
var_unprivileged="${var_unprivileged:-1}" var_unprivileged="${var_unprivileged:-1}"
header_info "$APP" header_info "$APP"
@@ -27,36 +27,31 @@ function update_script() {
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
msg_info "Stopping Service"
systemctl stop homer
msg_ok "Stopped Service"
msg_info "Backing up assets directory" if check_for_gh_release "homer" "bastienwirtz/homer"; then
cd ~ msg_info "Stopping Service"
mkdir -p assets-backup systemctl stop homer
cp -R /opt/homer/assets/. assets-backup msg_ok "Stopped Service"
msg_ok "Backed up assets directory"
msg_info "Updating ${APP}" msg_info "Backing up assets directory"
rm -rf /opt/homer/* cd ~
cd /opt/homer mkdir -p assets-backup
curl -fsSL "https://github.com/bastienwirtz/homer/releases/latest/download/homer.zip" -o $(basename "https://github.com/bastienwirtz/homer/releases/latest/download/homer.zip") cp -R /opt/homer/assets/. assets-backup
$STD unzip homer.zip msg_ok "Backed up assets directory"
msg_ok "Updated ${APP}"
msg_info "Restoring assets directory" CLEAN_INSTALL=1 fetch_and_deploy_gh_release "homer" "bastienwirtz/homer" "prebuild" "latest" "/opt/homer" "homer.zip"
cd ~
cp -Rf assets-backup/. /opt/homer/assets/
msg_ok "Restored assets directory"
msg_info "Cleaning" msg_info "Restoring assets directory"
rm -rf assets-backup /opt/homer/homer.zip cd ~
msg_ok "Cleaned" cp -Rf assets-backup/. /opt/homer/assets/
rm -rf assets-backup
msg_info "Starting Service" msg_ok "Restored assets directory"
systemctl start homer
msg_ok "Started Service" msg_info "Starting Service"
msg_ok "Updated successfully!" systemctl start homer
msg_ok "Started Service"
msg_ok "Updated successfully!"
fi
exit exit
} }

View File

@@ -13,32 +13,25 @@ setting_up_container
network_check network_check
update_os update_os
msg_info "Installing Dependencies" fetch_and_deploy_gh_release "homer" "bastienwirtz/homer" "prebuild" "latest" "/opt/homer" "homer.zip"
$STD apt-get install -y pip cp /opt/homer/assets/config.yml.dist /opt/homer/assets/config.yml
msg_ok "Installed Dependencies"
msg_info "Installing Homer"
mkdir -p /opt/homer
cd /opt/homer
curl -fsSL "https://github.com/bastienwirtz/homer/releases/latest/download/homer.zip" -o "homer.zip"
$STD unzip homer.zip
rm -rf homer.zip
cp assets/config.yml.dist assets/config.yml
msg_ok "Installed Homer"
msg_info "Creating Service" msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/homer.service cat <<EOF >/etc/systemd/system/homer.service
[Unit] [Unit]
Description=Homer Dashboard Description=Homer Dashboard
After=network-online.target After=network-online.target
Wants=network-online.target
[Service] [Service]
Type=simple Type=simple
WorkingDirectory=/opt/homer WorkingDirectory=/opt/homer
ExecStart=python3 -m http.server 8010 ExecStart=python3 -m http.server 8010
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
$STD systemctl enable --now homer systemctl enable -q --now homer
msg_ok "Created Service" msg_ok "Created Service"
motd_ssh motd_ssh