net.i2p.router.tasks

## Class InstallUpdate

- java.lang.Object
- - net.i2p.router.tasks.InstallUpdate

-     public class InstallUpdate
      extends Object

  Automatic I2P router update installer and processor. This class handles the complete update process when an i2pupdate.zip file is present in the router or base directory. It performs a comprehensive update including verification, extraction, cleanup, and restart procedures.

  Update Process:

  - Searches for i2pupdate.zip in router dir or base dir
  - Verifies write permissions to target directory
  - Validates ZIP file integrity and structure
  - Updates router configuration with version information
  - Extracts update files to base directory
  - Processes deletelist.txt for obsolete file removal
  - Cleans up native libraries (jbigi, jcpuid)
  - Removes update file and restarts JVM

  Error Handling:

  - Renames failed updates to "BAD-i2pupdate.zip"
  - Provides detailed logging throughout process
  - Handles permission issues gracefully
  - Performs cleanup even on partial failures

  Restart Behavior:

  - With wrapper: Automatic restart after update
  - Without wrapper: Manual restart required
  - Exit code: Router.EXIT_HARD_RESTART

  If no update file is found, performs routine maintenance including native library cleanup and deletion list processing.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `InstallUpdate()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `installUpdates(Router r)` Install updates from i2pupdate.zip file if present.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### InstallUpdate

          public InstallUpdate()

  - ### Method Detail

    - #### installUpdates

          public static void installUpdates(Router r)

      Install updates from i2pupdate.zip file if present. This method searches for an update file in the router directory or base directory, verifies its integrity, extracts it to the base directory, and performs cleanup operations. If successful, the JVM will exit with a restart code and never return. The method performs the following steps:
      - Search for i2pupdate.zip in router dir or base dir
      - Check write permissions to base directory
      - Verify ZIP file integrity
      - Update router configuration with version info
      - Extract update to base directory
      - Delete files listed in deletelist.txt
      - Cleanup update file and restart JVM
      If no update file is found, the method performs cleanup of old native libraries and processes any pending file deletions.
      Parameters:
        `r` - the router instance, must have a valid context
      Throws:
        `RuntimeException` - if critical errors occur during update process