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