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.