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.
Unless the file type is
“d”,
the temporary file is located in the .lpm
directory
of its partition.
The file's ownership and permissions are set as indicated in the manifest
file.
It is not an error if the temporary file does not exist. This happens when a partially completed commit resumes. If the temporary file does not exist, the commit process quietly moves on to the next line in the manifest file.
A file type of “s” indicates an install/uninstall script, which is executed, if it exists, and removed. If the corresponding file does not exist it is presumed to have been executed already, and no error is given.
Unless the file type is “d”, the file's directory is created if it doesn't exist.
Unless the file type is “d” or “D”, if the file already exists, and the file type contains the “b” character, then the existing file is backed up as “filename.lpmsave.YYYYMMDD-HHMMSS”.
The existing file is also backed up if the existing file is a directory, but the new file isn't, or if the new file is a directory, but the existing file isn't.
If the file type is “D” (a directory), and the directory already exists, its ownership and permissions are reset according to the manifest file.
If the file type is “d”, the existing file (if any) is deleted.
In all other cases the temporary file is renamed to its final installation location.
All buffers are flushed.
The GDBM records in the manifest file are processed literally. The GDBM file gets opened, the indicated records are stored or removed, then the GBDM file gets closed.
Note that if the commit process gets interrupted the entire sequence of GDBM updates can be repeated from the beginning with a problem. The repeated process ends up storing the same record, with the same key, or attempting to remove a record that's already been removed previously (which is ignored).
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.