Class ServerUpdater

java.lang.Object
com.iizix.server.tools.ServerUpdater

public final class ServerUpdater extends Object
Installs an update package into a STOPPED server installation (CC-SERVER-RESTART-UPDATE-V5, the owner's rulings of 2026-10-11 17:36 and 18:06): a separate process, run by the supervisor after the server exited with 101, or by an operator through bin/iiziServer-update.

The steps.

  1. The request: -package <file> on the command line, else the request file the server left, updates/update.request; the request file is consumed.
  2. 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).
  3. 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.
  4. The rollback copy: the single <install>.rollback is replaced by the current installation (all of it but db/, logs/ and updates/, which an update never touches and which may be large).
  5. 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 the KeepList (conf/update-keep.lst, else the defaults). Any failure restores the installation from the rollback copy.
  6. The stage is deleted; the result is written to updates/update.result, which ServerAdmin shows at the next start, and to updates/update.log.
No code of the package is ever run (NetPhantom's Pre/PostUpgrade is not carried over).

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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    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.
    static final String
    The keep list in the installation.
    static final String
    The files of the updates directory.
    static final String
    The files of the updates directory.
    static final int
    The exit codes.
    static final int
    The exit codes.
    static final int
    The exit codes.
    static final int
    The exit codes.
    static final String
    The files of the updates directory.
    static final String
    The files of the updates directory.
    static final String
    The resource of the pinned signers in the tools jar: one or two PEM certificates, written by the distribution build from BuildUtil/currentCert.cer (and nextCert.cer when a renewal is announced).
    static final String
    The files of the updates directory.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    main(String[] args)
    The entry.
    static int
    run(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_UPDATED
      The exit codes.
      See Also:
    • RC_UNCHANGED

      public static final int RC_UNCHANGED
      The exit codes.
      See Also:
    • RC_ROLLBACK_FAILED

      public static final int RC_ROLLBACK_FAILED
      The exit codes.
      See Also:
    • RC_PARAMETER

      public static final int RC_PARAMETER
      The exit codes.
      See Also:
    • SIGNERS_RESOURCE

      public static final String SIGNERS_RESOURCE
      The resource of the pinned signers in the tools jar: one or two PEM certificates, written by the distribution build from BuildUtil/currentCert.cer (and nextCert.cer when a renewal is announced). Absent in an unsigned build.
      See Also:
    • UPDATES

      public static final String UPDATES
      The files of the updates directory.
      See Also:
    • REQUEST

      public static final String REQUEST
      The files of the updates directory.
      See Also:
    • RESULT

      public static final String RESULT
      The files of the updates directory.
      See Also:
    • LOG

      public static final String LOG
      The files of the updates directory.
      See Also:
    • LOCK

      public static final String LOCK
      The files of the updates directory.
      See Also:
    • APPLYING

      public static final String 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

      public static final String KEEP_FILE
      The keep list in the installation.
      See Also:
  • Method Details

    • main

      public static void main(String[] args)
      The entry.
      Parameters:
      args - The options.
    • run

      public static int run(String[] args, PrintStream out)
      Runs the updater and returns its exit code (the test's entry).
      Parameters:
      args - The options.
      out - The standard output.
      Returns:
      The exit code.