agenshield 2026.7.17-beta.20105821 → 2026.7.17-beta.20151044
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/agenshield +35 -6
- package/bin/install.sh +28 -6
- package/package.json +1 -1
package/bin/agenshield
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
# Launcher for the `agenshield` npm wrapper package.
|
|
3
3
|
#
|
|
4
4
|
# The wrapper is a thin BOOTSTRAP — it no longer bundles platform-specific
|
|
5
|
-
# binaries (those are too large for npm
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
5
|
+
# binaries (those are too large for npm). The signed artifacts ship on the S3
|
|
6
|
+
# CDN (with the agen-co/agenshield GitHub Release as a fallback, stable only).
|
|
7
|
+
# The bundled `install.sh` resolves + verifies the signed artifact CDN-first, so
|
|
8
|
+
# `install`/`upgrade` run THAT (this wrapper version's own installer) rather than
|
|
9
|
+
# delegating to a possibly-older on-disk binary; every OTHER command delegates to
|
|
10
|
+
# the installed `agenshield` binary. This keeps `npx agenshield …` working while
|
|
11
|
+
# the heavy signed artifacts ship via the CDN instead of npm.
|
|
10
12
|
#
|
|
11
13
|
# Installed as `bin/agenshield` in the wrapper package (alongside `install.sh`).
|
|
12
14
|
|
|
@@ -371,6 +373,33 @@ case "${1:-}" in
|
|
|
371
373
|
;;
|
|
372
374
|
esac
|
|
373
375
|
|
|
376
|
+
# ── upgrade / install: run THIS wrapper's installer, NEVER the old binary ────
|
|
377
|
+
# `npx agenshield@<X> upgrade|install` means "lay down version X". The wrapper is
|
|
378
|
+
# a thin launcher, so delegating these to the ALREADY-INSTALLED binary ran the
|
|
379
|
+
# OLD binary's download logic — a pre-CDN, GitHub-only build can't fetch a
|
|
380
|
+
# CDN-only release and gets stuck (the 2026-07-19 alpha-upgrade break). Because
|
|
381
|
+
# the launcher itself is downloaded fresh by npx, running THIS version's
|
|
382
|
+
# `install.sh` here fixes it for every existing install: install.sh resolves the
|
|
383
|
+
# signed .pkg CDN-first (baked DEFAULT_CDN_BASE_URL) and installs/replaces the
|
|
384
|
+
# product + daemon via the .pkg postinstall — an idempotent upgrade driven by
|
|
385
|
+
# version X's OWN code, independent of whatever binary is already on disk. Extra
|
|
386
|
+
# flags (e.g. --org) pass through to install.sh.
|
|
387
|
+
case "${1:-}" in
|
|
388
|
+
upgrade|install)
|
|
389
|
+
if [ ! -f "$INSTALLER" ]; then
|
|
390
|
+
echo "agenshield: the bundled installer is missing." >&2
|
|
391
|
+
echo " Get the install command from https://portal.frontegg.com" >&2
|
|
392
|
+
exit 1
|
|
393
|
+
fi
|
|
394
|
+
shift # drop the subcommand; the remainder are install.sh flags
|
|
395
|
+
echo "agenshield: installing${WRAPPER_VERSION:+ v$WRAPPER_VERSION} (CDN-first, GitHub fallback)…" >&2
|
|
396
|
+
# AGENSHIELD_INSTALL_HEADLESS=1 → install.sh takes the SILENT `installer -pkg`
|
|
397
|
+
# path (sudo prompts on the TTY) instead of opening the macOS GUI Installer —
|
|
398
|
+
# a terminal `upgrade`/`install` must stay a silent in-place install.
|
|
399
|
+
exec env AGENSHIELD_INSTALL_HEADLESS=1 AGENSHIELD_VERSION="$WRAPPER_VERSION" sh "$INSTALLER" "$@"
|
|
400
|
+
;;
|
|
401
|
+
esac
|
|
402
|
+
|
|
374
403
|
# ── Every other subcommand: ensure installed, then delegate ─────────────────
|
|
375
404
|
BIN="$(find_installed || true)"
|
|
376
405
|
|
|
@@ -380,7 +409,7 @@ if [ -z "$BIN" ]; then
|
|
|
380
409
|
echo " Install AgenShield from your workspace: https://portal.frontegg.com" >&2
|
|
381
410
|
exit 1
|
|
382
411
|
fi
|
|
383
|
-
echo "agenshield: bootstrapping${WRAPPER_VERSION:+ v$WRAPPER_VERSION}
|
|
412
|
+
echo "agenshield: bootstrapping${WRAPPER_VERSION:+ v$WRAPPER_VERSION} (CDN-first, GitHub fallback)…" >&2
|
|
384
413
|
# --skip-services lays the binary down quickly; `agenshield start` (or the
|
|
385
414
|
# .pkg postinstall) performs the privileged service setup. AGENSHIELD_VERSION
|
|
386
415
|
# pins the wrapper's version so npx version-pinning is honored.
|
package/bin/install.sh
CHANGED
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
# AGENSHIELD_ORG - Org client ID for MDM enrollment (device code flow on daemon start)
|
|
37
37
|
# AGENSHIELD_BASE_URL - Base URL for downloading archive and checksums (overrides GitHub)
|
|
38
38
|
# AGENSHIELD_SKIP_SERVICES - Set to "1" to skip macOS LaunchDaemon/LaunchAgent install
|
|
39
|
+
# AGENSHIELD_INSTALL_HEADLESS - Set to "1" to force the SILENT command-line
|
|
40
|
+
# installer (installer -pkg) even in a terminal, instead
|
|
41
|
+
# of opening the macOS GUI Installer. sudo still prompts
|
|
42
|
+
# on the TTY. Set by `npx agenshield … upgrade|install`.
|
|
39
43
|
#
|
|
40
44
|
set -e
|
|
41
45
|
|
|
@@ -56,7 +60,7 @@ CLI_BINARY="agenshield"
|
|
|
56
60
|
# Developer ID signature). CDN_PLACEHOLDER is split so the sed substitution above
|
|
57
61
|
# can't rewrite this comparison; an unsubstituted copy (raw repo checkout) stays
|
|
58
62
|
# GitHub-only. Same layout on both bases: <root>/<pkg> + <root>/checksums.sha256.
|
|
59
|
-
CDN_BASE_URL=""
|
|
63
|
+
CDN_BASE_URL="https://assets.frontegg.com/agenshield"
|
|
60
64
|
CDN_PLACEHOLDER='__AGENSHIELD_''CDN_BASE_URL__'
|
|
61
65
|
[ "$CDN_BASE_URL" = "$CDN_PLACEHOLDER" ] && CDN_BASE_URL=""
|
|
62
66
|
CDN_BASE_URL="${CDN_BASE_URL%/}"
|
|
@@ -116,12 +120,24 @@ detect_downloader() {
|
|
|
116
120
|
fi
|
|
117
121
|
}
|
|
118
122
|
|
|
119
|
-
# Download a URL to a file
|
|
123
|
+
# Download a URL to a file. On an interactive terminal, render a live progress
|
|
124
|
+
# meter (bar + percentage, on stderr) — the .pkg/tarball artifacts are hundreds
|
|
125
|
+
# of MB and a silent download looks hung. Non-interactive runs (MDM, CI, piped
|
|
126
|
+
# logs) keep the quiet behavior: no meter spam, callers still warn/die on failure.
|
|
120
127
|
download() {
|
|
121
128
|
url="$1"
|
|
122
129
|
dest="$2"
|
|
123
130
|
if [ "$DOWNLOAD_CMD" = "curl" ]; then
|
|
124
|
-
|
|
131
|
+
if [ -t 2 ]; then
|
|
132
|
+
# --progress-bar draws `##### 42.3%`; -f still fails on HTTP errors, so
|
|
133
|
+
# caller fallback logic is unchanged (curl's error line names the miss).
|
|
134
|
+
curl -fL --progress-bar -o "$dest" "$url"
|
|
135
|
+
else
|
|
136
|
+
curl -fsSL -o "$dest" "$url"
|
|
137
|
+
fi
|
|
138
|
+
elif [ -t 2 ] && wget --help 2>&1 | grep -q -- '--show-progress'; then
|
|
139
|
+
# GNU wget >= 1.16: quiet except a single live progress bar.
|
|
140
|
+
wget -q --show-progress -O "$dest" "$url"
|
|
125
141
|
else
|
|
126
142
|
wget -qO "$dest" "$url"
|
|
127
143
|
fi
|
|
@@ -333,7 +349,9 @@ main() {
|
|
|
333
349
|
SERVED_BY="GitHub Releases"
|
|
334
350
|
fi
|
|
335
351
|
info "Trying $SERVED_BY..."
|
|
336
|
-
|
|
352
|
+
# stderr NOT suppressed: download() renders its live progress meter there
|
|
353
|
+
# on a TTY (it stays quiet when non-interactive, so logs don't fill up).
|
|
354
|
+
if ! download "$ROOT/$PKG_NAME" "$TMPDIR_INSTALL/$PKG_NAME"; then
|
|
337
355
|
warn "Download from $SERVED_BY failed — trying next source."
|
|
338
356
|
rm -f "$TMPDIR_INSTALL/$PKG_NAME"
|
|
339
357
|
continue
|
|
@@ -405,8 +423,12 @@ EEOF
|
|
|
405
423
|
chmod 600 "$ENROLL_HOME/pending-enrollment.json"
|
|
406
424
|
fi
|
|
407
425
|
|
|
408
|
-
if [ -t 0 ] && [ -t 1 ]; then
|
|
409
|
-
# Interactive: open the macOS
|
|
426
|
+
if [ -t 0 ] && [ -t 1 ] && [ "${AGENSHIELD_INSTALL_HEADLESS:-}" != "1" ]; then
|
|
427
|
+
# Interactive terminal (and not forced headless): open the macOS
|
|
428
|
+
# Installer GUI. `npx agenshield … upgrade|install` sets
|
|
429
|
+
# AGENSHIELD_INSTALL_HEADLESS=1 to take the SILENT `installer -pkg` branch
|
|
430
|
+
# below instead — a terminal command must not spawn a GUI. sudo still
|
|
431
|
+
# prompts for the password on the TTY, so this stays interactive-safe.
|
|
410
432
|
info "Opening installer..."
|
|
411
433
|
open "$TMPDIR_INSTALL/$PKG_NAME"
|
|
412
434
|
printf "\n${GREEN}${BOLD}macOS Installer opened.${RESET}\n"
|