Chapter 15. Installing files and packages

Table of Contents

1. Mount points
2. The lock file
3. Installing files
4. Preparing to commit
5. Committing an installation

One feature of LPMtool is that package installation and deinstallations are done as atomic transactions: either all files in a package will be installed, or not. The converse is true: when uninstalling a package, either it will be removed completely, or not. This chapter describes how atomic transactions are implemented. Of course, LPMtool cannot prevent someone from killing the LPMtool process. What happens is that if LPMtool is interrupted in a middle of installing or uninstalling a package, then the partially-completed task will be finished the next time LPMtool runs.

It is important to note that LPMtool's system package repository - the database that keeps track of all the installed packages - uses plain text files. LPMtool's package repository is updated concurrently with installing and uninstalling packages, so the same atomic transaction both installs or uninstalls the files in the package, and updates the system package repository. This is how LPMtool's system package repository is kept consistent.

The FileInstall object is responsible for executing atomic transactions. Only one FileInstall object can exist at the same time. Creating a FileInstall object automatically creates a lock file, which is cleared when the object is destroyed.

1. Mount points

LPMtool inventories all mounted filesystems when preparing a new transaction, and creates an .lpm subdirectory in each mount point. For example, if the /usr and /home are mounted filesystem, LPMtool creates the following subdirectories: /.lpm (because the root filesystem, / is always considered to be a mount point), /usr/.lpm, and /home/.lpm.