OSTree Manual |
---|
The largest endeavor is likely to be redesigning your
distribution's package manager to be on top of OSTree,
particularly if you want to keep compatibility with the "old
way" of installing into the physical /
. This section will use examples
from both dpkg and rpm as
the author has familiarity with both; but the abstract concepts
should apply to most traditional package managers.
There are many levels of possible integration; initially, we will describe the most naive implementation which is the simplest but also the least efficient. We will assume here that the admin is booted into an OSTree-enabled system, and wants to add a set of packages.
Many package managers store their state in /var
; but since in the OSTree model
that directory is shared between independent versions, the
package database must first be found in the per-deployment
/usr
directory. It
becomes read-only; remember, all upgrades involve constructing a
new filesystem tree, so your package manager will also need to
create a copy of its database. Most likely, if you want to
continue supporting non-OSTree deployments, simply have your
package manager fall back to the legacy /var
location if the one in
/usr
is not found.
To install a set of new packages (without removing any existing ones), enumerate the set of packages in the currently booted deployment, and perform dependency resolution to compute the complete set of new packages. Download and unpack these new packages to a temporary directory.
Now, because we are merely installing new packages and not
removing anything, we can make the major optimization of reusing
our existing filesystem tree, and merely
layering the composed filesystem tree of
these new packages on top. A command lke this: ostree
commit -b osname/releasename/description
--tree=ref=osname/releasenamename/description
--tree=dir=/var/tmp/newpackages.13A8D0/ will create a
new commit in the
osname/releasename/description
branch. The OSTree SHA256 checksum of all the files in
/var/tmp/newpackages.13A8D0/ will be computed, but we will not
re-checksum the present existing tree. In this layering model,
earlier directories will take precedence, but files in later
layers will silently override earlier layers.
Then to actually deploy this tree for the next boot:
ostree admin deploy
osname/releasenamename/description