5. Committing an installation

The installation process can be aborted any time up to the point where /.lpm/commit exists. No permanent changes actually take effect until /.lpm/commit's creation. Once it exists, the installation can not be revoked, and all files will be installed, one way or another. If the installation process gets interrupted past that point, it will be automatically resumed at the first available opportunity.

FileInstall's constructor checks if /.lpm/commit already exists. If it does, the constructor immediately runs this commit process, again. If it does not exist, all existing files in all .lpm are removed (except for the lock file held by the FileInstall object.

The commit process reads the number of files to install (or uninstall) from /.lpm/commit. This is for informational purposes only. The commit process then opens /.lpm/manifest and begins reading it, one line at a time. It's possible that /.lpm/manifest may not exist. This may happen if the commit process was previously interrupted right before it would've ended anyway. This error condition is silently treated as if the manifest file exist, but is empty.

The commit process reads the manifest file, one line at a time. Each line specifies the particulars of one file that should be installed or uninstalled.

After processing the entire manifest file, it is removed, the buffers are flushed, the commit file is also removed, and the buffers are flushed again.

The lock file is removed by FileInstall's destructor.