Files
ClaudeandClaude Opus 5 7ee270e128 Add printer and scanner driver support
A new "driver" provider installs Windows printer and scanner drivers through
the same catalog, UI and profiles as everything else: stage the package into the
driver store with pnputil, then register it with the print spooler so it turns
up in Add Printer.

Driver names are matched by PREFIX against the names read out of the package's
own INF files. Vendors stamp the version into the name -- "HP Universal Printing
PCL 6 (v7.1.0)" -- so an exact name in a catalog goes stale at the next release,
and a wrong one is unrecoverable without knowing what the package contains. When
a prefix matches nothing, the error lists the names the package actually
provides, which turns a dead end into a one-line fix.

INF parsing handles what real files are, not what the spec suggests: Windows
ships its own printer INFs as UTF-16LE and vendor packages follow suit, so
reading them as UTF-8 finds nothing at all. Verified against every prn*.inf on
a stock Windows install -- that test is what caught the encoding bug, since the
hand-written sample parsed fine.

Scanners are TWAIN/WIA rather than spooler drivers, so there is nothing to
register: leaving driver_match unset means stage-only. Detection falls back to
the uninstall entry, because a TWAIN data source has no spooler record.

Packages come from a driver share rather than the web. Vendor URLs are
version-pinned and several are EULA-gated, so nothing stable can be shipped in a
catalog; a UNC path or local folder is used in place with no download at all,
which is faster and is what a shop wants anyway. $DEPLOYR_DRIVERS names the
share, and an unset variable is reported by name rather than surfacing three
layers down as "no such file".

Ships universal drivers for HP, Xerox, Ricoh, Sharp, Canon, Kyocera, Konica
Minolta, Lexmark, Brother, Toshiba, Epson, Muratec and Zebra, plus scanner
packages for the fi series, ScanSnap, Canon DR, Epson, Brother, Visioneer and
Kodak Alaris. Profiles: @printers, @printers-all, @scanners.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-26 17:47:24 -05:00

297 lines
10 KiB
Markdown

# Deployr
Cross-platform application deployment and patching from a single binary.
Deployr replaces Ninite for endpoint software: one catalog of applications, one
command line, and the same behaviour on **Windows, macOS and Linux**. It prefers
the machine's native package manager and falls back to the vendor's own
installer when that route is missing or unreliable.
There is no server and no agent. Deployr is a single static executable you drop
on a machine — by hand, or through your RMM's script runner — and it exits with
a status code your automation can branch on.
## One-liner
```powershell
irm https://git.starwarslab.us/ATOM_IT/Deployr/raw/branch/main/scripts/install.ps1 | iex
```
```sh
curl -fsSL https://git.starwarslab.us/ATOM_IT/Deployr/raw/branch/main/scripts/install.sh | sh
```
That elevates if needed, downloads the right binary for the machine, verifies it
against the release checksums, puts it on PATH, and opens the UI.
To skip the UI and just run something, pass arguments through:
```powershell
& ([scriptblock]::Create((irm https://git.starwarslab.us/ATOM_IT/Deployr/raw/branch/main/scripts/install.ps1))) install @standard
```
```sh
curl -fsSL https://git.starwarslab.us/ATOM_IT/Deployr/raw/branch/main/scripts/install.sh | sh -s -- install @standard
```
## The UI
`deployr ui` serves a point-and-click interface on loopback and opens your
browser at it. Checkboxes grouped by category, one-click profile bundles, a
filter box, and live per-app progress streamed from the engine as it runs.
It is a browser page rather than a native window for one reason: it is the only
GUI that behaves identically on Windows, macOS and Linux without a toolkit or
cgo, so the binary stays a single static file. It binds `127.0.0.1` on a random
port, requires a session token minted at startup, and rejects cross-origin and
non-loopback requests — nothing is exposed to the network.
On a machine with no browser (SSH, recovery console), `deployr menu` gives you
the same thing as a numbered terminal picker.
## The CLI
```
deployr install chrome 7zip vlc
deployr install @standard --json
deployr update --all
deployr status
```
## Why not just call winget / brew / apt directly?
Because the interesting part is everything around the package manager:
- **winget does not exist under SYSTEM.** The `winget` on PATH is an app
execution alias that only resolves inside a user session — exactly what an RMM
script does not have. Deployr finds the real payload under `WindowsApps`.
- **Homebrew refuses to run as root**, which is the context an MDM or RMM gives
you. Deployr drops to the account that owns the Homebrew prefix.
- **Package managers lie with exit codes.** "Already installed" and "no
applicable upgrade" are failures to winget and successes to you.
- **Not every app is in every repo.** A source list per platform means Chrome
comes from winget on Windows, a cask on macOS and Google's own `.deb` on
Debian, and it is one catalog entry.
- **Unattended means unattended.** Every command runs with stdin closed, silent
flags applied and a timeout, so nothing ever waits on a prompt nobody will see.
## Install
Download the binary for the machine from `dist/` (see [Building](#building)) and
put it somewhere on PATH.
```powershell
# Windows (elevated)
Copy-Item deployr_windows_amd64.exe C:\ProgramData\Deployr\deployr.exe
```
```sh
# macOS / Linux
sudo install -m 0755 deployr_linux_amd64 /usr/local/bin/deployr
```
Verify the machine is ready:
```
deployr doctor
```
## Usage
| Command | What it does |
| --- | --- |
| `deployr ui` | Open the point-and-click interface in a browser |
| `deployr menu` | Pick apps from a terminal menu (no browser needed) |
| `deployr install <app...>` | Install applications that are not already present |
| `deployr update <app...>` | Update installed applications (`--all` for everything present) |
| `deployr uninstall <app...>` | Remove applications |
| `deployr list` | Show the catalog, filtered to this platform |
| `deployr status` | Report what is installed and at which version |
| `deployr info <app>` | Show one app's install recipe and current state |
| `deployr profiles` | List the bundles defined in the catalog |
| `deployr doctor` | Platform, privileges, directories and available providers |
| `deployr catalog validate` | Check a catalog overlay before you ship it |
Anything prefixed with `@` is a profile — a named bundle of apps:
```
deployr install @standard @security
```
### Useful flags
```
--json machine-readable summary on stdout (progress goes to stderr)
--dry-run plan the run without touching the machine
--verbose log every command that gets executed
--force act even when the app is already in the desired state
--strict fail instead of falling through to the next source
--provider winget restrict every app to a single provider
--catalog PATH load an extra catalog file or directory (repeatable)
--timeout 45m per-installer timeout (default 30m)
--require-checksum refuse vendor downloads with no sha256 pinned in the catalog
```
### Exit codes
| Code | Meaning |
| --- | --- |
| `0` | Everything ended in the requested state |
| `1` | At least one app failed |
| `2` | Usage or catalog error |
| `3` | Insufficient privileges — nothing was attempted |
## Deploying through an RMM
Deployr is designed to be the payload of a script policy. See
[docs/RMM.md](docs/RMM.md) for ready-made Level.io and NinjaOne snippets.
The short version:
```powershell
# Windows script policy
& "C:\ProgramData\Deployr\deployr.exe" install @standard --json
exit $LASTEXITCODE
```
```sh
# macOS / Linux script policy
/usr/local/bin/deployr install @standard --json
```
Progress lines go to stderr and the JSON summary to stdout, so an RMM that
captures both gets a readable transcript *and* a parseable result:
```json
{
"action": "install",
"host": "WS-014",
"os": "windows",
"arch": "amd64",
"total": 6,
"changed": 2,
"skipped": 4,
"failed": 0,
"reboot_required": false,
"results": [
{ "app": "chrome", "status": "skip", "version": "129.0.6668.90", "message": "already installed" },
{ "app": "vlc", "status": "ok", "provider": "winget", "version": "3.0.21" }
]
}
```
## The catalog
The catalog is compiled into the binary, so a bare executable on a fresh machine
already knows how to install ~45 common applications. Every entry lists its
sources in preference order:
```yaml
- id: chrome
name: Google Chrome
categories: [browser]
windows:
sources:
- provider: winget
id: Google.Chrome
- provider: choco
id: googlechrome
- provider: direct
url: https://dl.google.com/tag/s/dl/chrome/install/googlechromestandaloneenterprise64.msi
kind: msi
detect:
registry: ["Google Chrome"]
```
Add your own apps without rebuilding by dropping a YAML file in the overlay
directory (`C:\ProgramData\Deployr\catalog.d` or `/etc/deployr/catalog.d`), or by
passing `--catalog`. Overlays can also override a shipped entry — same `id`
replaces it wholesale.
Full format reference and worked examples: [docs/CATALOG.md](docs/CATALOG.md).
### Providers
| Provider | Platform | Notes |
| --- | --- | --- |
| `winget` | Windows | Resolved under SYSTEM; prefers machine scope, falls back to user scope |
| `choco` | Windows | Chocolatey 1.x and 2.x |
| `brew` | macOS, Linux | Formulae; drops from root to the Homebrew owner |
| `cask` | macOS | Casks; `--greedy` on upgrade so self-updating apps still get patched |
| `apt` | Linux | Refreshes the index once per run; `noninteractive` throughout |
| `dnf` | Linux | Also drives `dnf5` and `yum` |
| `zypper` | Linux | |
| `pacman` | Linux | |
| `flatpak` | Linux | System-wide as root, per-user otherwise |
| `snap` | Linux | |
| `direct` | all | Vendor download: msi, exe, msu, dmg, pkg, deb, rpm, zip, tar.gz, AppImage |
| `driver` | Windows | Printer and scanner drivers via `pnputil`, from a URL or your driver share |
## Printer and scanner drivers
```
deployr install @printers
deployr install hp-upd-pcl6 xerox-gpd-pcl6
deployr install @scanners
```
Deployr stages the package into the driver store with `pnputil` and registers it
with the print spooler, so it shows up in Add Printer. It reads driver names out
of the package's own INF files and matches on a prefix, so you never type
`HP Universal Printing PCL 6 (v7.1.0)` and never chase the version suffix when
the vendor bumps it.
Vendor driver URLs are version-pinned and several are EULA-gated, so the catalog
points at **your own driver share** instead:
```powershell
setx /m DEPLOYR_DRIVERS \\fileserver\drivers
```
Ships with universal drivers for HP, Xerox, Ricoh, Sharp, Canon, Kyocera, Konica
Minolta, Lexmark, Brother, Toshiba, Epson, Muratec and Zebra, plus scanner
packages for the Fujitsu/Ricoh fi series, ScanSnap, Canon DR, Epson, Brother,
Visioneer/DocuMate and Kodak Alaris. Full details, including per-site overlays:
[docs/PRINTERS.md](docs/PRINTERS.md).
## Building
Requires Go 1.24 or newer. No cgo, no external build tools.
```sh
make build # host binary
make dist VERSION=0.1.0 # all six platforms into dist/
make check # vet on every platform + tests + gofmt
```
```powershell
.\scripts\build.ps1 -Version 0.1.0
```
Output is one static binary per platform (~7 MB), with SHA256SUMS alongside.
## Layout
```
cmd/deployr entry point
internal/catalog catalog types, embedded data, overlay merging
internal/provider winget, choco, brew/cask, apt, dnf, zypper, pacman, flatpak, snap, direct
internal/engine decides what needs doing and walks the source list
internal/detect is it already installed (registry, paths, commands)
internal/download vendor downloads with retries and checksum pinning
internal/platform OS, arch, elevation, well-known directories
internal/run non-interactive command execution with timeouts
internal/ui local web UI (embedded page, SSE progress, token auth)
internal/cli command line parsing, terminal menu, output rendering
scripts/install.* one-liner bootstrap for Windows and Unix
```
## Status
Working: catalog, all providers, install/update/uninstall/status/list/info/
doctor, the browser UI and terminal menu, the bootstrap one-liners, JSON output,
overlays, RMM exit codes.
Not built yet: a central dashboard (deliberately — this is the standalone tool),
scheduled self-updates, and per-app version pinning.