#!/bin/sh set -eu need() { command -v "$1" >/dev/null 2>&1 || { printf '[harbor-connect] error: %s is required\n' "$1" >&2 exit 1 } } need curl need tar [ -x /bin/bash ] || { printf '[harbor-connect] error: /bin/bash is required\n' >&2; exit 1; } branch="${VPN_PROXY_BRANCH:-master}" archive_url="${VPN_PROXY_ARCHIVE_URL:-https://git.dokops.ru/dokril/vpn-proxy/archive/${branch}.tar.gz}" tmp="$(mktemp -d "${TMPDIR:-/tmp}/harbor-connect.XXXXXX")" trap 'rm -rf "$tmp"' 0 1 2 3 15 mkdir -p "$tmp/source" curl -fsSL "$archive_url" | tar -xzf - -C "$tmp/source" --strip-components=1 [ -f "$tmp/source/scripts/install-macos-client.sh" ] || { printf '[harbor-connect] error: installer is missing from archive\n' >&2 exit 1 } VPN_PROXY_SOURCE_DIR="$tmp/source" /bin/bash "$tmp/source/scripts/install-macos-client.sh"