Replaces Ninite for endpoint software: one catalog, one command line, and the same behaviour on Windows, macOS and Linux. Single static binary, no server and no agent, driven from an RMM script runner or by hand. - catalog of ~50 apps compiled into the binary, extendable with YAML overlays in catalog.d or via --catalog, no rebuild required - providers: winget, choco, brew, cask, apt, dnf/yum, zypper, pacman, flatpak, snap, plus direct vendor downloads (msi/exe/msu/dmg/pkg/deb/rpm/zip/tar.gz/ AppImage) - sources are tried in order and fall through, so one catalog entry covers winget on Windows, a cask on macOS and the vendor .deb on Debian - provider-independent detection (registry, paths, commands) makes runs idempotent even for software installed by hand - unattended by construction: stdin closed, silent flags, per-command timeouts - handles the traps that break naive wrappers: winget missing under SYSTEM, Homebrew refusing root, 1641/3010 reboot exits, "already installed" reported as failure - --json summary on stdout with progress on stderr, and RMM-friendly exit codes (0 ok, 1 failed, 2 usage, 3 privileges) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
188 lines
5.2 KiB
Markdown
188 lines
5.2 KiB
Markdown
# Running deployr from an RMM
|
|
|
|
Deployr is a single binary with meaningful exit codes, so any script runner can
|
|
drive it. The pattern is always the same: make sure the binary is on the
|
|
machine, run it, return its exit code.
|
|
|
|
| Code | Meaning | Suggested RMM handling |
|
|
| --- | --- | --- |
|
|
| `0` | Everything is in the requested state | Success |
|
|
| `1` | At least one app failed | Alert, read the JSON `results` |
|
|
| `2` | Usage or catalog error | Alert — the script or overlay is wrong |
|
|
| `3` | Insufficient privileges | Fix the policy's run-as context |
|
|
|
|
Progress goes to **stderr**, the `--json` summary to **stdout**. An RMM that
|
|
captures both gets a readable transcript and a parseable result from one run.
|
|
|
|
## Getting the binary onto the machine
|
|
|
|
Deployr has no self-update, on purpose: the RMM already does software
|
|
distribution, and one authority beating another is how endpoints drift. Ship it
|
|
the way you ship any other tool.
|
|
|
|
### Windows
|
|
|
|
```powershell
|
|
$dir = "C:\ProgramData\Deployr"
|
|
$exe = "$dir\deployr.exe"
|
|
$src = "https://files.example.com/deployr/deployr_windows_amd64.exe"
|
|
$expected = "PUT_THE_SHA256_HERE"
|
|
|
|
New-Item -ItemType Directory -Force -Path $dir | Out-Null
|
|
|
|
$need = $true
|
|
if (Test-Path $exe) {
|
|
$need = (Get-FileHash $exe -Algorithm SHA256).Hash -ne $expected
|
|
}
|
|
if ($need) {
|
|
Invoke-WebRequest -Uri $src -OutFile "$exe.new" -UseBasicParsing
|
|
if ((Get-FileHash "$exe.new" -Algorithm SHA256).Hash -ne $expected) {
|
|
Remove-Item "$exe.new"; throw "deployr checksum mismatch"
|
|
}
|
|
Move-Item "$exe.new" $exe -Force
|
|
}
|
|
```
|
|
|
|
### macOS / Linux
|
|
|
|
```sh
|
|
BIN=/usr/local/bin/deployr
|
|
SRC=https://files.example.com/deployr/deployr_linux_amd64
|
|
EXPECTED=PUT_THE_SHA256_HERE
|
|
|
|
if [ ! -x "$BIN" ] || [ "$(shasum -a 256 "$BIN" | cut -d' ' -f1)" != "$EXPECTED" ]; then
|
|
curl -fsSL "$SRC" -o /tmp/deployr.new
|
|
echo "$EXPECTED /tmp/deployr.new" | shasum -a 256 -c - || exit 1
|
|
install -m 0755 /tmp/deployr.new "$BIN"
|
|
rm -f /tmp/deployr.new
|
|
fi
|
|
```
|
|
|
|
## Level.io
|
|
|
|
Level runs scripts as SYSTEM on Windows and root on macOS/Linux, which is what
|
|
deployr wants. Create one script per intent and attach it to a policy.
|
|
|
|
**Windows — install the standard bundle**
|
|
|
|
```powershell
|
|
$exe = "C:\ProgramData\Deployr\deployr.exe"
|
|
& $exe install @standard --json
|
|
exit $LASTEXITCODE
|
|
```
|
|
|
|
**macOS / Linux — patch everything present, weekly**
|
|
|
|
```sh
|
|
#!/bin/sh
|
|
/usr/local/bin/deployr update --all --json
|
|
```
|
|
|
|
Level surfaces a non-zero exit as a failed script run, so no extra wiring is
|
|
needed for alerting.
|
|
|
|
## NinjaOne
|
|
|
|
Ninja's script results branch on exit code the same way. Add deployr as a script
|
|
with **Run As: System**, then either:
|
|
|
|
- **Scheduled patching** — `deployr update --all --json` on a weekly policy.
|
|
- **Onboarding** — `deployr install @standard --json` as a task on new devices.
|
|
- **On-demand** — take the app list as a script parameter:
|
|
|
|
```powershell
|
|
param([string]$Apps = "@standard")
|
|
$exe = "C:\ProgramData\Deployr\deployr.exe"
|
|
& $exe install @($Apps -split '\s+') --json
|
|
exit $LASTEXITCODE
|
|
```
|
|
|
|
## Site-specific app lists
|
|
|
|
Rather than editing scripts per client, ship a catalog overlay with the binary
|
|
and reference profiles by name:
|
|
|
|
```
|
|
C:\ProgramData\Deployr\catalog.d\client.yaml -> profiles: { standard: [...] }
|
|
```
|
|
|
|
The script stays `deployr install @standard` everywhere, and what `@standard`
|
|
means is a per-site file your RMM already knows how to distribute. See
|
|
[CATALOG.md](CATALOG.md).
|
|
|
|
## Scheduling without an RMM
|
|
|
|
**Windows — weekly patch run at 03:00**
|
|
|
|
```powershell
|
|
$action = New-ScheduledTaskAction -Execute "C:\ProgramData\Deployr\deployr.exe" -Argument "update --all"
|
|
$trigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Sunday -At 3am
|
|
Register-ScheduledTask -TaskName "Deployr patching" -Action $action -Trigger $trigger `
|
|
-User "SYSTEM" -RunLevel Highest
|
|
```
|
|
|
|
**Linux — systemd timer**
|
|
|
|
```ini
|
|
# /etc/systemd/system/deployr.service
|
|
[Service]
|
|
Type=oneshot
|
|
ExecStart=/usr/local/bin/deployr update --all
|
|
|
|
# /etc/systemd/system/deployr.timer
|
|
[Timer]
|
|
OnCalendar=Sun 03:00
|
|
Persistent=true
|
|
|
|
[Install]
|
|
WantedBy=timers.target
|
|
```
|
|
|
|
**macOS — a LaunchDaemon** running the same `update --all` on a
|
|
`StartCalendarInterval` works identically. Keep it a daemon, not an agent:
|
|
deployr needs root, and it drops to the console user itself when Homebrew is
|
|
involved.
|
|
|
|
## Reading the results
|
|
|
|
```json
|
|
{
|
|
"action": "update",
|
|
"host": "WS-014",
|
|
"os": "windows",
|
|
"total": 12,
|
|
"changed": 3,
|
|
"skipped": 9,
|
|
"failed": 0,
|
|
"reboot_required": true,
|
|
"results": [
|
|
{
|
|
"app": "vlc",
|
|
"status": "ok",
|
|
"provider": "winget",
|
|
"version": "3.0.21",
|
|
"duration_ms": 18422
|
|
},
|
|
{
|
|
"app": "linemgr",
|
|
"status": "fail",
|
|
"error": "winget: not available on this machine; direct: HTTP 404",
|
|
"attempts": [
|
|
{ "provider": "winget", "error": "not available on this machine" },
|
|
{ "provider": "direct", "error": "HTTP 404" }
|
|
]
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
`attempts` is the useful field when something fails: it lists every route that
|
|
was tried and why each one did not work, which is usually enough to fix the
|
|
catalog entry without logging into the machine.
|
|
|
|
Every run also appends to a log file:
|
|
|
|
- Windows: `C:\ProgramData\Deployr\logs\deployr.log`
|
|
- macOS: `/Library/Logs/Deployr/deployr.log`
|
|
- Linux: `/var/log/deployr/deployr.log`
|