Skip to content

__nexus_license__

miscellaneous · scripts/miscellaneous/__nexus_license__.m

: __nexus_license__ ()
: __nexus_license__ ("activate")
: __nexus_license__ ("status")
: __nexus_license__ ("clear")
: info = __nexus_license__ (mode, name, value, …)

Store, show or remove the licence of this Nexus install.

__nexus_license__ () (or nexus --license from the shell) asks for the email address and licence key you registered with, checks them with the licence service of the download portal (POST /api/v1/license/status) and, when the service accepts them, stores them in license.json in the per-user settings folder: ~/.config/nexus on Linux (or under XDG_CONFIG_HOME), %APPDATA%\nexus on Windows. That is the file __nexus_license_notify__ and __nexus_support__ read, with the same content the Windows installer writes to %ProgramData%\Nexus\license.json. A key the service rejects, a licence that is not active, or a service that cannot be reached stores nothing. The key is only sent to that service: NEXUS_LICENSE_SERVER, else the "server" of an existing file, else https://nexusone.org.uk.

__nexus_license__ ("status") prints where the licence comes from and checks it now. __nexus_license__ ("clear") removes the stored file.

The startup file calls __nexus_license__ ("FirstRun"): while no licence is stored, an interactive session on an installed build asks for the email and key, at most once a day; Enter skips. Scripts, --eval, CI (CI, JENKINS_URL), runs without a terminal, development builds and NEXUS_NO_LICENSE_CHECK never ask, nor does a settings folder whose license-check.json has "enabled": false.

Options for scripts and tests: "Email" and "Key" (skip the prompt), "Server", "Timeout" (seconds), "FetchFcn" (replaces the HTTP call), "InputFcn" (replaces input), "StateDir" (replaces the settings folder), "Interactive" (true: treat the session as interactive).

The optional output is a struct with state ("stored", "skipped", "rejected", "inactive", "unreachable", "nolicense", "cleared", or for "status" the state of the check), message, email and file.