mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-02 11:39:06 +02:00
Homebrew deprecated the postflight and uninstall_preflight cask stanzas in favour of the declarative *_steps DSL, so every brew command that evaluates netbirdio/tap now prints deprecation warnings. Once the deprecation becomes a disable the generated cask stops loading and netbird-ui can no longer be installed or upgraded through Homebrew. The *_steps blocks take JSON-serialisable steps run in a sandbox rather than arbitrary Ruby, so system_command is re-expressed as run/remove. The two postflight blocks merge into one because a cask carries only a single instance, preserving the original order. set_permissions moves from a hardcoded /Applications to base: :appdir, matching what the installer invocation already did. The launchctl fallbacks keep their tolerant semantics through must_succeed: false, and remove is a no-op when the plist is absent.
37 lines
1.4 KiB
Cheetah
37 lines
1.4 KiB
Cheetah
{{ $projectName := env.Getenv "PROJECT" }}{{ $amdFilePath := env.Getenv "AMD" }}{{ $armFilePath := env.Getenv "ARM" }}
|
|
{{ $amdURL := env.Getenv "AMD_URL" }}{{ $armURL := env.Getenv "ARM_URL" }}
|
|
{{ $amdFile := filepath.Base $amdFilePath }}{{ $armFile := filepath.Base $armFilePath }}{{ $amdFileBytes := file.Read $amdFilePath }}
|
|
{{ $armFileBytes := file.Read $armFilePath }}# Netbird's UI Client Cask Formula
|
|
cask "{{ $projectName }}" do
|
|
version "{{ env.Getenv "VERSION" }}"
|
|
|
|
if Hardware::CPU.intel?
|
|
url "{{ $amdURL }}"
|
|
sha256 "{{ crypto.SHA256 $amdFileBytes }}"
|
|
app "netbird_ui_darwin", target: "Netbird UI.app"
|
|
else
|
|
url "{{ $armURL }}"
|
|
sha256 "{{ crypto.SHA256 $armFileBytes }}"
|
|
app "netbird_ui_darwin", target: "Netbird UI.app"
|
|
end
|
|
|
|
depends_on formula: "netbird"
|
|
|
|
postflight_steps do
|
|
set_permissions ["Netbird UI.app/installer.sh", "Netbird UI.app/uninstaller.sh"], "0755",
|
|
base: :appdir, recursive: false
|
|
run "Netbird UI.app/installer.sh", args: ["#{version}"], base: :appdir, sudo: true
|
|
end
|
|
|
|
uninstall_preflight_steps do
|
|
run "/bin/launchctl", args: ["bootout", "system/netbird"], sudo: true, must_succeed: false
|
|
run "/bin/launchctl", args: ["unload", "/Library/LaunchDaemons/netbird.plist"],
|
|
sudo: true, must_succeed: false
|
|
remove "/Library/LaunchDaemons/netbird.plist", sudo: true
|
|
end
|
|
|
|
name "Netbird UI"
|
|
desc "Netbird UI Client"
|
|
homepage "https://www.netbird.io/"
|
|
end
|