This commit is contained in:
CanbiZ 2025-06-16 13:57:01 +02:00
parent 9d622a03de
commit 48c7d7ee1b
3 changed files with 126 additions and 7 deletions

44
ct/hanko.sh Normal file
View File

@ -0,0 +1,44 @@
#!/usr/bin/env bash
source <(curl -s https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func)
# Copyright (c) 2021-2025 tteck
# Author: tteck (tteckster)
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://www.debian.org/
APP="Debian"
var_tags="${var_tags:-os}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-512}"
var_disk="${var_disk:-2}"
var_os="${var_os:-debian}"
var_version="${var_version:-12}"
var_unprivileged="${var_unprivileged:-1}"
var_fuse="${var_fuse:-yes}"
var_tun="${var_tun:-yes}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /var ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Updating $APP LXC"
$STD apt-get update
$STD apt-get -y upgrade
msg_ok "Updated $APP LXC"
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"

24
install/hanko-install.sh Normal file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 tteck
# Author: tteck (tteckster)
# License: MIT
# https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
fetch_and_deploy_gh_release "hanko" "teamhanko/hanko" "prebuild" "latest" "/opt/hanko" "hanko_Linux_x86_64.tar.gz"
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"

View File

@ -676,16 +676,33 @@ install_mongodb() {
}
# ------------------------------------------------------------------------------
# Downloads and deploys latest GitHub release tarball.
# Downloads and deploys latest GitHub release (source, binary or asset tarball).
#
# Description:
# - Fetches latest release from GitHub API
# - Detects matching asset by architecture
# - Extracts to /opt/<app> and saves version
# - Fetches latest release metadata from GitHub API
# - Supports source tarball, .deb binary or prebuilt .tar.gz asset
# - Extracts or installs the release and writes version to ~/.<app>
#
# Variables:
# APP - Override default application name (optional)
# GITHUB_TOKEN - (optional) GitHub token for private rate limits
# Parameters:
# $1 APP - Application name (used for target path and version file)
# $2 REPO - GitHub repository (e.g. user/repo)
# $3 MODE - Release type: tarball | source | binary | prebuild
# $4 VERSION - Optional version tag (default: latest)
# $5 TARGET_DIR - Optional install path (default: /opt/<app>)
# $6 ASSET_FILENAME - Required for mode=prebuild (e.g. hanko_Linux_x86_64.tar.gz)
#
# Optional:
# - Set GITHUB_TOKEN env var to increase API rate limit (esp. in CI).
#
# Examples:
# # 1. Minimal: Source tarball (default mode = tarball)
# fetch_and_deploy_gh_release "myapp" "myuser/myapp"
#
# # 2. Binary install via .deb (auto-detected by architecture)
# fetch_and_deploy_gh_release "myapp" "myuser/myapp" "binary"
#
# # 3. Prebuilt asset tar.gz (exact filename match)
# fetch_and_deploy_gh_release "hanko" "teamhanko/hanko" "prebuild" "latest" "/opt/hanko" "hanko_Linux_x86_64.tar.gz"
# ------------------------------------------------------------------------------
fetch_and_deploy_gh_release() {
@ -816,6 +833,40 @@ fetch_and_deploy_gh_release() {
}
}
elif [[ "$mode" == "prebuild" ]]; then
local pattern="$6"
if [[ -z "$pattern" ]]; then
msg_error "Mode 'prebuild' requires 6th parameter (asset filename pattern)"
rm -rf "$tmpdir"
return 1
fi
local assets asset_url=""
assets=$(echo "$json" | jq -r '.assets[].browser_download_url')
for u in $assets; do
if [[ "$u" =~ $pattern || "$u" == *"$pattern" ]]; then
asset_url="$u"
break
fi
done
if [[ -z "$asset_url" ]]; then
msg_error "No asset matching pattern '$pattern' found"
rm -rf "$tmpdir"
return 1
fi
filename="${asset_url##*/}"
$STD msg_info "Downloading prebuilt asset: $asset_url"
curl $curl_timeout -fsSL -o "$tmpdir/$filename" "$asset_url" || {
msg_error "Download failed: $asset_url"
rm -rf "$tmpdir"
return 1
}
mkdir -p "$target"
tar -xzf "$tmpdir/$filename" -C "$target"
else
msg_error "Unknown mode: $mode"
rm -rf "$tmpdir"