mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 10:22:50 +00:00 
			
		
		
		
	Refactor: Headscale (#6180)
This commit is contained in:
		@@ -27,18 +27,17 @@ function update_script() {
 | 
			
		||||
    msg_error "No ${APP} Installation Found!"
 | 
			
		||||
    exit
 | 
			
		||||
  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) }')
 | 
			
		||||
  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}"
 | 
			
		||||
    systemctl stop headscale
 | 
			
		||||
    msg_ok "Stopped ${APP}"
 | 
			
		||||
 | 
			
		||||
    msg_info "Updating $APP to v${RELEASE}"
 | 
			
		||||
    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}"
 | 
			
		||||
    fetch_and_deploy_gh_release "headscale" "juanfont/headscale" "binary"
 | 
			
		||||
 | 
			
		||||
    msg_info "Starting ${APP}"
 | 
			
		||||
    # Temporary fix until headscale project resolves service getting disabled on updates.
 | 
			
		||||
 
 | 
			
		||||
@@ -13,19 +13,16 @@ setting_up_container
 | 
			
		||||
network_check
 | 
			
		||||
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) }')
 | 
			
		||||
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"
 | 
			
		||||
$STD dpkg -i headscale_${RELEASE}_linux_amd64.deb
 | 
			
		||||
fetch_and_deploy_gh_release "headscale" "juanfont/headscale" "binary"
 | 
			
		||||
 | 
			
		||||
msg_info "Starting service"
 | 
			
		||||
systemctl enable -q --now headscale
 | 
			
		||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
 | 
			
		||||
msg_ok "Installed ${APPLICATION} v${RELEASE}"
 | 
			
		||||
msg_ok "Service started"
 | 
			
		||||
 | 
			
		||||
motd_ssh
 | 
			
		||||
customize
 | 
			
		||||
 | 
			
		||||
msg_info "Cleaning up"
 | 
			
		||||
rm headscale_${RELEASE}_linux_amd64.deb
 | 
			
		||||
$STD apt-get -y autoremove
 | 
			
		||||
$STD apt-get -y autoclean
 | 
			
		||||
msg_ok "Cleaned"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user