fix: stop netbird-ui upgrade from printing launchctl errors

Upstream installer.sh always runs `netbird service stop` and
`netbird service uninstall` with stderr shown. uninstall_preflight_steps
has already removed the service by then, so every upgrade printed two
launchctl errors even though nothing failed.

Run the same steps from postflight_steps instead and silence only the
stop and uninstall calls. A failed service install or start now fails
the cask instead of being swallowed by `|| true`.
This commit is contained in:
tri committed 2026-10-27 14:58:55 +07:00
1 parent e4fd7d2255
commit 867a069427
1 file changed
+13 -4
+13 -4
View File
@@ -20,11 +20,20 @@ cask "netbird-ui" do
app "netbird_ui_darwin", target: "Netbird UI.app" app "netbird_ui_darwin", target: "Netbird UI.app"
# The release zip ships installer.sh as 0644. Upstream chmods it inside the # Do what upstream's installer.sh does without running it. The script always
# signed bundle, which can fail with "Operation not permitted". Running it # calls `netbird service stop` and `netbird service uninstall` and lets their
# through /bin/sh needs no chmod. # stderr through. On upgrade, uninstall_preflight_steps has already removed
# the service, so both print launchctl errors even though nothing failed.
postflight_steps do postflight_steps do
run "/bin/sh", args: ["{{appdir}}/Netbird UI.app/installer.sh", version], sudo: true run "/usr/bin/osascript", args: ["-e", 'quit app "Netbird UI"'],
sudo: true, must_succeed: false, print_stderr: false
run "{{HOMEBREW_PREFIX}}/bin/netbird", args: ["service", "stop"],
sudo: true, must_succeed: false, print_stderr: false
run "{{HOMEBREW_PREFIX}}/bin/netbird", args: ["service", "uninstall"],
sudo: true, must_succeed: false, print_stderr: false
run "{{HOMEBREW_PREFIX}}/bin/netbird", args: ["service", "install"], sudo: true
run "{{HOMEBREW_PREFIX}}/bin/netbird", args: ["service", "start"], sudo: true
run "/usr/bin/open", args: ["{{appdir}}/Netbird UI.app"], sudo: true, must_succeed: false
end end
# bootout returns before launchd has removed system/netbird. On upgrade the # bootout returns before launchd has removed system/netbird. On upgrade the