wpkg --rollback

Options Comments
--admindir Define the administration directory, where the database of the installed packages resides.
--debug Define a set of flags of things to print out for debug purposes.
--field-variables Add the specified fields to the list of control variables of this package.
--force-file-info Force the installation of files even if we cannot set their ownership and group properly.
--instdir Define the installation directory, where the data files are installed on the target.
--quiet Request for warning messages to not be displayed.
--recursive When generating binary packages from a source package, specify whethre the repository should be used recursively.
--repository The repository to use when restoring packages after an upgrade or a remove command.
--root Define the installation root path.
--verbose Display log information of level INFO.

The --rollback command can be used to restore an installation using a journal generated by the --install, --remove, and other similar commands when using the the --tracking-journal option.

By default the installation processes go like this:

  • Validate
  • If not valid, exit
  • Unpack
  • If error, delete what was just unpacked, exit
  • Configure
  • If error, exit
  • If more packages to install repeat from Unpack step

As we can see, if an error occurs, the system is left in a clean state (if possible) and then it exits. This means 1, 2 or 3 packages could be installed, then the 4th fails and the process stops there. The result is that packages 1, 2 and 3 are still on the target. This may not be expected if the whole transaction is viewed as one transaction. In other words, when installing anything, if anything goes wrong, we want the target to look exactly like before we started the installation process. In that case, we would have to rollback the changes: the installation of packages 1, 2, and 3. To do so, the installation scripts is capable of creating a journal which can be used to rollback.

The removal processes are similarly affected:

  • Validate
  • If not valid, exit
  • Delete
  • If error, restore what was deleted, exit
  • Deconfigure
  • If error, exit
  • If more packages to remove repeat from Delete step

By default no journal is created. You may ask the packager to create an installation journal with the --tracking-journal option. That journal can then be used by the --rollback command to restore the system as it was before the --install or the --remove command started.

Note that if the installation includes upgrading packages or you did removals, then a restore requires a repository of the binary packages that were successfully upgraded or removed. The system will automatically downgrade or re-install those packages for you.

WARNING: this function can be used in reverse order (installation a, b, and c generated journals A, B, and C; you can restore C, B, and A in that order,) but an out of sequence rollback may create other problems!

In most cases the command expects you to specify a --repository.

Syndicate content