- Fixes#1281. Supersedes #1306.
- When `-a` runs as a regular user (such as via
`brew install container`), two launchctl failures
bubble up as a non-zero exit and break Homebrew's
post-install:
- `bootout` against `system` requires root.
- `launchctl print` lists Mach endpoint names that
aren't loaded jobs, so `bootout` returns
`No such process` on them.
- Skip `system` when not root, and treat individual
`bootout` failures as non-fatal. Same fix applied to
the non-`-a` `xargs` pipeline.
Signed-off-by: Patrick Linnane <patrick@linnane.io>
- Services started from Terminal run in the `gui/$uid`
launchd domain. When `ensure-container-stopped.sh`
runs from a different context, `launchctl managername`
may return a different domain, causing the script to
check the wrong domain and miss running services.
I noticed this after upgrading `container` via Homebrew.
- Introduces a getopt option `-a` that allows booting out all
domains explicitly. Also adds `-h` for a usage message.
Signed-off-by: Patrick Linnane <patrick@linnane.io>