Copyright © 2001-2003 ALFS DTD Development Team
Copyright (c) 2001-2003, 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.
This book is dedicated to the LFS and ALFS communities.
3.1-20031105 - November 5th, 2003
November 5th, 2003 [jwrober]: Added elem_prefix.
November 5th, 2003 [jwrober]: Updated elem_configure, elem_copy, elem_description to match the DTD and standardized to the rest of the doc.
November 4th, 2003 [jwrober]: Updated elem_alfs, elem_archive, elem_base to match the DTD; also began the element standardization with the elem_alfs element's page.
November 3rd, 2003 [jwrober]: Standardized headings.
November 3rd, 2003 [jwrober]: Updated acknowledgements, conventions and general preface pages.
September 30th, 2003 [jwrober]: Added an alfs_dtd intro page.
September 26th, 2003 [jwrober]: Modified the header of each page to conform with the DocBook rules that the LFS and BLFS books use (for consistency).
September 24th, 2003 [jwrober]: Removed all references to nALFS, moved files to the ALFS/docs from the ALFS/nALFS/doc moudule in CVS.
September 22nd, 2003 [jwrober]: Various changes to file locations and began standardizing document look and feel like the LFS and BLFS Books.
September 18th, 2003 [vdzuba]: Reorganized the document, now split into small chunks.
February 20th, 2003 [vdzuba]: Added the elements <if>, <then> and <else>.
February 5th, 2003 [vdzuba]: Added an option to <link> and added element <version>.
January 19th, 2003 [vdzuba]: Upgraded to version 3.1 of the DTD.
January 8th, 2003 [vdzuba]: Replaced "option?" by "option*" in copy.
December 5th, 2002 [vdzuba]: Added bash script equivalent to all examples.
October 22nd, 2002 [vdzuba]: Replaced "parent" with "parents" in mkdir.
October 21st, 2002 [vdzuba]: Added element <digest>.
October 13th, 2002 [vdzuba]: Make attribute append of <variable> optional.
September 5th, 2002 [vdzuba]: Added chapter with syntax.
May 7th, 2002 [highos]: Initial structure.
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 source tarball or on the ALFS website.
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
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.
Some other links that might interest you:
Linux From Scratch:
Automated Linux From Scratch:
The current ALFS DTD documentation maintainer is James Robertson. If you need to reach James, send an email to jwrober@linuxfromscratch.org.
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.
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
This form of text is 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 hyperlinks, 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.
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 DTD syntax
a description of the element
one or several examples
an equivalent bash script(s) for the examples, when applicable
The bash scripts have been generated by YAALFS or by hand. The checking of the return code has been removed.
Note: This document describes the syntax of the version 3.1 of the syntax, as used in nALFS v1.1.8 and YAALFS.
<!ELEMENT alfs ((configure | copy | download | execute | link | make | mkdir | move | ownership | package | patch | permissions | remove | search_replace | stage | textdump | unpack)*)> <!ATTLIST alfs base CDATA #IMPLIED version CDATA #FIXED "3.1"> |
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>
The element alfs is the root element of the ALFS DTD. This means that an ALFS profile should contain one and only one alfs element with all the other elements being embedded in this element.
When processing an alfs element, one processes all its embedded children in their order of occurence.
Notice that all the main operation elements (configure to unpack) are surrounded by parathensis [ ( ) ]and followed by an asterisk [ * ]. The asterisk signifies that each main operation element can be used optionally inside the alfs declaration in a profile and that, if used, they can be used more than once.
The attribute base is used to specify the base directory which will be used by all the commands in the element alfs. The use of #IMPLIED denotes that this attribute is optional. If not used, base will inherit its value from an earlier use in the profile. See Element : <base>.
The attribute version identifies the version of the ALFS profile syntax used; it should be "3.1".
<!DOCTYPE alfs SYSTEM "alfs-3.1.dtd" [ <!ENTITY % general_entities SYSTEM "entities/general"> %general_entities; ]> <alfs version="3.1"> ..... </alfs> |
<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 |
The element base is used to specify 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. See also : Element : <alfs> | Element : <configure> | Element : <copy> | Element: <execute> | Element: <link> | Element: <make> | Element: <mkdir> | Element: <move> | Element: <ownership> | Element: <patch> | Element: <permissions> | Element: <search_replace> | Element: <textdump>
<stage> <stageinfo> <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 Stage 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 configure ((param | prefix)*)> <!ATTLIST configure base CDATA #IMPLIED command CDATA #IMPLIED> |
This element is an element of : Element : <alfs> | Element: <stage>
See also : Element: <param> | Element: <prefix>
The element configure is one of the many main operation elements. The element configure is used to describe the command configure.
Notice that all the elements param and prefix are surrounded by parathensis [ ( ) ] and followed by an asterisk [ * ]. The asterisk signifies that each element can be used optionally inside the configure declaration in a profile and that, if used, they can be used more than once.
When processing the element, one executes the command ./configure with the parameter(s) and prefix(es) specified.
The attribute base allows you to specify the directory in which the command is executed. See Element : <base>.
The attribute command allows you to specify a custom command if you doen't want to use the default ./configure. This is extremely usefull when running ./configure in a build directory outside the main source directory. The packages gcc and glibc often require this.
This example calls to configure without any parameters :
<configure base="/usr/src/mypackage/"> </configure> |
The equivalent bash script is :
echo Executing configure cd /usr/src/mypackage/ ./configure |
This example calls configure with 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/ ./configure --prefix=/opt/mypackage |
This example calls configure with a parameter and an explicit command :
<configure base="/usr/src/mypackage/" command="PATH=/usr/local/bin ./configure"> <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 |
The element content 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.
<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 (option*, source+, destination)> <!ATTLIST copy base CDATA #IMPLIED> |
This element is an element of : Element : <alfs> | Element: <stage>
See also : Element: <option> | Element: <source> | Element: <destination>
The element copy is one of the many main operation elements. The element copy is used to copy one or several source files and/or directories into a destination file or directory
The element option is optional and can be used one or many times to ensure the correct use of the cp command. The following is the currently supported list of options for the cp command :
archive (-a, --archive)
force (-f, --force)
no-dereference (-d, --no-dereference)
preserve (-p, --preserve)
recursive (-R, -r, --recursive)
The element source is required and can be used many times to provide multiple source locations for a file.
The element destination is required and can only be used once. A copy can only have one destination.
The attribute base allows you to specify the directory in which the command is executed. See Element : <base>.
<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 (para | list)*> |
This element occurs in the Element: <packageinfo>
See also : Element: <para> | Element: <list>
The element description contains the description of a package. Its use is for documentation only.
Notice that all the elements para and list are surrounded by parathensis [ ( ) ] and followed by an asterisk [ * ]. The asterisk signifies that each element can be used optionally inside the description declaration in a profile and that, if used, they can be used more than once.
<package name="gimp" version="1.2.3"> <packageinfo> <description> <para>The gimp package contains the GNU Image Manipulation Program. This is useful for photo retouching, image composition and image authoring. </para> </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> </required> .... </package> |
<!ELEMENT destination (#PCDATA)> |
This element occurs in the elements copy, download, move and unpack. .
The element destination is used to specify the name of the destination file or directory when processing a copy, move or unpack element.
It is also used to specify the path of the destination directory when processing a download element.
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 |
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 (#PCDATA)> <ATTLIST digest type CDATA "md5"> |
The element unpack is used to specify the digest of the archive file to be unpacked, or of the file to be downloaded.
<download> <file>kbd-1.08.tar.gz</file> <url>ftp://ftp.win.tue.nl/pub/linux-local/utils/kbd/</url> <destination>/tmp/</destination> <digest>924e6a05e52715dc0f96385b35f2f680</digest> </download> |
YAALFS does not process this element yet.
<!ELEMENT download (file,url*,destination,digest?)> |
This element occurs in the elements alfs, else, stage. and then
See also : file, destination, digest, url,
The element download is used to specify one or several urls from which a file can be downloaded, and optionally a digest to check that the file being downloaded if the right one.
The sub-element file contains the name of the file to be downloaded.
The sub-element url 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 sub-element destination contains the path of the directory into which the download should be performed.
The sub-element digest contains the value with which the digest computed from the dowloaded file (e.g. computed using the md5 algorithm) will be compared.
If the file is already present in the destination directory, no download is performed but the digest is checked if present.
<download> <file>kbd-1.08.tar.gz</file> <url>ftp://ftp.win.tue.nl/pub/linux-local/utils/kbd/</url> <destination>/tmp/</destination> <digest>924e6a05e52715dc0f96385b35f2f680</digest> </download> |
YAALFS does not process this element yet.
<!ELEMENT else (stageinfo?,(configure|copy|download|execute| if|link|make|mkdir|move|ownership|package| patch|permissions|remove|search_replace| stage|textdump|unpack)*)> |
This element occurs in the element if.
See also : configure, copy, download, execute, if, link, make, mkdir, move, ownership, package, patch, permissions, remove, search_replace, stageinfo, textdump, unpack.
This element groups the elements that should be executed if the test performed when evaluating an if element isn't satisfied.
<!ELEMENT environment (variable+)> <!ATTLIST environment mode CDATA #IMPLIED> |
This element occurs in the element stageinfo.
See also : variable,
The element environment 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 attribute mode allows you to specify whether the supplied value should be prepended or appended to the existing value.
<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> <configure /> <make /> <make> <param>install</param> </make> </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 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 execute (param*)> <!ATTLIST execute base CDATA #IMPLIED command CDATA #REQUIRED> |
This element occurs in the elements alfs, else, stage. and then
See also : param.
The element execute is used to execute an arbitrary command.
The attribute base allows to specify the directory in which the command will be executed;
The attribute command contains the text of the command itself.
The subelements param contain parameters of the command.
The first example is an execute command without parameter.
<execute command="umount" /> |
The equivalent bash script is :
echo Executing 'umount' umount |
The second example is an execute command without one parameter.
<execute command="mount"> <param>/mnfs/lfs</param> </execute> |
The equivalent bash script is :
echo Executing 'mount' mount /mnfs/lfs |
<!ELEMENT file (#PCDATA)> |
This element occurs in the elements download, search_replace and textdump.
The element file is used to specify the file in a download, search_replace or textdump element.
The first example is a search_replace.
<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 |
The second example is a textdump.
<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 |
The element find allows to specify the string to be searched in a search and replace operation.
<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 if (then?,else?)> <!ATTLIST if test CDATA #IMPLIED package CDATA #IMPLIED condition (eq|ne|gt|ge|lt|le) #IMPLIED version CDATA #IMPLIED> |
This element occurs in the elements alfs, else, stage, and then.
The element if perform either a test either of a shell expression (if the test attribute is specified), or an evaluation on the existence or version of a package (if the package attribute is specified.
If the test attribute is specified, one look first for four special values : "0", "1", "false", and "true", which have the usual meaning. If the attribute has another value, one executes the attribute as a shell expression, and consider that the test is satisfied of the status is 0.
If the package attribute is specified but the condition attribute is not specified, the test will be satisfied if the specified package has been build.
If the attributes package, condition and version are specified, the test will be satisfied if the condition on the vaersion of the package is satisfied. The condition is evaluated the same was as when evaluating the version element.
The two attributes test and package are mutually exclusive.
<if test="0"> <then><execute command="echo this should be executed." /></then> <else><execute command="echo this should not be executed." /></else> </if> |
<execute command="touch /tmp/foo" /> <if test="[-r /tmp/foo"> <then><execute command="echo this should be executed." /></then> <else><execute command="echo this should not be executed." /></else> </if> |
<if package="bison"> <then><execute command="echo this should be executed if bison is build." /></then> <else><execute command="echo this should not be executed if bison is build." /></else> </if> |
<if package="bison" condition="ge" version="1.875"> <then><execute command="echo this should be executed if bison 1.875 or greater is build." /></then> </if> |
<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> </required> .... </package> |
<!ELEMENT link (option?, target+, name)> <!ATTLIST link base CDATA #IMPLIED type CDATA #IMPLIED> |
This element occurs in the elements alfs, else, stage. and then
The element link allows to create a (hard or symbolic) link.
The attribute base specify the directory in which the link creation is performed.
The attribute type specify if the link is symbolic (the attribute value is "symbolic" or not specified) or not (if the attribute value is "hard")
The following two options are supported :
"force" means that the existing destination files are removed.
"no_dereference" means that if the destination is a symlink to a directory it will be treated as if it were a normal file (and thus will replace it if the "force" option is specified).
The sub-element target gives the name(s) of the targets.
The sub-element name 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.
<link> <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 (item|list)+> <!ATTLIST list type (bullet|number) "bullet"> |
This element occurs in the elements description and list.
See also : item.
<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> </required> .... </package> |
<!ELEMENT make (param+)> <!ATTLIST make base CDATA #IMPLIED> |
This element occurs in the elements alfs, else, stage. and then
See also : param,
The element make describes a make command.
The sub-elements param allow to specify parameters of the make command.
The attribute base allows to specify the directory in which the make will be performed.
The first example is a make without parameter
<make /> |
The equivalent bash script is :
echo Executing make make |
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 (option?, name+)> <!ATTLIST mkdir base CDATA #IMPLIED> |
This element occurs in the elements alfs, else, stage. and then
The element mkdir describes the creation of one (or several) directory(ies).
The sub-elements name contains the name(s) of the directory(ies) to be created.
The attribute base gives the name of the directory in which the new directory will be created.
The only option supported is "parents". When specified, the parents directories are created as needed.
<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 (option?, source+, destination)> <!ATTLIST move base CDATA #IMPLIED> |
This element occurs in the elements alfs, else, stage. and then
See also : option, source, destination.
The element move is used to move one or several source files and/or directories into a destination file or directory
The supported option is an option of the mv command:
force
When processing this element, one moves each source to the destination, using the specified option if present.
When the attribute base is specified, it should contain the name of the current directory from which the move operation is performed.
<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 (#PCDATA)> |
This element occurs in the elements link, mkdir, ownership, permissions, requires. and utilizes.
<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 (#PCDATA)> |
This element occurs in the elements copy, link, mkdir, move, ownership and permissions. .
<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 (option?, name+)> <!ATTLIST ownership base CDATA #IMPLIED user CDATA #IMPLIED group CDATA #IMPLIED> |
This element occurs in the elements alfs, else, stage. and then
The element ownership is used to perform a group and/or user ownership change on a file or set of files
The only option supported is "recursive"
The sub-element name contains the name of the file (or directory) whose ownership is to be changed.
The attribute base specifies the directory in which the command is performed.
The attribute user specifies the name of the user which will own the file or directory
The attribute group specifies the name of the group which will own the file or directory
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 into root chgrp -R root /etc/rc.d echo Changing owner of /etc/rc.d into root chown -R root /etc/rc.d echo Changing group of /etc/sysconfig into root chgrp -R root /etc/sysconfig echo Changing owner of /etc/sysconfig into root chown -R root /etc/sysconfig |
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 into 0 chgrp -R 0 /etc/rc.d echo Changing owner of /etc/rc.d into 0 chown -R 0 /etc/rc.d echo Changing group of /etc/sysconfig into 0 chgrp -R 0 /etc/sysconfig echo Changing owner of /etc/sysconfig into 0 chown -R 0 /etc/sysconfig |
<!ELEMENT package (packageinfo?,stage+)> <!ATTLIST package name CDATA #REQUIRED version CDATA #REQUIRED> |
This element occurs in the elements alfs, else, stage. and then
See also : packageinfo, stage.
The element package describes the build process of a package.
The actual build process is described by the stage sub-elements.
The attribute name contains the name of the package.
The attribute version contains the version of the package.
<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 (description?,requires*,utilizes*)> |
This element occurs in the element package.
See also : description, requires. utilizes.
The element packageinfo groups elements containg information about the package, namely a description and some deopendency relationship.
The description of the packge is contained in the description sub-element.
The relationship "depends-on" is described by the requires sub-element.
The relationship "will utilize" is described by the utilizes sub-element.
<package name="gimp" version="1.2.3"> <packageinfo> <description> <para>The gimp package contains the GNU Image Manipulation Program. This is useful for photo retouching, image composition and image authoring. </para> </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> </required> .... </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 |
<package name="gimp" version="1.2.3"> <packageinfo> <description> <para>The gimp package contains the GNU Image Manipulation Program. This is useful for photo retouching, image composition and image authoring. </para> </description> <requires>gtk+</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> </required> .... </package> |
<!ELEMENT param (#PCDATA)> |
This element occurs in the element configure, execute, make and patch.
<make> <param>install</param> </make> |
The equivalent bash script is :
echo Executing make make install |
<!ELEMENT patch (param*)> <!ATTLIST patch base CDATA #IMPLIED> |
This element occurs in the elements alfs, else, stage. and then
See also : param,
The element patch is used to execute the patch command.
The sub-elements param contain the parameters of the command.
The attribute base specified the directory in which the command will be performed.
<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 (option?, name+)> <!ATTLIST permissions base CDATA #IMPLIED mode CDATA #REQUIRED> |
This element occurs in the elements alfs, else, stage. and then
This element allows to change the permissions of a (set of) file(s) or directory(ies).
The sub-element(s) name contain the name(s) of the files whose permission is to be modified.
The attribute base gives the name of the directory in which the command will be performed
The attribute mode gives the new access mode, as used in the command chmod.
The only option supported is "recursive"
<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 |
The element reference is used to specify the URL of the reference archive to download if the local copy is not available.
<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 :
cho 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 |
The element remove allows to remove a file or directory. The content of the element contains the name of the file.
The deletion of the directory is always recursive (rm -fr).
<remove>/usr/src/mypackage</remove> |
The equivalent bash script is :
echo Removing /usr/src/mypackage rm -rf /usr/src/mypackage |
The element replace allows to specify the replacement string in a search and replace operation.
<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 |
The element requires denotes a dependency between two packages : the package containg the requires element depends on the package whose name is contained in the name sub-element.
The actual name is put into a name element because we might want to add a version in a future version.
<package name="librep" version="0.16.1"> <packageinfo> <requires><name>gmp</name></requires> <requires><name>gdbm</name></requires> </packageinfo> <stage name="Unpacking a package."> <unpack> <archive>librep-0.16.1/librep-0.16.1.tar.gz</archive> <destination>/usr/src</destination> </unpack> </stage> .... </package> |
The equivalent bash script is :
#----------------------------------------- # processing package librep 0.16.1 echo Generating package librep 0.16.1 [[ ! -f ${NALFS_STAMP_DIR:-/var/log/nALFS}/gmp]] && echo Stamp of package gmp missing && exit 3 [[ ! -f ${NALFS_STAMP_DIR:-/var/log/nALFS}/gdbm]] && echo Stamp of package gdbm missing && exit 3 #----------------------------------------- echo Stage "Unpacking a package." echo Unpacking librep-0.16.1/librep-0.16.1.tar.gz into /usr/src cd /usr/src tar xzvf librep-0.16.1/librep-0.16.1.tar.gz echo Exiting stage "Unpacking a package." .... echo End of generating package librep 0.16.1 |
The element root allow to specify the name of a directory which will be the root directory for the commands of the stage.
<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 /static/bin/env -i \ PATH='/bin:/usr/bin:/sbin:/usr/sbin:/static/bin' \ HOME='/root' /static/bin/bash -c ./_nalfs_tmp.1 echo Exiting stage |
<!ELEMENT search_replace (file, find, replace)> <!ATTLIST configure base CDATA #IMPLIED> |
This element occurs in the elements alfs, else, stage. and then
The element search_replace is used to perform a search and replace operation of a file.
The sub-element file contains the filename
The sub-element find contains the string to be searched
The sub-element replace contains the replacement string.
<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 |
The element source is used to specify name of the source file when processing a copy, or a move.
<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 stage (stageinfo?,(configure|copy|download|execute| if|link|make|mkdir|move|ownership|package| patch|permissions|remove|search_replace| stage|textdump|unpack)*)> <!ATTLIST stage name CDATA #IMPLIED> |
This element occurs in the elements alfs, else, stage. and then
See also : configure, copy, download, execute, if, link, make, mkdir, move, ownership, package, patch, permissions, remove, search_replace, stageinfo, textdump, unpack.
The element stage allows to regroup commands, give a name to this group, through the attribute name, and optionally modify the execution context through the element stageinfo.
<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 (root?,environment?,user?,base?)> |
This element occurs in the element stage.
See also : root, base. environment. user.
The element stageinfo allows to specify several context informations used to process the commands of the stage to which the stageinfo belongs.
The base sub-element specify a base directory that will be used by all the commands of the stage, unless that command redefines the base locally.
The user sub-element specify a user name that will be used as the effective user ID of the current process for all the commands of the stage
The root sub-element specify a directory name in which the commands of the stage will be performed (using a chroot command).
The environment sub-element allow to specify a environment variable that will be added to the current environment when processing the commands of the stage.
<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 |
<link> <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 textdump (file, content)> <!ATTLIST textdump base CDATA #IMPLIED mode CDATA #IMPLIED> |
This element occurs in the elements alfs, else, stage. and then
The sub-element file contains the name of the file to be created.
The sub-element content 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 attribute base allows to specify the directory in which the file creation will be perforemd.
The attribute mode allows to specify the append creation mode
<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 |
<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 then (stageinfo?,(configure|copy|download|execute| if|link|make|mkdir|move|ownership|package| patch|permissions|remove|search_replace| stage|textdump|unpack)*)> |
This element occurs in the element if.
See also : configure, copy, copy, execute, if, link, make, mkdir, move, ownership, package, patch, permissions, remove, search_replace, stageinfo, textdump, unpack.
This element groups the elements that should be executed if the test performed when evaluating an if element is satisfied.
<!ELEMENT unpack (digest?,reference?,archive,destination)> |
This element occurs in the elements alfs, else, stage. and then
See also : archive, destination, digest, reference,
This element is used to unpack an archive into a destination directory
The sub-element reference gives the URL of the archive, which is used if the archive file is not available locally.
The sub-element digest gives the digest of the archive, as computed by openssl, using the digest type specified in the attribute type.
The sub-element archive gives the name of the archive, and the sub-element destination given the name of the directory in which the archive is unpacked
The choice of the program performing the unpacking is based on the extension of the archive file. The supported extensions are :
.tar.gz
.tar.bz2
.Z
.tgz
.gz
.bz2
.tar
.zip
Note: The use of the sub-elements digest and reference is deprecated. You should use the element download instead.
<unpack> <digest>cbe9f79450aeecfb06d5e856af16c2cf</digest> <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 [[ ! -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 |
The element url allow to specify the URL of the directory containing the file to be downloaded when processing a download element.
<download> <file>kbd-1.08.tar.gz</file> <url>ftp://ftp.win.tue.nl/pub/linux-local/utils/kbd/</url> <destination>/tmp/</destination> <digest>924e6a05e52715dc0f96385b35f2f680</digest> </download> |
The element user allow to specify a user ID that will be the effective user ID when executing the commands of the stage to which it applies.
<stage> <stageinfo> <base>/usr/src/mypackage</base> <user>lfs</user> </stageinfo> <make> <param>install</param> </make> </stage> |
The equivalent bash script is :
echo Stage echo Creating file ./_nalfs_tmp.1... cat > ./_nalfs_tmp.1 << 'EOF1' echo Executing make cd /usr/src/mypackage make install true EOF1 [[ $? != 0 ]] && echo Creating file failed && exit 3 chmod 775 ./_nalfs_tmp.1 echo Executing as user lfs /bin/su lfs -c ./_nalfs_tmp.1 echo Finished execution as user lfs echo Exiting stage |
The element utilizes indicates that the package containg the utilizes element utilizes the package whose name is contained in the name sub-element, but does not depend on it, in which case the element requires is used.
The actual name is put into a name element because we might want to add a version in a future version.
<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> |
<!ELEMENT variable (#PCDATA)> <!ATTLIST variable name CDATA #REQUIRED mode CDATA #IMPLIED> |
This element occurs in the element environment.
The element variable allows to add a variable definition to the environment.
The name of the variable is given by the attribute name of the element.
The attribute mode can take the value "append", in which case the content of the element is appended to the value of the environment variable
The value of the variable is given by the textual content of the element.
<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 (#PCDATA)> <!ATTLIST variable condition (eq|ne|gt|ge|lt|le) #REQUIRED> |
The element version describes a constraint on the version of an utilized/required package.
The condition is satisfied if the comparison specified by the attribute condition 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 that 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 equals to 3.0, and that it be different from 3.0beta.
<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.