ALFS DTD

Version 3.1

ALFS DTD Development Team

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions in any form must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Neither the name of "Linux From Scratch", "Automated Linux From Scratch" nor the names of its contributors may be used to endorse or promote products derived from this material without specific prior written permission.

  • Any material derived from Linux From Scratch must contain a reference to the "Linux From Scratch" project.

  • Any material derived from Automated Linux From Scratch must contain a reference to the "Automated Linux From Scratch" project.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Abstract

This book explains in detail how to use ALFS DTD v3.1.


Dedication

This book is dedicated to the LFS and ALFS communities.

Table of Contents

Preface
ChangeLog
Who Would Want To Read This Book
Contact Information
Mailing Lists
News Server
WWW Links
Other
Acknowledgements
Conventions Used In This Book
1. Description of the ALFS Profile Syntax
ALFS DTD Introduction
XML & DTD Syntax
Quick Introduction to XML Syntax
Standard Entities
XML Elements and Attributes
Quick Introduction to DTD Syntax
DTD Element Declaration
DTD Attribute Declaration
DOCTYPE and SYSTEM Declarations
Element : <alfs>
Syntax
Description
Examples
Element : <archive>
Syntax
Description
Examples
Element : <base>
Syntax
Description
Examples
Element : <configure>
Syntax
Description
Example #1
Example #2
Example #3
Element : <content>
Syntax
Description
Examples
Element : <copy>
Syntax
Description
Examples
Element : <description>
Syntax
Description
Examples
Element: <destination>
Syntax
Description
Example #1
Example #2
Element: <digest>
Syntax
Description
Examples
Element: <download>
Syntax
Description
Examples
Element: <environment>
Syntax
Description
Examples
Element: <execute>
Syntax
Description
Example #1
Example #2
Element: <file>
Syntax
Description
Examples
Element: <find>
Syntax
Description
Examples
Element: <include>
Syntax
Description
Examples
Element: <item>
Syntax
Description
Examples
Element: <link>
Syntax
Description
Examples
Element: <list>
Syntax
Description
Examples
Element: <make>
Syntax
Description
Example #1
Example #2
Element: <mkdir>
Syntax
Description
Examples
Element: <move>
Syntax
Description
Examples
Element: <name>
Syntax
Description
Examples
Element: <option>
Syntax
Description
Examples
Element: <ownership>
Syntax
Description
Example #1
Example #2
Element: <package>
Syntax
Description
Examples
Element: <packageinfo>
Syntax
Description
Examples
Element: <para>
Syntax
Description
Examples
Element: <param>
Syntax
Description
Examples
Element: <patch>
Syntax
Description
Examples
Element: <permissions>
Syntax
Description
Examples
Element: <prefix>
Syntax
Description
Examples
Element: <reference>
Syntax
Description
Examples
Element: <remove>
Syntax
Description
Examples
Element: <replace>
Syntax
Description
Examples
Element: <requires>
Syntax
Description
Examples
Element: <root>
Syntax
Description
Examples
Element: <search_replace>
Syntax
Description
Examples
Element: <source>
Syntax
Description
Examples
Element: <stage>
Syntax
Description
Examples
Element: <stageinfo>
Syntax
Description
Examples
Element: <target>
Syntax
Description
Examples
Element: <textdump>
Syntax
Description
Example #1
Example #2
Element: <unpack>
Syntax
Description
Examples
Element: <url>
Syntax
Description
Examples
Element: <user>
Syntax
Description
Examples
Element: <utilizes>
Syntax
Description
Examples
Element: <variable>
Syntax
Description
Examples
Element: <version>
Syntax
Description
Examples

Preface

ChangeLog

3.1 - June 17th, 2004

  • June 17th, 2004 [jwrober]: Released v3.1.

Who Would Want To Read This Book

This book is mainly aimed at those who want more information on the ALFS DTD. The DTD is designed to be implementation agnostic. This means that you may be reading this book as part of an ALFS implementation source tarball or on the ALFS website.

Contact Information

Mailing Lists

The ALFS DTD uses two mailing list hosted from the Linux From Scratch servers.

Please direct the majority of your emails to the ALFS mailing list at alfs-discuss@linuxfromscratch.org. This is an excellent place to post questions and bug reports. For complete mailing list information, refer to http://www.linuxfromscratch.org/mailman/listinfo/alfs-discuss.

The second list is really for the development team's use and is available at alfs-log@linuxfromscratch.org. This is an excellent place to see the daily activity of the project. For complete mailing list information, refer to http://www.linuxfromscratch.org/mailman/listinfo/alfs-log.

News Server

All the mailing lists hosted at linuxfromscratch.org are also accessible via the NNTP server. All messages posted to a mailing list will be copied to its correspondent newsgroup, and vice versa.

The news server can be reached at news.linuxfromscratch.org.

WWW Links

Some other xrefs that might interest you:

Linux From Scratch:

Automated Linux From Scratch:

Other

The current ALFS DTD documentation maintainer is James Robertson. If you need to reach James, send an email to jwrober@linuxfromscratch.org.

Acknowledgements

We would like to thank the following people and organizations for their contributions towards the Automated Linux From Scratch project:

  • Vassili Dzuba <vassili@linuxfromscratch.org> -- for helping to create the DTD and writing the intial version of this book.

  • Gerard Beekmans <gerard@linuxfromscratch.org> -- for being more then a great help.

  • James Robertson <jwrober@linuxfromscratch.org> -- Current documentation editor.

  • Jesse Tien-Ten-Que for helping to create the DTD and writing the initial version of this book.

  • Countless other people on the ALFS mailing list who are making this project happen by giving their suggestions, testing the tools and submitting bug reports.

Conventions Used In This Book

To make things easy to follow, there are a number of conventions used throughout the book. Following are some examples :

./configure --prefix=/usr

This form of text is designed to be typed in exactly as seen unless otherwise noted in the surrounding text.

install-info: unknown option '--dir-file=/mnt/lfs/usr/info/dir'

This form of text (fixed width text) is showing screen output, probably as the result of commands issued and is also used to show filenames such as /bin/grep

Emphasis

Bold Emphasis

These forms of text are used for several purposes in the book but mainly to emphasize important points or to give examples as to what to type.

http://www.linuxfromscratch.org/alfs

This form of text is used for hyperxrefs, both within the book and to external pages such as HowTo's, download locations, websites, etc.

cat > $LFS/etc/group <<"EOF"
        root:x:0:
        bin:x:1:
        ......
EOF

This type of section is used mainly when creating configuration files. The first command (in bold) tells the system to create the file $LFS/etc/group from whatever is typed on the following lines until the sequence EOF is encountered. Therefore, this whole section is generally typed as seen.

Note

Sample Note

This type of section is to define a notice of some kind. Mostly to alert you of something to take note of.

Chapter 1. Description of the ALFS Profile Syntax

ALFS DTD Introduction

ALFS profiles are written using an XML syntax. This chapter describes the various XML elements that can occur in a profile.

For each element, the book describes:

  • the formal definition of the element, using the exact DTD syntax.

  • a description of the element.

  • one or several examples.

  • an equivalent bash script(s) for the examples (when applicable).

XML & DTD Syntax

Quick Introduction to XML Syntax

To ensure that all readers of the ALFS DTD Book get as much as possible from its contents, it is necessary to provide a quick introduction to the concepts of XML and DTD syntax.

Note

This introduction provides very few examples. This book is written in an XML DTD called DocBook XML. For an example of XML just look at the book's source. Since this book is documenting an XML DTD, look at the rest of the book's contents for examples of DTD syntax.

To begin, here are some basic rules of XML :

  • XML documents use a self-describing and simple to use syntax.

  • All XML elements must have a closing tag. With XML, it is illegal to omit the closing tag.

  • XML tags are case sensitive.

  • All XML elements must be properly nested. Improper nesting of tags makes no sense to XML.

  • All XML documents must have a root element. In other words, all XML documents must contain a single tag pair to define a root element.

  • Attribute values must always be quoted. With XML, it is illegal to omit quotation marks around attribute values.

  • XML parsers preserve all whitespace in XML documents, even that which is considered non-significant.

  • The use of the ampersand [ & ] symbol is reserved. XML uses this to define an entity reference.

Standard Entities

As mentioned in the last section, the ampersand symbol cannot be used by itself. There are a set of standard entity references that every DTD file should contain. There are mostly symbols that you would want to place inside the XML file. You define them by using thier decimal value on the ASCII chart. Here is a good list :

  • Less-Than [ < ] : "&#60;"

  • Greater-Than [ > ] : "&#62;"

  • Ampersand [ & ] : "&#38;"

  • Apostrophe [ ' ] : "&#39;"

  • Quote [ " ] : "&#34;"

  • Non Breaking Space (a forced space) : "&#32;"

  • Emdash [ -- ] : "&#045;&#045;"

Generally, you can assume that amp, lt, gt, and apos are predefined, but you can always make sure by using the numeric references above. Also, if you ever need to create your own, you know how to do it now.

XML Elements and Attributes

XML is designed to hold any kind of information. This information is stored in Elements. Elements are the basic building blocks of XML and are represented in a XML document as tag pairs. Attributes provide a mechanism to further define or classify an element. Elements have relationships with other elements in a document. Some are parents and some are children. Using this semantic description, one can see that children elements need parent elements defined and used first. As mentioned in the last section, an XML document must have a root element. Think of this as the ultimate parent element. The root element must be defined and used before all other elements and all sub-elements (children). All elements and sub-elements will reside inside of the root element. An element can have parsed content, mixed content, simple content, empty content or attributes in their definition.

XML elements must follow these naming rules :

  • Names can contain letters, numbers, and other characters

  • Names must not start with a number or punctuation character

  • Names must not start with the letters xml (or XML or Xml ...)

  • Names cannot contain spaces

Quick Introduction to DTD Syntax

Once an XML document is written, it is generally a good idea to validate the elements used in the document against a known DTD. The Document Type Definition is the mechanism with which one validates the content of a well-formed XML document.

XML DTD files contain :

  • Element declarations and definitions : Elements are declared and defined with their relationships in the DTD file.

  • Attribute declarations and definitions : Element classes or attributes are declared and defined in the DTD file.

  • Entities : Entities are the same thing as variables inside a DTD file or XML document. They can hold any kind of data.

  • PCDATA : PCDATA is Parsed Character DATA. PCDATA is text that will be parsed by a parser. Tags inside the text will be treated as markup and entities will be expanded.

  • CDATA : CDATA is Character DATA. CDATA is text that will NOT be parsed by a parser. Tags inside the text will NOT be treated as markup and entities will not be expanded.

DTD Element Declaration

Elements are declared in the DTD file using a simple, but strict syntax. There are four ways to define an element :

  • EMPTY : When an element is declared with the EMPTY keyword, it means that the element will not hold any information. This is generally used for special tags like <br>.

  • ANY : When an element is declared with the ANY keyword, it means that the element can contain any information that the author wants it to. This is generally a special case.

  • Character Data : When an element is declared with either the PCDATA or CDATA keywords, it will hold one of the two types of information described above.

  • With Children : When an element is declared with the names of other elements in it, this defines a parent-child relationship. Look in the DTD for the child element names to be further defined with the other three ways.

  • Mixed : Some combination of the above four. Generally this is character data mixed with children.

When an element is declared with children, it will also define how the children can be used inside an XML document and also in the order that they are allowed to appear in an XML document. There are four ways that children elements can be defined in a DTD file :

  • One Occurance Only : Example : Element: <search_replace>. The child elements of <search_replace> -- <file>, <find>, and <replace> can only be used once. Notice that there are no symbols after any of the child element names. This is the identifier.

  • Minimum of One Occurance : Example : Element: <permissions>. One of the child elements of <permissions> -- <name>, must be used a minimum of once, but can also be used many times. Notice the plus [ + ] symbol after the name. This is the identifier.

  • Zero or More Occurances : Example : Element: <download>. One of the child elements of <download> -- <url>, can be used zero or many times. Notice the asterisk [ * ] symbol after the name. This is the identifier.

  • Zero or One Occurance : Example : Element: <download>. One of the child elements of <download> -- <digest>, can be used zero or one time only. Notice the question mark [ ? ] symbol after the name. This is the identifier.

  • Either / Or Occurances : Example : Element: <execute>. One of the two child elements of <execute> -- <param>, or <prefix>, can only be used. Notice the pipe [ | ] symbol in between the two elements. This is the identifier.

DTD Attribute Declaration

As mentioned above, attributes can help to define "classes" of Elements. Attributes are defined with types and values. There are 11 types :

  • CDATA : The value is Character Data.

  • (en1|en2|...) : The value is an enumerated list.

  • ID : The value is a unique id.

  • IDREF : The value is the id of another element.

  • IDREFS : The value is a list of other ids,

  • NMTOKEN : The value is a valid XML name.

  • NMTOKENS : The value is a list of valid XML names.

  • ENTITY : The value is an entity.

  • ENTITIES : The value is a list of entities.

  • NOTATION : The value is a name of a notation.

  • xml : The value is a predefined XML value.

There are four value options :

  • Value : The default value of the attribute surrounded by quotes [ " " ]. Example : Element : <alfs>.

  • #IMPLIED : The attribute is optional. Example : Element : <alfs>.

  • #REQUIRED : The attribute is required when the element is used. Example : Element: <execute>.

  • #FIXED : A fixed value. Used with the Value option. Example : Element : <alfs>.

DOCTYPE and SYSTEM Declarations

The DOCTYPE declaration is used in an XML document to define to the XML parser what DTD should be referenced. This declaration is helpful when you have a seperate DTD file outside of the XML document. See Element : <alfs> for an example.

The SYSTEM declaration is used in an XML document to give provide a way to split up a file into smaller chunks. Many XML files can be quite large and having all the information inside one file can be unwieldy. The SYSTEM declaration works just like any ENTITY declaration. See Element : <alfs> for an example.

Element : <alfs>

Syntax

<!ELEMENT alfs           ((configure | copy | download | execute | link | 
                           make | mkdir | move | ownership | package | 
                           patch | permissions | remove | search_replace | 
                           stage | textdump | unpack | include)+)>
<!ATTLIST alfs
          base           CDATA #IMPLIED
          version        CDATA #FIXED "3.1"
          xml:base       CDATA #IMPLIED
          xmlns:xi       CDATA #IMPLIED>

See also : Element : <configure> | Element : <copy> | Element: <download> | Element: <execute> | Element: <link> | Element: <make> | Element: <mkdir> | Element: <move> | Element: <ownership> | Element: <package> | Element: <patch> | Element: <permissions> | Element: <remove> | Element: <search_replace> | Element: <stage> | Element: <textdump> | Element: <unpack> | Element: <include>

Description

The alfs element is the root element of an ALFS profile document. This means that an ALFS profile should contain one and only one alfs element with all the other elements being embedded (used) within this element.

When processing an alfs element, you processes all its embedded children in their order of occurrence.

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, see Element : <base>.

The version attribute identifies the version of the ALFS profile syntax used; it should be "3.1".

The include element and the xml:base and xmlns:xi attributes allow you to use xi:include directives in your profile(s).

Examples

<!DOCTYPE alfs SYSTEM "alfs-3.1.dtd" [

        <!ENTITY % general_entities SYSTEM "entities/general">

        %general_entities;

]>

<alfs version="3.1">

 .....

</alfs>

There is no equivalent Bash script example for this element.

Element : <archive>

Syntax

<!ELEMENT archive        (#PCDATA)>

This element occurs in : Element: <unpack>.

Description

The archive element is used to specify the archive file in an unpack operation.

Examples

Refer to Element: <unpack> for an example.

Element : <base>

Description

The base element when used as an element specifies the base directory which will be used by all the commands in the stage (inherited), unless another base is specified at the level of the command as an attribute.

The base element when used as an attribute specifies the base directory which will be used by any parent element it was called from.

Important

It is very important to understand the difference between the two uses. Most importantly understand that the base element/attribute has no effect on the parent element it is used in unless relative paths are used in the parent element's other attributes and child elements.

Examples

<stage name="Install gzip">

        <stageinfo>

                <root>/mnt/lfs</root>
                <user>lfs</user>
                <environment>
                        <variable name="PATH">/bin:/sbin</variable>
                </environment>
                <base>/usr/src/gzip.1.2.4a</base>

        </stageinfo>

        <configure>
        </configure>

        <make>
        </make>

        <make>
                <param>install</param>
        </make>

</stage>

The equivalent bash script is :

echo Executing configure
su - lfs
export PATH=/bin:/sbin
cd /usr/src/gzip.1.2.4a
./configure

echo Executing make
su - lfs
export PATH=/bin:/sbin
cd /usr/src/gzip.1.2.4a
make

echo Executing make
su - lfs
export PATH=/bin:/sbin
cd /usr/src/gzip.1.2.4a
make install

echo Exiting stage

Element : <configure>

Syntax

<!ELEMENT configure      ((param | prefix)*)>
<!ATTLIST configure
          base           CDATA #IMPLIED
          command        CDATA #IMPLIED>

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element: <param> | Element: <prefix>

Description

The configure element is one of the top-level operation elements. The configure element is used to describe the configure command.

When processing the element, you execute the command ./configure with the parameter(s) and prefix(es) specified.

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, see Element : <base>.

The command attribute allows you to specify a custom command if you don't want to use the default ./configure. This is extremely useful when running ./configure in a build directory outside the main source directory. The packages gcc and glibc often require this.

Example #1

This first example calls configure without any parameters :

<configure base="/usr/src/mypackage/">
</configure>

The equivalent bash script is :

echo Executing configure
cd /usr/src/mypackage/
./configure

Example #2

This second example calls configure with some prefixes and a parameter :

<configure base="/usr/src/mypackage/">
        <prefix>CFLAGS="..."<prefix>
        <prefix>CXXFLAGS="..."<prefix>
        <param>--prefix=/opt/mypackage</param>
</configure>

The equivalent bash script is :

echo Executing configure
cd /usr/src/mypackage/
CFLAGS="..." CXXFLAGS="..." ./configure --prefix=/opt/mypackage

Example #3

This third example calls configure with a parameter and uses prefix :

<configure base="/usr/src/mypackage/">
        <prefix>PATH=/usr/local/bin</prefix>
        <param>--prefix=/opt/mypackage</param>
</configure>

The equivalent bash script is :

echo Executing configure
cd /usr/src/mypackage/
PATH=/usr/local/bin ./configure --prefix=/opt/mypackage

Element : <content>

Syntax

<!ELEMENT content        (#PCDATA)>

This element occurs in : Element: <textdump>.

Description

The content element is used to specify the content of the file being created when processing a textdump operation.

Note

Of course, it is possible to use XML entity references in the #PCDATA or string of this element.

Examples

<textdump base="/etc">

        <file>group</file>

        <content>
                =root:x:0:
                =bin:x:1:
                =sys:x:2:
                =kmem:x:3:
                =tty:x:4:
                =tape:x:5:
                =daemon:x:6:
                =floppy:x:7:
                =disk:x:8:
                =lp:x:9:
                =dialout:x:10:
                =audio:x:11:
        </content>

</textdump>

The equivalent bash script is :

echo Generating file group
cd /etc
cat > group << 'EOF'
root:x:0:
bin:x:1:
sys:x:2:
kmem:x:3:
tty:x:4:
tape:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
dialout:x:10:
audio:x:11:
EOF

Element : <copy>

Syntax

<!ELEMENT copy           (option*, source+, destination)>
<!ATTLIST copy
          base           CDATA #IMPLIED>

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element: <option> | Element: <source> | Element: <destination>

Description

The copy element is one of the top-level operation elements and is used to copy one or more files and/or directories to a specified destination.

The option child-element provides a means to pass an option to the cp command.

Note

Not all of the cp command's options are in every implementation. Refer to the documentation for your implementation to determine what options are available.

The source child-element is required and can be used multiple times to provide multiple source files and/or directories.

The destination child-element is required and can only be used once. A copy can only have one destination.

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, see Element : <base>.

Examples

<copy base="/usr/src/mypackage">
        <option>force</option>
        <source>config.txt</source>
        <destination>/opt/mypackage/config.txt</destination>
</copy>

The equivalent bash script is :

echo Copying 'config.txt into /opt/mypackage/config.txt'
cd /usr/src/mypackage
cp -f config.txt /opt/mypackage/config.txt

Element : <description>

Syntax

<!ELEMENT description    (para | list)*>

This element occurs in : Element: <packageinfo>

See also : Element: <para> | Element: <list>

Description

The description element contains the description of a package. Its use is for documentation only.

Examples

Refer to Element: <packageinfo> for an example.

There is no equivalent Bash script example for this element.

Element: <destination>

Syntax

<!ELEMENT destination    (#PCDATA)>

This element occurs in : Element : <copy> | Element: <download> | Element: <move> | Element: <unpack> |

Description

The destination element is used to specify the name of the destination file or directory when processing an element in which it occurs.

Example #1

The first example is an unpack command.

<unpack>
        <archive>/usr/src/lfs-packages/gzip.1.2.4a.tar.gz</archive>
        <destination>/usr/src</destination>
</unpack>

The equivalent bash script is :

echo Unpacking /usr/src/lfs-packages/gzip.1.2.4a.tar.gz into /usr/src
cd /usr/src
tar -xzvf /usr/src/lfs-packages/gzip.1.2.4a.tar.gz

Example #2

The second example is a copy command.

<copy base="/usr/src/mypackage">
        <option>force</option>
        <source>config.txt</source>
        <destination>/opt/mypackage/config.txt</destination>
</copy>

The equivalent bash script is :

echo Copying 'config.txt into /opt/mypackage/config.txt'
cd /usr/src/mypackage
cp -f  config.txt /opt/mypackage/config.txt

Element: <digest>

Syntax

<!ELEMENT digest         (#PCDATA)>
<!ATTLIST digest
          type           CDATA "md5">

This element occurs in ; Element: <download> | Element: <unpack>

Description

The digest element is used to specify a unique digest of the file to be operated on by the parent element. Typically these digests are MD5 sums, but an ALFS implementation can support alternative digests as well, including SHA-1.

Note

Support for the digest element is implementation specific. Not all implementations will support every type of digest hash available. Refer to the documentation for your implementation to determine what options are available.

The type attribute specifies the algorithm used to create the specified digest value, and defaults to MD5 if not specified.

Examples

Refer to Element: <reference> for an example.

There is no equivalent Bash script example for this element.

Element: <download>

Syntax

<!ELEMENT download       (file, url*, destination, digest?)>

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element: <file> | Element: <url> | Element: <destination> | Element: <digest>

Description

The download element is one of the top-level operation elements. It is used to specify one or several URLs from which a file can be downloaded; optionally a digest to check that the file being downloaded is the right one and was downloaded correctly (not corrupted or truncated).

The file child-element contains the name of the file to be downloaded.

The url child-element contains the url of the directory from which the download is performed. It should be terminated by a slash [ / ]. More precisely, the actual URL used for the download is the catenation of the content of the url element with the content of the file element.

The destination child-element contains the path of the directory into which the download should be performed.

The digest child-element contains the value to which the digest computed from the dowloaded file will be compared. See Element: <digest>.

If the file is already present in the destination directory, no download is performed but the digest is checked if specified.

Examples

<download>
        <file>gzip-1.2.4a.tar.gz</file>
        <url>ftp://gnu.org/</url>
        <destination>/tmp/</destination>
</download>

The equivalent bash script is :

echo Executing 'download'
wget -nc -O /tmp/gzip-1.2.4a.tar.gz ftp://gnu.org/gzip-1.2.4a.tar.gz

Element: <environment>

Syntax

<!ELEMENT environment    (variable+)>
<!ATTLIST environment
          mode           (append | prepend) #IMPLIED>

This element occurs in : Element: <stageinfo>

See also : Element: <variable>

Description

The environment element allows you to define one or more environment variables to be added to the system environment used when calling the commands of the stage to which it applies.

By default, the supplied value replaces any existing value for the specified variable. The mode attribute allows you to specify whether the supplied value should be prepended or appended to the existing value.

Examples

<stage>
        <stageinfo>

                <base>/usr/src/gzip.1.2.4a</base>

                <environment>
                        <variable name="GCCFLAGS">-O2</variable>
                        <variable name="PATH" mode="prepend">/usr/src/gzip.1.2.4a:</variable>
                        <variable name="LDFLAGS" mode="append"> -s</variable>
                </environment>

        </stageinfo>

</stage>

The equivalent bash script is :

echo Stage

export GCCFLAGS=-O2
export PATH=/usr/src/gzip.1.2.4a:$PATH
export LDFLAGS="$LDFLAGS -s"

echo Exiting stage

Element: <execute>

Syntax

<!ELEMENT execute        ((param | prefix)*)>
<!ATTLIST execute
          base           CDATA #IMPLIED
          command        CDATA #REQUIRED>

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element: <param> | Element: <prefix>

Description

The execute element is one of the top-level operation elements. It is used to execute any arbitrary system command.

The param child-element contains parameters for the command.

The prefix child-element contains any prefix data for the command to execute.

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, see Element : <base>.

The command attribute contains the text of the command itself.

Example #1

The first example is an execute command without a parameter.

<execute command="umount">

The equivalent bash script is :

echo Executing 'umount'
umount

Example #2

The second example is an execute command with one parameter.

<execute command="mount">
        <param>/mount/lfs</param>
</execute>

The equivalent bash script is :

echo Executing 'mount'
mount /mount/lfs

Element: <file>

Syntax

<!ELEMENT file           (#PCDATA)>

This element occurs in : Element: <download> | Element: <search_replace> | Element: <textdump>.

Description

The file element is used to specify the filename for a download, search_replace or textdump operation.

Examples

See any one of the parent elements for an example.

Element: <find>

Syntax

<!ELEMENT find           (#PCDATA)>

This element occurs in : Element: <search_replace>

Description

The find element allows you to specify the string to be searched for in a search and replace operation.

Examples

Refer to the parent Element: <search_replace> for an example.

Element: <include>

Syntax

<!ELEMENT include        EMPTY>
<!ATTLIST include
          href           CDATA #REQUIRED>

This element occurs in : Element : <alfs>

Description

The include element contains data necessary to handle the xi:include directive in an alfs element.

Examples

Refer to Element : <alfs> for an example.

Element: <item>

Syntax

<!ELEMENT item           (#PCDATA)>

This element occurs in : Element: <list>

Description

The item element contains an item within a list in a description element.

Examples

Refer to Element : <description> for an example.

Element: <link>

Syntax

<!ELEMENT link           (option?, target+, name)>
<!ATTLIST link
          base           CDATA #IMPLIED
          type           CDATA #IMPLIED>

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element: <option> | Element: <target> | Element: <name>

Description

The link element is one of the top-level operation elements. It allows you to create a hard or symbolic link.

The target child-element gives the name(s) of the target.

The option child-element provides a means to pass an option to the ln command.

Note

Not all of the ln command's options are in every implementation. Refer to the documentation for your implementation to determine what options are available.

The name child-element gives the name of the link. When there are several targets, this must be the name of a directory, in which the links to the targets will be created.

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, see Element : <base>.

The type attribute generally can have one of two values: "symbolic" or "hard" to go along with how the ln works.

Examples

<link type="symbolic">
        <target>share/man</target>
        <target>share/doc</target>
        <target>share/info</target>
        <name>/usr/local</name>
</link>

The equivalent bash script is :

echo 'Linking  share/man share/doc share/info into /usr/local'
ln -s  share/man share/doc share/info /usr/local

Element: <list>

Syntax

<!ELEMENT list           (item | list)+>
<!ATTLIST list
          type           (bullet | number) "bullet">

This element occurs in : Element : <description>

See also : Element: <item>

Description

The list element contains a list of items or sub-lists in a description.

The type attribute provides a way to define a numbered or bulleted list

Examples

Refer to the parent Element : <description> for an example.

Element: <make>

Syntax

<!ELEMENT make           ((param | prefix)*)>
<!ATTLIST make
          base           CDATA #IMPLIED>

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element: <param> | Element: <prefix>

Description

The make element is one of the top-level operation elements. It describes the make command.

The param child-element allows you to specify parameters of the make command.

The prefix child-element allows you to specify an environment variable or some other prefix to the make command

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, see Element : <base>.

Example #1

The first example is a make without parameter

<make />

The equivalent bash script is :

echo Executing make
make

Example #2

The second example is a make with a parameter

<make base="/usr/src/mypackage">
        <param>install</param>
</make>

The equivalent bash script is :

echo Executing make
cd /usr/src/mypackage
make install

Element: <mkdir>

Syntax

<!ELEMENT mkdir          (option?, permissions?, name+)>
<!ATTLIST mkdir
          base           CDATA #IMPLIED>

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element: <option> | Element: <name> | Element: <permissions>

Description

The mkdir element is one of the top-level operation elements. It describes the creation of one (or several) directory(ies).

The option child-element provides a means to pass an option to the mkdir command.

Note

Not all of the mkdir command's options are in every implementation. Refer to the documentation for your implementation to determine what options are available.

The permissions child-element assigns permissions to the directories created by the command following the syntax in Element: <permissions>.

The name child-element contains the name(s) of the directory(ies) to be created.

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, see Element : <base>.

Examples

<mkdir base="/usr/local/lib">
        <option>parents</option>
        <name>X11</name>
</mkdir>

The equivalent bash script is :

cd /usr/local/lib
echo Making directory X11
mkdir -p X11

Element: <move>

Syntax

<!ELEMENT move           (option?, source+, destination)>
<!ATTLIST move
          base           CDATA #IMPLIED>

This element occurs in : Element : <alfs> | Element: <stage> |

See also : Element: <option> | Element: <source> | Element: <destination>

Description

The move element is one of the top-level operation elements. It can be used to move one or more files and/or directories into a destination directory, or to rename a single file or directory.

The option child-element provides a means to pass an option to the mv command.

Note

Not all of the mv command's options are in every implementation. Refer to the documentation for your implementation to determine what options are available.

When processing this element, you move each source to the destination, using the specified option if present.

The source child-element contains the name of the source file and its directory.

The destination child-element contains the name of the destination directory (and, optionally, the command) for the mv command.

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, see Element : <base>.

Examples

<move>
        <source>/usr/src/mypackage/config.txt</source>
        <destination>/opt/mypackage/config.txt</destination>
</move>

The equivalent bash script is :

echo Move ' /usr/src/mypackage/config.txt /opt/mypackage/config.txt'
mv /usr/src/mypackage/config.txt /opt/mypackage/config.txt

Element: <name>

Syntax

<!ELEMENT name           (#PCDATA)>

This element occurs in : Element: <link> | Element: <mkdir> | Element: <ownership> | Element: <permissions> | Element: <requires> | Element: <utilizes>

See also (used as an attribute) : Element: <package> | Element: <stage> | Element: <variable>

Description

The name element is used to specify a name for those commands that requires it.

Examples

<mkdir base="/usr/local/lib">
        <option>parents</option>
        <name>X11</name>
</mkdir>

The equivalent bash script is :

cd /usr/local/lib
echo Making directory X11
mkdir -p X11

Element: <option>

Syntax

<!ELEMENT option         (#PCDATA)>

This element occurs in : Element : <copy> | Element: <link> | Element: <mkdir> | Element: <move> | Element: <ownership> | Element: <permissions>

Description

The option element allows you to specify an option of the parent element.

Examples

<mkdir base="/usr/local/lib">
        <option>parents</option>
        <name>X11</name>
</mkdir>

The equivalent bash script is :

cd /usr/local/lib
echo Making directory X11
mkdir -p X11

Element: <ownership>

Syntax

<!ELEMENT ownership      (option?, name+)>
<!ATTLIST ownership
          base           CDATA #IMPLIED
          user           CDATA #IMPLIED
          group          CDATA #IMPLIED>

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element: <option> | Element: <name>

Description

The ownership element is one of the top-level operation elements. It is used to perform a group and/or user ownership change on a file or set of files

The option child-element provides a means to pass an option to the chown command.

Note

Not all of the chown command's options are in every implementation. Refer to the documentation for your implementation to determine what options are available.

The name child-element contains the name of the file (or directory) whose ownership is to be changed. This child-element can accept both names and group numbers.

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, see Element : <base>.

The user attribute specifies the name of the user which will own the file or directory. This child-element can accept both names and user numbers. See Element: <user>.

The group attribute specifies the name of the group which will own the file or directory.

Example #1

The first example uses symbolic names.

<ownership user="root" group="root">
        <option>recursive</option>
        <name>/etc/rc.d</name>
        <name>/etc/sysconfig</name>
</ownership>

The equivalent bash script is :

echo Changing group of /etc/rc.d to root
chgrp -R root /etc/rc.d

echo Changing owner of /etc/rc.d to root
chown -R root /etc/rc.d

echo Changing group of /etc/sysconfig to root
chgrp -R root /etc/sysconfig

echo Changing owner of /etc/sysconfig to root
chown -R root /etc/sysconfig

Example #2

The second example uses numeric values (0 = root).

<ownership user="0" group="0">
        <option>recursive</option>
        <name>/etc/rc.d</name>
        <name>/etc/sysconfig</name>
</ownership>

The equivalent bash script is :

echo Changing group of /etc/rc.d to 0
chgrp -R 0 /etc/rc.d

echo Changing owner of /etc/rc.d to 0
chown -R 0 /etc/rc.d

echo Changing group of /etc/sysconfig to 0
chgrp -R 0 /etc/sysconfig

echo Changing owner of /etc/sysconfig to 0
chown -R 0 /etc/sysconfig

Element: <package>

Syntax

<!ELEMENT package        (packageinfo?, stage+)>
<!ATTLIST package
          name           CDATA #REQUIRED
          version        CDATA #REQUIRED>

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element: <packageinfo> | Element: <stage>

Description

The package element is one of the top-level operation elements. It describes the build process of a package. The actual build process is described by the stage sub-elements.

The name attribute contains the name of the package. See Element: <name>.

The version attribute contains the version of the package. See Element: <version>.

Examples

<package name="zlib" version="1.1.4">

        <stage name="Unpacking a package.">

                <unpack>
                        <archive>/usr/src/lfs-packages/zlib.1.1.4.tar.gz</archive>
                        <destination>/usr/src</destination>
                </unpack>

        </stage>

        .....

</package>

The equivalent bash script is :

echo Generating package zlib 1.1.4

#-----------------------------------------
echo Stage "Unpacking a package."

echo Unpacking /usr/src/lfs-packages/zlib.1.1.4.tar.gz into /usr/src
cd /usr/src
[[ $? != 0 ]] &&  echo Command failed && exit 3

tar xzvf /usr/src/lfs-packages/zlib.1.1.4.tar.gz
[[ $? != 0 ]] &&  echo Command failed && exit 3


echo Exiting stage "Unpacking a package."

.....

echo End of generating package zlib 1.1.4

Element: <packageinfo>

Syntax

<!ELEMENT packageinfo    (description?, requires*, utilizes*)>

This element occurs in : Element: <package>

See also : Element : <description> | Element: <requires> | Element: <utilizes>

Description

The packageinfo element groups elements containing information about the package, namely a description and some dependency relationship(s).

The description child-element provides for a description of the packge.

The requires child-element provides for a relationship (dependancy) to other defined packages in the profile.

The utilizes child-element provdes for a relationship (uses / optional) to other defined packages in the profile.

Examples

<package name="gimp" version="1.2.3">

        <packageinfo>

                <description>

                        <para>The gimp package contains the GNU Image Manipulation Program.
                                    This is useful for :</para>

                        <list>
                                <item>photo retouching,</item>
                                <item>image composition,</item>
                                <item>image authoring.</item>
                        </list>

                </description>
        
                <requires><name>gtk+</name></requires>

                <utilizes><name>libtiff</name></utilizes>
                <utilizes><name>libpng</name></utilizes>
                <utilizes><name>libjpeg</name></utilizes>
                <utilizes><name>aalib</name></utilizes>
                <utilizes><name>mpeg_lib</name></utilizes>
                <utilizes><name>python</name></utilizes>

        </packageinfo>

        ....

</package>

There is no equivalent bash script for the element.

Element: <para>

Syntax

<!ELEMENT para           (#PCDATA)>

This element occurs in : Element : <description>

Description

The para element contains a paragraph of documentary text.

Examples

Refer to Element: <packageinfo> for an example.

Element: <param>

Syntax

<!ELEMENT param          (#PCDATA)>

This element occurs in : Element : <configure> | Element: <execute> | Element: <make> | Element: <patch>

Description

This element is used to specify a parameter for the parent element.

Examples

<make>
        <param>install</param>
</make>

The equivalent bash script is :

echo Executing make
make install

Element: <patch>

Syntax

<!ELEMENT patch          ((param | prefix)*)>
<!ATTLIST patch
          base           CDATA #IMPLIED>

This element occurs : Element : <alfs> | Element: <stage>

See also : Element: <param> | Element: <prefix>

Description

The patch element is one of the top-level operation elements. It is used to execute the patch command.

The param child-element contains the parameters of the command.

The prefix child-element provides a means to specify an environment variable or some other prefix to the patch command.

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, see Element : <base>.

Examples

<patch>
        <param>-N</param>
        <param>-p1</param>
        <param>-i ../gawk-3.1.1.patch</param>
</patch>

The equivalent bash script is :

echo 'patch -N -p1 -i ../gawk-3.1.1.patch'
patch -N -p1 -i ../gawk-3.1.1.patch

Element: <permissions>

Syntax

<!ELEMENT permissions    (option?, name+)>
<!ATTLIST permissions
          base           CDATA #IMPLIED
          mode           CDATA #REQUIRED>

See also : Element: <option> | Element: <name>

Description

The permissions element is one of the top-level operation elements. It allows you to change the permissions of a (set of) file(s) or directory(ies).

The option child-element provides a means to pass an option to the chmod command.

Note

Not all of the chmod command's options are in every implementation. Refer to the documentation for your implementation to determine what options are available.

The name child-element contains the name(s) of the files whose permission is to be modified. See Element: <name>.

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, see Element : <base>.

The mode attribute gives the new access mode, as used in the chmod command.

Examples

<permissions mode="755">
        <name>/usr/bin/lex</name>
</permissions>

The equivalent bash script is :

echo Changing permissions of /usr/bin/lex to 755
chmod 755 /usr/bin/lex

Element: <prefix>

Syntax

<!ELEMENT prefix         (#PCDATA)>

This element occurs in : Element : <configure> | Element: <execute> | Element: <make> | Element: <patch>

Description

The prefix element provides a means to specify an environment variable or some other prefix to the parent element.

Examples

See any one of the parent elements for an example.

Element: <reference>

Syntax

<!ELEMENT reference      (#PCDATA)>

This element occurs in : Element: <unpack>

Description

The reference element is used to specify the URL of the reference archive to download if the local copy is not available.

Examples

<unpack>
        <reference>ftp://ftp.gnu.org/gnu/gzip/gzip.1.2.4a.tar.gz</reference>
        <archive>/usr/src/lfs-packages/gzip.1.2.4a</archive>
        <destination>/usr/src</destination>
</unpack>

The equivalent bash script is :

echo Unpacking /usr/src/lfs-packages/gzip.1.2.4a.tar.gz into /usr/src
[[ ! -f /usr/src/lfs-packages/gzip.1.2.4a.tar.gz ]] &&
  echo Retrieving  ftp://ftp.gnu.org/gnu/gzip/gzip.1.2.4a.tar.gz
[[ ! -f /usr/src/lfs-packages/gzip.1.2.4a.tar.gz ]] &&
  wget -O /usr/src/lfs-packages/gzip.1.2.4a.tar.gz ftp://ftp.gnu.org/gnu/gzip/gzip.1.2.4a.tar.gz
[[ ! -f /usr/src/lfs-packages/gzip.1.2.4a.tar.gz ]] &&
  echo Archive does not exist && exit 3

cd /usr/src
tar xzvf /usr/src/lfs-packages/gzip.1.2.4a.tar.gz

Element: <remove>

Syntax

<!ELEMENT remove         (#PCDATA)>

This element occurs in : Element : <alfs> | Element: <stage>

Description

The remove element is one of the top-level operation elements. It allows you to remove a file or directory. The content of the element contains the name of the file.

Note

Not all of the rm command's options are in every implementation. Refer to the documentation for your implementation to determine what options are available.

Examples

<remove>/usr/src/mypackage</remove>

The equivalent bash script is :

echo Removing /usr/src/mypackage
rm -rf /usr/src/mypackage

Element: <replace>

Syntax

<!ELEMENT replace        (#PCDATA)>

This element occurs in : Element: <search_replace>

Description

The replace element allows you to specify the replacement string in a search and replace operation.

Examples

Refer to Element: <search_replace> for an example.

Element: <requires>

Syntax

<!ELEMENT requires       (name, version*)>

This element occurs in : Element: <packageinfo>

See also : Element: <name> | Element: <version>

Description

The requires element denotes a dependency between two packages. The package containing the requires element depends on the package whose name is contained in the name child-element.

The actual name is put into a name child-element.

Note

To work properly, the package identified in the name child-element must be defined in either the same profile as the requires element, or in an additional profile (if the ALFS implementation you are using supports loading multiple profiles).

The version element can be used to specify the allowable version(s) of the required package.

Examples

Refer to Element: <packageinfo> for an example.

Element: <root>

Syntax

<!ELEMENT root           (#PCDATA)>

This element occurs in : Element: <stageinfo>

Description

The root element allows you to specify the name of a directory which will be the root directory for the commands of the stage.

Examples

<stage>
        <stageinfo>
                <root>/mnt/lfs</root>
                <base>/usr/src/gzip.1.2.4a</base>
        </stageinfo>

        <configure />

        <make />

        <make>
                <param>install</param>
        </make>
</stage>

The equivalent bash script is :

echo Creating file /mnt/lfs/_nalfs_tmp.1...
cat > /mnt/lfs/_nalfs_tmp.1 << 'EOF1'
echo Executing configure
cd /usr/src/gzip.1.2.4a
./configure

echo Executing make
cd /usr/src/gzip.1.2.4a
make

echo Executing make
cd /usr/src/gzip.1.2.4a
make install

true
EOF1

chmod 775 /mnt/lfs/_nalfs_tmp.1
echo Executing in directory /mnt/lfs
/usr/sbin/chroot /mnt/lfs sh -c ./_nalfs_tmp.1

echo Exiting stage

Element: <search_replace>

Syntax

<!ELEMENT search_replace (file, find, replace)>
<!ATTLIST configure
          base           CDATA #IMPLIED>

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element: <file> | Element: <find> | Element: <replace>

Description

The search_replace element is one of the top-level operation elements. It is used to perform a search and replace operation of a file on a file's contents.

The file child-element contains the filename.

The find child-element contains the string to be searched.

The replace child-element contains the replacement string.

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, see Element : <base>.

Examples

<search_replace base="/usr/src/mypackage">
        <file>runit.sh</file>
        <find>BINDIR</find>
        <replace>/bin</replace>
</search_replace>

The equivalent bash script is :

echo Performing substitution in runit.sh
cd /usr/src/mypackage
cp runit.sh /tmp/foo.$$
sed -e 's/BINDIR/\/bin/' /tmp/foo.$$ > runit.sh

Element: <source>

Syntax

<!ELEMENT source         (#PCDATA)>

This element occurs : Element : <copy> | Element: <move>

Description

The source element is used to specify the name of the source in the parent element.

Examples

See any one of the parent elements for an example.

Element: <stage>

Syntax

<!ELEMENT stage          (stageinfo?, (alfs | configure | copy | download | 
                             execute | link | make | mkdir | move | ownership |
                             package | patch | permissions | remove | 
                             search_replace | stage | textdump | unpack)*)>
<!ATTLIST stage
          name           CDATA #IMPLIED>

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element : <alfs> | Element : <configure> | Element : <copy> | Element: <download> | Element: <execute> | Element: <link> | Element: <make>> | Element: <mkdir> | Element: <move> | Element: <ownership> | Element: <package> | Element: <patch> | Element: <permissions> | Element: <remove> | Element: <search_replace> | Element: <stageinfo> | Element: <textdump> | Element: <unpack>

Description

The stage element is one of the top-level operation elements. It allows you to regroup commands, give a name to this group (through the name attribute) and optionally modify the execution context through the element stageinfo.

Examples

<stage>
        <stageinfo>
                <base>/usr/src/gzip.1.2.4a</base>
        </stageinfo>

        <configure />

        <make />

        <make>
                <param>install</param>
        </make>
</stage>

The equivalent bash script is :

echo Executing configure
cd /usr/src/gzip.1.2.4a
./configure

echo Executing make
cd /usr/src/gzip.1.2.4a
make

echo Executing make
cd /usr/src/gzip.1.2.4a
make install

echo Exiting stage

Element: <stageinfo>

Syntax

<!ELEMENT stageinfo      (root?, user?, environment?, base?)>

This element occurs in : Element: <stage>

See also : Element: <root> | Element : <base> | Element: <environment> | Element: <user>

Description

The stageinfo element allows you to specify several contexts of information used to process the commands of the stage to which the stageinfo element belongs.

The user child-element specifies a user ID that will be used as the effective user ID of the current process for all the commands of the stage. See Element: <user>.

The root child-element specifies a directory name in which the commands of the stage will be performed (using a chroot command). See Element: <root>.

The environment child-element allows you to specify an environment variable that will be added to the current environment when processing the commands of the stage. See Element: <environment>.

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, see Element : <base>.

Examples

<stage name="Install gzip">

        <stageinfo>
                <root>/mnt/lfs</root>
                <user>lfs</user>
                <base>/usr/src/gzip.1.2.4a</base>
        </stageinfo>

        <configure>
        </configure>

        <make>
        </make>

        <make>
                <param>install</param>
        </make>

</stage>

The equivalent bash script is :

echo Executing configure
su - lfs
cd /usr/src/gzip.1.2.4a
./configure

echo Executing make
su - lfs
cd /usr/src/gzip.1.2.4a
make

echo Executing make
su - lfs
cd /usr/src/gzip.1.2.4a
make install

echo Exiting stage

Element: <target>

Syntax

<!ELEMENT target         (#PCDATA)>

This element occurs in : Element: <link>

Description

The target element describes a target of a link operation.

Examples

Refer to Element: <link> for an example.

Element: <textdump>

Syntax

<!ELEMENT textdump       (file, content)>
<!ATTLIST textdump
          base           CDATA #IMPLIED
          mode           CDATA #IMPLIED>

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element: <file> | Element : <content>

Description

The textdump element is one of the top-level operation elements. It allows you to create a text file containing specified text.

The file child-element contains the name of the file to be created.

The content child-element is used to specify the content of the file being created when processing a textdump operation. When processing the textual content of this element, one removes the leading blanks up to and including a '=' character.

The base attribute allows you to specify the directory in which the operation will be performed. For a better description, see Element : <base>.

The mode attribute allows you to specify the append creation mode.

Example #1

<textdump base="/etc">

        <file>group</file>

        <content>
                =root:x:0:
                =bin:x:1:
                =sys:x:2:
                =kmem:x:3:
                =tty:x:4:
                =tape:x:5:
                =daemon:x:6:
                =floppy:x:7:
                =disk:x:8:
                =lp:x:9:
                =dialout:x:10:
                =audio:x:11:
        </content>
</textdump>

The equivalent bash script is :

cd /etc
cat > group << 'EOF'
root:x:0:
bin:x:1:
sys:x:2:
kmem:x:3:
tty:x:4:
tape:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
dialout:x:10:
audio:x:11:
EOF

Example #2

<textdump mode="append">

        <file>/etc/sysconfig/network</file>

        <content>
                =GATEWAY=192.168.123.254
                =GATEWAY_IF=eth0
        </content>

</textdump>

The equivalent bash script is :

echo Generating file /etc/sysconfig/network
cat >> /etc/sysconfig/network << 'EOF'
GATEWAY=192.168.123.254
GATEWAY_IF=eth0
EOF

Element: <unpack>

Syntax

<!ELEMENT unpack         (digest?, reference*, archive, destination)>

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element : <archive> | Element: <destination> | Element: <digest> | Element: <reference>

Description

The unpack element is one of the top-level operation elements. It is used to unpack an archive into a destination directory.

The reference child-element gives the URL of the archive; it is only used if the archive file is not available locally.

The digest child-element gives the digest of the archive, using the digest type specified in the type attribute. See Element: <digest>.

The archive child-element gives the name of the archive, and the destination child-element gives the name of the directory in which the archive is unpacked.

Examples

<unpack>
        <reference>ftp://ftp.gnu.org/gnu/gzip/gzip.1.2.4a.tar.gz</reference>
        <archive>/usr/src/lfs-packages/gzip.1.2.4a.tar.gz</archive>
        <destination>/usr/src</destination>
</unpack>

The equivalent bash script is :

echo Unpacking /usr/src/lfs-packages/gzip.1.2.4a.tar.gz into /usr/src
wget -nc -O /usr/src/lfs-packages/gzip-1.2.4a.tar.gz ftp://ftp.gnu.org/gnu/gzip/gzip.1.2.4a.tar.gz
cd /usr/src
tar xzvf /usr/src/lfs-packages/gzip.1.2.4a.tar.gz

Element: <url>

Syntax

<!ELEMENT url            (#PCDATA)>

This element occurs in : Element: <download>

Description

The url element allows you to specify the Uniform Resource Locator (URL) of the directory containing the file to be downloaded when processing a download element.

Examples

Refer to Element: <download> for an example.

There is no equivalent Bash script example for this element.

Element: <user>

Syntax

<!ELEMENT user           (#PCDATA)>

This element occurs in : Element: <stageinfo>

See also : Element: <ownership>

Description

The user element allows you to specify a user ID that will be the effective user ID when executing the commands of the stage to which it applies.

Examples

Refer to Element: <stageinfo> for an example.

Element: <utilizes>

Syntax

<!ELEMENT utilizes       (name, version*)>

This element occurs in : Element: <packageinfo>

See also : Element: <name> | Element: <version>

Description

The utilizes element indicates that the package containing the utilizes element utilizes the package whose name is contained in the name child-element, but does not depend on it (in which case the element requires should be used).

The actual name is put into the name child-element.

Note

To work properly, the package identified in the name child-element must be defined in either the same profile as the utilizes element, or in an additional profile (if the ALFS implementation you are using supports loading multiple profiles).

Examples

<package name="gimp" version="1.2.3">

        <packageinfo>

                <requires><name>gtk+</name></requires>

                <utilizes><name>libtiff</name></utilizes>
                <utilizes><name>libpng</name></utilizes>
                <utilizes><name>libjpeg</name></utilizes>
                <utilizes><name>aalib</name></utilizes>
                <utilizes><name>mpeg_lib</name></utilizes>
                <utilizes><name>python</name></utilizes>

        </packageinfo>

        .....

</package>

There is no equivalent Bash script example for this element.

Element: <variable>

Syntax

<!ELEMENT variable       (#PCDATA)>
<!ATTLIST variable
          name           CDATA #REQUIRED
          mode           CDATA #IMPLIED>

This element occurs in : Element: <environment>

Description

The variable element allows you to add a variable definition to the system environment.

The name of the variable is given by the name attribute of the element.

The value of the variable is given by the textual content of the element.

The mode attribute can take the value "append", in which case the content of the element is appended to the value of the environment variable.

The mode attribute can also take the value "prepend", in which case the content of the element is prepended to the value of the environment variable.

Examples

<stage>
        <stageinfo>
                <base>/usr/src/gzip.1.2.4a</base>
                <environment>
                        <variable name="GCCFLAGS">-O2</variable>
                        <variable name="PATH" mode="append">:/opt/foo</variable>
                </environment>
        </stageinfo>

        <configure />

        <make />

        <make>
                <param>install</param>
        </make>
</stage>

The equivalent bash script is :

echo Stage

export GCCFLAGS=-O2
export PATH=${PATH}:/opt/foo
echo Executing configure
cd /usr/src/gzip.1.2.4a
./configure

echo Executing make
cd /usr/src/gzip.1.2.4a
make

echo Executing make
cd /usr/src/gzip.1.2.4a
make install

echo Exiting stage

Element: <version>

Syntax

<!ELEMENT version        (#PCDATA)>
<!ATTLIST version
          condition      (eq | ne | gt | ge | lt | le) #REQUIRED>

This element occurs : Element: <package> | Element: <requires> | Element: <utilizes>

Description

The version element describes a constraint on the version of an utilized or required package.

The condition is satisfied if the comparison specified by the condition attribute applies between the actual version value of the package, and the value specified as the content of the element.

When performing the comparison, the sequences of digits are compared numerically, while all the other characters are compared using their codes. Moreover, any substring is greater than the empty string.

That means, for instance, that 2.0.10 is greater than 2.0.9, 2.0a is greater than 2.0 and 2.10 is greater than 2.1a.

Note

The algorithm fails for reasonable interpretations of version numbers like 3.0 and 3.0beta. Intuitively, 3.0 is greater than 3.0beta, but the algorithm returns the opposite. To indicate for instance that the required package must have a version greater than 3.0, one would need two version elements, to require that the actual version be greater than or equal to 3.0, and that it be different from 3.0beta.

Examples

<packageinfo>
        <requires>
                <name>guile</name>
                <version condition="ge">1.5</version>
        </requires>
</packageinfo>

This signifies that the package being build requires guile in its version 1.5 or more recent.

There is no equivalent Bash script example for this element.