Refactor: Headscale (#6180)

This commit is contained in:
Slaviša Arežina 2025-07-24 12:43:32 +02:00 committed by GitHub
parent de1a93bf6d
commit 1f51e96cb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 14 deletions

View File

@ -27,18 +27,17 @@ function update_script() {
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
if [[ -f /opt/${APP}_version.txt ]]; then
mv /opt/"${APP}_version.txt" ~/.headscale
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/juanfont/headscale/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') RELEASE=$(curl -fsSL https://api.github.com/repos/juanfont/headscale/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then if [[ "${RELEASE}" != "$(cat ~/.headscale 2>/dev/null)" ]] || [[ ! -f ~/.headscale ]]; then
msg_info "Stopping ${APP}" msg_info "Stopping ${APP}"
systemctl stop headscale systemctl stop headscale
msg_ok "Stopped ${APP}" msg_ok "Stopped ${APP}"
msg_info "Updating $APP to v${RELEASE}" fetch_and_deploy_gh_release "headscale" "juanfont/headscale" "binary"
curl -fsSL "https://github.com/juanfont/headscale/releases/download/v${RELEASE}/headscale_${RELEASE}_linux_amd64.deb" -o $(basename "https://github.com/juanfont/headscale/releases/download/v${RELEASE}/headscale_${RELEASE}_linux_amd64.deb")
dpkg -i headscale_${RELEASE}_linux_amd64.deb
rm headscale_${RELEASE}_linux_amd64.deb
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated $APP to ${RELEASE}"
msg_info "Starting ${APP}" msg_info "Starting ${APP}"
# Temporary fix until headscale project resolves service getting disabled on updates. # Temporary fix until headscale project resolves service getting disabled on updates.

View File

@ -13,19 +13,16 @@ setting_up_container
network_check network_check
update_os update_os
RELEASE=$(curl -fsSL https://api.github.com/repos/juanfont/headscale/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') fetch_and_deploy_gh_release "headscale" "juanfont/headscale" "binary"
msg_info "Installing ${APPLICATION} v${RELEASE}"
curl -fsSL "https://github.com/juanfont/headscale/releases/download/v${RELEASE}/headscale_${RELEASE}_linux_amd64.deb" -o "headscale_${RELEASE}_linux_amd64.deb" msg_info "Starting service"
$STD dpkg -i headscale_${RELEASE}_linux_amd64.deb
systemctl enable -q --now headscale systemctl enable -q --now headscale
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt msg_ok "Service started"
msg_ok "Installed ${APPLICATION} v${RELEASE}"
motd_ssh motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
rm headscale_${RELEASE}_linux_amd64.deb
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
msg_ok "Cleaned" msg_ok "Cleaned"