Index: pkgmngt/packageManager.xml.dpkg
===================================================================
--- pkgmngt/packageManager.xml.dpkg	(revision bd0095150ac71f1060cc2c5b00670bbe5e982a2d)
+++ pkgmngt/packageManager.xml.dpkg	(revision bd0095150ac71f1060cc2c5b00670bbe5e982a2d)
@@ -0,0 +1,352 @@
+﻿<?xml version="1.0" encoding="UTF-8"?>
+<!-- $Id$ -->
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY buildtime "Approximate build time">
+<!ENTITY diskspace "Required disk space">
+<!ENTITY dependencies "Installation depends on">
+<!ENTITY testsuites "Test suite depends on">
+<!ENTITY before "Must be installed before">
+<!ENTITY external "Optional dependencies">
+<!ENTITY debian-pool "http://ftp2.fr.debian.org/debian/pool/main/">
+<!ENTITY dpkg-version "1.17.22">
+<!ENTITY dpkg-size "4,259 KB">
+<!ENTITY dpkg-url "&debian-pool;d/dpkg/dpkg_&dpkg-version;.tar.xz">
+<!ENTITY dpkg-md5 "c9c46c5318c98c9162fbd03d24f2f95b">
+<!ENTITY dpkg-home "http://wiki.debian.org/Teams/Dpkg">
+<!ENTITY dpkg-ch5-du "54 MB">
+<!ENTITY dpkg-ch5-sbu "0.3 SBU">
+<!ENTITY dpkg-ch6-du "63 MB">
+<!ENTITY dpkg-ch6-sbu "0.5 SBU">
+]>
+<article>
+
+<sect1 id="package">
+  <?dbhtml filename="packages.html"?>
+
+  <title>All Packages</title>
+
+  <para>Download or otherwise obtain the following packages:</para>
+
+  <variablelist role="materials">
+
+    <varlistentry>
+      <term>Dpkg (&dpkg-version;) - <token>&dpkg-size;</token>:</term>
+      <listitem>
+        <para>Home page: <ulink url="&dpkg-home;"/></para>
+        <para>Download: <ulink url="&dpkg-url;"/></para>
+        <para>MD5 sum: <literal>&dpkg-md5;</literal></para>
+      </listitem>
+    </varlistentry>
+
+  </variablelist>
+
+</sect1>
+<!-- If needed, uncomment and edit this:
+<sect1 id="patches">
+  <?dbhtml filename="patches.html"?>
+
+  <title>Needed Patches</title>
+
+  <para>In addition to the package(s), zero or more patches are also required.
+  These patches correct any mistakes in the packages that should be
+  fixed by the maintainer.  The patches also make small modifications to
+  make the packages easier to work with. The following patches will be
+  needed to build an LFS system:</para>
+
+  <variablelist role="materials">
+
+    <varlistentry>
+      <term>Dpkg Some Patch - <token>&dpkg-somepatche-size;</token>:</term>
+      <listitem>
+        <para>Download: <ulink url="&somepatch-url;"/></para>
+        <para>MD5 sum: <literal>&somepatch-md5;</literal></para>
+      </listitem>
+    </varlistentry>
+
+  </variablelist>
+
+</sect1>
+-->
+
+<sect1 id="ch-tools-pkgmngt" role="wrap">
+  <?dbhtml filename="dpkg.html"?>
+
+  <sect1info condition="script">
+    <productname>dpkg</productname>
+    <productnumber>&dpkg-version;</productnumber>
+    <address>&dpkg-url;</address>
+  </sect1info>
+
+  <title>Dpkg-&dpkg-version;</title>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>This is my choice of package manager. Dpkg is the basic package
+    manager of Debian. It can be complemented by deselect (in the same
+    package), apt or aptitude. We use it in a very crude way.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&dpkg-ch5-sbu;</seg>
+        <seg>&dpkg-ch5-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Dpkg</title>
+
+    <para>Since Debian is shipping its own package, all patches have already
+    been applied. Nevertheless there is either a bug or something
+    I do not understand... Apply this:</para>
+
+    <screen><userinput remap="pre">sed -i '/compress_filter(s/,/va_start/s/^$/compressor_fixup_params(params);\n/' lib/dpkg/compress.c</userinput></screen>
+
+    <para> Configure the package:</para>
+
+    <screen><userinput remap="configure">./configure --prefix=/tools \
+    --disable-nls --disable-dselect \
+    --disable-start-stop-daemon \
+    --disable-update-alternatives \
+    --without-zlib --with-liblzma=static --without-selinux</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--disable-dselect</parameter></term>
+        <listitem>
+          <para>Avoids building <command>dselect</command>, an
+          awful thing!</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-start-stop-daemon</parameter></term>
+        <listitem>
+          <para>The utility <command>start-stop-daemon</command>
+          is not needed here.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-update-alternatives</parameter></term>
+        <listitem>
+          <para>Same for <command>update-alternatives</command>.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--without-zlib</parameter></term>
+        <listitem>
+          <para>Use <command>gzip</command> for compression of binary
+          packages instead of the zlib library, which is not installed
+          in chapter 5.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--with-liblzma=static</parameter></term>
+        <listitem>
+          <para>Use statically linked <command>liblzma</command> for compression
+          of binary packages.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--without-selinux</parameter></term>
+        <listitem>
+          <para>Disable building for <application>selinux</application>, which
+          is not used woth LFS/BLFS.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile the package:</para>
+
+    <screen><userinput remap="make">(cd lib  &amp;&amp; make)
+(cd src &amp;&amp; make)
+(cd dpkg-deb &amp;&amp; make)
+(cd dpkg-split &amp;&amp; make)</userinput></screen>
+
+    <para>This package does not come with a test suite.</para>
+
+    <para>Install only the needed files:</para>
+
+    <screen><userinput remap="install">cp src/dpkg src/dpkg-* /tools/bin
+cp dpkg-deb/dpkg-deb /tools/bin
+cp dpkg-split/dpkg-split /tools/bin
+mkdir -pv /tools/etc/dpkg/{,dpkg.cfg.d}
+cp debian/dpkg.cfg /tools/etc/dpkg</userinput></screen>
+
+    <para>Add a line in <filename>dpkg.cfg</filename> to
+    tell where to put administration files</para>
+
+    <screen><userinput>cat &gt;&gt; /tools/etc/dpkg/dpkg.cfg &lt;&lt; EOF
+# admindir on LFS system
+admindir /var/lib/dpkg
+EOF</userinput></screen>
+
+    <para>On a Debian system, <command>dpkg</command> relies on two other
+    files to be present. Since we do not install them, issue:</para>
+
+    <screen><userinput>cat &gt;&gt; /tools/etc/dpkg/dpkg.cfg &lt;&lt; EOF
+# disable fatal error on path checking
+force-bad-path
+EOF</userinput></screen>
+
+  </sect2>
+
+</sect1>
+
+<sect1 id="ch-pkgmngt-creatingdirs">
+  <?dbhtml filename="creatingdirs.html"?>
+
+  <title>Adding Directories for package management</title>
+
+  <para>Those directories should be added to the system.
+  <filename>/var/lib/dpkg</filename> and subdirectories are
+  adminitrative directories of <command>dpkg</command>.
+  <filename>/var/log</filename> is the log directory for
+  <command>dpkg</command>. <filename>/var/lib/packages</filename>
+  will be used to store our packages.deb files.</para>
+
+  <screen><userinput>mkdir -pv /var/{log,lib/dpkg/{info,updates}}
+mkdir -pv /var/lib/packages</userinput></screen>
+
+</sect1>
+
+<sect1 id="ch-pkgmngt-createfiles">
+  <?dbhtml filename="createfiles.html"?>
+
+  <title>Adding administrative files for Dpkg</title>
+  <para><command>dpkg</command> needs that some files exist to run
+  for the first time. The log file must exist in order to be
+  used.</para>
+
+  <screen><userinput>touch /var/lib/dpkg/{available,status}
+touch /var/log/dpkg.log</userinput></screen>
+
+</sect1>
+
+<sect1 id="ch-system-pkgmngt" role="wrap">
+  <?dbhtml filename="dpkg.html"?>
+
+  <sect1info condition="script">
+    <productname>dpkg</productname>
+    <productnumber>&dpkg-version;</productnumber>
+    <address>&dpkg-url;</address>
+  </sect1info>
+
+  <title>Dpkg-&dpkg-version;</title>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>This is my choice of package manager. Dpkg is the basic package
+    manager of Debian. It can be complemented by deselect (in the same
+    package), apt or aptitude. We use it in a very crude way.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&dpkg-ch6-sbu;</seg>
+        <seg>&dpkg-ch6-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>Installation of Dpkg</title>
+
+    <para>Since Debian is shipping its own package, all patches have already
+    been applied. We do not need more in chapter 6. Configure it:</para>
+
+    <screen><userinput remap="configure">./configure --prefix=/usr \
+        --sysconfdir=/etc \
+        --localstatedir=/var \
+        --disable-dselect \
+        --disable-start-stop-daemon \
+        --disable-update-alternatives \
+        --without-selinux</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--disable-dselect</parameter></term>
+        <listitem>
+          <para>Avoids building <command>dselect</command>, an
+          awful thing!</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-start-stop-daemon</parameter></term>
+        <listitem>
+          <para>The utility <command>start-stop-daemon</command>
+          is not needed here.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-update-alternatives</parameter></term>
+        <listitem>
+          <para>Same for <command>update-alternatives</command>.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--without-selinux</parameter></term>
+        <listitem>
+          <para>Selinux is not used in LFS.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile the package:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>This package does not come with a test suite.</para>
+
+    <para>Install the package:</para>
+
+<screen><userinput remap="install">mkdir -pv $PKG_DEST
+make DESTDIR=$PKG_DEST install
+mkdir -pv $PKG_DEST/etc/dpkg/{,dpkg.cfg.d}
+cp debian/dpkg.cfg $PKG_DEST/etc/dpkg</userinput></screen>
+
+    <para>Add a line in <filename>dpkg.cfg</filename> to
+    tell where to put administration files</para>
+
+<screen><userinput remap="install">cat &gt;&gt; $PKG_DEST/etc/dpkg/dpkg.cfg &lt;&lt; EOF
+# admindir on LFS system
+admindir /var/lib/dpkg
+EOF</userinput></screen>
+
+<!-- Is this needed in chapter 06 -->
+    <para>On a Debian system, <command>dpkg</command> relies on two other
+    files (<command>ldconfig</command> and maybe <command>update-rc.d</command>)
+    to be present. Since we do not install them, issue:</para>
+
+<screen><userinput>cat &gt;&gt; /etc/dpkg/dpkg.cfg &lt;&lt; EOF
+# disable fatal error on path checking
+force-bad-path
+EOF</userinput></screen>
+
+  </sect2>
+
+</sect1>
+</article>
