mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-10-23 19:55:05 +00:00
Every interactive prompt takes a var_<app>_<name> override and treats a closed stdin like Enter (`|| true`), so an install keeps going after the console that started it is gone. Values the script cannot do without end with exit 64 and name the variable to set. Validation loops stop asking when nobody can answer instead of spinning on an empty read.
58 lines
1.3 KiB
Bash
58 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Copyright (c) 2021-2026 tteck
|
|
# Author: tteck (tteckster)
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
# Source: https://github.com/juanfont/headscale
|
|
|
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
color
|
|
verb_ip6
|
|
catch_errors
|
|
setting_up_container
|
|
network_check
|
|
update_os
|
|
|
|
fetch_and_deploy_gh_release "headscale" "juanfont/headscale" "binary"
|
|
|
|
prompt="${var_headscale_admin:-}"
|
|
[[ -n "$prompt" ]] || read -r -p "${TAB3}Would you like to add headscale-admin UI? <y/N> " prompt || true
|
|
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
|
fetch_and_deploy_gh_release "headscale-admin" "GoodiesHQ/headscale-admin" "prebuild" "latest" "/opt/headscale-admin" "admin.zip"
|
|
|
|
msg_info "Configuring headscale-admin"
|
|
$STD apt install -y caddy
|
|
$STD caddy stop
|
|
rm /etc/caddy/Caddyfile
|
|
cat <<'EOF' >/etc/caddy/Caddyfile
|
|
:80
|
|
|
|
redir /admin /admin/
|
|
|
|
handle_path /admin/* {
|
|
root * /opt/headscale-admin
|
|
encode gzip zstd
|
|
|
|
header {
|
|
X-Content-Type-Options nosniff
|
|
}
|
|
|
|
try_files {path} /opt/headscale-admin/index.html
|
|
file_server
|
|
}
|
|
|
|
reverse_proxy localhost:8080
|
|
EOF
|
|
caddy fmt --overwrite /etc/caddy/Caddyfile
|
|
systemctl start caddy
|
|
msg_ok "Configured headscale-admin"
|
|
fi
|
|
|
|
msg_info "Starting service"
|
|
systemctl enable -q --now headscale
|
|
msg_ok "Service started"
|
|
|
|
motd_ssh
|
|
customize
|
|
cleanup_lxc
|