Skip to content
Back to search

closedvps

MarketplaceWorks with Claude CodeGitHub

Buy Hetzner Cloud servers with every inbound port closed, reachable only over Tailscale, for Claude Code, Codex or anything else.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/tulayha--closedvps/badge.svg)](/listings/tulayha--closedvps)

HTML

<a href="/listings/tulayha--closedvps"><img src="/api/listings/tulayha--closedvps/badge.svg" alt="findsafeskills safety rating" /></a>

Install

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

These steps run a script from the network that findsafeskills does not scan.

curl -fsSL https://closedvps.com/install.sh | sh    # macOS, Linux
irm https://closedvps.com/install.ps1 | iex         # Windows
closedvps create

The first run asks three things: your Hetzner API token (Hetzner Console, your project, Security, API tokens, **Read & Write**), which it offers to keep in your system's password store; what the server is for (just a server, Claude Code, Codex, or both); and, once you've seen the plan and said yes, a Tailscale auth key (login.tailscale.com/admin/settings/keys, one-off). Everything else is a default it shows in the plan: the first type Hetzner sells you in nbg1, fsn1 or hel1 for up to 10 a month, no backups, and your local user name. A few minutes after the purchase it prints the command to log in, `ssh you@vps`.

The server asks for the tag `tag:closedvps` itself, which works once your tailnet policy has the two changes in [Tailscale access](#tailscale-access). Until then it joins untagged, and ClosedVPS says how to fix that.

It also needs an SSH key on your computer (it offers to run `ssh-keygen` when there's none) and Tailscale running there, so you can reach the server.

`closedvps setup` saves your own answers: what servers are for, locations, types, price caps, backups, your user name and alerts. Its last step is optional and worth it if you buy often: a Tailscale OAuth client, so ClosedVPS makes a one-off key for each server itself and checks your policy before buying.

closedvps setup                                   # save your defaults
closedvps types                                   # stock and prices, buys nothing
closedvps create -n --show-setup                  # the plan and the exact first-boot setup, buys nothing
closedvps create --name web --claude              # another server, with Claude Code on it
closedvps create --name agents --claude --codex   # with Claude Code and Codex
closedvps create --count 10 --type cx23:6         # ten servers at up to 6 a month each
CLOUDFLARE_TUNNEL_TOKEN=... closedvps create      # with a Cloudflare Tunnel for public sites
closedvps list                                    # what you have, what it costs, what can reach it
closedvps delete vps                              # gone, with its firewall

Any saved answer can be overridden for one run with a flag (`--location`, `--type`, `--max-price`, `--max-total`, `--backups`, `--claude`, `--codex`); `closedvps create --help` lists them. Claude Code and Codex need 4 GB, so with either ClosedVPS only buys types with 4 GB or more.

`closedvps upgrade` replaces it with the newest release, checked against the release's checksums the way the install scripts check it. Once a day at most, a command you run in a terminal asks closedvps.com whether a newer release is out and says so when it ends. The site counts each ask by version, operating system and country, and keeps nothing else. Runs with `--json` or `--yes` never ask, and `CLOSEDVPS_NO_UPDATE_CHECK=1` turns it off. In Docker, pull the image again.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 14 lines
  1. {
  2. "name": "closedvps",
  3. "description": "Buy Hetzner Cloud servers with every inbound port closed, reachable only over Tailscale, for Claude Code, Codex or anything else.",
  4. "owner": { "name": "Talha Amjad", "url": "https://github.com/tulayha" },
  5. "plugins": [
  6. {
  7. "name": "closedvps",
  8. "source": "./",
  9. "description": "Buy Hetzner Cloud servers with every inbound port closed, waiting and retrying while Hetzner is sold out.",
  10. "category": "devops",
  11. "keywords": ["hetzner", "vps", "tailscale", "firewall", "claude-code", "codex", "remote-dev"]
  12. }
  13. ]
  14. }
README.md · README · 272 lines · 2 findings marked
  1. # ClosedVPS
  2. [![CI](https://github.com/tulayha/closedvps/actions/workflows/ci.yml/badge.svg)](https://github.com/tulayha/closedvps/actions/workflows/ci.yml)
  3. [![Release](https://img.shields.io/github/v/release/tulayha/closedvps)](https://github.com/tulayha/closedvps/releases/latest)
  4. [![Go](https://img.shields.io/github/go-mod/go-version/tulayha/closedvps)](go.mod)
  5. [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
  6. ClosedVPS buys Hetzner Cloud servers with a firewall that lets nothing in, and you SSH in over Tailscale. When
  7. Hetzner is sold out it keeps trying, up to the prices you set, and tells you when it has them. It's a single
  8. command that runs on your laptop or any machine that stays on, with no account and no server of ours involved.
  9. ## Quick start
  10. ```sh
  11. curl -fsSL https://closedvps.com/install.sh | sh # macOS, Linux
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 15 on GitHub
  12. ```
  13. ```powershell
  14. irm https://closedvps.com/install.ps1 | iex # Windows
  15. ```
  16. ```sh
  17. closedvps create
  18. ```
  19. The first run asks three things: your Hetzner API token (Hetzner Console, your project, Security, API tokens,
  20. **Read & Write**), which it offers to keep in your system's password store; what the server is for (just a
  21. server, Claude Code, Codex, or both); and, once you've seen the plan and said yes, a Tailscale auth key
  22. (login.tailscale.com/admin/settings/keys, one-off). Everything else is a default it shows in the plan: the
  23. first type Hetzner sells you in nbg1, fsn1 or hel1 for up to 10 a month, no backups, and your local user
  24. name. A few minutes after the purchase it prints the command to log in, `ssh you@vps`.
  25. The server asks for the tag `tag:closedvps` itself, which works once your tailnet policy has the two changes
  26. in [Tailscale access](#tailscale-access). Until then it joins untagged, and ClosedVPS says how to fix that.
  27. It also needs an SSH key on your computer (it offers to run `ssh-keygen` when there's none) and Tailscale
  28. running there, so you can reach the server.
  29. `closedvps setup` saves your own answers: what servers are for, locations, types, price caps, backups, your
  30. user name and alerts. Its last step is optional and worth it if you buy often: a Tailscale OAuth client, so
  31. ClosedVPS makes a one-off key for each server itself and checks your policy before buying.
  32. ```sh
  33. closedvps setup # save your defaults
  34. closedvps types # stock and prices, buys nothing
  35. closedvps create -n --show-setup # the plan and the exact first-boot setup, buys nothing
  36. closedvps create --name web --claude # another server, with Claude Code on it
  37. closedvps create --name agents --claude --codex # with Claude Code and Codex
  38. closedvps create --count 10 --type cx23:6 # ten servers at up to 6 a month each
  39. CLOUDFLARE_TUNNEL_TOKEN=... closedvps create # with a Cloudflare Tunnel for public sites
  40. closedvps list # what you have, what it costs, what can reach it
  41. closedvps delete vps # gone, with its firewall
  42. ```
  43. Any saved answer can be overridden for one run with a flag (`--location`, `--type`, `--max-price`,
  44. `--max-total`, `--backups`, `--claude`, `--codex`); `closedvps create --help` lists them. Claude Code and
  45. Codex need 4 GB, so with either ClosedVPS only buys types with 4 GB or more.
  46. `closedvps upgrade` replaces it with the newest release, checked against the release's checksums the way the
  47. install scripts check it. Once a day at most, a command you run in a terminal asks closedvps.com whether a
  48. newer release is out and says so when it ends. The site counts each ask by version, operating system and
  49. country, and keeps nothing else. Runs with `--json` or `--yes` never ask, and `CLOSEDVPS_NO_UPDATE_CHECK=1`
  50. turns it off. In Docker, pull the image again.
  51. ## Prices and several servers
  52. Every price is per month before VAT, with the IPv4 address included (and backups, when on), in your Hetzner account's
  53. currency. `--max-price` caps each server. A type can carry its own cap in the list, so `--type cx23:6,cx33:12`
  54. tries cx23 at up to 6 and then cx33 at up to 12. `--max-total` caps all the servers ClosedVPS made in that
  55. Hetzner project together, counting the ones already there, and it's checked before every purchase. Prices are
  56. read again on every check, so a price rise while it waits can't push a purchase over a cap.
  57. `--count 10` buys ten servers named vps-1 to vps-10, each with its own firewall. Each check it buys as many as
  58. are in stock and keeps waiting for the rest. A pasted Tailscale key has to be reusable, or only the first
  59. server joins your tailnet; with a saved OAuth client each server gets its own one-off key. Hetzner limits how many servers an account can have; reaching that stops the run, and the
  60. servers already bought stay.
  61. ## Waiting for stock
  62. Since June 2026 Hetzner often shows the cheaper types as unavailable, and it blocks new accounts and some
  63. existing ones, chosen at random, from creating servers. Every minute ClosedVPS asks Hetzner which of your
  64. candidates are in stock and tries them in order. A refusal that waiting can fix means another round. One it
  65. can't fix, such as a bad token or a full account limit, stops it with Hetzner's own message.
  66. It keeps the computer from sleeping on idle while it waits, but closing a laptop lid still sleeps it. For waits
  67. longer than a laptop stays open, run it on a machine that stays on (below).
  68. `closedvps types` shows Hetzner's in-stock flag, which is the same for everyone. Your account can still be
  69. refused, and only trying tells.
  70. ## Alerts
  71. When it buys a server, when the server answers SSH, and when it stops without buying, this computer shows a
  72. notification with a sound. That's all, unless you give it links to send the same alerts to:
  73. | Where | What you give it |
  74. | --- | --- |
  75. | ntfy app | `ntfy` in `closedvps setup` makes a private topic, or `https://ntfy.sh/<topic>` |
  76. | Discord | a channel webhook link (channel settings, Integrations, Webhooks) |
  77. | Slack | an incoming webhook link |
  78. | Telegram | `telegram` in `closedvps setup` connects a bot you make with @BotFather |
  79. | Anything else | any https link, which gets each alert as JSON |
  80. `closedvps setup` saves them in your system's password store and sends a test message. `CLOSEDVPS_NOTIFY`
  81. sets them for one run, and `--notify none` turns them off. `--notify <links>` works too, but leaves the links
  82. in your shell history. The "ready"
  83. alert comes from the new server itself once it's on your tailnet, so it arrives even when the machine running
  84. ClosedVPS has no Tailscale.
  85. ## Running it on a machine that stays on
  86. `create --yes` runs without a terminal. Give it the secrets as environment variables, and the SSH public key
  87. as `CLOSEDVPS_SSH_KEY` where there's no key file.
  88. ```sh
  89. docker run -d --restart on-failure:3 --name closedvps \
  90. -e HCLOUD_TOKEN -e TS_OAUTH_CLIENT_ID -e TS_OAUTH_CLIENT_SECRET -e CLOSEDVPS_NOTIFY \
  91. -e CLOSEDVPS_SSH_KEY="$(cat ~/.ssh/id_ed25519.pub)" \
  92. ghcr.io/tulayha/closedvps create --yes --user you --type cx23:6
  93. docker logs -f closedvps
  94. ```
  95. A wait can take days, which a pasted `TS_AUTHKEY` may not outlast, so an OAuth client (as above, or saved
  96. with `closedvps setup` where the machine has a password store) is the better fit here: the key is made at the
  97. moment of buying. Without a terminal a taken name stops the run, so a restart after a purchase can't buy a
  98. second server. On a Linux machine without Docker, `systemd-run` keeps it going in the background (with
  99. `loginctl enable-linger` it also outlives your login):
  100. ```sh
  101. systemd-run --user --unit=closedvps -E HCLOUD_TOKEN -E TS_AUTHKEY closedvps create --yes --type cx23:6
  102. journalctl --user -u closedvps -f
  103. ```
  104. The exit code says how it ended, and 3 always means a server is billing; `closedvps create --help` lists the
  105. codes. `--json` prints one event per line on stdout and moves the text to stderr, for scripts and agents. The
  106. [skill](skills/closedvps/references/events.md) describes the events.
  107. ## What it creates
  108. In your Hetzner project it adds your SSH public key if Hetzner doesn't have it yet, which also stops Hetzner
  109. from emailing a root password. It creates a firewall named `closedvps-<name>` with no rules, which Hetzner
  110. treats as "drop all inbound, allow all outbound", and then the server with that firewall attached in the same
  111. API call. The server is labelled `managed-by=closedvps`, and backups are switched on right after if you chose
  112. them.
  113. On first boot, cloud-init on the server:
  114. - creates your user with your SSH key and passwordless sudo, and limits SSH to keys, to that user, and to no
  115. root login;
  116. - lets only root reach Hetzner's metadata service, which keeps serving this setup and its secrets for the
  117. server's life, so other users and Docker containers can't read them;
  118. - installs all updates and turns on unattended upgrades, which reboot the server at 04:00 UTC when an update
  119. needs it;
  120. - joins your tailnet under the server's name, after that first reboot if the kernel was updated;
  121. - sets Docker, should you install it later, to publish container ports on 127.0.0.1, on Compose networks too;
  122. - with `CLOUDFLARE_TUNNEL_TOKEN`, installs cloudflared from Cloudflare's apt repository and runs your tunnel;
  123. - with `--claude`, installs Claude Code for your user, plus what its sandbox needs. Run `claude` on the
  124. server to log in.
  125. - with `--codex`, installs OpenAI's Codex CLI for your user, plus the same sandbox pieces. Run
  126. `codex login --device-auth` on the server to log in from your laptop's browser, after turning on device
  127. code login in ChatGPT's security settings.
  128. ## Public websites
  129. Create a tunnel in the Cloudflare dashboard (Networking, Tunnels, Create a tunnel), copy the token from the
  130. install command it shows, and pass it as `CLOUDFLARE_TUNNEL_TOKEN`. Then on the tunnel's Routes tab add a
  131. published application with the service URL `http://127.0.0.1:<port>`. The tunnel connects outward, so the
  132. firewall stays closed.
  133. ## Security model
  134. Nothing on the internet can reach the server. The Hetzner firewall drops every inbound packet, ping
  135. included, before it gets there, and `closedvps list` shows whether each server's firewalls still let nothing
  136. in.
  137. These stay as they are, and you should know them:
  138. - The Hetzner token can do anything in its project. ClosedVPS sends it only to `api.hetzner.cloud`. If you let
  139. it save the token, it goes in the macOS Keychain, Windows Credential Manager or the Linux Secret Service, or
  140. where none exists, a file only you can read in the ClosedVPS config folder. `closedvps forget` deletes it,
  141. the alert links and the Tailscale OAuth client.
  142. A separate Hetzner project for these servers keeps the token away from anything else.
  143. - The Tailscale auth key, the tunnel token and the alert links reach the server in its cloud-init data.
  144. Hetzner keeps that for the server's life in its metadata service, which only root on the server can reach.
  145. A one-off auth key is spent once the server joins; a reusable one for `--count` should expire within a day.
  146. cloudflared needs the tunnel token on the server anyway.
  147. - A server that joins untagged can open connections to every device on your tailnet and drops off it after
  148. 180 days. Each server asks for `tag:closedvps`, which your policy allows once it has the changes in
  149. [Tailscale access](#tailscale-access), and ClosedVPS warns when a new server has no tag.
  150. - A saved Tailscale OAuth client can make tagged keys and read your policy and device list. It can't reach
  151. your devices or change the policy. It's kept like the Hetzner token.
  152. - Outbound traffic is allowed, and your user has passwordless sudo, as on most cloud images.
  153. - Alert links can post to your chat, so they're kept like the token. Each server sends its own "ready" alert
  154. with them and then deletes its copy, though root can still read them from the metadata service. Alerts
  155. carry server names, types and prices (a plain webhook also gets the public IP), never a token. Anyone who knows an ntfy topic's name can
  156. read it, so ClosedVPS makes a random one.
  157. Report vulnerabilities as described in [SECURITY.md](SECURITY.md).
  158. ## Tailscale access
  159. A new tailnet lets every device reach every other one, so a server that Claude Code or a bad package takes
  160. over could reach your laptop. Two changes in the tailnet policy (login.tailscale.com/admin/acls) keep your
  161. devices able to reach the servers and stop the servers from opening connections to anything:
  162. ```jsonc
  163. "tagOwners": { "tag:closedvps": ["autogroup:admin"] },
  164. "grants": [
  165. // was "src": ["*"]; tagged servers aren't members, so they can only answer
  166. {"src": ["autogroup:member"], "dst": ["*"], "ip": ["*"]},
  167. ],
  168. ```
  169. Each server asks for `tag:closedvps` when it joins, so a plain one-off key is enough. Replies to your
  170. connections still get through, and tagged devices skip key expiry. An older tailnet whose policy has `acls` in place of `grants` changes the
  171. `src` of its allow-everything rule the same way. A server that's already running gets the tag from the Machines page, its menu, Edit tags.
  172. [closedvps.com/tailscale](https://closedvps.com/tailscale) explains each step.
  173. ## If Tailscale stops working
  174. ```sh
  175. closedvps open-ssh vps # one rule: TCP 22 from your current public IPv4 only
  176. ssh you@<the server's public IP> # fix it, e.g. sudo tailscale up
  177. closedvps close-ssh vps # the rule is gone again
  178. ```
  179. `open-ssh` looks up your IP at `ipv4.icanhazip.com`; `--from <ip>` skips that.
  180. If SSH itself is broken, use Hetzner's web console. A key-only server has no root password, so set one first
  181. in the Hetzner Console under the server's Rescue tab (Reset root password), then log in as root through the
  182. console's `>_` button. SSH never allows root, so that password only works there. If the reset fails, the same
  183. tab can boot a rescue system with your SSH key; run `closedvps open-ssh` first so you can reach it.
  184. ## Servers you already have
  185. `closedvps list` shows every server in the Hetzner project, made by ClosedVPS or not, with its price, whether
  186. the internet can reach it and what's let in, and whether it's on your tailnet. `--json` adds the firewall
  187. rules. A server with no firewall takes connections on every port it
  188. listens on, Docker's published ports included. [Closing one by hand](https://closedvps.com/guide#close-a-server-you-already-have)
  189. puts Tailscale on it before the firewall goes on, so you never lose your way in.
  190. ## Removing a server
  191. `closedvps delete vps` deletes the server, its disk and backups, and its `closedvps-vps` firewall, after you
  192. type its name. It only deletes servers ClosedVPS made, and it says when snapshots are left, since Hetzner keeps
  193. billing those. Remove the machine from your Tailscale admin too. A firewall left from a stopped run goes the
  194. same way: `closedvps list` names it, and `closedvps delete <name>` removes it.
  195. ## For coding agents
  196. The [skill](skills/closedvps/SKILL.md) covers running ClosedVPS with no prompts. In Claude Code it installs
  197. as a plugin:
  198. ```
  199. /plugin install closedvps --marketplace tulayha/closedvps
  200. ```
  201. It adds `/closedvps:create` and `/closedvps:delete`, and asks you to approve every real buy or delete the agent
  202. runs. Other agents (Codex, Cursor, Gemini CLI and more) can add the skill with:
  203. ```
  204. npx skills add tulayha/closedvps
  205. ```
  206. ## Development
  207. [CONTRIBUTING.md](CONTRIBUTING.md) has the checks and how the code is laid out. The install scripts are in
  208. [install/](install/), and closedvps.com is on the [site branch](https://github.com/tulayha/closedvps/tree/site).
  209. ## License
  210. [MIT](LICENSE)
install/install.ps1 · Bundled script · 42 lines · 1 finding marked
  1. # Installs closedvps from its GitHub release: irm https://closedvps.com/install.ps1 | iex
    • Note: Runs a downloaded PowerShell script (iex / Invoke-Expression)
    • Line 1 on GitHub
  2. # $env:CLOSEDVPS_VERSION = "v1.2.3" picks a release (default: latest). The download is checked against the
  3. # release's checksums.txt. Installs to %LOCALAPPDATA%\Programs\closedvps and adds it to your user PATH.
  4. & {
  5. $ErrorActionPreference = 'Stop'
  6. [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
  7. $repo = 'tulayha/closedvps'
  8. $arch = if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { 'arm64' } else { 'amd64' }
  9. $base = if ($env:CLOSEDVPS_DOWNLOAD_BASE) { $env:CLOSEDVPS_DOWNLOAD_BASE } # CI tests the script against a local build
  10. elseif ($env:CLOSEDVPS_VERSION) { "https://github.com/$repo/releases/download/$env:CLOSEDVPS_VERSION" }
  11. else { "https://github.com/$repo/releases/latest/download" }
  12. $file = "closedvps_windows_$arch.zip"
  13. $dir = Join-Path $env:LOCALAPPDATA 'Programs\closedvps'
  14. $tmp = Join-Path ([IO.Path]::GetTempPath()) ("closedvps-" + [guid]::NewGuid())
  15. New-Item -ItemType Directory -Path $tmp | Out-Null
  16. try {
  17. Write-Host "Downloading $file"
  18. $ProgressPreference = 'SilentlyContinue'
  19. Invoke-WebRequest -UseBasicParsing -Uri "$base/$file" -OutFile (Join-Path $tmp $file)
  20. Invoke-WebRequest -UseBasicParsing -Uri "$base/checksums.txt" -OutFile (Join-Path $tmp 'checksums.txt')
  21. $line = Get-Content (Join-Path $tmp 'checksums.txt') | Where-Object { $_ -match " $([regex]::Escape($file))$" }
  22. if (-not $line) { throw "$file is not listed in checksums.txt" }
  23. $want = ($line -split ' ')[0]
  24. $got = (Get-FileHash -Algorithm SHA256 (Join-Path $tmp $file)).Hash.ToLower()
  25. if ($got -ne $want) { throw "checksum mismatch for $file; not installing" }
  26. Expand-Archive -Path (Join-Path $tmp $file) -DestinationPath $tmp -Force
  27. New-Item -ItemType Directory -Path $dir -Force | Out-Null
  28. Copy-Item (Join-Path $tmp 'closedvps.exe') (Join-Path $dir 'closedvps.exe') -Force
  29. } finally {
  30. Remove-Item -Recurse -Force $tmp -ErrorAction SilentlyContinue
  31. }
  32. $userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
  33. if (($userPath -split ';') -notcontains $dir) {
  34. [Environment]::SetEnvironmentVariable('Path', (($userPath, $dir) -join ';').Trim(';'), 'User')
  35. }
  36. if (($env:Path -split ';') -notcontains $dir) { $env:Path = "$env:Path;$dir" }
  37. Write-Host "Installed $(& (Join-Path $dir 'closedvps.exe') version) to $dir"
  38. Write-Host 'Next: closedvps create'
  39. }
install/install.sh · Bundled script · 66 lines · 2 findings marked
  1. #!/bin/sh
  2. # Installs closedvps from its GitHub release: curl -fsSL https://closedvps.com/install.sh | sh
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 2 on GitHub
  3. # CLOSEDVPS_VERSION=v1.2.3 picks a release (default: latest); CLOSEDVPS_INSTALL_DIR picks the folder
  4. # (default: ~/.local/bin). The download is checked against the release's checksums.txt.
  5. set -eu
  6. main() {
  7. repo="tulayha/closedvps"
  8. case "$(uname -s)" in
  9. Linux) os=linux ;;
  10. Darwin) os=darwin ;;
  11. *) fail "this script is for macOS and Linux; on Windows run: irm https://closedvps.com/install.ps1 | iex" ;;
  12. esac
  13. case "$(uname -m)" in
  14. x86_64 | amd64) arch=amd64 ;;
  15. arm64 | aarch64) arch=arm64 ;;
  16. *) fail "no build for $(uname -m)" ;;
  17. esac
  18. if [ -n "${CLOSEDVPS_DOWNLOAD_BASE:-}" ]; then # CI tests the script against a local build
  19. base="$CLOSEDVPS_DOWNLOAD_BASE"
  20. elif [ -n "${CLOSEDVPS_VERSION:-}" ]; then
  21. base="https://github.com/$repo/releases/download/$CLOSEDVPS_VERSION"
  22. else
  23. base="https://github.com/$repo/releases/latest/download"
  24. fi
  25. dir="${CLOSEDVPS_INSTALL_DIR:-$HOME/.local/bin}"
  26. file="closedvps_${os}_${arch}.tar.gz"
  27. tmp="$(mktemp -d)"
  28. trap 'rm -rf "$tmp"' EXIT
  29. echo "Downloading $file"
  30. curl -fsSL -o "$tmp/$file" "$base/$file" || fail "download failed: $base/$file"
  31. curl -fsSL -o "$tmp/checksums.txt" "$base/checksums.txt" || fail "download failed: $base/checksums.txt"
  32. want="$(grep " $file\$" "$tmp/checksums.txt" | cut -d' ' -f1)"
  33. [ -n "$want" ] || fail "$file is not listed in checksums.txt"
  34. if command -v sha256sum >/dev/null 2>&1; then
  35. got="$(sha256sum "$tmp/$file" | cut -d' ' -f1)"
  36. else
  37. got="$(shasum -a 256 "$tmp/$file" | cut -d' ' -f1)"
  38. fi
  39. [ "$got" = "$want" ] || fail "checksum mismatch for $file; not installing"
  40. tar -xzf "$tmp/$file" -C "$tmp" closedvps
  41. mkdir -p "$dir"
  42. mv "$tmp/closedvps" "$dir/closedvps"
  43. chmod 755 "$dir/closedvps"
  44. echo "Installed $("$dir/closedvps" version) to $dir/closedvps"
  45. case ":$PATH:" in
  46. *":$dir:"*) echo "Next: closedvps create" ;;
  47. *)
  48. echo
  49. echo "$dir is not on your PATH yet. Add it in your shell's startup file, or run it directly:"
  50. echo " $dir/closedvps create"
  51. ;;
  52. esac
  53. }
  54. fail() {
  55. echo "closedvps install: $1" >&2
  56. exit 1
  57. }
  58. main "$@"

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.