Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
115 lines (85 sloc) 4.52 KB
darwinup
12-Mar-2010
Kevin Van Vechten <kvv@apple.com>
William Siegrist <wsiegrist@apple.com>
OVERVIEW
========
The Darwin Update utility provides a transaction-based mechanism to
install software on the base system that modifies or supersedes existing
system components. Darwin Update is not a "package manager," and does
not specify any package format. Updates can be installed from a directory,
a tar archive, or other formats.
Darwin Update provides the following:
* Installation of Darwin components (usually built with DarwinBuild)
* Verification of components previously installed with Darwin Update
* Un-installation of components installed with Darwin Update
It is a design goal of Darwin Update that all components installed by
this utility can subsequently be uninstalled, leaving the system in its
original state.
THE DEPOT
=========
The Darwin Update utility creates a directory at the root level of the
filesystem (/.DarwinDepot) where it stores its database of currently
installed components, and archived copies of the components they superseded.
This is known as the depot.
The following files are present in the depot:
/.DarwinDepot/Database-V100
SQLite database containing information about all of the archives and files
that have been installed with darwinbuild.
/.DarwinDepot/Archives/
If an archive has any data to be installed, it will have a corresponding entry
in this directory. This is known as the backing-store of the archive.
The backing-store is either in a compressed (.tar.bz2) or expanded (directory)
state. The compressed state is always authoritative and the expanded state
is pruned when darwinup exits. The backing store for each archive is named
according to that archive's UUID in the database.
/.DarwinDepot/Downloads/
Temporary storage for any remote archives, such as when giving http or
rsync urls to darwinup.
OPERATIONS
==========
1. INSTALLATION
When Darwin Update is used for installing a tar archive (for example), it
will first create two entries in the database. One for the archive to be
installed, and another for the "rollback" archive associated with this
archive. The rollback archive is where all of the base system files and
existing user data are preserved before the new archive is installed.
A backing-store directory is created for both the new archive and the
rollback archive. Darwin Update extracts the tar archive into the newly
created backing store directory. This effectively pre-allocates space on
the root volume for the installation.
Next, the location is compared against the software currently installed.
Records are inserted into the database for each file in the new archive.
Additionally, records are also inserted into the rollback archive
representing the initial state of the system. (Note, that if a new file
is identical to a file that Darwin Update has previously installed, no
rollback file will be added since the record of the previously installed
file is sufficient).
Once all the records have been committed to the database, each file that
was added to the rollback archive is moved into the backing-store. At this
point the rollback archive backing store directory is compacted into a
.tar.bz2 archive.
Finally, each new file is moved from the backing store to its location on
the root filesystem.
Installation is complete.
2. UNINSTALLATION
When Darwin Update is used for uninstalling an archive, it will iterate
through all the files in that archive as recorded in the database.
If another newer archive has installed a file in the same location, then
no action is taken because the archive to be uninstalled no longer has a
claim on that file. However, if there are no newer archives claiming this
file, it will be uninstalled.
When a file is uninstalled, Darwin Update searches the database for the
previous version of the file, whether archived from the base system, or
installed in an earlier archive. If the file is identical to the previous
version, then no action is taken. However, if the previous version differs
it will need to be restored.
During restoration, if the file did not previously exist at all, it will be
deleted. Otherwise, the rollback archive backing store is expanded, and the
file is moved from teh rollback archive backing store onto the root filesystem.
The previous file has been restored.
At this point Darwin Update deletes the record of the previous file from the
database.
Once all files affected by the uninstalled archive have been deleted or
restored, the archive and its list of files are deleted from the database.
Uninstallation is complete.