[7072e1f] | 1 | TITLE : Package management in jhalfs
|
---|
[f60a8b7] | 2 | BY : Pierre Labastie (work in progress)
|
---|
[7072e1f] | 3 |
|
---|
| 4 | 1. INTRODUCTION:
|
---|
| 5 |
|
---|
| 6 | There are several hints discussing package management for LFS, but
|
---|
| 7 | nothing under jhalfs. There used to be a patch for PACO that I cannot
|
---|
[945ccaa] | 8 | find now. So there was a need for such a tool, and an infrastructure,
|
---|
| 9 | which allows using a package manager inside jhalfs, has been developped.
|
---|
| 10 | I hope it is flexible enough to support several package managers, at least
|
---|
| 11 | among those who use DESTDIR install and/or LD_PRELOAD during install.
|
---|
| 12 | It has been tested with dpkg from Debian, pacman from Arch Linux,
|
---|
| 13 | and porg. Sample configuration files are given for those three packages.
|
---|
| 14 | I am sorry to say I have (almost) no experience with rpm, so I cannot
|
---|
| 15 | tell whether it would fit.
|
---|
[7072e1f] | 16 |
|
---|
| 17 | 2. OVERVIEW OF THE SYSTEM:
|
---|
| 18 |
|
---|
[945ccaa] | 19 | For now, package management is only available for LFS. The `porg style'
|
---|
| 20 | (see below) package management has been ported to BLFS, but not the distro
|
---|
[9a86aa58] | 21 | style one (the book layout makes it rather difficult).
|
---|
[c7c32a3] | 22 |
|
---|
[945ccaa] | 23 | This tool comes in two flavours:
|
---|
| 24 | - for distros package managers (e.g dpkg or pacman), it basically performs
|
---|
[9a86aa58] | 25 | a "DESTDIR install" for all pages in chapter 8, 9 and 10 of the book. The
|
---|
[945ccaa] | 26 | name of the DESTDIR directory is the same as the one of the executed
|
---|
| 27 | script. The path to this directory is available to the scriplets through
|
---|
| 28 | the PKG_DEST variable. The details of the DESTDIR part are given below.
|
---|
| 29 | After the package is installed in $PKG_DEST, a function "packInstall" is
|
---|
| 30 | called, which is supposed to create a binary package (e.g. make a .deb
|
---|
| 31 | file), store it to a repository and install it to the system.
|
---|
| 32 | - for porg style package manager, the install instructions are wrapped
|
---|
| 33 | between pairs of single quotes ('). This allows passing those instructions
|
---|
| 34 | to a function ("wrapInstall"), which may itself call porg or another
|
---|
| 35 | (e.g. fakeroot, not tested) instruction wrapper. Note that if the
|
---|
| 36 | instructions contain single quote charaters, they are changed to '\'',
|
---|
| 37 | which pass them literally. At the end of the installation, a function
|
---|
| 38 | "packInstall" is called, with a slighly different aim compared to the
|
---|
| 39 | DESTDIR one: it is used to make a tarball of the installed files (e.g.
|
---|
| 40 | using "porgball") and store them into some repository. But there is no
|
---|
| 41 | need to install them to the system, since this has already been done.
|
---|
[c7c32a3] | 42 |
|
---|
[945ccaa] | 43 | Note that with carefully crafted "packInstall" and "wrapInstall"
|
---|
| 44 | functions, a combination of the two methods could be used, for example for
|
---|
| 45 | DESTDIR installs using fakeroot. This is work in progress and not fully
|
---|
[9a86aa58] | 46 | implemented yet (well... Closer to a wish list actually).
|
---|
[945ccaa] | 47 |
|
---|
| 48 | 3. DETAILS:
|
---|
[c7c32a3] | 49 |
|
---|
[bd00951] | 50 | The XSL stylesheet used for generating the scriptlets, automatically
|
---|
| 51 | adds DESTDIR install instructions when "package management" is selected.
|
---|
| 52 | Also all the paths beginning with " /" or ">/" (absolute paths) are prepended
|
---|
| 53 | with $PKG_DEST. This has the default that you might want to move
|
---|
[7072e1f] | 54 | files to non existent directories. There is no simple way to automatically
|
---|
| 55 | create those directories, because you have sometimes to use the full path
|
---|
| 56 | (instructions of the form `cp file dir') and sometimes only the dirname
|
---|
[bd00951] | 57 | (instructions of the form `cp file1 file2'). So the XSL stylesheet
|
---|
| 58 | creates a reasonable subset of the FHS hierarchy into the destination
|
---|
| 59 | directory. Empty directories are then removed before packing the
|
---|
[7072e1f] | 60 | binary package.
|
---|
[945ccaa] | 61 |
|
---|
[bd00951] | 62 | In order to use the package manager, it has to be installed at the end of
|
---|
[9a86aa58] | 63 | chapter 7 (temporary installation) and chapter 8 (final install).
|
---|
[bd00951] | 64 | Furthermore, the administrative files and directories have to be created
|
---|
| 65 | during the `Creating Directories' and `Creating Essential Files' stages.
|
---|
| 66 | For all this, the user has to supply a file in docbook XML format, with
|
---|
| 67 | the necessary instructions and enough information to download the tarball.
|
---|
| 68 | This file should reside in the `pkgmngt' directory and be named
|
---|
| 69 | `packageManager.xml'. A template named `packageManager.xml.template' is
|
---|
[945ccaa] | 70 | provided in the `pkgmngt' subdirectory. There are also three XML files for
|
---|
| 71 | dpkg, pacman, and porg, respectively `packageManager.xml.dpkg',
|
---|
| 72 | `packageManager.xml.pacman', and `packageManager.xml.porg', that you can
|
---|
| 73 | copy to `packageManager.xml' and modify to suit your needs.
|
---|
[bd00951] | 74 | They are not updated often, so the versions used can be rather old.
|
---|
[945ccaa] | 75 |
|
---|
| 76 | The last thing to do is to tell how to use the package manager. The user
|
---|
| 77 | has to provide two functions, "wrapInstall" and "packInstall", as described
|
---|
[2e1c1c3] | 78 | above. Please note that nothing has been done to manage configuration files,
|
---|
[bd00951] | 79 | which are ususally treated specially by package managers: depending on
|
---|
[7072e1f] | 80 | the book layout, it is sometimes possible to create those files afterwards,
|
---|
| 81 | and sometimes not, which means that you have to check them after each
|
---|
[945ccaa] | 82 | upgrade. Both functions should be defined in a file named `packInstall.sh',
|
---|
| 83 | residing in the `pkgmngt' directory. A template is provided (actually a copy
|
---|
| 84 | of the file for dpkg), as well as three example scripts for dpkg, pacman,
|
---|
| 85 | and porg. Pacman Note: due to the way pacman checks the available space on
|
---|
| 86 | disk, the root directory in chroot must be a mount point, otherwise the
|
---|
| 87 | installation of packages fails.
|
---|