Class ServerUpdater
bin/iiziServer-update.The steps.
- The request:
-package <file>on the command line, else the request file the server left,updates/update.request; the request file is consumed. - The verification,
UpdateVerifier, before anything is written: the signature, the build, the content, and the package's flavour, which must be the installation's (DistributionFlavour: customer, mindus or mls - CC-FIX-DIST-NO-ICU). - The stage: the package is unpacked into
<install>.stage, beside the installation, and checked; on any failure the stage is deleted and the error reported - nothing of the installation was touched. - The rollback copy: the single
<install>.rollbackis replaced by the current installation (all of it butdb/,logs/andupdates/, which an update never touches and which may be large). - The apply: each top-level tree of the package is applied with MIRROR semantics - the file of the package replaces the installation's, a file of the installation the package does not have is deleted (the versioned jar names of
lib/demand it) - honouring theKeepList(conf/update-keep.lst, else the defaults). Any failure restores the installation from the rollback copy. - The stage is deleted; the result is written to
updates/update.result, which ServerAdmin shows at the next start, and toupdates/update.log.
Exit codes (what the supervisor reads): 0 updated; 1 nothing changed or rolled back - the old version runs; 2 the rollback failed - the installation is inconsistent and needs the operator; 9 a parameter error.
Its own jar. Windows locks an open jar, and the updater replaces bin/iiziServerTools.jar with the package's: when this class runs from a jar under the installation it copies the jar to the temporary directory and runs itself from there (-noreexec stops the recursion).
Options: -install <dir> (default: the current directory), -package <file>, -keep <file> (the keep list, default conf/update-keep.lst), -allowDowngrade, -allowUnsigned, -truststore <file> [-truststorepass <pw>] (the trust anchors, default the JDK's cacerts), -noreexec, and -rollback: restores the installation from the rollback copy when an apply was interrupted (the marker APPLYING is there), what every supervisor does before it starts the server; without the marker it does nothing (exit 0).
Nothing here depends on another IIZI class: the updater runs from its own jar.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe marker in the updates directory that says an apply is under way: written before the first file of the installation is touched, deleted when the apply has ended.static final StringThe keep list in the installation.static final StringThe files of the updates directory.static final StringThe files of the updates directory.static final intThe exit codes.static final intThe exit codes.static final intThe exit codes.static final intThe exit codes.static final StringThe files of the updates directory.static final StringThe files of the updates directory.static final StringThe resource of the pinned signers in the tools jar: one or two PEM certificates, written by the distribution build fromBuildUtil/currentCert.cer(andnextCert.cerwhen a renewal is announced).static final StringThe files of the updates directory.Method Summary
Modifier and TypeMethodDescriptionstatic voidThe entry.static intrun(String[] args, PrintStream out) Runs the updater and returns its exit code (the test's entry).
Field Details
RC_UPDATED
public static final int RC_UPDATEDThe exit codes.- See Also:
RC_UNCHANGED
public static final int RC_UNCHANGEDThe exit codes.- See Also:
RC_ROLLBACK_FAILED
public static final int RC_ROLLBACK_FAILEDThe exit codes.- See Also:
RC_PARAMETER
public static final int RC_PARAMETERThe exit codes.- See Also:
SIGNERS_RESOURCE
The resource of the pinned signers in the tools jar: one or two PEM certificates, written by the distribution build fromBuildUtil/currentCert.cer(andnextCert.cerwhen a renewal is announced). Absent in an unsigned build.- See Also:
UPDATES
REQUEST
RESULT
LOG
LOCK
APPLYING
The marker in the updates directory that says an apply is under way: written before the first file of the installation is touched, deleted when the apply has ended. A supervisor that finds it at start runs the updater with-rollback: the apply was interrupted (a kill, a power loss) and the installation is restored from the rollback copy.- See Also:
KEEP_FILE
Method Details
main
run
Runs the updater and returns its exit code (the test's entry).- Parameters:
args- The options.out- The standard output.- Returns:
- The exit code.