Files
Deployr/internal/platform/elevated_windows.go
T
ClaudeandClaude Opus 5 4909edee2d Deployr 0.1.0: cross-platform application deployment CLI
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>
2026-08-26 16:55:13 -05:00

19 lines
554 B
Go

package platform
import "golang.org/x/sys/windows"
// IsElevated reports whether the process holds an elevated token. Under the
// SYSTEM account (how RMM agents run scripts) this is true.
func IsElevated() bool {
tok := windows.GetCurrentProcessToken()
return tok.IsElevated()
}
// ConsoleUser is meaningless on Windows.
func ConsoleUser() string { return "" }
// PrivilegeHint explains how to obtain the rights deployr needs.
func PrivilegeHint() string {
return "run deployr from an elevated (Administrator) shell, or as SYSTEM via your RMM"
}