Guys, based on the previous discussion on lfs-dev, I plan on doing a
custom book for LFS as a sample of what destdir might look like and I
want a custom jhalfs to test it with.  I plan on adding a separate set
of instructions to do DESTDIR installations and I wanted to use
remap="destdir" as opposed to remap="install" in both chapters 6 and 7.
 I'm digging through lfs.xml and I had thought I understood enough to do
what I wanted.  :-)

I effectively need to match on these tests at the end of the userinput
template "The rest of commands"...I think.

      <!-- The rest of commands -->
      <xsl:otherwise>
        <xsl:choose>
          <xsl:when test="(../@id='chapter-building-system' or
                           ../@id='chapter-bootscritps') and
                           $usedestdir = 'y' and
                           @remap != 'install'">
            <xsl:apply-templates/>
            <xsl:text>&#xA;</xsl:text>
          </xsl:when>
          <xsl:otherwise>
            <xsl:if test="(not(../@id='chapter-building-system') or
                          not(../@id='chapter-bootscripts') or
                          $usedestdir = 'n') and
                          @remap != 'destdir'">
              <xsl:apply-templates/>
              <xsl:text>&#xA;</xsl:text>
            </xsl:if>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>


That is what I came up with (which doesn't work like I think it should).
 It always ignores <userinput remap="destdir">.  It appears that the @id
guards used to limit the tests to chapter 6 and chapter 7 aren't working
like I think they should.  Any pointers?  I think my logic is correct,
just not the testcase for the chapter.  Attached is a sample (fake, as
in not the real instructions) grub.xml that includes a destdir block
which would be similar to something that would go into chapter 6 of the
POC book.

TIA

-- DJ Lucas

PS - Attached jhalfs-destdir-1.patch is the rest of the changes
(configuration parts) which seem to work correctly.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"; [
  <!ENTITY % general-entities SYSTEM "../general.ent">
  %general-entities;
]>

<sect1 id="ch-system-grub" role="wrap">
  <?dbhtml filename="grub.html"?>

  <sect1info condition="script">
    <productname>grub</productname>
    <productnumber>&grub-version;</productnumber>
    <address>&grub-url;</address>
  </sect1info>

  <title>GRUB-&grub-version;</title>

  <indexterm zone="ch-system-grub">
    <primary sortas="a-Grub">GRUB</primary>
  </indexterm>

  <sect2 role="package">
    <title/>

    <para>The GRUB package contains the GRand Unified Bootloader.</para>

    <segmentedlist>
      <segtitle>&buildtime;</segtitle>
      <segtitle>&diskspace;</segtitle>

      <seglistitem>
        <seg>&grub-ch6-sbu;</seg>
        <seg>&grub-ch6-du;</seg>
      </seglistitem>
    </segmentedlist>

  </sect2>

  <sect2 role="installation">
    <title>Installation of GRUB</title>

    <para>Prepare GRUB for compilation:</para>

<screen><userinput remap="configure">./configure --prefix=/usr           \
             --sysconfdir=/etc       \
             --disable-grub-emu-usb  \
             --disable-grub-fstest   \
             --disable-efiemu</userinput></screen>

    <para>The --disable switches minimize what is built by disabling features
    and testing programs not really needed for LFS.</para>

    <para>Compile the package:</para>

<screen><userinput remap="make">make</userinput></screen>

    <para>This package does not come with a test suite.</para>

    <para>If not using DESTDIR, install the package:</para>

<screen><userinput remap="install">make install</userinput></screen>

    <para>If using DESTDIR, create the package and install it:</para>

<screen><userinput remap="destdir">make DESTDIR="/packages/grub" install &amp;&amp;
rm /packages/grub/usr/share/info/info.dir &amp;&amp;
for file in find /packages/grub -type f
do
    touch $file
done &amp;&amp;
chown -R root:root /packages/grub &amp;&amp;
tar -jcf /packages/grub-&grub-version;-1.tar.bz2 /packages/grub/* &amp;&amp;
cp -R /packages/grub/* / &amp;&amp;
install-info --dir /usr/share/info/dir /usr/share/info/grub.info &amp;&amp;
rm -rf /package/grub</userinput></screen>

  <para>Using GRUB to make your LFS system bootable will be discussed in 
  <xref linkend="ch-bootable-grub"/>.</para>

  </sect2>

  <sect2 id="contents-gRUB" role="content">
    <title>Contents of GRUB</title>

    <segmentedlist>
      <segtitle>Installed programs</segtitle>
      <segtitle>Installed directories</segtitle>

      <seglistitem>
        <seg>grub-bin2h, grub-editenv, grub-install, grub-mkconfig,
        grub-mkdevicemap, grub-mkelfimage, grub-mkimage, grub-mkisofs,
        grub-mkpasswd-pbkdf2, grub-mkrelpath, grub-mkrescue, grub-probe,
        grub-reboot, grub-script-check, grub-set-default, grub-setup</seg>
        <seg>/usr/lib/grub, /etc/grub.d, /usr/share/grub</seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="grub-bin2h">
        <term><command>grub-bin2h</command></term>
        <listitem>
          <para>Converts a binary file to a C header</para>
          <indexterm zone="ch-system-grub grub-bin2h">
            <primary sortas="b-grub-bin2h">grub-bin2h</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="grub-editenv">
        <term><command>grub-editenv</command></term>
        <listitem>
          <para>A tool to edit the environment block</para>
          <indexterm zone="ch-system-grub grub-editenv">
            <primary sortas="b-grub-editenv">grub-editenv</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="grub-install">
        <term><command>grub-install</command></term>
        <listitem>
          <para>Install GRUB on your drive</para>
          <indexterm zone="ch-system-grub grub-install">
            <primary sortas="b-grub-install">grub-install</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="grub-mkconfig">
        <term><command>grub-mkconfig</command></term>
        <listitem>
          <para>Generate a grub config file</para>
          <indexterm zone="ch-system-grub grub-mkconfig">
            <primary sortas="b-grub-mkconfig">grub-mkconfig</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="grub-mkdevicemap">
        <term><command>grub-mkdevicemap</command></term>
        <listitem>
          <para>Generate a device map file automatically</para>
          <indexterm zone="ch-system-grub grub-mkdevicemap">
            <primary sortas="b-grub-mkdevicemap">grub-mkdevicemap</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="grub-mkelfimage">
        <term><command>grub-mkelfimage</command></term>
        <listitem>
          <para>Make a bootable image of GRUB</para>
          <indexterm zone="ch-system-grub grub-mkelfimage">
            <primary sortas="b-grub-mkelfimage">grub-mkelfimage</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="grub-mkimage">
        <term><command>grub-mkimage</command></term>
        <listitem>
          <para>Make a bootable image of GRUB</para>
          <indexterm zone="ch-system-grub grub-mkimage">
            <primary sortas="b-grub-mkimage">grub-mkimage</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="grub-mkisofs">
        <term><command>grub-mkisofs</command></term>
        <listitem>
          <para>Creates a bootable ISO image</para>
          <indexterm zone="ch-system-grub grub-mkisofs">
            <primary sortas="b-grub-mkisofs">grub-mkisofs</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="grub-mkpasswd-pbkdf2">
        <term><command>grub-mkpasswd-pbkdf2</command></term>
        <listitem>
          <para>Generates an encrypted PBKDF2 password for use in the boot
          menu</para>
          <indexterm zone="ch-system-grub grub-mkpasswd-pbkdf2">
            <primary sortas="b-grub-mkpasswd-pbkdf2">grub-mkpasswd-pbkdf2</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="grub-mkrelpath">
        <term><command>grub-mkrelpath</command></term>
        <listitem>
          <para>Makes a system pathname relative to its root</para>
          <indexterm zone="ch-system-grub grub-mkrelpath">
            <primary sortas="b-grub-mkrelpath">grub-mkrelpath</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="grub-mkrescue">
        <term><command>grub-mkrescue</command></term>
        <listitem>
          <para>Make a bootable image of GRUB suitable for a floppy disk</para>
          <indexterm zone="ch-system-grub grub-mkrescue">
            <primary sortas="b-grub-mkrescue">grub-mkrescue</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="grub-probe">
        <term><command>grub-probe</command></term>
        <listitem>
          <para>Probe device information for a given path or device</para>
          <indexterm zone="ch-system-grub grub-probe">
            <primary sortas="b-grub-probe">grub-probe</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="grub-reboot">
        <term><command>grub-reboot</command></term>
        <listitem>
          <para>Sets the default boot entry for GRUB for the next boot only</para>
          <indexterm zone="ch-system-grub grub-reboot">
            <primary sortas="b-grub-reboot">grub-reboot</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="grub-script-check">
        <term><command>grub-script-check</command></term>
        <listitem>
          <para>Checks GRUB configuration script for syntax errors</para>
          <indexterm zone="ch-system-grub grub-script-check">
            <primary sortas="b-grub-script-check">grub-script-check</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="grub-set-default">
        <term><command>grub-set-default</command></term>
        <listitem>
          <para>Sets the default boot entry for GRUB</para>
          <indexterm zone="ch-system-grub grub-set-default">
            <primary sortas="b-grub-set-default">grub-set-default</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="grub-setup">
        <term><command>grub-setup</command></term>
        <listitem>
          <para>Set up images to boot from a device</para>
          <indexterm zone="ch-system-grub grub-setup">
            <primary sortas="b-grub-setup">grub-setup</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>
diff -Naur jhalfs/common/libs/func_book_parser 
jhalfs-destdir/common/libs/func_book_parser
--- jhalfs/common/libs/func_book_parser 2010-07-29 00:38:41.000000000 -0500
+++ jhalfs-destdir/common/libs/func_book_parser 2010-07-29 00:41:55.000000000 
-0500
@@ -139,6 +139,7 @@
         xsltproc --nonet \
                  --xinclude \
                  --stringparam testsuite $TEST \
+                 --stringparam usedestdir $USE_DESTDIR \
                  --stringparam bomb-testsuite $BOMB_TEST \
                  --stringparam vim-lang $VIMLANG \
                  --stringparam timezone $TIMEZONE \
diff -Naur jhalfs/common/libs/func_validate_configs.sh 
jhalfs-destdir/common/libs/func_validate_configs.sh
--- jhalfs/common/libs/func_validate_configs.sh 2010-07-29 00:38:41.000000000 
-0500
+++ jhalfs-destdir/common/libs/func_validate_configs.sh 2010-07-29 
00:46:54.000000000 -0500
@@ -25,7 +25,7 @@
   local -r  GENERAL_common="LUSER LGROUP LHOME BUILDDIR CLEAN GETPKG 
SRC_ARCHIVE \
                             SERVER RETRYSRCDOWNLOAD RETRYDOWNLOADCNT 
DOWNLOADTIMEOUT \
                             GETKERNEL RUNMAKE"
-  local -r    BUILD_chroot="TEST BOMB_TEST STRIP"
+  local -r    BUILD_chroot="TEST BOMB_TEST STRIP USE_DESTDIR"
   local -r    BUILD_common="FSTAB CONFIG TIMEZONE PAGE LANG INSTALL_LOG"
   local -r ADVANCED_chroot="COMPARE RUN_ICA RUN_FARCE ITERATIONS OPTIMIZE"
   local -r ADVANCED_common="REPORT REBUILD_MAKEFILE"
diff -Naur jhalfs/Config.in jhalfs-destdir/Config.in
--- jhalfs/Config.in    2010-07-29 00:38:41.000000000 -0500
+++ jhalfs-destdir/Config.in    2010-07-29 00:41:15.000000000 -0500
@@ -880,6 +880,17 @@
 
        #--- End Test Suites
 
+        #--- Use DESTDIR commands
+        config  USE_DESTDIR
+                bool    "Use DESTDIR style installations"
+                depends BOOK_LFS
+                default n
+                help
+                        #-- Select this if you would rather use the optional
+                        #   DESTDIR installations instead of the standard 
+                        #   'make install' commands.
+        #--- End Use DESTDIR commands
+
        #--- Installed files logs
        config  INSTALL_LOG
                bool    "Create installed files logs"
diff -Naur jhalfs/LFS/lfs.xsl jhalfs-destdir/LFS/lfs.xsl
--- jhalfs/LFS/lfs.xsl  2010-07-29 00:38:41.000000000 -0500
+++ jhalfs-destdir/LFS/lfs.xsl  2010-07-29 00:29:11.000000000 -0500
@@ -13,6 +13,13 @@
 
 <!-- XSLT stylesheet to create shell scripts from LFS books. -->
 
+  <!-- Use destdir installations?
+       n = no, just use regular 'make install'
+       y = yes, install to DESTDIR, and install to final from there with
+           post-install commands.
+  -->
+  <xsl:param name="usedestdir" select="n"/>
+
   <!-- Run test suites?
        0 = none
        1 = only chapter06 Glibc, GCC and Binutils testsuites
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to