diff options
author | Jeremy Huntwork <jhuntwork@linuxfromscratch.org> | 2008-10-19 15:42:27 +0000 |
---|---|---|
committer | Jeremy Huntwork <jhuntwork@linuxfromscratch.org> | 2008-10-19 15:42:27 +0000 |
commit | b329b4003361265604d1fc560c46d4fd1add9919 (patch) | |
tree | c38863e873d3f28f5170463e6b7ebea97a6c9d13 | |
parent | f259f5611a679031cb8e7627567d8626623526eb (diff) |
Brought jh branch up to date. Should be considered broken with this commit, since the placement of gcc's bootstrap needs to be fixed in this branch. Will fix shortly.
git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/jh/BOOK@8670 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
158 files changed, 11058 insertions, 669 deletions
@@ -12,7 +12,7 @@ else Q = @ endif -lfs: validxml profile-html +lfs: maketar validxml profile-html @echo "Generating chunked XHTML files..." $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \ -stringparam rootid "$(ROOT_ID)" -stringparam base.dir $(BASEDIR)/ \ @@ -67,7 +67,7 @@ nochunks: validxml profile-html @echo "Running Tidy..." $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true @echo "Running obfuscate.sh..." - $(Q)sh obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT) + $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT) $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" \ $(BASEDIR)/$(NOCHUNKS_OUTPUT) @@ -78,9 +78,17 @@ tmpdir: $(Q)rm -f $(RENDERTMP)/lfs-pdf.fo validxml: tmpdir + @echo "Processing bootscripts..." + $(Q)bash process-scripts.sh $(RENDERTMP) @echo "Validating the book..." $(Q)xmllint --nonet --noent --xinclude --postvalid \ -o $(RENDERTMP)/lfs-full.xml index.xml + $(Q)rm -f appendices/*.script + $(Q)sh aux-file-data.sh $(RENDERTMP)/lfs-full.xml + +maketar: + @echo "Making tarballs..." + $(Q)sh make-aux-files.sh $(RENDERTMP) profile-html: validxml @echo "Generating profiled XML for XHTML..." @@ -99,11 +107,10 @@ dump-commands: validxml $(Q)xsltproc --output $(DUMPDIR)/ \ stylesheets/dump-commands.xsl $(RENDERTMP)/lfs-full.xml -validate: - @echo "Validating the book..." - $(Q)xmllint --noout --nonet --xinclude --postvalid index.xml +validate: maketar validxml + @echo "Validation complete." all: lfs nochunks pdf dump-commands .PHONY : all dump-commands lfs nochunks pdf profile-html tmpdir validate \ - validxml wget-list + validxml wget-list maketar diff --git a/appendices/acknowledgments.xml b/appendices/acknowledgments.xml index a7a4287f1..325ad25b3 100644 --- a/appendices/acknowledgments.xml +++ b/appendices/acknowledgments.xml @@ -61,7 +61,7 @@ <listitem> <para><ulink url="mailto:randy@linuxfromscratch.org">Randy McMurchy</ulink> <randy@linuxfromscratch.org> – BLFS - Project Leader</para> + Project Leader, LFS Editor</para> </listitem> <listitem> @@ -71,6 +71,11 @@ </listitem> <listitem> + <para><ulink url="mailto:dj@linuxfromscratch.org">DJ Lucas</ulink> + <dj@linuxfromscratch.org> – LFS and BLFS Editor</para> + </listitem> + + <listitem> <para><ulink url="mailto:ken@linuxfromscratch.org">Ken Moffat</ulink> <ken@linuxfromscratch.org> – LFS and CLFS Editor</para> </listitem> diff --git a/appendices/creat-comm.xml b/appendices/creat-comm.xml new file mode 100644 index 000000000..2ecc76097 --- /dev/null +++ b/appendices/creat-comm.xml @@ -0,0 +1,403 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="CC" xreflabel="Creative Commons License"> + <?dbhtml filename="creat-comm.html"?> + + <title>Creative Commons License</title> + + <para role='title'>Creative Commons Legal Code</para> + + <para role='title'>Attribution-NonCommercial-ShareAlike 2.0</para> + + <important> + <para>CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT + PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN + "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION + PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS + USE.</para> + </important> + + <para role='title'>License</para> + + <para>THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE + COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY + COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS + AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.</para> + + <para>BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE + BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE RIGHTS + CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND + CONDITIONS.</para> + + <orderedlist> + <?dbfo label-width="1.5em"?> + <listitem> + <para>Definitions</para> + + <orderedlist> + <listitem> + <para>"Collective Work" means a work, such as a periodical issue, anthology or + encyclopedia, in which the Work in its entirety in unmodified form, along + with a number of other contributions, constituting separate and independent + works in themselves, are assembled into a collective whole. A work that + constitutes a Collective Work will not be considered a Derivative Work (as + defined below) for the purposes of this License.</para> + </listitem> + + <listitem> + <para>"Derivative Work" means a work based upon the Work or upon + the Work and other pre-existing works, such as a translation, musical + arrangement, dramatization, fictionalization, motion picture version, sound + recording, art reproduction, abridgment, condensation, or any other form in + which the Work may be recast, transformed, or adapted, except that a work + that constitutes a Collective Work will not be considered a Derivative Work + for the purpose of this License. For the avoidance of doubt, where the Work + is a musical composition or sound recording, the synchronization of the Work + in timed-relation with a moving image ("synching") will be considered a + Derivative Work for the purpose of this License.</para> + </listitem> + + <listitem> + <para>"Licensor" means the individual or entity that offers the + Work under the terms of this License.</para> + </listitem> + + <listitem> + <para>"Original Author" means the individual or entity who created + the Work.</para> + </listitem> + + <listitem> + <para>"Work" means the copyrightable work of authorship offered + under the terms of this License.</para> + </listitem> + + <listitem> + <para>"You" means an individual or entity exercising rights under + this License who has not previously violated the terms of this License with + respect to the Work, or who has received express permission from the + Licensor to exercise rights under this License despite a previous + violation.</para> + </listitem> + + <listitem> + <para>"License Elements" means the following high-level license + attributes as selected by Licensor and indicated in the title of this + License: Attribution, Noncommercial, ShareAlike.</para> + </listitem> + + </orderedlist> + </listitem> + + <listitem> + <para>Fair Use Rights. Nothing in this license is intended to reduce, + limit, or restrict any rights arising from fair use, first sale or other + limitations on the exclusive rights of the copyright owner under copyright law + or other applicable laws.</para> + </listitem> + + + <listitem> + <para>License Grant. Subject to the terms and conditions of this + License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, + perpetual (for the duration of the applicable copyright) license to exercise + the rights in the Work as stated below:</para> + + <orderedlist> + + <listitem> + <para>to reproduce the Work, to incorporate the Work into one or + more Collective Works, and to reproduce the Work as incorporated in the + Collective Works;</para> + </listitem> + + <listitem> + <para>to create and reproduce Derivative Works;</para> + </listitem> + + <listitem> + <para>to distribute copies or phonorecords of, display publicly, + perform publicly, and perform publicly by means of a digital audio + transmission the Work including as incorporated in Collective + Works;</para> + </listitem> + + <listitem> + <para>to distribute copies or phonorecords of, display publicly, + perform publicly, and perform publicly by means of a digital audio + transmission Derivative Works;</para> + </listitem> + + </orderedlist> + + <para>The above rights may be exercised in all media and formats whether now + known or hereafter devised. The above rights include the right to make such + modifications as are technically necessary to exercise the rights in other + media and formats. All rights not expressly granted by Licensor are hereby + reserved, including but not limited to the rights set forth in Sections 4(e) + and 4(f).</para> + </listitem> + + <listitem> + <para>Restrictions.The license granted in Section 3 above is + expressly made subject to and limited by the following + restrictions:</para> + + <orderedlist> + + <listitem> + <para>You may distribute, publicly display, publicly perform, or + publicly digitally perform the Work only under the terms of this License, and + You must include a copy of, or the Uniform Resource Identifier for, this + License with every copy or phonorecord of the Work You distribute, publicly + display, publicly perform, or publicly digitally perform. You may not offer + or impose any terms on the Work that alter or restrict the terms of this + License or the recipients' exercise of the rights granted hereunder. You may + not sublicense the Work. You must keep intact all notices that refer to this + License and to the disclaimer of warranties. You may not distribute, publicly + display, publicly perform, or publicly digitally perform the Work with any + technological measures that control access or use of the Work in a manner + inconsistent with the terms of this License Agreement. The above applies to + the Work as incorporated in a Collective Work, but this does not require the + Collective Work apart from the Work itself to be made subject to the terms of + this License. If You create a Collective Work, upon notice from any Licensor + You must, to the extent practicable, remove from the Collective Work any + reference to such Licensor or the Original Author, as requested. If You + create a Derivative Work, upon notice from any Licensor You must, to the + extent practicable, remove from the Derivative Work any reference to such + Licensor or the Original Author, as requested.</para> + </listitem> + + <listitem> + <para>You may distribute, publicly display, publicly perform, or + publicly digitally perform a Derivative Work only under the terms of this + License, a later version of this License with the same License Elements as + this License, or a Creative Commons iCommons license that contains the same + License Elements as this License (e.g. Attribution-NonCommercial-ShareAlike + 2.0 Japan). You must include a copy of, or the Uniform Resource Identifier + for, this License or other license specified in the previous sentence with + every copy or phonorecord of each Derivative Work You distribute, publicly + display, publicly perform, or publicly digitally perform. You may not offer + or impose any terms on the Derivative Works that alter or restrict the terms + of this License or the recipients' exercise of the rights granted hereunder, + and You must keep intact all notices that refer to this License and to the + disclaimer of warranties. You may not distribute, publicly display, publicly + perform, or publicly digitally perform the Derivative Work with any + technological measures that control access or use of the Work in a manner + inconsistent with the terms of this License Agreement. The above applies to + the Derivative Work as incorporated in a Collective Work, but this does not + require the Collective Work apart from the Derivative Work itself to be made + subject to the terms of this License.</para> + </listitem> + + <listitem> + <para>You may not exercise any of the rights granted to You in + Section 3 above in any manner that is primarily intended for or directed + toward commercial advantage or private monetary compensation. The exchange of + the Work for other copyrighted works by means of digital file-sharing or + otherwise shall not be considered to be intended for or directed toward + commercial advantage or private monetary compensation, provided there is no + payment of any monetary compensation in connection with the exchange of + copyrighted works.</para> + </listitem> + + <listitem> + <para>If you distribute, publicly display, publicly perform, or + publicly digitally perform the Work or any Derivative Works or Collective + Works, You must keep intact all copyright notices for the Work and give the + Original Author credit reasonable to the medium or means You are utilizing by + conveying the name (or pseudonym if applicable) of the Original Author if + supplied; the title of the Work if supplied; to the extent reasonably + practicable, the Uniform Resource Identifier, if any, that Licensor specifies + to be associated with the Work, unless such URI does not refer to the + copyright notice or licensing information for the Work; and in the case of a + Derivative Work, a credit identifying the use of the Work in the Derivative + Work (e.g., "French translation of the Work by Original Author," or + "Screenplay based on original Work by Original Author"). Such credit may be + implemented in any reasonable manner; provided, however, that in the case of + a Derivative Work or Collective Work, at a minimum such credit will appear + where any other comparable authorship credit appears and in a manner at least + as prominent as such other comparable authorship credit.</para> + </listitem> + + + <listitem> + <para>For the avoidance of doubt, where the Work is a musical + composition:</para> + + <orderedlist> + + <listitem> + <para>Performance Royalties Under Blanket Licenses. Licensor + reserves the exclusive right to collect, whether individually or via a + performance rights society (e.g. ASCAP, BMI, SESAC), royalties for the + public performance or public digital performance (e.g. webcast) of the + Work if that performance is primarily intended for or directed toward + commercial advantage or private monetary compensation.</para> + </listitem> + + <listitem> + <para>Mechanical Rights and Statutory Royalties. Licensor + reserves the exclusive right to collect, whether individually or via a + music rights agency or designated agent (e.g. Harry Fox Agency), + royalties for any phonorecord You create from the Work ("cover + version") and distribute, subject to the compulsory license created + by 17 USC Section 115 of the US Copyright Act (or the equivalent in + other jurisdictions), if Your distribution of such cover version is primarily + intended for or directed toward commercial advantage or private monetary + compensation. 6. Webcasting Rights and Statutory Royalties. For the + avoidance of doubt, where the Work is a sound recording, Licensor + reserves the exclusive right to collect, whether individually or via a + performance-rights society (e.g. SoundExchange), royalties for the public + digital performance (e.g. webcast) of the Work, subject to the compulsory + license created by 17 USC Section 114 of the US Copyright Act (or the + equivalent in other jurisdictions), if Your public digital performance is + primarily intended for or directed toward commercial advantage or private + monetary compensation.</para> + </listitem> + + </orderedlist> + </listitem> + + <listitem> + <para>Webcasting Rights and Statutory Royalties. For the + avoidance of doubt, where the Work is a sound recording, Licensor reserves + the exclusive right to collect, whether individually or via a + performance-rights society (e.g. SoundExchange), royalties for the public + digital performance (e.g. webcast) of the Work, subject to the compulsory + license created by 17 USC Section 114 of the US Copyright Act (or the + equivalent in other jurisdictions), if Your public digital performance is + primarily intended for or directed toward commercial advantage or private + monetary compensation.</para> + </listitem> + + </orderedlist> + </listitem> + + <listitem> + <para>Representations, Warranties and Disclaimer</para> + + <para>UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR + OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND + CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, + WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A + PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. + SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH + EXCLUSION MAY NOT APPLY TO YOU.</para> + </listitem> + + <listitem> + <para>Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY + APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY + FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES + ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</para> + </listitem> + + <listitem> + <para>Termination</para> + + <orderedlist> + + <listitem> + <para>This License and the rights granted hereunder will terminate + automatically upon any breach by You of the terms of this License. + Individuals or entities who have received Derivative Works or Collective + Works from You under this License, however, will not have their licenses + terminated provided such individuals or entities remain in full compliance + with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any + termination of this License.</para> + </listitem> + + <listitem> + <para>Subject to the above terms and conditions, the license + granted here is perpetual (for the duration of the applicable copyright in + the Work). Notwithstanding the above, Licensor reserves the right to release + the Work under different license terms or to stop distributing the Work at + any time; provided, however that any such election will not serve to withdraw + this License (or any other license that has been, or is required to be, + granted under the terms of this License), and this License will continue in + full force and effect unless terminated as stated above.</para> + </listitem> + + </orderedlist> + </listitem> + + <listitem> + <para>Miscellaneous</para> + + <orderedlist> + + <listitem> + <para>Each time You distribute or publicly digitally perform the + Work or a Collective Work, the Licensor offers to the recipient a license to + the Work on the same terms and conditions as the license granted to You under + this License.</para> + </listitem> + + <listitem> + <para>Each time You distribute or publicly digitally perform a + Derivative Work, Licensor offers to the recipient a license to the original + Work on the same terms and conditions as the license granted to You under + this License.</para> + </listitem> + + <listitem> + <para>If any provision of this License is invalid or unenforceable + under applicable law, it shall not affect the validity or enforceability of + the remainder of the terms of this License, and without further action by the + parties to this agreement, such provision shall be reformed to the minimum + extent necessary to make such provision valid and + enforceable.</para> + </listitem> + + <listitem> + <para>No term or provision of this License shall be deemed waived + and no breach consented to unless such waiver or consent shall be in writing + and signed by the party to be charged with such waiver or + consent.</para> + </listitem> + + <listitem> + <para>This License constitutes the entire agreement between the + parties with respect to the Work licensed here. There are no understandings, + agreements or representations with respect to the Work not specified here. + Licensor shall not be bound by any additional provisions that may appear in + any communication from You. This License may not be modified without the + mutual written agreement of the Licensor and You.</para> + </listitem> + + + </orderedlist> + </listitem> + </orderedlist> + + <important> + <para>Creative Commons is not a party to this License, and makes no warranty + whatsoever in connection with the Work. Creative Commons will not be liable to + You or any party on any legal theory for any damages whatsoever, including + without limitation any general, special, incidental or consequential damages + arising in connection to this license. Notwithstanding the foregoing two (2) + sentences, if Creative Commons has expressly identified itself as the Licensor + hereunder, it shall have all rights and obligations of Licensor.</para> + + <para>Except for the limited purpose of indicating to the public that the Work is + licensed under the CCPL, neither party will use the trademark "Creative + Commons" or any related trademark or logo of Creative Commons without the prior + written consent of Creative Commons. Any permitted use will be in compliance + with Creative Commons' then-current trademark usage guidelines, as may be + published on its website or otherwise made available upon request from time to + time.</para> + + <para>Creative Commons may be contacted at <ulink url='http://creativecommons.org/' />.</para> + </important> + + +</sect1> diff --git a/appendices/dependencies.xml b/appendices/dependencies.xml index c26bbcd3e..ee117521a 100644 --- a/appendices/dependencies.xml +++ b/appendices/dependencies.xml @@ -486,7 +486,8 @@ <seglistitem> <seg>Bash, Binutils, Coreutils, Diffutils, Findutils, Gawk, GCC, - Gettext, Glibc, Grep, Make, Patch, Perl, Sed, Tar, and Texinfo</seg> + Gettext, Glibc, GMP (Chapter 6), Grep, M4 (Chapter 5), Make, + MPFR (Chapter 6), Patch, Perl, Sed, Tar, and Texinfo</seg> </seglistitem> </segmentedlist> @@ -1072,7 +1073,7 @@ <seglistitem> <seg>Bash, Berkeley DB, Binutils, Coreutils, Gawk, GCC, Glibc, Grep, - Groff, Make, and Sed</seg> + Groff, Make, Sed, and Zlib</seg> </seglistitem> </segmentedlist> @@ -1475,7 +1476,7 @@ <segtitle>&before;</segtitle> <seglistitem> - <seg>File, Module-Init-Tools, and Util-Linux</seg> + <seg>File, Module-Init-Tools, Perl, and Util-Linux</seg> </seglistitem> </segmentedlist> diff --git a/appendices/license.xml b/appendices/license.xml new file mode 100644 index 000000000..da2b891be --- /dev/null +++ b/appendices/license.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<appendix id="Licenses" xreflabel="Appendix E"> + <?dbhtml dir="appendices"?> + <?dbhtml filename="licenses.html"?> + + <title>LFS Licenses</title> + + <para>This book is licensed under the Creative Commons + Attribution-NonCommercial-ShareAlike 2.0 License.</para> + + <para>Computer instructions may be extracted from the book under the MIT + License.</para> + + + <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="creat-comm.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="mit-lic.xml"/> + + +</appendix> diff --git a/appendices/mit-lic.xml b/appendices/mit-lic.xml new file mode 100644 index 000000000..8cfd5b2d2 --- /dev/null +++ b/appendices/mit-lic.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="MIT" xreflabel="MIT License"> + <?dbhtml filename="mit.html" ?> + + <title>The MIT License</title> + + <para>Copyright © ©rightdate; Gerard Beekmans</para> + + <para>Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions:</para> + + <para>The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software.</para> + + <para>HE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE.</para> + +</sect1> diff --git a/appendices/scripts.xml b/appendices/scripts.xml new file mode 100644 index 000000000..7730a9198 --- /dev/null +++ b/appendices/scripts.xml @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + <!ENTITY checkfs SYSTEM "checkfs.script"> + <!ENTITY cleanfs SYSTEM "cleanfs.script"> + <!ENTITY console SYSTEM "console.script"> + <!ENTITY functions SYSTEM "functions.script"> + <!ENTITY consolelog SYSTEM "consolelog.script"> + <!ENTITY halt SYSTEM "halt.script"> + <!ENTITY localnet SYSTEM "localnet.script"> + <!ENTITY modules SYSTEM "modules.script"> + <!ENTITY mountfs SYSTEM "mountfs.script"> + <!ENTITY mountkernfs SYSTEM "mountkernfs.script"> + <!ENTITY network SYSTEM "network.script"> + <!ENTITY reboot SYSTEM "reboot.script"> + <!ENTITY rc SYSTEM "rc.script"> + <!ENTITY sendsignals SYSTEM "sendsignals.script"> + <!ENTITY setclock SYSTEM "setclock.script"> + <!ENTITY swap SYSTEM "swap.script"> + <!ENTITY sysctl SYSTEM "sysctl.script"> + <!ENTITY sysklogd SYSTEM "sysklogd.script"> + <!ENTITY template SYSTEM "template.script"> + <!ENTITY udev SYSTEM "udev.script"> + <!ENTITY udev_retry SYSTEM "udev_retry.script"> + <!ENTITY createfiles SYSTEM "createfiles.script"> + <!ENTITY modules_sys SYSTEM "modules-sysinit.script"> + <!ENTITY rc_sys SYSTEM "rc-sysinit.script"> + <!ENTITY ifup SYSTEM "ifup.script"> + <!ENTITY ifdown SYSTEM "ifdown.script"> + <!ENTITY ipv4_static SYSTEM "ipv4-static.script"> + <!ENTITY ipv4_static_route SYSTEM "ipv4-static-route.script"> + %general-entities; +]> + +<appendix id="scripts" xreflabel="Appendix D"> + <?dbhtml dir="scripts"?> + <?dbhtml filename="scripts.html"?> + + <title>Boot and sysconfig scripts version-&lfs-bootscripts-version;</title> + + <para>The scripts in this appendix are listed by the directory where they + normally reside. The order is <filename + class='directory'>/etc/rc.d/init.d</filename>, <filename + class='directory'>/etc/sysconfig</filename>, <filename + class='directory'>/etc/sysconfig/network-devices</filename>, and <filename + class='directory'>/etc/sysconfig/network-devices/services</filename>. Within + each section, the files are listed in the order they are normally called. + </para> + + <sect1 id="rc" role="wrap"> + <title>/etc/rc.d/init.d/rc</title> + + <para>The <systemitem>rc</systemitem> script is the first script called by + <application>init</application> and initiates the boot process.</para> + + <screen>&rc;</screen> + </sect1> + + <sect1 id="functions" role="wrap"> + <title>/etc/rc.d/init.d/functions</title> + <screen>&functions;</screen> + </sect1> + + <sect1 id="mountkernfs" role="wrap"> + <title>/etc/rc.d/init.d/mountkernfs</title> + <screen>&mountkernfs;</screen> + </sect1> + + <sect1 id="consolelog" role="wrap"> + <title>/etc/rc.d/init.d/consolelog</title> + <screen>&consolelog;</screen> + </sect1> + + <sect1 id="modules" role="wrap"> + <title>/etc/rc.d/init.d/modules</title> + <screen>&modules;</screen> + </sect1> + + <sect1 id="udev" role="wrap"> + <title>/etc/rc.d/init.d/udev</title> + <screen>&udev;</screen> + </sect1> + + <sect1 id="swap" role="wrap"> + <title>/etc/rc.d/init.d/swap</title> + <screen>&swap;</screen> + </sect1> + + <sect1 id="setclock" role="wrap"> + <title>/etc/rc.d/init.d/setclock</title> + <screen>&setclock;</screen> + </sect1> + + <sect1 id="checkfs" role="wrap"> + <title>/etc/rc.d/init.d/checkfs</title> + <screen>&checkfs;</screen> + </sect1> + + <sect1 id="mountfs" role="wrap"> + <title>/etc/rc.d/init.d/mountfs</title> + <screen>&mountfs;</screen> + </sect1> + + <sect1 id="udev_retry" role="wrap"> + <title>/etc/rc.d/init.d/udev_retry</title> + <screen>&udev_retry;</screen> + </sect1> + + <sect1 id="cleanfs" role="wrap"> + <title>/etc/rc.d/init.d/cleanfs</title> + <screen>&cleanfs;</screen> + </sect1> + + <sect1 id="console" role="wrap"> + <title>/etc/rc.d/init.d/console</title> + <screen>&console;</screen> + </sect1> + + <sect1 id="localnet" role="wrap"> + <title>/etc/rc.d/init.d/localnet</title> + <screen>&localnet;</screen> + </sect1> + + <sect1 id="sysctlscript" role="wrap"> + <title>/etc/rc.d/init.d/sysctl</title> + <screen>&sysctl;</screen> + </sect1> + + <sect1 id="sysklogd" role="wrap"> + <title>/etc/rc.d/init.d/sysklogd</title> + <screen>&sysklogd;</screen> + </sect1> + + <sect1 id="network" role="wrap"> + <title>/etc/rc.d/init.d/network</title> + <screen>&network;</screen> + </sect1> + + <sect1 id="sendsignals" role="wrap"> + <title>/etc/rc.d/init.d/sendsignals</title> + <screen>&sendsignals;</screen> + </sect1> + + <sect1 id="rebootscript" role="wrap"> + <title>/etc/rc.d/init.d/reboot</title> + <screen>&reboot;</screen> + </sect1> + + <sect1 id="haltscript" role="wrap"> + <title>/etc/rc.d/init.d/halt</title> + <screen>&halt;</screen> + </sect1> + + <sect1 id="template" role="wrap"> + <title>/etc/rc.d/init.d/template</title> + <screen>&template;</screen> + </sect1> + + <sect1 id="rcsys" role="wrap"> + <title>/etc/sysconfig/rc</title> + <screen>&rc_sys;</screen> + </sect1> + + <sect1 id="modulessys" role="wrap"> + <title>/etc/sysconfig/modules</title> + <screen>&modules_sys;</screen> + </sect1> + + <sect1 id="createfiles" role="wrap"> + <title>/etc/sysconfig/createfiles</title> + <screen>&createfiles;</screen> + </sect1> + + <sect1 id="ifup" role="wrap"> + <title>/etc/sysconfig/network-devices/ifup</title> + <screen>&ifup;</screen> + </sect1> + + <sect1 id="ifdown" role="wrap"> + <title>/etc/sysconfig/network-devices/ifdown</title> + <screen>&ifdown;</screen> + </sect1> + + <sect1 id="ipv4static" role="wrap"> + <title>/etc/sysconfig/network-devices/services/ipv4-static</title> + <screen>&ipv4_static;</screen> + </sect1> + + <sect1 id="ipv4route" role="wrap"> + <title>/etc/sysconfig/network-devices/services/ipv4-static-route</title> + <screen>&ipv4_static_route;</screen> + </sect1> + +</appendix> diff --git a/appendices/udev-rules.xml b/appendices/udev-rules.xml new file mode 100644 index 000000000..362732fb9 --- /dev/null +++ b/appendices/udev-rules.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + <!ENTITY lfs-rules SYSTEM "55-lfs.rules.script"> + <!ENTITY cdrom-rules SYSTEM "61-cdrom.rules.script"> + %general-entities; +]> + +<appendix id="rules" xreflabel="Appendix E"> + <?dbhtml dir="scripts"?> + <?dbhtml filename="udev-rules.html"?> + + <title>Udev configuration rules</title> + + <para>The rules from &udev-config;.tar.bz2 in this appendix are listed for + convenience. Installation is normally done via instructions in <xref + linkend='ch-system-udev'/>. </para> + + <sect1 id="lfsrules" role="wrap"> + <title>55-lfs.rules</title> + <screen>&lfs-rules;</screen> + </sect1> + + <sect1 id="cdromrules" role="wrap"> + <title>61-cdrom.rules</title> + <screen>&cdrom-rules;</screen> + </sect1> + +</appendix> diff --git a/aux-file-data.sh b/aux-file-data.sh new file mode 100755 index 000000000..8df4ac2cd --- /dev/null +++ b/aux-file-data.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +if [ $# -lt 1 ] ; then + echo "This script needs the location of the xml file to update" + exit 1 +fi + +FILE=$1 + +# Bootscript data +bootscripts=$(ls lfs-bootscripts*.bz2) +base=$(basename $bootscripts .tar.bz2) +bootsize=$(ls -lk $bootscripts | cut -f5 -d" ") +bootmd5=$(md5sum $bootscripts | cut -f1 -d" ") + +# Figure intalled size of bootscripts +TOPDIR=$(pwd) +TMP_DIR=$(mktemp -d /tmp/lfsbootfiles.XXXXXX) +pushd $TMP_DIR > /dev/null +tar -xf $TOPDIR/$bootscripts +bootinstallsize=$(du -sk $TMP_DIR | cut -f1) +popd > /dev/null +rm -rf $TMP_DIR + +sed -i -e s/BOOTSCRIPTS-SIZE/$bootsize/ \ + -e s/BOOTSCRIPTS-INSTALL-KB/$bootinstallsize/ \ + -e s/BOOTSCRIPTS-MD5SUM/$bootmd5/ $FILE + +############ + +# udev configuration tarball data +udevconfig=$(ls udev-config*.bz2) +udevsize=$(ls -lk $udevconfig | cut -f5 -d" ") +udevmd5=$(md5sum $udevconfig | cut -f1 -d" ") + +sed -i -e s/UDEV-SIZE/$udevsize/ \ + -e s/UDEV-MD5SUM/$udevmd5/ $FILE + diff --git a/bootscripts/ChangeLog b/bootscripts/ChangeLog new file mode 100644 index 000000000..32e06a8b4 --- /dev/null +++ b/bootscripts/ChangeLog @@ -0,0 +1,927 @@ +2008-05-21 Bryan Kadzban <bryan@linuxfromscratch.org> + * lfs/init.d/udev, lfs/init.d/udev_retry: Use new udevadm program. + +2007-08-20 DJ Lucas <dj@linuxfromscratch.org> + * lfs/init.d/setclock: Added missing 'stop' argument to usage text + +2007-08-13 Dan Nicholson <dnicholson@linuxfromscratch.org> + * lfs/init.d/checkfs: Don't suppress error messages from the screen. + +2007-07-18 Dan Nicholson <dnicholson@linuxfromscratch.org> + * Makefile, lfs/init.d/consolelog: New bootscript controlling the + kernel log level on the console. This is controlled by the LOGLEVEL + variable in /etc/sysconfig/console. + * lfs/init.d/modules: Remove the log level handling since this is + done in the consolelog script now. + * lfs/init.d/modules: Clean up the script by removing the file + descriptor duplication and instead just redirecting + /etc/sysconfig/modules to the input of the while loop. + +2007-06-16 Dan Nicholson <dnicholson@linuxfromscratch.org> + * lfs/init.d/mountfs, lfs/init.d/mountkernfs, lfs/init.d/setclock, + lfs/init.d/modules, lfs/sysconfig/network-devices/if{up,down}: + Don't suppress stderr during bootscripts unless necessary. This + would prevent potentially critical messages from reaching the screen. + +2007-04-24 Dan Nicholson <dnicholson@linuxfromscratch.org> + * lfs/init.d/functions: When killproc is executed, it checks that + the process is still running, sleeps if it is, then checks again. + The sleep is 1 second in between checks. By sleeping for 0.1 seconds + in between checks, killproc is much faster as it's wasting much + less time sleeping in the normal case that the process has died + after a short delay. + +2007-04-16 Dan Nicholson <dnicholson@linuxfromscratch.org> + * lfs/init.d/functions: Redirect stderr when using kill to suppress + output. + * lfs/init.d/functions: killproc() was not handling the case where a + pidfile is passed to the function. The logic with the signal to be + used was causing issues with the handling of pidfiles. This has been + fixes, and now killproc() will recheck the process if the signal + was TERM (the default) or KILL. + * lfs/init.d/functions: statusproc() has been changed to use pidofproc() + instead of the deprecated getpids(). Additionally, it now accepts + the -p argument to specify a pidfile. + * lfs/init.d/functions: Currently, statusproc() always returns + successfully, and the only way to know if the process is running + is to parse the output. This changes statusproc() to return the + status of pidofproc(), which will return unsuccessfully if the + requested process is not running. + * lfs/init.d/functions: Changed reloadproc() to use pidofproc() and + respect the -p argument for pidfiles. + * lfs/init.d/sysklogd: Remove a useless argument to reloadproc(). + +2007-03-13 Dan Nicholson <dnicholson@linuxfromscratch.org> + * lfs/init.d/functions: If pidofproc() is passed the -p argument + it can bomb testing a null variable with an integer expression. + +2007-02-22 Dan Nicholson <dnicholson@linuxfromscratch.org> + * lfs/init.d/mountfs, lfs/init.d/console, lfs/init.d/setclock, + lfs/init.d/mountkernfs: &> redirection is not supported in POSIX. + Fortunately, it's equivalent to >word 2>&1 according to bash(1). + +2007-02-22 Dan Nicholson <dnicholson@linuxfromscratch.org> + * lfs/init.d/console: POSIX says that shells only need to trap on + signals. Trapping on ERR isn't always supported. Conditionals have + been added to set the $failed variable in spots that seemed + appropriate for checking errors. + +2007-02-22 Dan Nicholson <dnicholson@linuxfromscratch.org> + * lfs/init.d/functions: Use arithmetic expansion and string length, + which are both mandated by POSIX, rather than spawning two processes + every time boot_mesg() is called. + +2007-02-22 Dan Nicholson <dnicholson@linuxfromscratch.org> + * lfs/init.d/functions: In order to provide an `echo' which provides + handles the -e and -n options for all POSIX shells, a feature test + is added which stores its result in $ECHO. /bin/echo will be used + if the default echo is not capable. Changed the existing functions + to reference $ECHO when needed. + * lfs/init.d/console: Use $ECHO when -en is needed. + +2007-02-03 Bryan Kadzban <bryan@linuxfromscratch.org> + * ChangeLog: Rename from CHANGELOG, start using GNU style entries. + + * Makefile: Move setclock before checkfs. Fixes #1948. + +2006-11-25 Bryan Kadzban <bryan@linuxfromscratch.org> + * lfs/init.d/udev_retry: Copy Debian's "copy generated rules" initscript + code, to clean up when the rule_generator scripts run before / is + writable. (Since the rule_generator code is from Debian, I assume their + cleanup code is appropriate.) + +2006-10-15 Bryan Kadzban <bryan@linuxfromscratch.org> + * lfs/init.d/udev_retry: Fix to work with udev >= 099. + +n/a - June 2, 2006 + * Removed console config file and makefile targets. + * Removed references to /dev/bug and bugreport in udevand + udev_retry bootscripts. (DJ Lucas) +n/a - April 17, 2006 + * Updated udev script to use the new udevsettle program. + * Added udev_retry script for systems that have /usr on a different + partition or for some other reason fail the initial replay. (Archaic) + +n/a - April 15, 2006 + * Cleaned up contrib directory. Removed: contrib/init.d, + contrib/enhanced, contrib/livecd, contrib/hotplug, and raq2 + patch. (DJ Lucas) + +n/a - April 14, 2006 + * Merged changes from udev_update branch (DJ Lucas) + * Replaced a return with an exit and reversed comment changes in + udev bootscript. (Dan Nicholson) + * Replaced walk_sysfs function in udev bootscript with new udevtrigger + program and move wait_for_uevents function inline. (DJ Lucas) + * Removed extra evaluate_retval in udev bootscript. (Ken Moffat) + * Wait for uevents to be processed in the udev script. See ticket #1720 + for details. (Matthew Burgess) + +n/a - March 21, 2006 + * Removed old references to boot_log function and arguments passed + to boot_mesg_flush in echo_* functions. (DJ Lucas) + +n/a - March 10, 2006 + * Moved src argument to ipv4-static-route service script and + removed from ipv4-static service script. (DJ Lucas) + +n/a - March 8. 2006 + * Correct sourced path in checkfs script. (Matthew Burgess) + +n/a - December 31, 2005 + * Replaced /etc/rc.d with ${rc_base} in checkfs. (Vincent Fretin) + +n/a - December 24, 2005 + * Added UTF-8 support to console script. (Alexander E. Patrakov) + +n/a - September 11, 2005 + * Removed text wraping and boot logging. + * Changed killproc to use warning if not running + * Changed 'print_status warning' to use old style output + * Fixed display error with LSB init-functions script + * Made above killproc/print_status changes in enhanced + bootscripts. + * Made logger service configurable in enhanced + bootscripts. (DJ Lucas) + +n/a - August 14, 2005 + * Added -s flag to pidofproc() for backwards + compatibility (DJ Lucas) + * Fixed erronous values returned by pidofproc() which + broke the functionality of statusproc (DJ Lucas) + +n/a - July 1, 2005 + * Changed a == to a = in lfs/init.d/functions, in the boot_mesg + function for ash compliancy (Nathan Coulson) + +n/a - June 26, 2005 + * Removed consolelog script from contrib + * Updated interactive rc script in contrib and added + README.rc-Interactive, added install target to the + Makefile. (DJ Lucas) + +3.2.2 - May 29, 2005 + * Tagged as 3.2.2 (Nathan Coulson) + +n/a - May 26, 2005 + * Added minimal target for cross-lfs book (Jim Gifford) + * Fixed raq2 patch (Jim Gifford) + +3.2.1 - May 1, 2005 + * Tagged as 3.2.1 (Nathan Coulson) + +n/a - April 17, 2005 + * removed touch from hotplug bootscript (Matthew Burgess) + * moved commands around in localnet bootscript (Andrew Benton) + +3.2.0 - March 30, 2005 + * Changed from syslog-ng to sysklogd (Archaic) + * Temporairly changed loadproc to return 0 if the program is + already running (Nathan Coulson) + * Fixed (by reverting) ifup/ifdown/network (Nathan Coulson), + Reported by Jim Gifford + * Fixed network up/down along with adding support of ONHOTPLUG + * Tagged as 3.2.0 + +n/a - March 19, 2005 + * Updated RaQ2 patch (Jim Gifford) + * Added net.agent for Hotplug of Network adapters in contrib + (Jim Gifford) + +n/a - March 16, 2005 + * Reverted the change from loadproc to start_daemon, + Moved compatibility code into one single function. + (Nathan Coulson) + * Readded the ONHOTPLUG option for ifup/ifdown (Nathan Coulson) + * Fixed killproc's output + +n/a - March 01, 2005 + * Added CHECK_LINK variable in ifconfig.*/*, so if the + interface does not exist, it will not fail. + (Nathan Coulson) + +n/a - February 19, 2005 + * Added evaluate_retval to the end of loadproc and killproc. + lsb does not say that killproc should print [ OK ], + but required for compatibility. (Nathan Coulson) + +n/a - February 9, 2005 + * Accidently mounted /dev with 775 instead of 755, fixed + (Reported by Alexander E. Patrakov) + +n/a - February 9, 2005 + * Bugfix for /dev, now mounted with 755 permission + +n/a - February 8, 2005 + * changed pidof, so it doesnt check the process id + of running bootscripts, and to process shell scripts + (Nathan Coulson) + +n/a - February 6, 2005 + * Updated main functions file with lsb functions file + Should now be LSB compliant (Nathan Coulson) + +n/a - January 10, 2005 + * Moved ONBOOT check back to network (Nathan Coulson) + * Removed ONHOTPLUG check (Nathan Coulson) + +n/a - January 6, 2005 + * fixed mountkernfs output (Nathan Coulson) + * reverted mountfs fakemounting (Nathan Coulson) + +n/a - January 5, 2005 + * Attempted to simplify network bootup files (Nathan Coulson) + * Modified mountkernfs to use mountpoint (Nathan Coulson) + * Assuming sysfs is always mounted (Nathan Coulson) + * Moved fakemount to below mounting (Nathan Coulson) + * Removed -t noramfs from umount, as we now use tmpfs (Nathan Coulson) + * moved sysctl from mountkernfs to sysctl (Nathan Coulson) + * Added -q to sysctl (Nathan Coulson) + +n/a - January 2, 2005 + * Fixed statusproc output. (DJ Lucas) + +3.1.0 - December 31, 2004 + * fixed textoutput + * Tagged as 3.1.0 + +n/a - December 30, 2004 + * Fixed name of LSB Functions file + * Changed boot_mesg to act like echo instead of echo -n, boot_mesg now + takes the -n argument if you do not wish to goto the next line + +3.0.1 - December 25, 2004 + * Released as 3.0.1 + +n/a - December 20, 2004 + * Cleaned up header. + * Added RaQ2 Patch + +n/a - December 16, 2004 + * Fixed a text typo in udev, tmpfs instead of ramfs (Steve Crosby) + +n/a - December 14, 2004 + * Fixed a warning with find in cleanfs + + +3.0 - December 8, 2004 + +n/a - December 5, 2004 + * Moved bootlog to use local2 service to avoide conflict with + dhcpcd (DJ Lucas) + +3.0-rc1 - December 1, 2004 + * rc-Interactive added (DJ Lucas) + * rc-Interactive moved to contrib (Nathan Coulson) + +n/a - November 27, 2004 + * Moved bootlog to use local1 to avoid conflict with ppd (DJ Lucas) + +n/a - November 25, 2004 + * Added consolelog to contrib/sysconfig (DJ Lucas) + * Rewrite of line wraping in boot_mesg and various fixes + related to boot_mesg changes (DJ Lucas, Alexander Patrakov) + * syslog-ng is now installed by default (Jeremy Utley) + * hotplug is now installed by default (Jeremy Utley) + * udev now uses /sbin/hotplug as the default hotplug handler (Nathan Coulson) + * udev now mounts a tmpfs instead of a ramfs onto /dev, + as suggested by Greg K-H (Nathan Coulson) + * Created contrib/lsb, and added a LSB compliant functions file + (Nathan Coulson, and Alexander Patrakov) + * Modified find [requires find 4.2.3+] (Matthew Burgess) + +n/a - November 20, 2004 + * Modifed modules script to return to previous kernel message + level (DJ Lucas) + +n/a - November 02, 2004 + * Added sysctl -p to mountkernfs (Matthew Burgess, DJ Lucas) + +n/a - October 07, 2004 + * statusproc modified not to send data to bootlog (Nathan Coulson) + * Fixed halt commands in checkfs and udev (James Robertson) + +n/a - October 04, 2004 + * Fixes to commit on 2004/09/30 (James Robertson) + * Revert a few changes until later (Nathan Coulson) + * Added a warning about switching from a 8bit font + to a 9bit font (Alexander Patrakov) + +n/a - September 30, 2004 + * Finished off boot_mesg() (James Robertson) + * Standardized all scripts to same variable format and other + internal sh/bash function calls (James Robertson) + * Fully implemented boot_mesg across all scripts in sysconfig + and init.d (James Robertson) + +n/a - September 26, 2004 + * Added BOOTMESG_PREFIX variable, so users can optionally set a + prefix for boot messages (James Robertson) + * Fixed localnet status, to use ip instead of ifconfig (Jim Gifford) + * Added consolelog to contrib (DJ Lucas) + * loadproc and killproc can have the -nomsg parameter to avoid + calling evaluate_retval or print_status (Jim Gifford) + * boot_mesg no longer explicitly adds a \n onto end of lines + * Added a function called boot_mesg_flush, which can + dump the BOOTMESG to the bootlog. This helps avoid making + everything have to end in OK/WARN/FAIL (Nathan Coulson) + +n/a - September 24, 2004 + * Removed /dev/udev.tdb test + +n/a - September 23, 2004 + * Fixed boot_log so it output's $@'s contents, not @$ + * Added support for colors in boot_mesg (James Robertson) + * Modified udev's error checking + * Modified hotplug's error checking + * Converted checkfs's error handling to use boot_mesg with + color support + * Added $INFO color to functions (James Robertson) + +n/a - September 22, 2004 + * Removed the dependency on wl by replacing it with grep (Bryan Kadzban) + * Fixed getpids, to remove unused pids obtained from $PIDFILE + * Removed ${NORMAL} from echo "$BOOTMESG" in functions, and removed + space added to each additional sentence tacked onto BOOTMESG + * boot_mesg now handles \n's properly, and does not dimish the size of + the next line (James Robertson) + * boot_log has been added. The echo_ functions commit the log, + and then clear the BOOTMSG variable + * All scriptes have been converted to use boot_mesg + +n/a - September 21, 2004 + * boot_mesg has been enhanced. Subsequent calls will overwrite previous + text, and it will wrap text basedupon the variable ${WCOL}. + (James Robertson) + * Fixed mtu optional service typo (Kevin P Fleming) + * Added SOURCE variable to ipv4-static-route (Kevin P Fleming) + +n/a - September 16, 2004 + * nework interfaces are now brought down in reverse order + +n/a - September 15, 2004 + * Added blue bracket, from dj's 3.0-pre1 bootscript package + [echo_failure, echo_warning, and echo_ok] + * Added a new function called boot_mesg, meant to replace the echo + command. + This will give us the posibility of doing logging at a later date + * Do not set COLUMNS if COLUMNS is already set + * Modified getpids, loadproc, killproc, reloadproc, and statusproc as + done by DJ + +2.2.3 - September 04, 2004 + * Tagged as 2.2.3 + +n/a - September 04, 2004 + * Added new script to contrib for syslog-ng, which is now part of + LFS-Unstable, and a new Makefile target install-syslog-ng which + removes the sysklogd links, and replaces them with syslog-ng (JU) + +2.2.2 - August 11, 2004 + * Tagged as 2.2.2 + +n/a - August 7, 2004 + * Added missing error redirect (/dev/null) in getpids. (DJ) + +n/a - August 4, 2004 + * Added MODE, DIRMODE, and CONFMODE variables to the makefile + to allow permissions to be set at install. (DJ) + +n/a - July 31, 2004 + + * Moved PIDFILE check to getpids and removed arguments from + killproc and reloadproc. Signals are now set at begining of + funtcions script with KILLDELAY. (DJ) + * Added a optional service script which can set the MTU for a given + interface + +n/a - July 21, 2004 + + * Committed DJ Lucas's patch for the killproc function. It no + longer requires arguments if PIDFILE is set + * added --backup to all sysconfig configuration files, so they are not + replaced on a make install + +n/a - July 13, 2004 + + * Added the PEER variable to the ifconfig.*/* file, done by + Kevin P. Fleming + +2.2.1 - July 12, 2004 + + * Tagged as 2.2.1 + +n/a - July 12, 2004 + + * Hotplug was moved from rcsysinit.d to rc{1,2,3,4,5} to help bring + up/down network interfaces started by hotplug. This has been revoked + at this time + * Networking interfaces are now brought down in reverse order + * Moved the ONBOOT check to within ifup/ifdown, so we can bring up/down + the interfaces at boottime/shutdown properly, done by Kevin P. Fleming + * Use PREFIX instead of NETMASK for adding addresses in ipv4-static, + done by Kevin P. Fleming + * Fix reversal of services inside ifconfig.* directories in ifdown, + done by Kevin P. Fleming + * Add ipv4-static-route service, supplied by Kevin P. Fleming + +2.2.0 - July 12, 2004 + + * Tagged as 2.2.0 + +n/a - July 11, 2004 + + * Minor script output changes + * Repaired networking scripts broken in previous commits + +n/a - July 10, 2004 + + * We now use the ip program [from iproute2] instead of ipconfig + [net-tools] to bring up/down ethernet interfaces, and local + connections, submitted by Jim Gifford + * Removed gateway backward compatibility + * Removed ifup-eth0 ifdown-eth0 compatibility + * Removed the "assume SERVICE=static if SERVICE is unset" compatibility + * Pass the IFCONFIG environmental variable to services, so they can + locate the file with the parameters they must read + * Rename static to ipv4-static + * Stage1 for network configuration via directories, ifup and ifdown + modified, and the static service modified + * Stage2 for network configuration via directories complete, network was + modified to check within subdirectories for ONBOOT=yes. Final Stage + +n/a - July 8, 2004 + + * Changed iso01 to lat1 everywhere in /etc/sysconfig/console. This + fixes the problem with line-drawing characters. + +n/a - July 7, 2004 + + * Halted the computer, if unable to mount /dev as a ramfs + +n/a - July 6, 2004 + + * Moved the hotplug bootscript back to contrib, it will not be used in + the testing branch of the lfs book at this time + +n/a - July 4, 2004 + + * Modified ifup and ifdown to be hotplug aware + +n/a - July 3, 2004 + + * Change the check for ONBOOT into a source within a subshell + +n/a - July 1, 2004 + + * Moved hotplug start to runlevels 3-5 from sysinit + +n/a - June 30, 2004 + + * Pass -depth in cleanfs + +n/a - June 29, 2004 + + * Made the grep for ONBOOT in the network script more exact + +2.1.2 - June 27, 2004 + + * Install the automatic module loading script by default + * Tagged as 2.1.2 + +n/a - June 26, 2004 + + * Fixed font for UK in /etc/sysconfig/console + +n/a - June 23, 2004 + + * Fixed a typo in the hotplug installation procedure + +n/a - June 21, 2004 + + * Re-ordered the "mount" and "echo" commands in the udev script, to + prevent a possible race + * Converted the udev script to use udevsend/udevd + * Moved removal of /fastboot and /forcefsck to just after the root fs + becomes writable, and dropped the removal of /etc/nologin + * Cleaned and tweaked both the output and actions of cleanfs + * Removed the disabling of hotplug from sendsignals + * Removed anything that might call "rmmod" in hotplug, since rmmod is + notoriously troublesome in the 2.6.x kernels, and call it with the + stop argument from runlevels 0 and 6 + * Fixed previous modifications to the udev and cleanfs scripts + +n/a - June 20, 2004 + + * Rolled back to the /dev/.udev.tdb check from 2.1.1, since the new + one doesn't work as well, and the bug that caused it to change is + now fixed + +n/a - June 18, 2004 + + * Updated sysconfig/console + * Fixed disabling hotplug in sendsignals + * hotplug is now installed by default + +n/a - June 15, 2004 + + * Reset /proc/sys/kernel/hotplug to /bin/true when running the "stop" + command for hotplug + * Cleaned the output of the mountkernfs script + * Don't output "Creating files and directories" when it's a lie + +n/a - June 8, 2004 + + * Changed the location the optional module script is installed to + /etc/rc.d/rcsysinit.d/S05modules. + +n/a - June 4, 2004 + + * Added a echo to the > /proc/sys/kernel/hotplug line, as > did not + clear it + +n/a - June 3, 2004 + + * Added '> /proc/sys/kernel/hotplug' to sendsignals, to disable hotplug + events, which may start up new daemons + * Added elementry bootup logging support. If it can write to + /var/log/boot.log, it will + * Removed logging support, it kept / from being remounted ro + +n/a - June 2, 2004 + + * Reorganize what goes on in the udev script + * Reorganize what goes on in the hotplug script + * Moved setting /sbin/hotplug as the default hotplug manager into the + hotplug script + +n/a - June 1, 2004 + + * Removed usbfs from mountkernfs, and mountfs + * Edited the udev script, so it'll always set /proc/sys/kernel/hotplug + +n/a - May 24, 2004 + + * Added more example keymaps and font settings to /etc/sysconfig/console + * Install the /etc/sysconfig/console file by default + +n/a - May 23, 2004 + + * Changed the symlink for the optional modules script + * Removed depmod from the optional modules script + +n/a - May 20, 2004 + + * Removed the random script. There is not a strong enough case for + adding it to the lfs-bootscripts. + +n/a - May 19, 2004 + + * Added the random bootscript from blfs-bootscripts + +2.1.1 - May 18, 2004 + + * Fixed installation of modules configuration + * Tagged as 2.1.1 + +n/a - May 16, 2004 + + * Added sysklogd configuration file + * Added example /etc/sysconfig/console file + * Do not attempt to populate /dev if that directory has already been + set up earlier in bootup (such as on initramfs/initrd) + * Prevent excessive kernel output once klogd starts + * Added hotplug script + +n/a - May 15, 2004 + + * Namespace rework (enumeration of scripts is now cleaner) + * Removed directories: blfs, contrib/new-boot-0.2, contrib/rlv + +n/a - May 13, 2004 + + * Repaired the console script + * Added a check to cleanfs [createfiles], to make sure that we have + a valid devicetype, if we have type=dev + +n/a - May 11, 2004 + + * Added usbfs to mountkernfs and mountfs + +n/a - May 6, 2004 + + * Don't use loadproc in localnet, it's not meant for that + * Quote tests of $PIDFILE, so that things behave when it's empty + * Removed unused kill -0 from killproc + +2.1.0 - May 4, 2004 + + * Update to the console script, prevent install of the console script + * Chgrp /var/run/utmp to group utmp if it exists. + * Moved udev from contrib to lfs + * Moved GATEWAY setup from /etc/rc.d/init.d/network to + /etc/sysconfig/network-devices/services/static + * Use the contents of $PIDFILE, if it is set in the script + * Tagged as 2.1.0. + +n/a - April 30, 2004 + + * Moved the loadkeys script to console, and added setfont. Contributed + by Alexander E. Patrakov + +2.0.5 - April 29, 2004 + + * Added the heimdal init script. + * Tagged as 2.0.5 + +2.0.4 - April 27, 2004 + + * Tagged as 2.0.4 + +n/a - April 24, 2004 + + * Added a example script for /etc/sysconfig/createfiles + * Added a check for /sys before mounting sysfs + * Added -t noramfs to umount on /etc/rc.d/init.d/mountfs. + This will prevent /dev from being unmounted, if /proc/mounts + is symlinked to /etc/mtab + +n/a - April 18, 2004 + + * Small fix to a if statement in netfs + +n/a - April 17, 2004 + + * Added the lisa bootscript, lisa is part of the KDE Network package + * Add proper error checking to the mountfs script when writing out mtab + * Add more comments to the udev script, and conditionalize various + things that should've been done this way in the first place + * Include a template module auto-loading configuration file instead of + having syntax comments in the script itself + +n/a - April 12, 2004 + + * Added a automatic modules loading script to the contrib directory + submitted by Zack + * Edited mountkernfs, so that if you can mount sysfs on /sys, it will + be mounted at boottime. Should not affect 2.4 systems + * Since all entries are added to /etc/mtab, we should not require + the NO_FS variable. It has been removed from mountfs + * Added the udev script into the contrib directory, submitted by Zack + +2.0.3 - April 8, 2004 + + * Updated cleanfs, so it can create devices. Supplied by Zack + * Tagged as 2.0.3 + +n/a - March 31, 2004 + + * Changed "Press Enter" on unknown error to white + * Moved S10swap to S20swap. When udev is added, it has to be + ran before swap is setup + +n/a - March 29, 2004 + + * Fixed the rc5.d symlink for ntp so it creates S26ntp instead + of S26npt + * Moved S20mountkernfs to S00mountkernfs in rcsysinit.d. Will help in + the addition of udev in the future. + +n/a - March 27, 2004 + + * Changed gdm path from hardcoded to program name. There are 2 spots + gnome can be installed + +n/a - March 26, 2004 + + * Updated fam daemon script. It now uses the famd daemon instead of fam + +n/a - March 24, 2004 + + * Removed mount command out of nfs. the netfs script already handles + this + +2.0.2 - March 24, 2004 + + * Edited cleanfs to solve a problem. [if /tmp does not exist, it + could run the find command on the root filesystem] + * Tagged as 2.0.2 + +2.0.1 - March 24, 2004 + + * Found typo in BLFS MySQL Script. + * Tagged as 2.0.1 + +2.0.0 - March 23, 2004 + + * Tagged as 2.0.0, no changes from 2.0.0-pre2 + +2.0.0-pre2 - March 23, 2004 + + * Cleaned the /tmp directory on bootup. find command supplied by Zack + * Added a script which can automatically create files and directories + on startup. [Handles files/directories, permissions, and user/group]. + Created by Zack + * Added blfs/init.d/fam script + * Tagged as 2.0.0-pre2 + +n/a - March 20, 2004 + + * Added create-service-dir target and removed from create-dirs + * Changed service script install targets to use + create-service-dir + * Added check for dhcpcd service script for stale pid file + Suggested by Jeremy + * Added ifconfig to ipx service script for hosting device not up + +n/a - March 19, 2004 + + * Added support for ETCDIR, and DESTDIR in the Makefile, + compliments of Tushar + * Renamed mountproc to mountkernfs + * Updated the README file + * Coloured the print_error_message in functions red + * added stop to the setclock script + * changed echo > to > in cleanfs, suggested by winkie + * BLFS Scripts Added, collected by Zack + * Edited killproc, so it checks for running pids, rather then + the completion of the above kill command. Suggested by Zack + * Added network services found in blfs, removed adsl. Submitted by + DJ. + +1.99.4 - March 17, 2004 + + * Fixed one last halt line in checkfs script + * Moved the directory structure around + * Tagged as development release 1.99.4 + +n/a - February 28, 2004 + + * Added stty sane to the top of rc.d/init.d/rc. Hopefully, this will + fix the problems + * Also changed all instances of <ctrl-j> back to enter + +1.99.3 - February 23, 2004 + + * Tagged as development release 1.99.3 + +n/a - February 19, 2004 + + * Fixed checkfs script, so it will no longer continue to boot after a + failure in the init.d/checkfs script. Tested with the help of Andre + Müller. Fix suggested by Zack + +n/a - February 7, 2004 + + * Added -s onto grep on network stop + * Replaced a few more enter's with ctrl-j + +1.99.2 - February 6, 2004 + + * Added -s onto grep in network start + * Tagged as development release 1.99.2 + +n/a - February 4, 2004 + + * Fixed $WARNING $NORMAL and $ERROR lines, broken by changes in + functions + * Changed above fixes to work with ash + * Fixed checkfs symlink in Makefile + * functions is no longer installed as executable + * Added a check to checkfs, for errors above 16. These are caused by + being unable to run fsck, either due to user input, or a unfunctional + linux system + +1.99.1 - February 2, 2004 + + * Tagged as development release 1.99.1 + +n/a - February 2, 2004: + + * Added -d to umount in mountfs. + * Fixed network shutdown script + * Fixed Makefile rc.6 to reboot + * Added -s flag to grep command in rc.d/init.d/network - + suppresses an error if no ifconfig.* files exist + +n/a - January 30, 2004: + + * Reorganized the network system to accept multiple services. + * Ash Compliancy + * Modified some scripts to follow template + * Reorganized functions, based upon Ash Compliancy Patch + * Added a sleep 5 to failure for evaulate_retval, and changed + evaulate_retval to return true instead of false. Instead, a + exit 1 will indicate the script terminated abnormally, causing + your system to wait until you hit ctrl-J + * Switched "Press enter to continue" to "Press <ctrl-j> to continue" + * replaced 3 with $KILLDELAY in sendsignals + * mountfs does not mount network filesystems [identified by _netdev + in /etc/fstab] + * removed unneded touch out of cleanfs + +n/a - January 30, 2004: + + * New maintainers for the lfs-bootscripts package are: + Jeremy Utley (jeremy@linuxfromscratch.org) + Nathan Coulson (nathan@linuxfromscratch.org) + +1.11 - February 3rd, 2003: + + * /etc/mtab is now a real file and is handled correctly so there are + no errors even when the machine has crashed. + +1.10 - September 12th, 2002: + + * Fixed up checkfs to work with non-ext2 filesystems too (such as + minix). + +1.9 - April 5th, 2002: + + * reloadproc function had a missing '=' in the "failure 1" command (it + should be failure=1) + + * When script exists with unexpected value, you have to hit "Enter" to + continue, not just a random key as printed on the screen. + + * Moved K10sysklogd, K20sendsignals, K30mount and K40swap to + K40sysklogd, K50sendsignals, K60mount, K70swap + + * Changed the #!/bin/sh lines to #!/bin/bash - /bin/sh may not be + linked to bash but to some other shell of your choice. These scripts + are written to work with bash, so you can't just run them when + /bin/sh -> csh or ash or whatever else tickles your fancy. This + change should fix that. + +1.8 - March 14th, 2002: + + * Fixed the getpids function call so PPID's would be taken into account + properly. + + * Added the 'contrib' directory with other people's bootscript + implementations. + +1.7 - March 10th, 2002: + + * Used code from Matthias Benkmann's simpleinit-msb @ + http://winterdrache.de/linux/newboot/index.html mainly for improved + killproc function handling + + * When a requested process isn't running, or is already running, a + warning "Not running" or "Already running" will be displayed. This + was out of allignment due to a missing $CURS_UP + + * Removed "||exit" from ifup and ifdown scripts. They are useless. + + * Changed the loadkeys script to run "loadkeys -d" and removed the need + for the /etc/sysconfig/keyboard file. The kbd patch fixes the + "loadkeys -d" behaviour. + +1.6 - February 26th, 2002: + + * replaced -o %PPID with -o $PPID throughout the functions script. This + construct does what it's supposed to do (don't take PPID into account + because this would fail if a running daemon and the bootscript have + the same name). + + * added 'restart' to the swap script + + * instead of using 'echo -n' to supress newlines so the [ OK ] and + related messages allign properly, substitute this with a single echo + command that simply goes one line up before outputting anything. This + also has the benefit that when programs have their own output (like + swapon, fsck and loadkeys), there won't be an unwanted blank line + between the program's output and the [ OK ] et all. messages. + +1.5 - February 2nd, 2002: + + * added 'exit 1' to the statusproc function when there aren't enough + parameters passed to it (such as the name of process to check for) + +1.4 - February 2nd, 2002: + + * when /fastboot is detected and the message about it is printed, + don't run 'exit 1' else the rc script will cause a [FAILED] to + be printed which is undesired in this case. + +1.3 - January 30th, 2002: + * network script: changed default route detection by using the same + method as used when starting the script: check if the GATEWAY + variable is set + + * removed the emptying of /etc/mtab since it's a symlink to + /proc/mounts now + + * added the mountproc script which mounts the proc system. This is done + because we need proc mounted even before the mountfs script is ran + (now that /etc/mtab is a symlink to /proc/mounts) + + * removed all absolute paths from command calls + + * added umask 022 and PATH="/bin:/usr/bin:/sbin:/usr/sbin" to the + functions script. Every file now sources this so that umask and PATH + are set correctly + +1.2 - January 26th, 2002: + * network script: detect if a default route is set before removing it + diff --git a/bootscripts/LICENSE b/bootscripts/LICENSE new file mode 100644 index 000000000..8beeec4bd --- /dev/null +++ b/bootscripts/LICENSE @@ -0,0 +1,29 @@ +Copyright (c) 1999-2002, Gerard Beekmans + +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" 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. + +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. + diff --git a/bootscripts/Makefile b/bootscripts/Makefile new file mode 100644 index 000000000..4c6bcca10 --- /dev/null +++ b/bootscripts/Makefile @@ -0,0 +1,134 @@ +ETCDIR=/etc +EXTDIR=${DESTDIR}${ETCDIR} +MODE=754 +DIRMODE=755 +CONFMODE=644 + +all: install + +create-dirs: + install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc0.d + install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc1.d + install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc2.d + install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc3.d + install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc4.d + install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc5.d + install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc6.d + install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rcsysinit.d + install -d -m ${DIRMODE} ${EXTDIR}/rc.d/init.d + install -d -m ${DIRMODE} ${EXTDIR}/sysconfig + +create-service-dir: + install -d -m ${DIRMODE} ${EXTDIR}/sysconfig/network-devices/services + +install: create-dirs create-service-dir + install -m ${MODE} lfs/init.d/checkfs ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/cleanfs ${EXTDIR}/rc.d/init.d/ + install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/halt ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/console ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/consolelog ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/localnet ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/modules ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/mountfs ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/mountkernfs ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/network ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/rc ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/reboot ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/sendsignals ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/setclock ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/sysklogd ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/swap ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/sysctl ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/template ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/udev ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/udev_retry ${EXTDIR}/rc.d/init.d/ + ln -sf ../init.d/network ${EXTDIR}/rc.d/rc0.d/K80network + ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc0.d/K90sysklogd + ln -sf ../init.d/sendsignals ${EXTDIR}/rc.d/rc0.d/S60sendsignals + ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rc0.d/S70mountfs + ln -sf ../init.d/swap ${EXTDIR}/rc.d/rc0.d/S80swap + ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rc0.d/S90localnet + ln -sf ../init.d/halt ${EXTDIR}/rc.d/rc0.d/S99halt + ln -sf ../init.d/network ${EXTDIR}/rc.d/rc1.d/K80network + ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc1.d/K90sysklogd + ln -sf ../init.d/network ${EXTDIR}/rc.d/rc2.d/K80network + ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc2.d/K90sysklogd + ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc3.d/S10sysklogd + ln -sf ../init.d/network ${EXTDIR}/rc.d/rc3.d/S20network + ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc4.d/S10sysklogd + ln -sf ../init.d/network ${EXTDIR}/rc.d/rc4.d/S20network + ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc5.d/S10sysklogd + ln -sf ../init.d/network ${EXTDIR}/rc.d/rc5.d/S20network + ln -sf ../init.d/network ${EXTDIR}/rc.d/rc6.d/K80network + ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc6.d/K90sysklogd + ln -sf ../init.d/sendsignals ${EXTDIR}/rc.d/rc6.d/S60sendsignals + ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rc6.d/S70mountfs + ln -sf ../init.d/swap ${EXTDIR}/rc.d/rc6.d/S80swap + ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rc6.d/S90localnet + ln -sf ../init.d/reboot ${EXTDIR}/rc.d/rc6.d/S99reboot + ln -sf ../init.d/mountkernfs ${EXTDIR}/rc.d/rcsysinit.d/S00mountkernfs + ln -sf ../init.d/consolelog ${EXTDIR}/rc.d/rcsysinit.d/S02consolelog + ln -sf ../init.d/modules ${EXTDIR}/rc.d/rcsysinit.d/S05modules + ln -sf ../init.d/udev ${EXTDIR}/rc.d/rcsysinit.d/S10udev + ln -sf ../init.d/swap ${EXTDIR}/rc.d/rcsysinit.d/S20swap + ln -sf ../init.d/setclock ${EXTDIR}/rc.d/rcsysinit.d/S25setclock + ln -sf ../init.d/checkfs ${EXTDIR}/rc.d/rcsysinit.d/S30checkfs + ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rcsysinit.d/S40mountfs + ln -sf ../init.d/udev_retry ${EXTDIR}/rc.d/rcsysinit.d/S45udev_retry + ln -sf ../init.d/cleanfs ${EXTDIR}/rc.d/rcsysinit.d/S50cleanfs + ln -sf ../init.d/console ${EXTDIR}/rc.d/rcsysinit.d/S70console + ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rcsysinit.d/S80localnet + ln -sf ../init.d/sysctl ${EXTDIR}/rc.d/rcsysinit.d/S90sysctl + if [ ! -f ${EXTDIR}/sysconfig/createfiles ]; then install -m ${CONFMODE} lfs/sysconfig/createfiles ${EXTDIR}/sysconfig/; fi + if [ ! -f ${EXTDIR}/sysconfig/modules ]; then install -m ${CONFMODE} lfs/sysconfig/modules ${EXTDIR}/sysconfig/; fi + if [ ! -f ${EXTDIR}/sysconfig/rc ]; then install -m ${CONFMODE} lfs/sysconfig/rc ${EXTDIR}/sysconfig/; fi + install -m ${MODE} lfs/sysconfig/network-devices/ifup ${EXTDIR}/sysconfig/network-devices/ + install -m ${MODE} lfs/sysconfig/network-devices/ifdown ${EXTDIR}/sysconfig/network-devices/ + install -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static ${EXTDIR}/sysconfig/network-devices/services/ + install -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static-route ${EXTDIR}/sysconfig/network-devices/services/ + +install-consolelog: create-dirs + install -m ${MODE} contrib/init.d/consolelog ${EXTDIR}/rc.d/init.d + ln -sf ../init.d/consolelog ${EXTDIR}/rc.d/rcsysinit.d/S00consolelog + +install-lsb-compliant: + make -C contrib/lsb + +install-service-mtu: create-service-dir + install -m ${MODE} contrib/sysconfig/network-devices/services/mtu ${EXTDIR}/sysconfig/network-devices/services + +minimal: create-dirs create-service-dir + install -m ${MODE} lfs/init.d/checkfs ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/cleanfs ${EXTDIR}/rc.d/init.d/ + install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/halt ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/localnet ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/mountfs ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/mountkernfs ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/rc ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/reboot ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/sendsignals ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/setclock ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/swap ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} lfs/init.d/udev ${EXTDIR}/rc.d/init.d/ + ln -sf ../init.d/sendsignals ${EXTDIR}/rc.d/rc0.d/S60sendsignals + ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rc0.d/S70mountfs + ln -sf ../init.d/swap ${EXTDIR}/rc.d/rc0.d/S80swap + ln -sf ../init.d/halt ${EXTDIR}/rc.d/rc0.d/S99halt + ln -sf ../init.d/sendsignals ${EXTDIR}/rc.d/rc6.d/S60sendsignals + ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rc6.d/S70mountfs + ln -sf ../init.d/swap ${EXTDIR}/rc.d/rc6.d/S80swap + ln -sf ../init.d/reboot ${EXTDIR}/rc.d/rc6.d/S99reboot + ln -sf ../init.d/mountkernfs ${EXTDIR}/rc.d/rcsysinit.d/S00mountkernfs + ln -sf ../init.d/udev ${EXTDIR}/rc.d/rcsysinit.d/S10udev + ln -sf ../init.d/swap ${EXTDIR}/rc.d/rcsysinit.d/S20swap + ln -sf ../init.d/setclock ${EXTDIR}/rc.d/rcsysinit.d/S25setclock + ln -sf ../init.d/checkfs ${EXTDIR}/rc.d/rcsysinit.d/S30checkfs + ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rcsysinit.d/S40mountfs + ln -sf ../init.d/cleanfs ${EXTDIR}/rc.d/rcsysinit.d/S50cleanfs + if [ ! -f ${EXTDIR}/sysconfig/rc ]; then install -m ${CONFMODE} lfs/sysconfig/rc ${EXTDIR}/sysconfig/; fi + +.PHONY: all create-dirs create-service-dir \ + install install-service-mtu + diff --git a/bootscripts/README b/bootscripts/README new file mode 100644 index 000000000..a2582bc82 --- /dev/null +++ b/bootscripts/README @@ -0,0 +1,79 @@ +Network Configuration: + Script Files: + rc.d/init.d/network + sysconfig/network-devices/ifup + sysconfig/network-devices/ifdown + sysconfig/network-devices/services/* + + Configuration Files: + sysconfig/network-devices/ifconfig.*/* + Note: ifconfig.* could be either a file or directory, + but the filename extention must be the same name + as the network interface you wish it to belong to. + The files within the directory will be processed + in alphanumerical order on boot, and reversed on + shutdown. + - SERVICE: which script to run in services directory. + - ONBOOT: if set to yes, this interface will be started on + bootup, and stopped on shutdown + - ONHOTPLUG: if set to yes, this interface will be started + and stopped on hotplug events. This requires + ifup and ifdown symlinked to /sbin, as well + as the hotplug package + + sysconfig/network + - HOSTNAME: Value of the system's hostname + + Additional Configuration: + sysconfig/network-devices/ifconfig.* + ipv4-static: + - IP: static IP Address + - GATEWAY: Specifies the IP Address of the gateway server + - PREFIX: CIDR prefix of IP Address, defaults to 24 if not set + - PEER: IP Address of peer (for point-to-point connections and tunnels) + - BROADCAST: broadcast address + ipv4-static-route: + - TYPE: network (default type if not specified), default, host or + unreachable + - IP: IP Address of target (for network, host and unreachable) + - PREFIX: CIDR prefix of target (for network, host and unreachable) + - GATEWAY: IP Address of gateway to reach target (for network and default) + + +SetClock configuration: + Script Files: + rc.d/init.d/setclock + + Configuration Files: + sysconfig/clock + - UTC: 1 assumes hwclock is in UTC + 0 assumes hwclock is in local time + +CleanFS configuration: + Script Files: + rc.d/init.d/cleanfs + + Configuration Files: + /etc/sysconfig/createfiles + Each line is parsed, using space as a deliminator. + [NAME] [TYPE] [PERMISSIONS] [USER] [GROUP] + The below fields are currently only used on dev type. + ([DEV TYPE] [MAJOR#] [MINOR#]) + Name: + File/Directory/Device name + Type: + dir: creates a directory + file: creates a file + dev: creates a device + Permissions: + chmod the created file + User/Group: + chown the created file/dir to this user/group + Dev Type: + char: character [needs MAJOR#, MINOR#] + block: block [needs MAJOR#, MINOR#] + pipe: pipe + Major#: + Used by character and block devices. + Minor#: + Used by character and block devices. diff --git a/bootscripts/contrib/lsb-v3/ChangeLog b/bootscripts/contrib/lsb-v3/ChangeLog new file mode 100644 index 000000000..dc2fe95d5 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/ChangeLog @@ -0,0 +1,42 @@ +ChangeLog +20080908 - [dj] * Corrected echo command in rc script - Thanks to + Michael Tremer at IPFire. + +20080907 - [dj] * Use new initd-tools package to activate scripts. + * $syslog and modules services cannot be a hard dependencies + due to minimal install target. + * Store bootlog date in UTC. + * Added hard deps to network script for local_fs, swap, and + localnet (account for /usr at network instead of $remote_fs). + +20080831 - [dj] * Corrected more, and minimized dependencies in scripts. + * Don't try to write to bootlog in 0 and 6. + * Use /etc/rcS.d instead of /etc/rcsysinit.d - added + replacement /etc/inittab file + +20080830 - [dj] * Corrected remaining dependency errors in script headers. + +20080531 - [dj] * Synced with LFS-Bootscrpts-20080531 (use udevadm) + * Added additional functions to manage_functions script. + +20080413 - [dj] * Added manage_functions script for use by scripts such as + {install,remove}_initd or chkconfig, that need to parse the + LSB headers. + * Cleaned up script headers to reflect real Start or Stop + +20080315 - [dj] * Corrected test for $pidfile in pidofproc() + * Replaced exit with return in statusproc() - (lfs-functions) + +20080315 - [dj] * Added missing 'stale pid file' checking for pidofproc() + +20080210 - [dj] * Updated documentation + +20070820 - [dj] * Synced with LFS-bootscripts + +20070705 - [dj] * Synced with LFS-bootscripts + * Removed 'stty' from the environment setup as it breaks + custom key configs when run from the CLI. + +20070218 - [dj] * Synced with LFS-bootscripts. + +20070206 - [dj] * Initial commit diff --git a/bootscripts/contrib/lsb-v3/INSTALL b/bootscripts/contrib/lsb-v3/INSTALL new file mode 100644 index 000000000..4828b4323 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/INSTALL @@ -0,0 +1,31 @@ +LSB-V3 Installation: + +NOTE: initd-tools must be installed prior to installation of these scripts. + +initd-tools installation: + +Download initd-tools from: +http://www.dwcab.com/downloads/initd-tools/initd-tools-0.1.2.tar.gz + + ./configure && + make && + make check && + make install + +Inline installation of lsb-v3 bootscripts: + sudo make install + +After LFS installation of lsb-v3 bootscripts: + for file in /etc/rc.d /etc/sysconfig/rc /etc/sysconfig/modules \ + /etc/sysconfig/createfiles + do + mv $file $file.bak + done && + make install + +There is no longer an upgrade path for existing installations. You will have +to reinstall any bootscripts installed by BLFS or any self written scripts. +Fortunately, this will soon be very easy for BLFS scripts as a contrib +directory containing lsb-v3 scripts will be added in the near future. + +That's it! diff --git a/bootscripts/contrib/lsb-v3/Makefile b/bootscripts/contrib/lsb-v3/Makefile new file mode 100644 index 000000000..d86c083cb --- /dev/null +++ b/bootscripts/contrib/lsb-v3/Makefile @@ -0,0 +1,115 @@ +ETCDIR=/etc +EXTDIR=${DESTDIR}${ETCDIR} +MODE=754 +DIRMODE=755 +CONFMODE=644 + +all: install + +create-dirs: + install -d -m ${DIRMODE} ${EXTDIR}/rc0.d + install -d -m ${DIRMODE} ${EXTDIR}/rc1.d + install -d -m ${DIRMODE} ${EXTDIR}/rc2.d + install -d -m ${DIRMODE} ${EXTDIR}/rc3.d + install -d -m ${DIRMODE} ${EXTDIR}/rc4.d + install -d -m ${DIRMODE} ${EXTDIR}/rc5.d + install -d -m ${DIRMODE} ${EXTDIR}/rc6.d + install -d -m ${DIRMODE} ${EXTDIR}/rcS.d + install -d -m ${DIRMODE} ${EXTDIR}/init.d + install -d -m ${DIRMODE} ${EXTDIR}/sysconfig + install -d -m ${DIRMODE} ${DESTDIR}/lib/lsb + install -d -m ${DIRMODE} ${EXTDIR}/lsb/state + +create-service-dir: + install -d -m ${DIRMODE} ${EXTDIR}/sysconfig/network-devices/services + +create-boottemp-dir: + install -d -m ${DIRMODE} ${EXTDIR}/init.d/boottemp + +install: create-dirs create-service-dir create-boottemp-dir + install -m ${MODE} init.d/checkfs ${EXTDIR}/init.d/ + install -m ${MODE} init.d/cleanfs ${EXTDIR}/init.d/ + install -m ${CONFMODE} init.d/lfs-functions ${EXTDIR}/init.d/ + install -m ${MODE} init.d/halt ${EXTDIR}/init.d/ + install -m ${MODE} init.d/console ${EXTDIR}/init.d/ + install -m ${MODE} init.d/localnet ${EXTDIR}/init.d/ + install -m ${MODE} init.d/modules ${EXTDIR}/init.d/ + install -m ${MODE} init.d/mountfs ${EXTDIR}/init.d/ + install -m ${MODE} init.d/mountkernfs ${EXTDIR}/init.d/ + install -m ${MODE} init.d/network ${EXTDIR}/init.d/ + install -m ${MODE} init.d/rc ${EXTDIR}/init.d/ + install -m ${MODE} init.d/reboot ${EXTDIR}/init.d/ + install -m ${MODE} init.d/sendsignals ${EXTDIR}/init.d/ + install -m ${MODE} init.d/setclock ${EXTDIR}/init.d/ + install -m ${MODE} init.d/sysklogd ${EXTDIR}/init.d/ + install -m ${MODE} init.d/swap ${EXTDIR}/init.d/ + install -m ${MODE} init.d/sysctl ${EXTDIR}/init.d/ + install -m ${MODE} init.d/template ${EXTDIR}/init.d/ + install -m ${MODE} init.d/udev ${EXTDIR}/init.d/ + install -m ${MODE} init.d/udev_retry ${EXTDIR}/init.d/ + install -m ${CONFMODE} lsb/init-functions ${DESTDIR}/lib/lsb/ + install -m ${CONFMODE} lsb/manage-functions ${DESTDIR}/lib/lsb/ + install -m ${CONFMODE} etc/lsb-config ${EXTDIR}/lsb/ + if [ ! -f ${EXTDIR}/sysconfig/createfiles ]; then install -m ${CONFMODE} sysconfig/createfiles ${EXTDIR}/sysconfig/; fi + if [ ! -f ${EXTDIR}/sysconfig/modules ]; then install -m ${CONFMODE} sysconfig/modules ${EXTDIR}/sysconfig/; fi + if [ ! -f ${EXTDIR}/sysconfig/rc ]; then install -m ${CONFMODE} sysconfig/rc ${EXTDIR}/sysconfig/; fi + if [ ! -f ${EXTDIR}/sysconfig/rc.site ]; then install -m ${CONFMODE} sysconfig/rc.site ${EXTDIR}/sysconfig/; fi + if [ -f ${EXTDIR}/inittab ]; then install -m ${CONFMODE} ${EXTDIR}/inittab ${EXTDIR}/inittab.bak; fi + install -m ${CONFMODE} etc/inittab ${EXTDIR}/ + install -m ${MODE} sysconfig/network-devices/ifup ${EXTDIR}/sysconfig/network-devices/ + install -m ${MODE} sysconfig/network-devices/ifdown ${EXTDIR}/sysconfig/network-devices/ + install -m ${MODE} sysconfig/network-devices/services/ipv4-static ${EXTDIR}/sysconfig/network-devices/services/ + install -m ${MODE} sysconfig/network-devices/services/ipv4-static-route ${EXTDIR}/sysconfig/network-devices/services/ + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/checkfs + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/cleanfs + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/halt + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/console + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/localnet + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/modules + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/mountfs + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/mountkernfs + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/network + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/reboot + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/sendsignals + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/setclock + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/sysklogd + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/swap + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/sysctl + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/udev + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/udev_retry + +minimal: create-dirs create-service-dir create-boottemp-dir + install -m ${MODE} init.d/checkfs ${EXTDIR}/init.d/ + install -m ${MODE} init.d/cleanfs ${EXTDIR}/init.d/ + install -m ${CONFMODE} init.d/lfs-functions ${EXTDIR}/init.d/ + install -m ${MODE} init.d/halt ${EXTDIR}/init.d/ + install -m ${MODE} init.d/localnet ${EXTDIR}/init.d/ + install -m ${MODE} init.d/mountfs ${EXTDIR}/init.d/ + install -m ${MODE} init.d/mountkernfs ${EXTDIR}/init.d/ + install -m ${MODE} init.d/rc ${EXTDIR}/init.d/ + install -m ${MODE} init.d/reboot ${EXTDIR}/init.d/ + install -m ${MODE} init.d/sendsignals ${EXTDIR}/init.d/ + install -m ${MODE} init.d/setclock ${EXTDIR}/init.d/ + install -m ${MODE} init.d/swap ${EXTDIR}/init.d/ + install -m ${MODE} init.d/udev ${EXTDIR}/init.d/ + install -m ${CONFMODE} lsb/init-functions ${DESTDIR}/lib/lsb/ + install -m ${CONFMODE} lsb/manage-functions ${DESTDIR}/lib/lsb/ + install -m ${CONFMODE} etc/lsb-config ${EXTDIR}/lsb/ + if [ ! -f ${EXTDIR}/sysconfig/rc ]; then install -m ${CONFMODE} sysconfig/rc ${EXTDIR}/sysconfig/; fi + if [ -f ${EXTDIR}/inittab ]; then install -m ${CONFMODE} ${EXTDIR}/inittab ${EXTDIR}/inittab.bak; fi + install -m ${CONFMODE} etc/inittab ${EXTDIR}/ + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/checkfs + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/cleanfs + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/halt + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/localnet + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/mountfs + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/mountkernfs + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/reboot + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/sendsignals + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/setclock + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/swap + /usr/lib/lsb/install_initd ${EXTDIR}/init.d/udev + +.PHONY: all create-dirs create-service-dir create-boottemp-dir \ + install minimal + diff --git a/bootscripts/contrib/lsb-v3/README b/bootscripts/contrib/lsb-v3/README new file mode 100644 index 000000000..47930627e --- /dev/null +++ b/bootscripts/contrib/lsb-v3/README @@ -0,0 +1,93 @@ +LSB-V3 README + +The scripts contianed in this directory are a complete rewrite of the +boot scripts from LFS-6.1 (updated for LFS-SVN about 2008-05-31). As is +usually the case with a rewrite, there have been many changes: + +AS OF 20080907, THESE SCRIPTS REQUIRE THE NEW initd-tools PACKAGE. +Dan Nicholson has recently released an initd-tools package that contain +LSB compliant install_initd and remove_initd programs written in C. +See the INSTALL file for installation instructions. + +LSB Version 3.2 Compliant Scripts - Immediately noticable are the LSB headers +in the rc.d scripts themselves. Each script contains a usable header to +allow for automating both the installation of, and determining proper +execution order for the startup scripts. These values can also be used +directly in parallel boot setups. Additionally, messages are displayed in +one single write to the screen, after exit status is determined, so that +they can be used in parallel setups. I am not sure if this was the only +barrier to auto language translation in the previous bootscripts. Further, +the messages are created from parts and only written to the screen in a +single command, so maybe no help at all WRT translated boot messages. + +Distribution Independent - this original goal for the LFS scripts has been +stretched even further by providing both a global rc config file that +contains (generally) static values, and a new rc.site config file to allow +customization of messages as diplayed to the end user during the boot +process. The format of messages printed to the screen is adjustable +here. As well, the other options that were available in the previous +versions of the lfs-bootscripts, and additional options as discussed below, +are configurable by the /etc/sysconfig/rc.site file. + +Single Environment - The rc script has been rewritten completely to allow a +single source of the boot configuration per runlevel change. This config +is inherited from rc's environment as opposed to being sourced everytime a +script is run. This results in a negledgable decrease in boot time, but +it is just better in principle. + +Boot Logging - The previous incarnation of the boot log didn't begin +recording events until the root filesystem was mounted read/write. This has +been corrected by providing a tempfs mount immediately after init hands +control to the rc script. The bootlog is generated on the tempfs and then +passed to the log file before login. Additionally, shutdown events are no +longer recorded in the bootlog. They were pretty much useless and it really +wasn't what I'd call a *boot* log. Boot logging is on by default and is +configurable in the /etc/sysconfig/rc.site file. + +Interactive Boot - This feature has been included by default, and is a +little more polished than my previous attempt. It does introduce a two +second delay in the boot process (so that you have time to press a button +to select interactive mode). This time value, and the option prompt itself, +is configurable in the /etc/sysconfig/rc.site file. + +Path changes - The base directory for the bootscripts is now /etc, not +/etc/rc.d. This is mostly to conform with mainstream distros, but other +boot methods do expect that /etc/init.d is the location of bootscripts. +Some distros provide a rc.d direcorty with symlinks to the rc*.d and init.d +directories, I have not done that. /etc is the location now, get your +flying fingers accustomed to it! Of course, this is still configurable in +/etc/sysconfig/rc.site, and if the change is too great, I'll put it back. +I've also removed the rcsysinit.d directory and replaced it with rcS.d. + +LSB Functions - The previous lfs-bootscripts sourced a functions file +located at /etc/rc.d/init.d/functions. This file has been renamed +$distro-functions to segregate it from the old. The name is configurable +by the rc.site configuration file. LSB defined functions are used where +possible, but the $distro-functions file provides, easy to use wraper +functions that start/stop/reload/force-reload/restart programs, evaluate +the numerical LSB return values, and print status messages to the screen. +Both LFS functions and LSB functions are documented directly in the scritps +located at /etc/init.d/$distro-functions and /lib/lsb/init-functions +respectively. + +Pretier - Yeah, I just couldn't handle all the grey text... By default, +successful boot messages are prefixed with a single green astrik character, +warning messages with two yellow astirks, and failures are prefixed with +three red astriks. This just provides a second 'quick glance' status when +watching the boot messages fly by. Again, the prefixes are configurable (or +completely removable) in the /etc/sysconfig/rc.site file. + +Complete Rewrite - Yep. That doesn't mean that code wasn't reused when +possible, so Alexander, Bryan, Dan, Gerard, Jeremy, Jim, Mathias, Matthew, +Nathan, and countless other contributors (whose names I've forgotten and will +promptly be reminded of (please)) are due credit for these as well. That +said, at very least, this is a complete reorganisation that I've tested to +the best of my ability, but there probably are some hidden bugs that will +come to lite when used more frequently. Please give me a shout _when_ you +find them. + +Thanks. + +-- DJ Lucas +dj@linuxfromscratch.org + diff --git a/bootscripts/contrib/lsb-v3/etc/inittab b/bootscripts/contrib/lsb-v3/etc/inittab new file mode 100644 index 000000000..c718c0584 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/etc/inittab @@ -0,0 +1,26 @@ +# Begin /etc/inittab + +id:3:initdefault: + +si::sysinit:/etc/init.d/rc S + +l0:0:wait:/etc/init.d/rc 0 +l1:S1:wait:/etc/init.d/rc 1 +l2:2:wait:/etc/init.d/rc 2 +l3:3:wait:/etc/init.d/rc 3 +l4:4:wait:/etc/init.d/rc 4 +l5:5:wait:/etc/init.d/rc 5 +l6:6:wait:/etc/init.d/rc 6 + +ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now + +su:S016:once:/sbin/sulogin + +1:2345:respawn:/sbin/agetty tty1 9600 +2:2345:respawn:/sbin/agetty tty2 9600 +3:2345:respawn:/sbin/agetty tty3 9600 +4:2345:respawn:/sbin/agetty tty4 9600 +5:2345:respawn:/sbin/agetty tty5 9600 +6:2345:respawn:/sbin/agetty tty6 9600 + +# End /etc/inittab diff --git a/bootscripts/contrib/lsb-v3/etc/lsb-config b/bootscripts/contrib/lsb-v3/etc/lsb-config new file mode 100644 index 000000000..856f8bf85 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/etc/lsb-config @@ -0,0 +1,8 @@ +# Begin /etc/lsb/lsb-config + +rcbase="/etc/init.d" +statedir="/etc/lsb/state" +distro="LFS" + +# End /etc/lsb/lsb-config + diff --git a/bootscripts/contrib/lsb-v3/init.d/checkfs b/bootscripts/contrib/lsb-v3/init.d/checkfs new file mode 100644 index 000000000..a7f125708 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/checkfs @@ -0,0 +1,105 @@ +#!/bin/sh +# Begin /etc/init.d/checkfs + +### BEGIN INIT INFO +# Provides: checkfs +# Required-Start: udev swap $time +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Checks local filesystems before mounting. +# Description: Checks local filesystmes before mounting. +# X-LFS-Default-Start: S30 +# X-LFS-Default-Stop: +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +case "${1}" in + start) + if [ -f /fastboot ]; then + echo "${INFO}/fastboot found!" + log_success_msg "Will not perform file system checks as requested." + exit 0 + fi + + mount -n -o remount,ro / >/dev/null + if [ ${?} != 0 ] + then + log_failure_msg "Mounting root file system in read-only mode" + echo "${FAILURE}FAILURE:\n" + echo -n "${FIALURE}Cannot check root filesystem because it " + echo "${FAILURE}could not be mounted" + echo "${FAILURE}in read-only mode.\n\n" + echo -n "${FAILURE}After you press Enter, this system will be " + echo "${FAILURE}halted and powered off.\n" + echo "${INFO}Press enter to continue...${NORMAL}" + read ENTER + /etc/rc.d/init.d/halt stop + fi + + if [ -f /forcefsck ] + then + echo "${INFO}/forcefsck found!" + log_success_msg "${INFO}Forcing file system checks as requested." + options="-f" + else + options="" + fi + + # Note: -a option used to be -p; but this fails e.g. + # on fsck.minix + fsck ${options} -a -A -C -T + error_value=${?} + + if [ "${error_value}" = 0 ] + then + log_success_msg "Checking file systems..." + elif [ "${error_value}" = 1 ] + then + log_warning_msg "Checking file systems..." + echo "${WARNING}WARNING:\n" + echo "${WARNING}File system errors were found and have been" + echo "${WARNING}corrected. You may want to double-check that" + echo "${WARNING}everything was fixed properly.${NORMAL}" + elif [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then + log_warning_msg "Checking file systems..." + echo "${WARNING}WARNING:\n" + echo "${WARNING}File system errors were found and have been been" + echo "${WARNING}corrected, but the nature of the errors require" + echo "${WARNING}this system to be rebooted.\n" + echo "After you press enter, this system will be rebooted.\n" + echo "${INFO}Press Enter to continue...${NORMAL}" + read ENTER + reboot -f + elif [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then + log_failure_msg "Checking file systems..." + echo "${FAILURE}FAILURE:\n" + echo "${FAILURE}File system errors were encountered that could" + echo "${FAILURE}not be fixed automatically. This system cannot" + echo "${FAILURE}continue to boot and will therefore be halted" + echo "${FAILURE}until those errors are fixed manually by a" + echo "${FAILURE}System Administrator.\n" + echo "${FAILURE}After you press Enter, this system will be" + echo "${FAILURE}halted and powered off.\n" + echo "${INFO}Press Enter to continue...${NORMAL}" + read ENTER + /etc/rc.d/init.d/halt stop + elif [ "${error_value}" -ge 16 ]; then + log_failure_msg "Checking file systems..." + echo "${FAILURE}FAILURE:\n" + echo "${FAILURE}Unexpected Failure running fsck. Exited with error" + echo "${FAILURE}code: ${error_value}.${NORMAL}" + exit ${error_value} + fi + ;; + *) + echo "Usage: ${0} {start}" + exit 1 + ;; +esac + +# End /etc/init.d/checkfs diff --git a/bootscripts/contrib/lsb-v3/init.d/cleanfs b/bootscripts/contrib/lsb-v3/init.d/cleanfs new file mode 100644 index 000000000..b702eefbd --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/cleanfs @@ -0,0 +1,113 @@ +#!/bin/sh +# Begin /etc/init.d/cleanfs + +### BEGIN INIT INFO +# Provides: cleanfs +# Required-Start: $local_fs +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Cleans temporary directories early in the boot process. +# Description: Cleans temporary directories /var/run, /var/lock, and +# /tmp. cleanfs also creates /var/run/utmp and any files +# defined in /etc/sysconfig/createfiles. +# X-LFS-Default-Start: S50 +# X-LFS-Default-Stop: +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +# Function to create files/directory on boot. +create_files() +{ + # Read in the configuration file. + exec 9>&0 < /etc/sysconfig/createfiles + while read name type perm usr grp dtype maj min junk + do + # Ignore comments and blank lines. + case "${name}" in + ""|\#*) continue ;; + esac + + # Ignore existing files. + if [ ! -e "${name}" ] + then + # Create stuff based on its type. + case "${type}" in + dir) + mkdir "${name}" + ;; + file) + :> "${name}" + ;; + dev) + case "${dtype}" in + char) + mknod "${name}" c ${maj} ${min} + ;; + block) + mknod "${name}" b ${maj} ${min} + ;; + pipe) + mknod "${name}" p + ;; + *) + echo -n "\n${WARNING}Unknown device type: ${dtype}" + echo "${NORMAL}" + ;; + esac + ;; + *) + echo "\n${WARNING}Unknown type: ${type}${NORMAL}" + continue + ;; + esac + + # Set up the permissions, too. + chown ${usr}:${grp} "${name}" + chmod ${perm} "${name}" + fi + done + exec 0>&9 9>&- +} + +case "${1}" in + start) + message="Cleaning file systems: " + + message="${message}${INFO} /tmp" + find /tmp -xdev -mindepth 1 ! -name lost+found \ + -delete || failed=1 + + message="${message} /var/lock" + find /var/lock -type f -exec rm -f {} \; || failed=1 + + message="${message} /var/run${NORMAL}" + find /var/run ! -type d ! -name utmp -exec rm -f {} \; || failed=1 + + > /var/run/utmp + if grep -q '^utmp:' /etc/group ; then + chmod 664 /var/run/utmp + chgrp utmp /var/run/utmp + fi + + (exit ${failed}) + evaluate_retval standard + + if egrep -qv '^(#|$)' /etc/sysconfig/createfiles 2>/dev/null + then + message="Creating files and directories..." + create_files + evaluate_retval standard + fi + ;; + *) + echo "Usage: ${0} {start}" + exit 1 + ;; +esac + +# End /etc/init.d/cleanfs diff --git a/bootscripts/contrib/lsb-v3/init.d/console b/bootscripts/contrib/lsb-v3/init.d/console new file mode 100644 index 000000000..071750125 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/console @@ -0,0 +1,111 @@ +#!/bin/sh +# Begin $rc_base/init.d/console + +### BEGIN INIT INFO +# Provides: console +# Required-Start: +# Should-Start: $local_fs +# Required-Stop: +# Should-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Sets up a localised console. +# Description: Sets up fonts and language settings for the user's +# local as defined by /etc/sysconfig/console. +# X-LFS-Default-Start: S70 +# X-LFS-Default-Stop: +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +MESSAGE="Setting up Linux console..." + +# Native English speakers probably don't have /etc/sysconfig/console at all +if [ -f /etc/sysconfig/console ] +then + . /etc/sysconfig/console +fi + +is_true() { + [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] +} + +failed=0 + +case "${1}" in + start) + # There should be no bogus failures below this line! + + # Figure out if a framebuffer console is used + [ -d /sys/class/graphics/fb0 ] && USE_FB=1 || USE_FB=0 + + # Figure out the command to set the console into the + # desired mode + is_true "${UNICODE}" && + MODE_COMMAND="echo -en '\033%G' && kbd_mode -u" || + MODE_COMMAND="echo -en '\033%@\033(K' && kbd_mode -a" + + # On framebuffer consoles, font has to be set for each vt in + # UTF-8 mode. This doesn't hurt in non-UTF-8 mode also. + + ! is_true "${USE_FB}" || [ -z "${FONT}" ] || + MODE_COMMAND="${MODE_COMMAND} && setfont ${FONT}" + + # Apply that command to all consoles mentioned in + # /etc/inittab. Important: in the UTF-8 mode this should + # happen before setfont, otherwise a kernel bug will + # show up and the unicode map of the font will not be + # used. + # FIXME: Fedora Core also initializes two spare consoles + # - do we want that? + + for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab | + grep -o '\btty[[:digit:]]*\b'` + do + openvt -f -w -c ${TTY#tty} -- \ + /bin/sh -c "${MODE_COMMAND}" || failed=1 + done + + # Set the font (if not already set above) and the keymap + is_true "${USE_FB}" || [ -z "${FONT}" ] || + setfont $FONT || + failed=1 + [ -z "${KEYMAP}" ] || + loadkeys ${KEYMAP} >/dev/null 2>&1 || + failed=1 + [ -z "${KEYMAP_CORRECTIONS}" ] || + loadkeys ${KEYMAP_CORRECTIONS} >/dev/null 2>&1 || + failed=1 + + # Linux kernel generates wrong bytes when composing + # in Unicode mode. That's why we disable dead keys in Unicode + # mode by default. If you need them, download and apply + # http://www.linuxfromscratch.org/~alexander/patches/linux-2.6.12.5-utf8_input-2.patch + # After patching, add "-m charset_of_your_keymap" to the FONT + # variable and set BROKEN_COMPOSE=false + # in /etc/sysconfig/console + + [ -n "$BROKEN_COMPOSE" ] || BROKEN_COMPOSE="$UNICODE" + ! is_true "$BROKEN_COMPOSE" || + echo "" | loadkeys -c >/dev/null 2>&1 || + failed=1 + + # Convert the keymap from $LEGACY_CHARSET to UTF-8 + [ -z "$LEGACY_CHARSET" ] || + dumpkeys -c "$LEGACY_CHARSET" | + loadkeys -u >/dev/null 2>&1 || + failed=1 + + # If any of the commands above failed, the trap at the + # top would set $failed to 1 + ( exit $failed ) + evaluate_retval standard + ;; + *) + echo $"Usage:" "${0} {start}" + exit 1 + ;; +esac + +# End $rc_base/init.d/console diff --git a/bootscripts/contrib/lsb-v3/init.d/halt b/bootscripts/contrib/lsb-v3/init.d/halt new file mode 100644 index 000000000..da933a127 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/halt @@ -0,0 +1,32 @@ +#!/bin/sh +# Begin $RC_BASE/init.d/halt + +### BEGIN INIT INFO +# Provides: halt +# Required-Start: +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: 0 +# Default-Stop: +# Short-Description: Halts the system. +# Description: Halts the System. +# X-LFS-Default-Start: +# X-LFS-Default-Stop: S99 +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +case "${1}" in + stop) + log_success_msg "Halting System..." + halt -d -f -i -p + ;; + *) + echo "Usage: {stop}" + exit 1 + ;; +esac + +# End /etc/init.d/halt diff --git a/bootscripts/contrib/lsb-v3/init.d/lfs-functions b/bootscripts/contrib/lsb-v3/init.d/lfs-functions new file mode 100644 index 000000000..afcd05de8 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/lfs-functions @@ -0,0 +1,214 @@ +# Begin /etc/init.d/lfs-functions +# Provides LFS specific functions for LSB style bootscripts + +################################# chkstat() ################################### +# chk_stat checks the status of a script by checking for both a binary file # +# to execute, and if set, a config file that may be needed for the program # +# to run successfully. The calling script will exit with a return value of 5 # +# if the binary does not exist, and a value of 6 if the needed config file is # +# unavailable as per LSB requirements. This function accepts zero, one, or # +# two string arguments. If arguments are passed, the first must be a bin # +# file. If a second argument is passed, it is interpreted as the config # +# file. Optionally, zero arguments can be passed if BIN_FILE, and optinally # +# CONFIG_FILE are set in the calling script. # +############################################################################### +chk_stat() +{ + if [ "${#}" -gt "0" -a "${#}" -lt "3" ]; then + BIN_FILE="${1}" + if [ -z "${2}" ]; then + CONFIG_FILE="" + else + CONFIG_FILE="${2}" + fi + elif [ -z "${BIN_FILE}" ]; then + echo "Usage: 'chk_stat BIN_FILE CONFIG_FILE'" + exit 1 # Generic Error + fi + + if [ ! -e "${BIN_FILE}" ]; then + log_failure_msg "${BIN_FILE} not installed" && + exit 5 + fi + + if [ ! -z "${CONFIG_FILE}" ]; then + if [ ! -e "${CONFIG_FILE}" ]; then + log_failure_msg "${CONFIG_FILE} does not exist" && + exit 6 + fi + fi +} + +################################ loadproc() ################################### +# loadproc is just a wraper to start_daemon for simple scripts, which will # +# require no arguments if $BIN_FILE is set. # +############################################################################### +loadproc() +{ + start_daemon "${BIN_FILE}" "${@}" +} + +################################ endproc() #################################### +# endproc, like loadproc, is just a wraper to killproc for simplicity and is # +# dependent on $BIN_FILE being set. # +############################################################################### +endproc() +{ + killproc "${BIN_FILE}" "${@}" +} + +############################### statusproc() ################################## +# statusproc checks the status of a particular binary and displays the # +# appropriate message (running or not running) and exits on the return value # +# of pidofproc. This function accepts two string arguments or zero arguments # +# if BIN_FILE and MESSAGE are set, else it requires the bin file as the first # +# argument, and the message as the second. Both must be enclosed in quotes. # +############################################################################### +statusproc() +{ + if [ "${#}" -gt "0" -a "${#}" -lt "3" ]; then + BIN_FILE="${1}" + MESSAGE="${2}" + elif [ -z "${BIN_FILE}" -o -z "${MESSAGE}" ]; then + echo "Usage: 'statusproc BIN_FILE MESSAGE'" + exit 1 # Generic Error + fi + + pidlist=`pidofproc "${BIN_FILE}"` + STATUS=$? + echo "Checking ${MESSAGE} status:" + if [ "${STATUS}" = "0" ]; then + log_success_msg "Running with PID(s) ${pidlist}" + else + log_warning_msg "Not running!" + fi + + return "${STATUS}" +} + +############################### reloadproc() ################################## +# reloadproc sends a HUP signal to the running program (relaod configuration) # +# It optionally, using the -force switch, checks the status of a particular # +# program and starts it if it is not already running. This function accepts # +# one optional switch (must be the first argument), and either two, or zero # +# string arguments. If BIN_FILE and MESSAGE are set in the script's # +# environment, it will use those values, else it requires the bin file as # +# the first argument (following -force if used), and the message as the # +# second. Both must be enclosed in quotes. If the force option is used, it # +# follows the LSB definition of 'force-reload' - the program is started if # +# not already running. # +############################################################################### +reloadproc() +{ + local force="0" + if [ "${#}" -gt "0" -a "${1}" = "-force" ]; then + force="1" + shift 1 + fi + + if [ "${#}" -gt "0" -a "${#}" -lt "3" ]; then + BIN_FILE="${1}" + MESSAGE="${2}" + elif [ -z "${BIN_FILE}" -o -z "${MESSAGE}" ]; then + echo "Usage: 'reloadproc BIN_FILE MESSAGE'" + exit 1 # Generic Error + fi + + + +} + +############################## evaluate_retval() ############################### +# evaluate_retval requires that you pass exactly one evaluation parameter of # +# (start, stop, other) based on the previous action that is being evaluated. # +# This function is intended for use with start_daemon and killproc to # +# interpret the LSB exit codes properly, othewise the checks only for success # +# or failure. # +################################################################################ +evaluate_retval() +{ + local error_value="${?}" + + # Handle LSB defined return values + case "${1}" in + + start) + case "${error_value}" in + 0) + log_success_msg "Starting ${MESSAGE} " + return "${error_value}" + ;; + 2) + log_failure_msg "Starting ${MESSAGE} Error: Invalid argument!" + return "${error_value}" + ;; + 5) + log_failure_msg "Starting ${MESSAGE} Error: Not available!" + return "${error_value}" + ;; + *) + log_failure_msg "Starting ${MESSAGE} Error: General failure!" + return "${error_value}" + ;; + esac + ;; + + stop) + case "${error_value}" in + 0) + log_success_msg "Stopping ${MESSAGE} " + return "${error_value}" + ;; + 2) + log_failure_msg "Stopping ${MESSAGE} Error: Invalid argument!" + return "${error_value}" + ;; + 5) + log_failure_msg "Stopping ${MESSAGE} Error: Not available!" + return "${error_value}" + ;; + 7) + log_warning_msg "Stopping ${MESSAGE} Warning: Not running!" + return "${error_value}" + ;; + *) + log_failure_msg "Stopping ${MESSAGE} Error: General failure!" + return "${error_value}" + ;; + esac + ;; + + force-reload) + message="Forcefully reloading " + ;; + + reload) + message="Reloading " + ;; + + restart) + message="Restarting " + ;; + + try-restart) + message="Trying restart " + ;; + + standard) + # $message or $MESSAGE must be set, but not both in order + # to use the 'standard' target. + ;; + esac + + # Print messages for the generic force-reload, reload, restart, + # and try-restart targets + if [ "${error_value}" = "0" ] + then + log_success_msg "${message}${MESSAGE} " + return "${error_value}" + else + log_failure_msg "${message}${MESSAGE} " + return "${error_value}" + fi +} + diff --git a/bootscripts/contrib/lsb-v3/init.d/localnet b/bootscripts/contrib/lsb-v3/init.d/localnet new file mode 100644 index 000000000..6dae531a0 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/localnet @@ -0,0 +1,84 @@ +#!/bin/sh +# Begin /etc/init.d/localnet + +### BEGIN INIT INFO +# Provides: localnet +# Required-Start: $local_fs +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Starts the local network. +# Description: Sets the hostname of the machine and starts the +# loopback interface. +# X-LFS-Default-Start: S80 +# X-LFS-Default-Stop: S90 +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions +. /etc/sysconfig/network + +case "${1}" in + start) + ip addr add 127.0.0.1/8 label lo dev lo + ip link set lo up + if [ "${?}" = "0" ] + then + log_success_msg "Bringing up the loopback interface..." + else + log_failure_msg "Bringing up the loopback interface..." + fi + + hostname "${HOSTNAME}" + if [ "${?}" = "0" ] + then + log_success_msg "Setting hostname to ${HOSTNAME}..." + else + log_failure_msg "Setting hostname to ${HOSTNAME}..." + fi + + ;; + + stop) + ip link set lo down + if [ "${?}" = "0" ] + then + log_success_msg "Bringing down the loopback interface..." + else + log_failure_msg "Bringing down the loopback interface..." + fi + + ;; + + restart) + ip link set lo down + retval="${?}" + sleep 1 + ip addr add 127.0.0.1/8 label lo dev lo + retval=$(( "${retval}" + "${?}" )) + ip link set lo up + retval=$(( "${retval}" + "${?}" )) + hostname "${HOSTNAME}" + retval=$(( "${retval}" + "${?}" )) + if [ "${retval}" = "0" ] + then + log_success_msg "Restarting local network..." + else + log_failure_msg "Restarting local network..." + fi + ;; + + status) + log_success_msg "Hostname is: ${INFO}$(hostname)${NORMAL}" + ip link show lo + ;; + + *) + echo "Usage: ${0} {start|stop|restart|status}" + exit 1 + ;; +esac + +# End /etc/init.d/localnet diff --git a/bootscripts/contrib/lsb-v3/init.d/modules b/bootscripts/contrib/lsb-v3/init.d/modules new file mode 100644 index 000000000..35cb9f2d4 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/modules @@ -0,0 +1,99 @@ +#!/bin/sh +# Begin /etc/init.d/modules + +### BEGIN INIT INFO +# Provides: modules +# Required-Start: mountkernfs sysctl +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Loads required modules. +# Description: Loads modules listed in /etc/sysconfig/modules. +# X-LFS-Default-Start: S10 +# X-LFS-Default-Stop: +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +# Assure that the kernel has module support. +[ -e /proc/ksyms -o -e /proc/modules ] || exit 0 + +case "${1}" in + start) + + # Exit if there's no modules file or there are no + # valid entries + [ -r /etc/sysconfig/modules ] && + egrep -qv '^($|#)' /etc/sysconfig/modules || + exit 0 + + # If proc is mounted, find the current kernel + # message level + if [ -f /proc/sys/kernel/printk ]; then + prev_msg=`cat /proc/sys/kernel/printk | \ + sed 'l 1' | sed -n '2~0p' | \ + sed 's/\\\//'` + else + prev_msg="6" + fi + + # Now set the message level to 1 so not to make too + # much noise when loading modules + dmesg -n 1 + + # Only try to load modules if the user has actually given us + # some modules to load. + if egrep -qv '^(#|$)' /etc/sysconfig/modules 2>/dev/null + then + + # Read in the configuration file. + exec 9>&0 < /etc/sysconfig/modules + + message="${INFO}Loading modules:" + + while read module args + do + # Ignore comments and blank lines. + case "${module}" in + ""|\#*) continue ;; + esac + + # Attempt to load the module, making + # sure to pass any arguments provided. + modprobe ${module} ${args} > /dev/null + + # Print the module name if successful, + # otherwise take note. + if [ ${?} -eq 0 ]; then + message="${message}${NORMAL} ${module}" + else + failedmod="${failedmod} ${module}" + fi + done + + # Print a message about successfully loaded + # modules on the correct line. + log_success_msg "${message}" + + # Print a failure message with a list of any + # modules that may have failed to load. + if [ "${failedmod}" ]; then + log_failure_msg "${FAILURE}Failed to load modules:${failedmod}" + fi + + exec 0>&9 9>&- + + fi + # Set the kernel message level back to it's previous value. + dmesg -n "${prev_msg}" + ;; + *) + echo "Usage: ${0} {start}" + exit 1 + ;; +esac + +# End /etc/init.d/modules diff --git a/bootscripts/contrib/lsb-v3/init.d/mountfs b/bootscripts/contrib/lsb-v3/init.d/mountfs new file mode 100644 index 000000000..eeaac95de --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/mountfs @@ -0,0 +1,60 @@ +#!/bin/sh +# Begin /etc/init.d/mountfs + +### BEGIN INIT INFO +# Provides: $local_fs +# Required-Start: udev checkfs +# Should-Start: +# Required-Stop: swap +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Mounts/unmounts local filesystems defined in /etc/fstab. +# Description: Remounts root filesystem read/write and mounts all +# remaining local filesystems defined in /etc/fstab on +# start. Remounts root filesystem read-only and unmounts +# remaining filesystems on stop. +# X-LFS-Default-Start: S40 +# X-LFS-Default-Stop: S70 +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +case "${1}" in + start) + message="Remounting root file system in read-write mode..." + mount -n -o remount,rw / >/dev/null + evaluate_retval standard + + # Remove fsck-related file system watermarks. + rm -f /fastboot /forcefsck + + message="Recording existing mounts in /etc/mtab..." + > /etc/mtab + mount -f / || failed=1 + mount -f /proc || failed=1 + mount -f /sys || failed=1 + (exit ${failed}) + evaluate_retval standard + + # This will mount all filesystems that do not have _netdev in + # their option list. _netdev denotes a network filesystem. + message="Mounting remaining file systems..." + mount -a -O no_netdev >/dev/null + evaluate_retval standard + ;; + + stop) + message="Unmounting all other currently mounted file systems..." + umount -a -d -r >/dev/null + evaluate_retval standard + ;; + + *) + echo "Usage: ${0} {start|stop}" + exit 1 + ;; +esac + +# End /etc/init.d/mountfs diff --git a/bootscripts/contrib/lsb-v3/init.d/mountkernfs b/bootscripts/contrib/lsb-v3/init.d/mountkernfs new file mode 100644 index 000000000..aa985b976 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/mountkernfs @@ -0,0 +1,45 @@ +#!/bin/sh +# Begin /etc/init.d/mountkernfs + +### BEGIN INIT INFO +# Provides: mountkernfs +# Required-Start: +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Mounts /sys and /proc virtual (kernel) filesystems. +# Description: Mounts /sys and /proc virtual (kernel) filesystems. +# X-LFS-Default-Start: S00 +# X-LFS-Default-Stop: +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +case "${1}" in + start) + message="Mounting kernel-based file systems:" + + if ! mountpoint /proc > /dev/null; then + message="${message}${INFO} /proc${NORMAL}" + mount -n /proc || failed=1 + fi + + if ! mountpoint /sys > /dev/null; then + message="${message}${INFO} /sys${NORMAL}" + mount -n /sys || failed=1 + fi + + (exit ${failed}) + evaluate_retval standard + ;; + + *) + echo "Usage: ${0} {start}" + exit 1 + ;; +esac + +# End /etc/init.d/mountkernfs diff --git a/bootscripts/contrib/lsb-v3/init.d/network b/bootscripts/contrib/lsb-v3/init.d/network new file mode 100644 index 000000000..22114a6d3 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/network @@ -0,0 +1,73 @@ +#!/bin/sh +# Begin /etc/init.d/network + +### BEGIN INIT INFO +# Provides: $network +# Required-Start: $local_fs swap localnet +# Should-Start: $syslog +# Required-Stop: $local_fs swap localnet +# Should-Stop: $syslog +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Starts and configures network interfaces. +# Description: Starts and configures network interfaces. +# X-LFS-Default-Start: S20 +# X-LFS-Default-Stop: K80 +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions +. /etc/sysconfig/network + +case "${1}" in + start) + # Start all network interfaces + for file in ${NETWORK_DEVICES}/ifconfig.* + do + interface=${file##*/ifconfig.} + + # skip if $file is * (because nothing was found) + if [ "${interface}" = "*" ] + then + continue + fi + IN_BOOT=1 ${NETWORK_DEVICES}/ifup ${interface} + done + ;; + + stop) + # Reverse list + FILES="" + for file in ${NETWORK_DEVICES}/ifconfig.* + do + FILES="${file} ${FILES}" + done + + # Stop all network interfaces + for file in ${FILES} + do + interface=${file##*/ifconfig.} + + # skip if $file is * (because nothing was found) + if [ "${interface}" = "*" ] + then + continue + fi + + IN_BOOT=1 ${NETWORK_DEVICES}/ifdown ${interface} + done + ;; + + restart) + ${0} stop + sleep 1 + ${0} start + ;; + + *) + echo "Usage: ${0} {start|stop|restart}" + exit 1 + ;; +esac + +# End /etc/init.d/network diff --git a/bootscripts/contrib/lsb-v3/init.d/rc b/bootscripts/contrib/lsb-v3/init.d/rc new file mode 100644 index 000000000..f3108d03d --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/rc @@ -0,0 +1,196 @@ +#!/bin/sh +# Begin $RC_BASE/init.d/rc + +# Get the configuration file +# All changes are to occur in the config file +. /etc/sysconfig/rc + +# These 3 signals will not cause our script to exit +trap "" INT QUIT TSTP + +# Simple sanity check - rc only takes one argument +if [ "${#}" -ne 1 ]; then + echo "Usage: ${0} <runlevel>" >&2 + exit 1 +fi + +# Do not use the RUNLEVEL and PREVLEVEL variables provided by init so +# that they can be modified and alternate directories (S) can +# be used without affecting init +runlevel="${1}" +prevlevel="${PREVLEVEL}" + +# Just in case - some flavors of init don't set PREVLEVEL to 'N' +if [ "${prevlevel}" = "" ]; then + prevlevel="N" +fi + +# Mount a tmpfs to store boot accounting information +if [ "${runlevel}" = "S" -a "${TEMPFS_MOUNT}" != "" ]; then + mount -n -t tmpfs tmpfs "${TEMPFS_MOUNT}" -o mode=600 +fi + +# Provide an interactive prompt (if requested) +if [ "${runlevel}" = "S" -a "${iprompt}" = "yes" ]; then + # ash does not accept t and n flags for read + ls -l /bin/sh | grep "/ash" + if [ "${?}" -eq "0" ]; then + # We are using ash + echo -e -n "${WARNING}WARNING: Either bash or zsh is required" + echo -e "${WARNING} for interactive startup.\n" + sleep 3 + else + echo "" + # dcol and icol are spaces before the message to center the + # message on screen. + dcol=$(( $(( ${COLUMNS} - ${dlen} )) / 2 )) + icol=$(( $(( ${COLUMNS} - ${ilen} )) / 2 )) + echo -e "\\033[${dcol}G${welcome_message}" + echo -e "\\033[${icol}G${i_message}${NORMAL}" + echo "" + read -t "${itime}" -n 1 interactive 2>&1 > /dev/null + if [ "${interactive}" = "I" -o "${interactive}" = "i" ]; then + echo -n -e "${CURS_UP}" + echo -e "${INFO}Interactive boot selected...${NORMAL}" + echo "interactive=I" > "${TEMPFS_MOUNT}/.interactive-start" + fi + fi +fi + + +# Verify that the directory exists +if [ ! -d "${RC_BASE}/rc${runlevel}.d" ]; then + echo -n -e "${WARNING}${RC_BASE}/rc${runlevel}.d does not exist." + echo -e "${NORMAL}" + exit 1 +fi + +# Source the interactive state file if it exists +if [ "${runlevel}" != "S" -a -f "${TEMPFS_MOUNT}/.interactive-start" ]; then + . "${TEMPFS_MOUNT}/.interactive-start" +fi + +# Prompt for interactive startup after completing S +if [ "${interactive}" = "I" -a "${runlevel}" != "S" -a \ + "${runlevel}" != "0" -a "${runlevel}" != "6" ]; then + echo -n -e "Proceed with interactive starup of runlevel " + echo -n -e "${INFO}${runlevel}${NORMAL}?" + echo -n -e "(${FAILURE}y${NORMAL})es/(${FAILURE}n${NORMAL})o " + read -n 1 go_on + echo "" + if [ "${go_on}" = "n" ]; then + # don't continue + exit 0 + fi +fi + + +# Attempt to stop all services started in the previous runlevel, +# that are stopped in this runlevel +if [ "${prevlevel}" != "N" ]; then + for link in $(ls -v ${RC_BASE}/rc${runlevel}.d/K* 2> /dev/null) + do + # Check to see if link is a valid symlink + if [ ! -f ${link} ]; then + echo -e "${WARNING}${link} is not a valid symlink." + continue # go on to the next K* link + fi + + # Check to see if link is executable + if [ ! -x ${link} ]; then + echo -e "${WARNING}${link} is not executable, skipping." + continue # go on to the next K* link + fi + + script=${link#$RC_BASE/rc$runlevel.d/K[0-9][0-9]} + prev_start=$RC_BASE/rc$prevlevel.d/S[0-9][0-9]$script + S_start=$RC_BASE/rcS.d/S[0-9][0-9]$script + + if [ "${runlevel}" != "0" -a "${runlevel}" != "6" ]; then + if [ ! -f ${prev_start} ] && [ ! -f ${S_start} ]; then + echo -e -n "${WARNING}WARNING:\n\n${link} can't be" + echo -e "${WARNING} executed because it was not" + echo -e -n "${WARNING} not started in the previous" + echo -e "${WARNING} runlevel (${prevlevel})." + echo -e "${NORMAL}" + continue + fi + fi + ${link} stop + error_value=${?} + + if [ "${error_value}" != "0" ]; then + print_error_msg + fi + done +fi + +# Start all functions in this runlevel if they weren't started in +# the previous runlevel +for link in $( ls -v ${RC_BASE}/rc${runlevel}.d/S* 2> /dev/null) +do + if [ "${prevlevel}" != "N" ]; then + script=${link#$RC_BASE/rc$runlevel.d/S[0-9][0-9]} + stop=$RC_BASE/rc$runlevel.d/K[0-9][0-9]$script + prev_start=$RC_BASE/rc$prevlevel.d/S[0-9][0-9]$script + + [ -f ${prev_start} ] && [ ! -f ${stop} ] && continue + fi + + # Check to see if link is a valid symlink + if [ ! -f ${link} ]; then + echo -e "${WARNING}${link} is not a valid symlink." + continue # go on to the next K* link + fi + + # Check to see if link is executable + if [ ! -x ${link} ]; then + echo -e "${WARNING}${link} is not executable, skipping." + continue # go on to the next K* link + fi + + case ${runlevel} in + 0|6) + ${link} stop + ;; + + *) + if [ "${interactive}" = "I" -o "${interactive}" = "i" ]; then + echo -e -n "${WARNING}Start ${INFO}${link} ${WARNING}?" + echo -e -n "${NORMAL}(${FAILURE}y${NORMAL})es/(${FAILURE}n${NORMAL})o " + read -n 1 startit 2>&1 > /dev/null + echo "" + if [ "${startit}" = "y" -o "${startit}" = "Y" ]; then + ${link} start + else + echo -e -n "${WARNING}Not starting ${INFO}${link}" + echo -e "${WARNING}.${NORMAL}\n" + fi + else + ${link} start + fi + ;; + esac + error_value=${?} + + if [ "${error_value}" -gt "1" ]; then + print_error_msg + fi +done + +# Strip apply time to the logs, strip out any color codes and dump +# the log to /var/log/boot.log +if [ -f "${TEMPFS_MOUNT}/.bootlog" -a "${runlevel}" != "S" ]; then + # Remove any color codes from the temp log file + sed -i 's@\\033\[[0-9];[0-9][0-9]m@@g' "${TEMPFS_MOUNT}/.bootlog" + #Fix the time and hostname + BTIMESPEC=$(echo `date +"%b %d %T"` `hostname`) + sed -i "s@^bootlog:@${BTIMESPEC} bootlog:@" "${TEMPFS_MOUNT}/.bootlog" + # Don't try and write in 0 and 6, this is a 'boot' log + if [ "${runlevel}" != "0" -a "${runlevel}" != "6" ]; then + cat "${TEMPFS_MOUNT}/.bootlog" >> /var/log/boot.log + rm -f "${TEMPFS_MOUNT}/.bootlog" + fi +fi + +# End $RC_BASE/init.d/rc diff --git a/bootscripts/contrib/lsb-v3/init.d/reboot b/bootscripts/contrib/lsb-v3/init.d/reboot new file mode 100644 index 000000000..0de939aca --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/reboot @@ -0,0 +1,34 @@ +#!/bin/sh +# Begin /etc/init.d/reboot + +### BEGIN INIT INFO +# Provides: reboot +# Required-Start: +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: 6 +# Default-Stop: +# Short-Description: Reboots the system. +# Description: Reboots the System. +# X-LFS-Default-Start: +# X-LFS-Default-Stop: S99 +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +case "${1}" in + stop) + log_success_msg "Restarting system..." + reboot -d -f -i + ;; + + *) + echo "Usage: ${0} {stop}" + exit 1 + ;; + +esac + +# End /etc/init.d/reboot diff --git a/bootscripts/contrib/lsb-v3/init.d/sendsignals b/bootscripts/contrib/lsb-v3/init.d/sendsignals new file mode 100644 index 000000000..e48e19fb7 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/sendsignals @@ -0,0 +1,49 @@ +#!/bin/sh +# Begin /etc/init.d/sendsignals + +### BEGIN INIT INFO +# Provides: sendsignals +# Required-Start: +# Should-Start: +# Required-Stop: $local_fs swap localnet +# Should-Stop: +# Default-Start: +# Default-Stop: 0 6 +# Short-Description: Attempts to kill remaining processes. +# Description: Attempts to kill remaining processes. +# X-LFS-Default-Start: +# X-LFS-Default-Stop: S60 +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +case "${1}" in + stop) + message="Sending all processes the TERM signal..." + killall5 -15 + error_value=${?} + + sleep 3 + + (exit ${error_value}) + evaluate_retval standard + + message="Sending all processes the KILL signal..." + killall5 -9 + error_value=${?} + + sleep 3 + + (exit ${error_value}) + evaluate_retval standard + ;; + + *) + echo "Usage: ${0} {stop}" + exit 1 + ;; + +esac + +# End /etc/init.d/sendsignals diff --git a/bootscripts/contrib/lsb-v3/init.d/setclock b/bootscripts/contrib/lsb-v3/init.d/setclock new file mode 100644 index 000000000..41da77b45 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/setclock @@ -0,0 +1,61 @@ +#!/bin/sh +# Begin /etc/init.d/setclock + +### BEGIN INIT INFO +# Provides: $time +# Required-Start: +# Should-Start: modules +# Required-Stop: +# Should-Stop: $syslog +# Default-Start: S +# Default-Stop: +# Short-Description: Stores and restores time from the hardware clock +# Description: On boot, system time is obtained from hwclock. The +# hardware clock can also be set on shutdown. +# X-LFS-Default-Start: S25 +# X-LFS-Default-Stop: K46 +# X-LFS-Provided-By: LFS BLFS +### END INIT INFO + +. /lib/lsb/init-functions + +BIN_FILE="/sbin/hwclock" +CONFIGFILE="/etc/sysconfig/clock" + +chk_stat + +. "${CONFIGFILE}" + +CLOCKPARAMS= + +case "${UTC}" in + yes|true|1) + CLOCKPARAMS="${CLOCKPARAMS} --utc" + ;; + + no|false|0) + CLOCKPARAMS="${CLOCKPARAMS} --localtime" + ;; + +esac + +case ${1} in + start) + message="Setting system clock..." + ${BIN_FILE} --hctosys ${CLOCKPARAMS} >/dev/null + evaluate_retval standard + ;; + + stop) + message="Setting hardware clock..." + ${BIN_FILE} --systohc ${CLOCKPARAMS} >/dev/null + evaluate_retval standard + ;; + + *) + echo "Usage: ${0} {start|stop}" + ;; + +esac + +# End /etc/init.d/setclock diff --git a/bootscripts/contrib/lsb-v3/init.d/swap b/bootscripts/contrib/lsb-v3/init.d/swap new file mode 100644 index 000000000..d62702848 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/swap @@ -0,0 +1,57 @@ +#!/bin/sh +# Begin /etc/init.d/swap + +### BEGIN INIT INFO +# Provides: swap +# Required-Start: +# Should-Start: modules +# Required-Stop: localnet +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Mounts and unmounts swap partitions. +# Description: Mounts and unmounts swap partitions defined in +# /etc/fstab. +# X-LFS-Default-Start: S20 +# X-LFS-Default-Stop: S80 +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +case "${1}" in + start) + message="Activating all swap files/partitions..." + swapon -a + evaluate_retval standard + ;; + + stop) + message="Deactivating all swap files/partitions..." + swapoff -a + evaluate_retval standard + ;; + + restart) + swapoff -a + error_level="${?}" + sleep 1 + swapon -a + error_level="$(( ${error_level} + ${?} ))" + (exit "${error_level}") + evaluate_retval restart + ;; + + status) + log_success_msg "Retrieving swap status..." + echo + swapon -s + ;; + + *) + echo "Usage: ${0} {start|stop|restart|status}" + exit 1 + ;; +esac + +# End /etc/init.d/swap diff --git a/bootscripts/contrib/lsb-v3/init.d/sysctl b/bootscripts/contrib/lsb-v3/init.d/sysctl new file mode 100644 index 000000000..cbae2408b --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/sysctl @@ -0,0 +1,41 @@ +#!/bin/sh +# Begin /etc/init.d/sysctl + +### BEGIN INIT INFO +# Provides: sysctl +# Required-Start: mountkernfs +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Makes changes to the proc filesystem +# Description: Makes changes to the proc filesystem as defined in +# /etc/sysctl.conf. See 'man sysctl(8)'. +# X-LFS-Default-Start: S05 +# X-LFS-Default-Stop: +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +case "${1}" in + start) + if [ -f "/etc/sysctl.conf" ]; then + message="Setting kernel runtime parameters..." + sysctl -q -p + evaluate_retval standard + fi + ;; + + status) + sysctl -a + ;; + + *) + echo "Usage: ${0} {start|status}" + exit 1 + ;; +esac + +# End /etc/init.d/sysctl diff --git a/bootscripts/contrib/lsb-v3/init.d/sysklogd b/bootscripts/contrib/lsb-v3/init.d/sysklogd new file mode 100644 index 000000000..ac73c76ce --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/sysklogd @@ -0,0 +1,71 @@ +#!/bin/sh +# Begin /etc/init.d/sysklogd + +### BEGIN INIT INFO +# Provides: $syslog +# Required-Start: localnet +# Should-Start: +# Required-Stop: $local_fs sendsignals +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Starts kernel and system log daemons. +# Description: Starts kernel and system log daemons. +# /etc/fstab. +# X-LFS-Default-Start: S10 +# X-LFS-Default-Stop: K90 +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +case "${1}" in + start) + MESSAGE="system log daemon..." + start_daemon /usr/sbin/syslogd -m 0 + evaluate_retval start + + MESSAGE="kernel log daemon..." + start_daemon /usr/sbin/klogd + evaluate_retval start + ;; + + stop) + MESSAGE="kernel log daemon..." + killproc /usr/sbin/klogd + evaluate_retval stop + + MESSAGE="system log daemon..." + killproc /usr/sbin/syslogd + evaluate_retval stop + ;; + + force-reload) + MESSAGE="system log daemon config file..." + killproc -HUP `/usr/sbin/syslogd` + evaluate_retval reload + ;; + + restart) + MESSAGE="system and kernel log deamons..." + failed=0 + killproc /usr/sbin/klogd || failed=1 + killproc /usr/sbin/syslogd || failed=1 + start_daemon /usr/sbin/syslogd -m 0 || failed=1 + start_daemon /usr/sbin/klogd || failed=1 + (exit ${failed}) + evaluate_retval restart + ;; + + status) + statusproc /usr/sbin/syslogd + statusproc /usr/sbin/klogd + ;; + + *) + echo "Usage: ${0} {start|stop|force-reload|restart|status}" + exit 1 + ;; +esac + +# End /etc/init.d/sysklogd diff --git a/bootscripts/contrib/lsb-v3/init.d/template b/bootscripts/contrib/lsb-v3/init.d/template new file mode 100644 index 000000000..24a9e7f93 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/template @@ -0,0 +1,92 @@ +#!/bin/sh +# Begin /etc/init.d/template + +### BEGIN INIT INFO +# Provides: template +# Required-Start: +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: +# Default-Stop: +# Short-Description: +# Description: +# X-LFS-Default-Start: +# X-LFS-Default-Stop: +# X-LFS-Provided-By: +### END INIT INFO + +# Source the LSB init-functions, ours are pulled in from there. +. /lib/lsb/init-functions + +# These are optional, but required for chk_stat. They will be used in +# the rest of the functions if defined, else you must provide a program +# name to control, and a message ('Starting Template Service...' +# or 'Stoping Template Service...') to evauate_retval. See the +# documentaion in the lfs-fucntions file for more information. +MESSAGE="Template Service" +BIN_FILE="/some/path/to/template" +CONFIGFILE="/etc/sysconfig/template.conf" + +# check that $BIN_FILE exists and is executable, and $CONFIGFILE exists. +chk_stat + +# LSB Defined functions require that at least $BIN_FILE be passed to them, +# where as lfs-functions will use the $BIN_FILE environment variable. +# loadproc() and endproc() are just wrappers that pass everything on to +# the LSB defined functions. + +case "${1}" in + start) + #start_daemon "${BIN_FILE}" -arg1 -arg2 #... or: + loadproc -arg1 -arg2 -arg3 #... + evaluate_retval start + ;; + + stop) + #killproc -TERM "${BIN_FILE}" or: + endproc + evaluate_retval stop + ;; + + force-reload) + reloadproc -force + evaluate_retval force-reload + ;; + + restart) + $0 stop + $0 start + ;; + + status) + statusproc + ;; + +# reload and try-restart are optional per LSB requirements + reload) + reloadproc + evaluate_retval reload + ;; + + try-restart) + # Since this is optional there is no lfs-function for this one... + # might be at a later time if used enough, but I doubt it usefullness. + pidofproc "${BIN_FILE}" > /dev/null + if [ "${?}" -ne "0" ]; then + MESSAGE="${MESSAGE}: Not Running" + else + $0 stop + $0 start + exit 0 + fi + evaluate_retval try-restart + ;; + + *) + echo "Usage: ${0} {start|stop|{force-}reload|{try-}restart|status}" + exit 1 + ;; +esac + +# End /etc/init.d/template diff --git a/bootscripts/contrib/lsb-v3/init.d/udev b/bootscripts/contrib/lsb-v3/init.d/udev new file mode 100644 index 000000000..3e95f9cb3 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/udev @@ -0,0 +1,81 @@ +#!/bin/sh +# Begin $rc_base/init.d/udev + +### BEGIN INIT INFO +# Provides: udev +# Required-Start: +# Should-Start: modules +# Required-Stop: +# Should-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Populated /dev with device nodes. +# Description: Mounts a tempfs on /dev and starts the udevd daemon. +# Device nodes are created as defined by udev. +# X-LFS-Default-Start: S15 +# X-LFS-Default-Stop: +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +MESSAGE="Populating /dev with device nodes..." + +case "${1}" in + start) + if ! grep -q '[[:space:]]sysfs' /proc/mounts; then + echo_failure + boot_mesg -n "FAILURE:\n\nUnable to create" ${FAILURE} + boot_mesg -n " devices without a SysFS filesystem" + boot_mesg -n "\n\nAfter you press Enter, this system" + boot_mesg -n " will be halted and powered off." + boot_mesg -n "\n\nPress Enter to continue..." ${INFO} + boot_mesg "" ${NORMAL} + read ENTER + /etc/rc.d/init.d/halt stop + fi + + # Mount a temporary file system over /dev, so that any devices + # made or removed during this boot don't affect the next one. + # The reason we don't write to mtab is because we don't ever + # want /dev to be unavailable (such as by `umount -a'). + mount -n -t tmpfs tmpfs /dev -o mode=755 + if [ ${?} != 0 ]; then + echo_failure + boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE} + boot_mesg -n " onto /dev, this system will be halted." + boot_mesg -n "\n\nAfter you press Enter, this system" + boot_mesg -n " will be halted and powered off." + boot_mesg -n "\n\nPress Enter to continue..." ${INFO} + boot_mesg "" ${NORMAL} + read ENTER + /etc/rc.d/init.d/halt stop + fi + + # Udev handles uevents itself, so we don't need to have + # the kernel call out to any binary in response to them + echo > /proc/sys/kernel/hotplug + + # Copy static device nodes to /dev + cp -a /lib/udev/devices/* /dev + + # Start the udev daemon to continually watch for, and act on, + # uevents + /sbin/udevd --daemon + + # Now traverse /sys in order to "coldplug" devices that have + # already been discovered + /sbin/udevadm trigger + + # Now wait for udevd to process the uevents we triggered + /sbin/udevadm settle + evaluate_retval standard + ;; + + *) + echo "Usage ${0} {start}" + exit 1 + ;; +esac + +# End $rc_base/init.d/udev diff --git a/bootscripts/contrib/lsb-v3/init.d/udev_retry b/bootscripts/contrib/lsb-v3/init.d/udev_retry new file mode 100644 index 000000000..df70132eb --- /dev/null +++ b/bootscripts/contrib/lsb-v3/init.d/udev_retry @@ -0,0 +1,51 @@ +#!/bin/sh +# Begin $rc_base/init.d/udev_retry + +### BEGIN INIT INFO +# Provides: udev_retry +# Required-Start: udev +# Should-Start: $local_fs +# Required-Stop: +# Should-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Replays failed uevents and creates additonal devices. +# Description: Replays any failed uevents that were skipped due to +# slow hardware initialization, and creates those needed +# device nodes +# X-LFS-Default-Start: S45 +# X-LFS-Default-Stop: +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +MESSAGE="Retrying failed uevents, if any..." + +case "${1}" in + start) + + # From Debian: "copy the rules generated before / was mounted + # read-write": + for file in /dev/.udev/tmp-rules--*; do + dest=${file##*tmp-rules--} + [ "$dest" = '*' ] && break + cat $file >> /etc/udev/rules.d/$dest + rm -f $file + done + + # Re-trigger the failed uevents in hope they will succeed now + /sbin/udevadm trigger --retry-failed + + # Now wait for udevd to process the uevents we triggered + /sbin/udevadm settle + evaluate_retval standard + ;; + + *) + echo "Usage ${0} {start}" + exit 1 + ;; +esac + +# End $rc_base/init.d/udev_retry diff --git a/bootscripts/contrib/lsb-v3/lsb/init-functions b/bootscripts/contrib/lsb-v3/lsb/init-functions new file mode 100644 index 000000000..b37eeb32f --- /dev/null +++ b/bootscripts/contrib/lsb-v3/lsb/init-functions @@ -0,0 +1,577 @@ +# Begin /lib/lsb/init-funtions + +# Provides initialization funtions as defined by the Linux Standard Base +# specification, version 3.1.0 + +# Source rc configuration if not inherited from the environment +if [ "${RC_BASE}" = "" ]; then + . /etc/sysconfig/rc +fi + +# Source the distro functions file +if [ "${DISTRO_MINI}" != "" ]; then + . "${RC_BASE}/init.d/${DISTRO_MINI}-functions" +fi + +################################################################################ +# start_daemon() # +# Usage: start_daemon [-f] [-n nicelevel] [-p pidfile] pathname [args...] # +# # +# Purpose: This runs the specified program as a daemon # +# # +# Inputs: -f: (force) run the program even if it is already running. # +# -n nicelevel: specify a nice level. See 'man nice(1)'. # +# -p pidfile: use the specified file to determine PIDs. # +# pathname: the complete path to the specified program # +# args: additional arguments passed to the program (pathname) # +# # +# Return values (as defined by LSB exit codes): # +# 0 - program is running or service is OK # +# 1 - generic or unspecified error # +# 2 - invalid or excessive argument(s) # +# 5 - program is not installed # +################################################################################ +start_daemon() +{ + local force="" + local nice="0" + local pidfile="" + local pidlist="" + local retval="" + + # Process arguments + while true + do + case "${1}" in + + -f) + force="1" + shift 1 + ;; + + -n) + nice="${2}" + shift 2 + ;; + + -p) + pidfile="${2}" + shift 2 + ;; + + -*) + return 2 + ;; + + *) + program="${1}" + break + ;; + esac + done + + # Check for a valid program + if [ ! -e "${program}" ] + then + return 5 + fi + + # Execute + if [ -z "${force}" ] + then + if [ -z "${pidfile}" ] + then + # determine the pid by discovery + pidlist=`pidofproc "${1}"` + retval="${?}" + else + # The PID file contains the needed PIDs + # Note that by LSB requirement, the path must be given to pidofproc, + # however, it is not used by the current implementation or standard. + pidlist=`pidofproc -p "${pidfile}" "${1}"` + retval="${?}" + fi + + # return a value ONLY + # It is the init script's (or distribution's functions) responsibilty + # to log messages! + case "${retval}" in + + 0) + # program is already running correctly, this is a + # succesful start. + return 0 + ;; + + 1) + # program is not running, but an invalid pid file exists + # remove the pid file and continue + rm -f "${pidfile}" + ;; + + 3) + # program is not running and no pidfile exists + # do nothing here, let start_deamon continue. + ;; + + *) + # Others as returned by status values shall not be interpreted + # and returned as an unspecified error. + return 1 + ;; + esac + fi + + # do the start! + nice -n "${nice}" "${@}" + +} + +################################################################################ +# killproc() # +# Usage: killproc [-p pidfile] pathname [signal] # +# # +# Purpose: Send control signals to running processes # +# # +# Inputs: -p pidfile, uses the specified pidfile # +# pathname, pathname to the specified program # +# signal, send this signal to pathname # +# # +# Return values (as defined by LSB exit codes): # +# 0 - program (pathname) has stopped/is already stopped or a # +# running program has been sent specified signal and stopped # +# successfully # +# 1 - generic or unspecified error # +# 2 - invalid or excessive argument(s) # +# 5 - program is not installed # +# 7 - program is not running and a signal was supplied # +################################################################################ +killproc() +{ + local pidfile + local program + local prefix + local progname + local signal="-TERM" + local fallback="-KILL" + local nosig + local pidlist + local retval + local pid + local delay="30" + local piddead + local dtime + + # Process arguments + while true + do + case "${1}" in + + -p) + pidfile="${2}" + shift 2 + ;; + + *) + program="${1}" + if [ -n "${2}" ] + then + signal="${2}" + fallback="" + else + nosig=1 + fi + + # error on additional arguments + if [ -n "${3}" ] + then + return 2 + else + break + fi + ;; + esac + done + + # Check for a valid program + if [ ! -e "${program}" ] + then + return 5 + fi + + # Check for a valid signal + check_signal "${signal}" + if [ "${?}" != "0" ] + then + return 2 + fi + + # Get a list of pids + if [ -z "${pidfile}" ] + then + # determine the pid by discovery + pidlist=`pidofproc "${1}"` + retval="${?}" + else + # The PID file contains the needed PIDs + # Note that by LSB requirement, the path must be given to pidofproc, + # however, it is not used by the current implementation or standard. + pidlist=`pidofproc -p "${pidfile}" "${1}"` + retval="${?}" + fi + + # return a value ONLY + # It is the init script's (or distribution's functions) responsibilty + # to log messages! + case "${retval}" in + + 0) + # program is running correctly + # do nothing here, let killproc continue. + ;; + + 1) + # program is not running, but an invalid pid file exists + # remove the pid file. + rm -f "${pidfile}" + # this is only a success if no signal was passed. + if [ -n "${nosig}" ] + then + return 0 + else + return 7 + fi + ;; + + 3) + # program is not running and no pidfile exists + # this is only a success if no signal was passed. + if [ -n "${nosig}" ] + then + return 0 + else + return 7 + fi + ;; + + *) + # Others as returned by status values shall not be interpreted + # and returned as an unspecified error. + return 1 + ;; + esac + + # perform different actions for exit signals and control signals + check_sig_type "${signal}" + if [ "${?}" -eq "0" ] # signal is used to terminate the program + then + # account for empty pidlist (pid file still exists and nosignal was given) + if [ "${pidlist}" != "" ]; then + #kill the list of pids + for pid in ${pidlist} + do + kill -0 "${pid}" 2> /dev/null + if [ "${?}" -ne "0" ]; then + # process is dead, continue to next and assume all is well + continue + else + kill "${signal}" "${pid}" 2> /dev/null + # Wait up to ${delay}/10 seconds to for "${pid}" to + # terminate in 10ths of a second + while [ "${delay}" != "0" ] + do + kill -0 "${pid}" 2> /dev/null || piddead="1" + if [ "${piddead}" = "1" ] + then + break + fi + sleep 0.1 + delay="$(( ${delay} - 1 ))" + done + # If a fallback is set, and program is still running, then + # use the fallback + if [ -n "${fallback}" -a "${piddead}" != "1" ] + then + kill "${fallback}" "${pid}" 2> /dev/null + sleep 1 + # Check again, and fail if still running + kill -0 "${pid}" 2> /dev/null && return 1 + else + # just check one last time and if still alive, fail + sleep 1 + kill -0 "${pid}" 2> /dev/null && return 1 + fi + fi + done + fi + + # Check for and remove stale PID files. + if [ -z "${pidfile}" ] + then + #find the basename of $program + prefix=`echo "${program}" | sed 's/[^/]*$//'` + progname=`echo "${program}" | sed "s@${prefix}@@"` + if [ -e "/var/run/${progname}.pid" ] + then + rm -f "/var/run/${progname}.pid" 2> /dev/null + fi + else + if [ -e "${pidfile}" ] + then + rm -f "${pidfile}" 2> /dev/null + fi + fi + + # For signals that do not expect a program to exit, simply + # let kill do it's job, and evaluate kills return for value + else # check_sig_type - signal is not used to terminate program + for pid in ${pidlist} + do + kill "${signal}" "${pid}" + if [ "${?}" -ne "0" ]; then + return 1 + fi + done + fi +} + +################################################################################ +# pidofproc() # +# Usage: pidofproc [-p pidfile] pathname # +# # +# Purpose: This function returns one or more pid(s) for a particular daemon # +# # +# Inputs: -p pidfile, use the specified pidfile instead of pidof # +# pathname, path to the specified program # +# # +# Return values (as defined by LSB status codes): # +# 0 - Success (PIDs to stdout) # +# 1 - Program is dead, PID file still exists (remaining PIDs output) # +# 3 - Program is not running (no output) # +################################################################################ +pidofproc() +{ + +local pidfile +local program +local prefix +local progname +local pidlist +local lpids +local exitstatus="0" + + # Process arguments + while true + do + case "${1}" in + + -p) + pidfile="${2}" + shift 2 + ;; + + *) + program="${1}" + if [ -n "${2}" ] + then + # Too many arguments + # Since this is status, return unknown + return 4 + else + break + fi + ;; + esac + done + + # If a PID file is not specified, try and find one. + if [ -z "${pidfile}" ] + then + # get the program's basename + prefix=`echo "${program}" | sed 's/[^/]*$//'` + progname=`echo "${program}" | sed "s@${prefix}@@"` + # if a PID file exists with that name, assume that is it. + if [ -e "/var/run/${progname}.pid" ] + then + pidfile="/var/run/${progname}.pid" + fi + fi + + # if a PID file is set and exists, use it. + if [ -n "${pidfile}" -a -e "${pidfile}" ] + then + # use the value in the first line of the pidfile + pidlist=`/bin/head -n1 "${pidfile}"` + # This can optionally be written as 'sed 1q' to repalce 'head -n1' + # should LFS move /bin/head to /usr/bin/head + else + # use pidof + pidlist=`pidof "${program}"` + fi + + # Figure out if all listed PIDs are running. + for pid in ${pidlist} + do + kill -0 ${pid} 2> /dev/null + if [ "${?}" = "0" ]; then + lpids="${pids}${pid} " + else + exitstatus="1" + fi + done + + if [ -z "${lpids}" -a ! -f "${pidfile}" ]; then + return 3 + else + echo "${lpids}" + return "${exitstatus}" + fi +} +################################################################################ +# log_success_msg() # +# Usage: log_success_msg [$MESSAGE | "message"] # +# # +# Purpose: Print a successful status message to the screen and optionally # +# a boot log file. # +# # +# Inputs: accepts one string value, either a quoted string or optionally # +# the value of $MESSAGE if set in the running environment. # +# # +# Return values: Not used # +################################################################################ +log_success_msg() +{ + echo -n -e "${PREFIX_SUCCESS}${@}" + echo -e "${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}" + if [ "${BOOTLOG_ENAB}" = "yes" ]; then + if [ $( hostname ) = "(none)" ]; then + BTTIMESPEC="" + else + BTTIMESPEC="$(echo `date -u +"%b %d %T"` `hostname`) " + fi + echo "${BTTIMESPEC}bootlog: ${@} Successful" >> "${TEMPFS_MOUNT}/.bootlog" + fi + return 0 +} + +################################################################################ +# log_failure_msg() # +# Usage: log_failure_msg [$MESSAGE | "message"] # +# # +# Purpose: Print a failure status message to the screen and optionally # +# a boot log file. # +# # +# Inputs: accepts one string value, either a quoted string or optionally # +# the value of $MESSAGE if set in the running environment. # +# # +# Return values: Not used # +################################################################################ +log_failure_msg() +{ + echo -n -e "${PREFIX_FAILURE}${@}" + echo -e "${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}" + if [ "${BOOTLOG_ENAB}" = "yes" ]; then + if [ $( hostname ) = "(none)" ]; then + BTTIMESPEC="" + else + BTTIMESPEC="$(echo `date -u +"%b %d %T"` `hostname`) " + fi + echo "${BTTIMESPEC}bootlog: ${@} Failed!" >> "${TEMPFS_MOUNT}/.bootlog" + fi + return 0 +} + +################################################################################ +# log_warning_msg() # +# Usage: log_warning_msg [$MESSAGE | "message"] # +# # +# Purpose: Print a warning status message to the screen and optionally # +# a boot log file. # +# # +# Inputs: accepts one string value, either a quoted string or optionally # +# the value of $MESSAGE if set in the running environment. # +# # +# Return values: Not used # +################################################################################ +log_warning_msg() +{ + echo -n -e "${PREFIX_WARNING}${@}" + echo -e "${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}" + if [ "${BOOTLOG_ENAB}" = "yes" ]; then + if [ $( hostname ) = "(none)" ]; then + BTTIMESPEC="" + else + BTTIMESPEC="$(echo `date -u +"%b %d %T"` `hostname`) " + fi + echo "${BTTIMESPEC}bootlog: ${@} Warning" >> "${TEMPFS_MOUNT}/.bootlog" + fi + return 0 +} + +################################################################################ +# check_signal() # +# Usage: check_signal [ -{signal} | {signal} ] # +# # +# Purpose: Check for a valid signal. This is not defined by any LSB draft, # +# however, it is required to check the signals to determine if the # +# signals chosen are invalid arguments to the other functions. # +# # +# Inputs: accepts a single string value in the form or -{signal} or {signal} # +# # +# Return values: # +# 0 - Success (signal is valid # +# 1 - Signal is not valid # +################################################################################ +check_signal() +{ + local valsig + + # Add error handling for invalid signals + valsig="-ALRM -HUP -INT -KILL -PIPE -POLL -PROF -TERM -USR1 -USR2" + valsig="${valsig} -VTALRM -STKFLT -PWR -WINCH -CHLD -URG -TSTP -TTIN" + valsig="${valsig} -TTOU -STOP -CONT -ABRT -FPE -ILL -QUIT -SEGV -TRAP" + valsig="${valsig} -SYS -EMT -BUS -XCPU -XFSZ -0 -1 -2 -3 -4 -5 -6 -8 -9" + valsig="${valsig} -11 -13 -14 -15" + + echo "${valsig}" | grep -- " ${1} " > /dev/null + if [ "${?}" = "0" ] + then + return 0 + else + return 1 + fi +} + + +################################################################################ +# check_sig_type() # +# Usage: check_signal [ -{signal} | {signal} ] # +# # +# Purpose: Check if signal is a program termination signal or a control signal # +# This is not defined by any LSB draft, however, it is required to # +# check the signals to determine if they are intended to end a # +# program or simply to control it. # +# # +# Inputs: accepts a single string value in the form or -{signal} or {signal} # +# # +# Return values: # +# 0 - Signal is used for program termination # +# 1 - Signal is used for program control # +################################################################################ +check_sig_type() +{ + local valsig + + # The list of termination signals (limited to generally used items) + valsig="-ALRM -INT -KILL -TERM -PWR -STOP -ABRT -QUIT -2 -3 -6 -9 -14 -15" + + echo "${valsig}" | grep -- " ${1} " > /dev/null + if [ "${?}" = "0" ] + then + return 0 + else + return 1 + fi +} + +# End /lib/lsb/init-functions diff --git a/bootscripts/contrib/lsb-v3/lsb/manage-functions b/bootscripts/contrib/lsb-v3/lsb/manage-functions new file mode 100644 index 000000000..7c7a8f495 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/lsb/manage-functions @@ -0,0 +1,306 @@ +#!/bin/bash +# Begin /lib/lsb/manage-functions + +# /lib/lsb/manage-functions contains the functions used by +# /lib/lsb/install_initd and /lib/lsb/remove_initd as well as additional helper +# functions for use in programs that would provide functionality similar to +# the RedHat chkconfig utility, for instance. + +# source the confif file +. /etc/lsb/lsb-config + +# Define all arrays at script start to avoid scope issues +# scriptlist is a list of valid scripts used as an index +declare -a scriptlist +# fullheaders is a complete set of valid LSB headers, stored in memory for +# each indexed script, to avoid multiple disk reads +declare -a fullheaders + +############################################################################### +# get_headers() - Obtains a valid list of scripts contained in ${rcbase} and # +# inserts the name of the script into the scriptlist[] array # +# for use by all other functions. Additionally, it inserts # +# the entire LSB header information from each script into a # +# second array, fullheaders[], so that diskreads need only be # +# done once # +# Returns no value, but populates the variable ${scriptcount} # +# and the arrays ${scriptlist} and ${fullheaders} for use # +# with other functions in this script. This function is # +# called unconditionally at the end of this scrip and is # +# provided as a function only for the case that it needs to # +# be called again after other operations. # +############################################################################### +get_headers() +{ + echo -n "Retrieving script information from disk..." + count=1 + for file in $(find -P /etc/init.d -xdev -perm -u=x | sed -n 2~1p \ + | sed "s@/etc/init.d/rc@@") + do + # determine if script is an LSB compliant script + grep "### BEGIN INIT INFO" $file > /dev/null + if test $? -gt "0" + then + # this is not a valid script and is ignored + # skip the rest of the loop + continue + fi + # determine basename using only bash (is basename a builtin?) + filename=$(echo "${file}" | sed "s@${rcbase}/@@") + # assign it to an array possition + scriptlist["${count}"]="${filename}" + # find the begining of the init info for the script + begin=$(grep -n "### BEGIN INIT INFO" "${file}" | cut -d: -f1) + # find the end of the init info for the script + end=$(grep -n "### END INIT INFO" "${file}" | cut -d: -f1) + # we'll use the difference between the values in the tail command + diff=$(( ${end} - ${begin} )) + # assign the entire LSB header information as a single string to the + # fullheaders[] array + fullheaders["${count}"]=$(head -n "${end}" "${file}" \ + | tail -n "${diff}") + count=$(( ${count} + 1 )) + unset begin + unset end + unset diff + unset filename + done + # a number or array elements would be a nice regular variable assignment + scriptcount="${#scriptlist[@]}" + unset count + echo -e "Completed!" +} + +############################################################################### +# print_headers() - Presents a formatted list of all LSB compliant script # +# headers to stdout preceeded by script name for use in # +# other scripts # +############################################################################### +print_headers() +{ + get_headers + count=1 + while test "${count}" -lt "${scriptcount}" + do + echo "${scriptlist[$count]}" + echo "=============================================================" + echo "${fullheaders[$count]}" + echo "" + echo "" + count="$(( ${count} + 1 ))" + done +} + +############################################################################### +# get_index() - Determines the array index of the specified script # +############################################################################### + +get_index() +{ + filename=$(echo "${1}" | sed "s@${rcbase}/@@") + count=1 + while test "${count}" -lt "${scriptcount}" + do + echo "${scriptlist[${count}]}" | grep "${filename}" > /dev/null + if test "${?}" -ne "0" + then + count=$(( ${count} + 1 )) + continue + else + break + fi + done + if test "${filename}" == "${scriptlist[${count}]}" + then + echo "${count}" + else + echo "${1} is not a valid LSB init script." + exit 1 + fi + unset filename + unset count +} + +############################################################################### +# get_lsb_value() - Obtains the LSB Value of $1 for index of script ($2). # +############################################################################### +get_lsb_value() +{ + # Probably need some error checking in here + echo "${fullheaders[${2}]}" | \ + grep "^# ${1}" | \ + sed -e "s@# ${1}:@@" \ + -e "s/^[ \t]*//" +} + +############################################################################### +# convert_lsb_required() - Converts LSB defined facilities (facility names # +# begining with a '$' character) into script names # +# for required start/stop # +############################################################################### +convert_lsb_required() +{ + local count=0 + local provides="" + local reqfacility="" + local reqprovideslist="" + + for reqfacility in $@ + do + # find the requires and it's index and then find the script name + # from the index. Since this is required, exit if it is not found + ## If reqfacility is already in script name format, nothing needs to + ## be done, just echo it back out. I can't think of an easy way to + ## do this right now, the scriptname will be the same as the provides + ## anyway, so just let it fly for now...it'll be correct, it just + ## takes an extra couple of commands to get the same result. + ## Besides, this will do some extra sanity checking in case somebody + ## writes a script that isn't named the same as provides, though this + ## isn't LSB compliant. Additionally, these same comments apply to + ## the convert_lsb_should() fucntion below. + count=0 + while test ${count} -lt ${scriptcount} + do + count=$(( $count + 1 )) + provides="$( get_lsb_value Provides ${count} )" + if test "${provides}" = "${reqfacility}" + then + reqprovideslist="${reqprovideslist} ${scriptlist[$count]}" + break + fi + if test ${count} -eq ${scriptcount}; then + # If we've never broken out of the while loop, then this is an + # unrecoverable error since it is a required item. Exit now! + echo "Error: unable to locate required facility ${reqfacility}!" + exit 5 + fi + done + done + echo "${reqprovideslist}" | sed -e "s/^[ \t]*//" -e "s/^[ \t]*//" +} + +############################################################################### +# convert_lsb_should() - Converts LSB defined facilities (facility names # +# begining with a '$' character) into script names for # +# should start/stop # +############################################################################### + +convert_lsb_should() +{ + local count=0 + local provides="" + local optfacility="" + local optprovideslist="" + + for optfacility in $@ + do + # find the should and it's index and then find the script name + # from the index. Since this is not an error, simply warn if it + # is not found. + count=0 + while test ${count} -lt ${scriptcount} + do + count=$(( $count + 1 )) + provides="$( get_lsb_value Provides ${count} )" + if test "${provides}" = "${optfacility}" + then + optprovideslist="${optprovideslist} ${scriptlist[$count]}" + break + fi + # No need to error or warn on should items, and it's messy if so! + done + done + echo "${optprovideslist}" | sed -e "s/^[ \t]*//" -e "s/[ \t]*$//" +} + +get_headers + +############################################################################### +# get_lsb_required_value() - Additional function to simplify repetitive tasks # +# Obtains the LSB Value of $1 for index of script # +# ($2) and immediately converts LSB defined # +# facilities (beginning with a '$' character) to a # +# script name. If the script is not found, then # +# the function exits with an error as per # +# convert_lsb_required. # +############################################################################### +get_lsb_required_value() +{ + local reqval + # Probably need some error checking in here + reqval=`echo "${fullheaders[${2}]}" | \ + grep "^# ${1}" | \ + sed -e "s@# ${1}:@@" \ + -e "s/^[ \t]*//"` + + # If $reqval contains a '$' charcter, then convert it to a script name + echo "${reqval}" | grep "\\$" 2>&1 > /dev/null + if test "${?}" -eq "0" + then + reqval=`convert_lsb_required "${reqval}"` + fi + echo "${reqval}" +} + +############################################################################### +# get_lsb_should_value() - Additional function to simplify repetitive tasks # +# Obtains the LSB Value of $1 for index of script # +# ($2) and immediately converts LSB defined # +# facilities (beginning with a '$' character) to a # +# script name. If the script is not found, the # +# value is removed from the list as it is optional. # +############################################################################### +get_lsb_should_value() +{ + local optval + local listitem + local optitem + # Probably need some error checking in here + optval=`echo "${fullheaders[${2}]}" | \ + grep "^# ${1}" | \ + sed -e "s@# ${1}:@@" \ + -e "s/^[ \t]*//"` + + # If $optval contains a '$' charcter, then convert it to a script name + echo "${optval}" | grep "\\$" 2>&1 > /dev/null + if test "${?}" -eq "0" + then + optval=`convert_lsb_should "${optval}"` + # if we still have a "$" character, then it's not found and it should + # be removed from the list (and it's trailing space if one exists) + # since it is optional + echo "${optval}" | grep "\\$" 2>&1 > /dev/null + if test "${?}" -eq "0" + then + # Remove the value + for listitem in ${optval} + do + echo "${listitem}" | grep "\\$" + if test "${?}" -eq "0" + then + optval=`echo "${optval}" | sed -e 's@${listitem} @@' \ + -e 's@${listitem}@@' | \ + sed -e "s@# ${1}:@@" \ + -e "s/^[ \t]*//"` + fi + done + fi + fi + # If a should start value does not have a script associted with it, then + # remove it (or it and trailing space) from the list + for optitem in ${otpval} + do + grep "${optitem}" "${statedir}/enabled-scripts" 2>&1 > /dev/null + if test "${?}" -ne "0" + then + optval=`echo "${optval}" | sed -e 's@${otpitem} @@' \ + -e 's@${optitem}@@' | \ + sed -e "s@# ${1}:@@" \ + -e "s/^[ \t]*//"` + fi + done + + echo "${optval}" +} + +# End /lib/lsb/manage-functions diff --git a/bootscripts/contrib/lsb-v3/sysconfig/createfiles b/bootscripts/contrib/lsb-v3/sysconfig/createfiles new file mode 100644 index 000000000..8d1f89dc6 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/sysconfig/createfiles @@ -0,0 +1,28 @@ +######################################################################## +# Begin /etc/sysconfig/createfiles +# +# Description : Createfiles script config file +# +# Authors : +# +# Version : 00.00 +# +# Notes : The syntax of this file is as follows: +# if type is equal to "file" or "dir" +# <filename> <type> <permissions> <user> <group> +# if type is equal to "dev" +# <filename> <type> <permissions> <user> <group> <devtype> <major> <minor> +# +# <filename> is the name of the file which is to be created +# <type> is either file, dir, or dev. +# file creates a new file +# dir creates a new directory +# dev creates a new device +# <devtype> is either block, char or pipe +# block creates a block device +# char creates a character deivce +# pipe creates a pipe, this will ignore the <major> and <minor> fields +# <major> and <minor> are the major and minor numbers used for the device. +######################################################################## + +# End /etc/sysconfig/createfiles diff --git a/bootscripts/contrib/lsb-v3/sysconfig/modules b/bootscripts/contrib/lsb-v3/sysconfig/modules new file mode 100644 index 000000000..1c8493d45 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/sysconfig/modules @@ -0,0 +1,18 @@ +######################################################################## +# Begin /etc/sysconfig/modules +# +# Description : Module auto-loading configuration +# +# Authors : +# +# Version : 00.00 +# +# Notes : The syntax of this file is as follows: +# <module> [<arg1> <arg2> ...] +# +# Each module should be on it's own line, and any options that you want +# passed to the module should follow it. The line deliminator is either +# a space or a tab. +######################################################################## + +# End /etc/sysconfig/modules diff --git a/bootscripts/contrib/lsb-v3/sysconfig/network-devices/ifdown b/bootscripts/contrib/lsb-v3/sysconfig/network-devices/ifdown new file mode 100644 index 000000000..28d1f1813 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/sysconfig/network-devices/ifdown @@ -0,0 +1,93 @@ +#!/bin/sh +######################################################################## +# Begin $NETWORK_DEVICES/ifdown +# +# Description : Interface Down +# +# Authors : Nathan Coulson - nathan@linuxfromscratch.org +# Kevin P. Fleming - kpfleming@linuxfromscratch.org +# +# Version : 00.01 +# +# Notes : the IFCONFIG variable is passed to the scripts found +# in the services directory, to indicate what file the +# service should source to get environmental variables. +# +######################################################################## + +. /lib/lsb/init-functions + +# Collect a list of configuration files for our interface +if [ -n "${2}" ]; then + for file in ${@#$1}; do # All parameters except $1 + FILES="${FILES} ${NETWORK_DEVICES}/ifconfig.${1}/${file}" + done +elif [ -d "${NETWORK_DEVICES}/ifconfig.${1}" ]; then + FILES=`echo ${NETWORK_DEVICES}/ifconfig.${1}/*` +else + FILES="${NETWORK_DEVICES}/ifconfig.${1}" +fi + +# Reverse the order configuration files are processed in +for file in ${FILES}; do + FILES2="${file} ${FILES2}" +done +FILES=${FILES2} + +# Process each configuration file +for file in ${FILES}; do + # skip backup files + if [ "${file}" != "${file%""~""}" ]; then + continue + fi + + if [ ! -f "${file}" ]; then + message="${file} is not a network configuration file or directory." + log_warning_msg + fi + ( + . ${file} + + # Will not process this service if started by boot, and ONBOOT + # is not set to yes + if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then + continue + fi + + # Will not process this service if started by hotplug, and + # ONHOTPLUG is not set to yes + if [ "${IN_HOTPLUG}" = "1" -a "${ONHOTPLUG}" != "yes" ]; then + continue + fi + + # This will run the service script, if SERVICE is set + if [ -n "${SERVICE}" -a -x "${NETWORK_DEVICES}/services/${SERVICE}" ]; then + if ip link show ${1} > /dev/null 2>&1 + then + IFCONFIG=${file} ${NETWORK_DEVICES}/services/${SERVICE} ${1} down + else + message="Interface ${1} doesn't exist." + log_warning_msg + fi + else + echo -e "${FAILURE}Unable to process ${file}. Either" + echo -e "${FAILURE}the SERVICE variable was not set," + echo -e "${FAILURE}or the specified service cannot be executed." + message="" + log_failure_msg + fi + ) +done + +if [ -z "${2}" ]; then + link_status=`ip link show $1` + if [ -n "${link_status}" ]; then + if echo "${link_status}" | grep -q UP; then + message="Bringing down the ${1} interface..." + ip link set ${1} down + evaluate_retval standard + fi + fi +fi + +# End $NETWORK_DEVICES/ifdown diff --git a/bootscripts/contrib/lsb-v3/sysconfig/network-devices/ifup b/bootscripts/contrib/lsb-v3/sysconfig/network-devices/ifup new file mode 100644 index 000000000..50e173ca6 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/sysconfig/network-devices/ifup @@ -0,0 +1,87 @@ +#!/bin/sh +######################################################################## +# Begin $NETWORK_DEVICES/ifup +# +# Description : Interface Up +# +# Authors : Nathan Coulson - nathan@linuxfromscratch.org +# Kevin P. Fleming - kpfleming@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : the IFCONFIG variable is passed to the scripts found +# in the services directory, to indicate what file the +# service should source to get environmental variables. +# +######################################################################## + +. /lib/lsb/init-functions + +# Collect a list of configuration files for our interface +if [ -n "${2}" ]; then + for file in ${@#$1} # All parameters except $1 + do + FILES="${FILES} ${NETWORK_DEVICES}/ifconfig.${1}/${file}" + done +elif [ -d "${NETWORK_DEVICES}/ifconfig.${1}" ]; then + FILES=`echo ${NETWORK_DEVICES}/ifconfig.${1}/*` +else + FILES="${NETWORK_DEVICES}/ifconfig.${1}" +fi + +message="Bringing up the ${1} interface..." + +# Process each configruation file +for file in ${FILES}; do + # skip backup files + if [ "${file}" != "${file%""~""}" ]; then + continue + fi + + if [ ! -f "${file}" ]; then + log_warning_msg + message="${file} is not a network configuration file or directory." + log_warning_msg + fi + + ( + . ${file} + + # Will not process this service if started by boot, and ONBOOT + # is not set to yes + if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then + continue + fi + # Will not process this service if started by hotplug, and + # ONHOTPLUG is not set to yes + if [ "${IN_HOTPLUG}" = "1" -a "${ONHOTPLUG}" != "yes" -a "${HOSTNAME}" != "(none)" ]; then + continue + fi + + if [ -n "${SERVICE}" -a -x "${NETWORK_DEVICES}/services/${SERVICE}" ]; then + if [ -z "${CHECK_LINK}" -o "${CHECK_LINK}" = "y" -o "${CHECK_LINK}" = "yes" -o "${CHECK_LINK}" = "1" ]; then + if ip link show ${1} > /dev/null 2>&1; then + link_status=`ip link show ${1}` + if [ -n "${link_status}" ]; then + if ! echo "${link_status}" | grep -q UP; then + ip link set ${1} up + evaluate_retval standard + fi + fi + else + message="${message}Interface ${1} doesn't exist." + log_warning_msg + fi + fi + IFCONFIG=${file} ${NETWORK_DEVICES}/services/${SERVICE} ${1} up + else + echo -e "${FAILURE}Unable to process ${file}. Either" + echo -e "${FAILURE}the SERVICE variable was not set," + echo -e "${FAILURE}or the specified service cannot be executed." + message="" + log_failure_msg + fi + ) +done + +# End $NETWORK_DEVICES/ifup diff --git a/bootscripts/contrib/lsb-v3/sysconfig/network-devices/services/ipv4-static b/bootscripts/contrib/lsb-v3/sysconfig/network-devices/services/ipv4-static new file mode 100644 index 000000000..417d22de6 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/sysconfig/network-devices/services/ipv4-static @@ -0,0 +1,80 @@ +#!/bin/sh +######################################################################## +# Begin $NETWORK_DEVICES/services/ipv4-static +# +# Description : IPV4 Static Boot Script +# +# Authors : Nathan Coulson - nathan@linuxfromscratch.org +# Kevin P. Fleming - kpfleming@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /lib/lsb/init-functions +. ${IFCONFIG} + +if [ -z "${IP}" ]; then + log_failure_msg "IP variable missing from ${IFCONFIG}, cannot continue." + exit 1 +fi + +if [ -z "${PREFIX}" -a -z "${PEER}" ]; then + log_warning_msg "PREFIX variable missing from ${IFCONFIG}, assuming 24." + PREFIX=24 + args="${args} ${IP}/${PREFIX}" +elif [ -n "${PREFIX}" -a -n "${PEER}" ]; then + log_failure_msg "PREFIX and PEER both specified in ${IFCONFIG}, cannot continue." + exit 1 +elif [ -n "${PREFIX}" ]; then + args="${args} ${IP}/${PREFIX}" +elif [ -n "${PEER}" ]; then + args="${args} ${IP} peer ${PEER}" +fi + +if [ -n "${BROADCAST}" ]; then + args="${args} broadcast ${BROADCAST}" +fi + +if [ -n "${SOURCE}" ]; then + args="${args} src ${SOURCE}" +fi + +case "${2}" in + up) + MESSAGE="Adding IPv4 address ${IP} to the ${1} interface..." + ip addr add ${args} dev ${1} + evaluate_retval + + if [ -n "${GATEWAY}" ]; then + if ip route | grep -q default; then + log_warning_msg "Gateway already setup; skipping." ${WARNING} + else + MESSAGE="Setting up default gateway..." + ip route add default via ${GATEWAY} dev ${1} + evaluate_retval + fi + fi + ;; + + down) + if [ -n "${GATEWAY}" ]; then + MESSAGE="Removing default gateway..." + ip route del default + evaluate_retval + fi + + MESSAGE="Removing IPv4 address ${IP} from the ${1} interface..." + ip addr del ${args} dev ${1} + evaluate_retval + ;; + + *) + echo "Usage: ${0} [interface] {up|down}" + exit 1 + ;; +esac + +# End $NETWORK_DEVICES/services/ipv4-static diff --git a/bootscripts/contrib/lsb-v3/sysconfig/network-devices/services/ipv4-static-route b/bootscripts/contrib/lsb-v3/sysconfig/network-devices/services/ipv4-static-route new file mode 100644 index 000000000..4205a022d --- /dev/null +++ b/bootscripts/contrib/lsb-v3/sysconfig/network-devices/services/ipv4-static-route @@ -0,0 +1,92 @@ +#!/bin/sh +######################################################################## +# Begin $NETWORK_DEVICES/services/ipv4-static-route +# +# Description : IPV4 Static Route Script +# +# Authors : Kevin P. Fleming - kpfleming@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /lib/lsb/init-functions +. ${IFCONFIG} + +case "${TYPE}" in + ("" | "network") + need_ip=1 + need_gateway=1 + ;; + + ("default") + need_gateway=1 + args="${args} default" + desc="default" + ;; + + ("host") + need_ip=1 + ;; + + ("unreachable") + need_ip=1 + args="${args} unreachable" + desc="unreachable " + ;; + + (*) + boot_mesg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue." ${FAILURE} + echo_failure + exit 1 + ;; +esac + +if [ -n "${need_ip}" ]; then + if [ -z "${IP}" ]; then + boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE} + echo_failure + exit 1 + fi + + if [ -z "${PREFIX}" ]; then + boot_mesg "PREFIX variable missing from ${IFCONFIG}, cannot continue." ${FAILURE} + echo_failure + exit 1 + fi + + args="${args} ${IP}/${PREFIX}" + desc="${desc}${IP}/${PREFIX}" +fi + +if [ -n "${need_gateway}" ]; then + if [ -z "${GATEWAY}" ]; then + boot_mesg "GATEWAY variable missing from ${IFCONFIG}, cannot continue." ${FAILURE} + echo_failure + exit 1 + fi + args="${args} via ${GATEWAY}" +fi + +case "${2}" in + up) + boot_mesg "Adding '${desc}' route to the ${1} interface..." + ip route add ${args} dev ${1} + evaluate_retval + ;; + + down) + boot_mesg "Removing '${desc}' route from the ${1} interface..." + ip route del ${args} dev ${1} + evaluate_retval + ;; + + *) + echo "Usage: ${0} [interface] {up|down}" + exit 1 + ;; +esac + +# End $NETWORK_DEVICES/services/ipv4-static-route diff --git a/bootscripts/contrib/lsb-v3/sysconfig/rc b/bootscripts/contrib/lsb-v3/sysconfig/rc new file mode 100644 index 000000000..ffb70d98c --- /dev/null +++ b/bootscripts/contrib/lsb-v3/sysconfig/rc @@ -0,0 +1,52 @@ +# Begin /etc/sysconfig/rc + +# Author: DJ Lucas - dj@linuxfromscratch.org +# Version: 1.0 LSB V.3.1 + +# Global variable inherited by initscripts are in caps +# Local variables for the rc script are in lowercase + +# Source site specific rc configuration +. /etc/sysconfig/rc.site + +# This sets default terminal options. +# stty sane - this has been removed as nobody recalls +# the reason for it in the first place - if no problems arize, +# then it will be removed completely at a later date. + +# Setup default values for the environment +umask 022 +PATH="/bin:/sbin" + +# Find current screen size +if [ -z "${COLUMNS}" ]; then + COLUMNS=$(stty size) + COLUMNS=${COLUMNS##* } +fi + +# When using remote connections, such as a serial port, stty size returns 0 +if [ "${COLUMNS}" = "0" ]; then + COLUMNS=80 +fi + +## Measurements for positioning result messages +COL=$((${COLUMNS} - 8)) +WCOL=$((${COL} - 2)) + +# Set Cursur Position Commands, used via echo -e +SET_COL="\\033[${COL}G" # at the $COL char +SET_WCOL="\\033[${WCOL}G" # at the $WCOL char +CURS_UP="\\033[1A\\033[0G" # Up one line, at the 0'th char + +# Bootlogging and interactive startup require a valid tempfs mount +# if this mount is not present, disable them +if [ "${TEMPFS_MOUNT}" = "" -o ! -d "${TEMPFS_MOUNT}" ]; then + TEMPFS_MOUNT="" + iprompt="" + BOOTLOG_ENAB="" +fi + +# Export the environment variables so they are inherited by the scripts +export PATH SET_COL SET_WCOL CURS_UP TEMPFS_MOUNT BOOTLOG_ENAB RUNLEVEL + +# End /etc/sysconfig/rc diff --git a/bootscripts/contrib/lsb-v3/sysconfig/rc.site b/bootscripts/contrib/lsb-v3/sysconfig/rc.site new file mode 100644 index 000000000..cf58e2fd7 --- /dev/null +++ b/bootscripts/contrib/lsb-v3/sysconfig/rc.site @@ -0,0 +1,69 @@ +# Set base directory information +RC_BASE="/etc" +RC_FUNCTIONS="${RC_BASE}/init.d/lfs-functions" + +# Location of network device scripts and config files +NETWORK_DEVICES="/etc/sysconfig/network-devices" + +# Directory to store boot process accounting information +# Used for boot logging and interactive flag when rootfs +# is not writable +TEMPFS_MOUNT="${RC_BASE}/init.d/boottemp" + +# Bootlogging (requires a tempfs mount) +BOOTLOG_ENAB="yes" + +# Distro Information +DISTRO="Linux From Scratch" # The distro name +DISTRO_CONTACT="lfs-dev@linuxfromscratch.org" # Bug report address +DISTRO_MINI="lfs" # Short name used in filenames for distro config + +# Define custom colors used in messages printed to the screen +BRACKET="\\033[1;34m" # Blue +FAILURE="\\033[1;31m" # Red +INFO="\\033[1;36m" # Cyan +NORMAL="\\033[0;39m" # Grey +SUCCESS="\\033[1;32m" # Green +WARNING="\\033[1;33m" # Yellow + +# Prefix boot messages for easier reading on framebuffer consoles +PREFIX_SUCCESS=" ${SUCCESS}*${NORMAL} " +PREFIX_WARNING="${WARNING}**${NORMAL} " +PREFIX_FAILURE="${FAILURE}***${NORMAL}" + +# Export varialbles so that they are inherited by the initscripts +export RC_BASE RC_FUNCTIONS NETWORK_DEVICES TEMPFS_MOUNT BOOTLOG_ENAB +export DISTRO DISTRO_CONTACT DISTRO_MINI +export BRACKET FAILURE INFO NORMAL SUCCESS WARNING +export PREFIX_SUCCESS PREFIX_WARNING PREFIX_FAILURE + +# Interactive startup +iprompt="yes" # Wether to display the interactive boot promp +itime="2" # The ammount of time (in seconds) to display the prompt +dlen="29" # The total length of the distro welcome string +ilen="38" # The total length of the interactive message +welcome_message="Welcome to ${INFO}${DISTRO}${NORMAL}" +i_message="Press '${FAILURE}I${NORMAL}' to enter interactive startup" + +# Error message displayed when a script's exit value is not zero +print_error_msg() +{ + # ${link} and ${error_value} are defined by the rc script + echo -e "${FAILURE}FAILURE: You should not be reading this error message." + echo -e "" + echo -e -n "${FAILURE}It means that an unforseen error took place in" + echo -e -n "${INFO} ${link}" + echo -e "${FAILURE}," + echo -e "${FAILURE}which exited with a return value of ${error_value}." + echo -e "" + echo -e -n "${FAILURE}If you are able to track this error down to a bug" + echo -e "${FAILURE}in one of the files" + echo -e -n "provided by ${INFO}${DISTRO}${FAILURE}, " + echo -e -n "${FAILURE}please be so kind to inform us at " + echo -e "${INFO}${DISTRO_CONTACT}${FAILURE}.${NORMAL}" + echo -e "" + echo -e "${INFO}Press Enter to continue..." + echo -e "${NORMAL}" + read ENTER +} + diff --git a/bootscripts/contrib/lsb/Makefile b/bootscripts/contrib/lsb/Makefile new file mode 100644 index 000000000..445608164 --- /dev/null +++ b/bootscripts/contrib/lsb/Makefile @@ -0,0 +1,11 @@ +ETCDIR=/etc +EXTDIR=${DESTDIR}${ETCDIR} +MODE=754 +DIRMODE=755 +CONFMODE=644 + +install: + install -d -m ${DIRMODE} ${DESTDIR}/lib/lsb + install -m ${CONFMODE} lib/init-functions ${DESTDIR}/lib/lsb + +.PHONY: install diff --git a/bootscripts/contrib/lsb/lib/init-functions b/bootscripts/contrib/lsb/lib/init-functions new file mode 100644 index 000000000..3f1ec2400 --- /dev/null +++ b/bootscripts/contrib/lsb/lib/init-functions @@ -0,0 +1,348 @@ + +#******************************************************************************* +# Function - start_daemon [-f] [-n nicelevel] [-p pidfile] pathname [args] +# +# Purpose: This runs the specified program as a daemon +# +# Inputs: -f, run the program even if it is already running +# -n nicelevel, specifies a nice level. See nice(1). +# -p pidfile, uses the specified pidfile +# pathname, pathname to the specified program +# args, arguments to pass to specified program +# +# Outputs: return 0 - Success +# return 2 - Invalid or excessive number of arguments, +# warning in stdout +# return 4 - Program or service status is unknown +# +# Dependencies: nice +# +# Todo: none +# +#******************************************************************************* +start_daemon() +{ + local pidfile="" + local forcestart="" + local nicelevel="0" + + while true + do + case "${1}" in + -f) + forcestart="1" + shift 1 + ;; + -n) + nicelevel="${2}" + shift 2 + ;; + -p) + pidfile="${2}" + shift 2 + ;; + -*) + log_failure_msg "Unknown Option: ${1}" + return 2 + ;; + *) + break + ;; + esac + done + + if [ -z "${forcestart}" ]; then + if [ -z "${pidfile}" ]; then + pidofproc "${1}" > /dev/null + else + pidofproc -p "${pidfile}" "${1}" > /dev/null + fi + + case "${?}" in + 0) + log_warning_msg "Unable to continue: ${1} is running" + return 4 + ;; + 1) + log_warning_msg "Unable to continue: ${pidfile} exists" + return 4 + ;; + 3) + ;; + *) + log_failure_msg "Unknown error code from pidofproc: ${?}" + return 4 + ;; + esac + fi + + nice -n "${nicelevel}" "${@}" +} + +#******************************************************************************* +# Function - killproc [-p pidfile] pathname [signal] +# +# Purpose: +# +# Inputs: -p pidfile, uses the specified pidfile +# pathname, pathname to the specified program +# signal, send this signal to pathname +# +# Outputs: return 0 - Success +# return 1 - Invalid or excessive number of arguments, +# warning in stdout +# return 4 - Unknown Status +# +# Dependencies: kill +# +# Todo: test +# +#******************************************************************************* +killproc() +{ + local pidfile="" + local killsig="" + local pidlist="" + while true + do + case "${1}" in + -p) + pidfile="${2}" + shift 2 + ;; + -*) + log_failure_msg "Unknown Option: ${1}" + return 1 + ;; + *) + break + ;; + esac + done + + if [ "${#}" = "2" ]; then + killsig="${2}" + elif [ "${#}" != "1" ]; then + shift 2 + log_failure_msg "Excess Arguments: $@" + return 1 + fi + + if [ -z "${pidfile}" ]; then + pidlist=`pidofproc "${1}"` + else + pidlist=`pidofproc -p "${pidfile}" "${1}"` + fi + + for pid in ${pidlist} + do + kill -${killsig:-TERM} ${pid} 2> /dev/null + if [ -z "${killsig}" ]; then + # Wait up to 3 seconds, for ${pid} to terminate + local dtime=3 + while [ "${dtime}" != "0" ] + do + kill -0 ${pid} 2> /dev/null || break + sleep 1 + dtime=$(( ${dtime} - 1)) + done + # If ${pid} is still running, kill it + kill -0 ${pid} 2> /dev/null && kill -KILL ${pid} 2> /dev/null + fi + done + + if [ -z "${killsig}" ]; then + pidofproc "${1}" 2>&1 > /dev/null + + # Program was terminated + if [ "$?" != "0" ]; then + # Pidfile Exists + if [ -f "${pidfile}" ]; then + rm -f "${pidfile}" 2>&1 > /dev/null + fi + return 0 + else # Program is still running + return 4 # Unknown Status + fi + else + if [ -z "${pidfile}" ]; then + pidofproc "${1}" 2> /dev/null + else + pidofproc -p "${pidfile}" "${1}" 2> /dev/null + fi + fi +} + +#******************************************************************************* +# Function - pidofproc [-p pidfile] pathname +# +# Purpose: This function returns one or more pid(s) for a particular daemon +# +# Inputs: -p pidfile, use the specified pidfile instead of pidof +# pathname, path to the specified program +# +# Outputs: return 0 - Success, pid's in stdout +# return 1 - Invalid or excessive number of arguments, +# warning in stdout +# return 1 - Program is dead, pidfile exists +# return 3 - Program is not running +# +# Dependencies: pidof, echo +# +# Todo: - Invalid or excessive argments, and program is dead pidfile exists +# conflict with eachother +# +#******************************************************************************* +pidofproc() +{ + local pidfile="" + local lpids="" + local pidlist="" + while true + do + case "${1}" in + -p) + pidfile="${2}" + shift 2 + ;; + -*) + log_failure_msg "Unknown Option: ${1}" + return 1 + ;; + *) + break + ;; + esac + done + + if [ "${#}" != "1" ]; then + shift 1 + log_failure_msg "Excess Arguments: $@" + return 1 + fi + + if [ -n "${pidfile}" ]; then + if [ ! -r "${pidfile}" ]; then + return 3 # Program is not running + fi + + lpids=`head -n 1 ${pidfile}` + for pid in ${lpids} + do + if [ "${pid}" -ne "$$" -a "${pid}" -ne "${PPID}" ]; then + kill -0 "${pid}" 2> /dev/null && + pidlist="${pidlist} ${pid}" + fi + echo ${pidlist} + test -z "${pidlist}" && return 1 # Program is dead, pidfile exists + return 0 + done + + else + pidof "${1}" + fi + + if [ "$?" != "0" ]; then + return 3 # Program is not running + fi +} + +# Screen Dimentions +if [ -z "${COLUMNS}" ]; then + COLUMNS=$(stty size) + COLUMNS=${COLUMNS##* } +fi + +# When using remote connections, such as a serial port, stty size returns 0 +if [ "${COLUMNS}" = "0" ]; then + COLUMNS=80 +fi + +# Measurements for positioning result messages +COL=$((${COLUMNS} - 8)) +WCOL=$((${COL} - 2)) + +# Set Cursur Position Commands, used via echo -e +SET_COL="\\033[${COL}G" # at the $COL char +SET_WCOL="\\033[${WCOL}G" # at the $WCOL char +CURS_UP="\\033[1A\\033[0G" # Up one line, at the 0'th char + +# Set color commands, used via echo -e +# Please consult `man console_codes` for more information +# under the "Set Graphics Resolution" section +# +# Warning, when switching from a 8bit to a 9bit font, +# the linux console will reinterpret the bold (1;) to +# the top 256 glyphs of the 9bit font. This does +# not affect framebuffer consoles +NORMAL="\\033[0;39m" # Standard console grey +SUCCESS="\\033[1;32m" # Success is green +WARNING="\\033[1;33m" # Warnings are yellow +FAILURE="\\033[1;31m" # Failures are red +INFO="\\033[1;36m" # Information is light cyan +BRACKET="\\033[1;34m" # Brackets are blue + +BOOTMESG_PREFIX=" * " # Text at the beginning of every line + + +#******************************************************************************* +# Function - log_success_msg "message" +# +# Purpose: Print a success message +# +# Inputs: +# +# Outputs: +# +# Dependencies: echo +# +# Todo: logging +# +#******************************************************************************* +log_success_msg() +{ + echo -n -e "${BOOTMESG_PREFIX}${@}" + echo -e "${SET_COL}""${BRACKET}""[""${SUCCESS}"" OK ""${BRACKET}""]""${NORMAL}" + return 0 +} + +#******************************************************************************* +# Function - log_failure_msg "message" +# +# Purpose: Print a failure message +# +# Inputs: $@ - Message +# +# Outputs: Text output to screen +# +# Dependencies: echo +# +# Todo: logging +# +#******************************************************************************* +log_failure_msg() { + echo -n -e "${BOOTMESG_PREFIX}${@}" + echo -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}" + return 0 +} + +#******************************************************************************* +# Function - log_warning_msg "message" +# +# Purpose: print a warning message +# +# Inputs: $@ - Message +# +# Outputs: Text output to screen +# +# Dependencies: echo +# +# Todo: logging +# +#******************************************************************************* +log_warning_msg() { + echo -n -e "${BOOTMESG_PREFIX}${@}" + echo -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}" + return 0 +} + diff --git a/bootscripts/contrib/sysconfig/network-devices/services/mtu b/bootscripts/contrib/sysconfig/network-devices/services/mtu new file mode 100644 index 000000000..5a7de080e --- /dev/null +++ b/bootscripts/contrib/sysconfig/network-devices/services/mtu @@ -0,0 +1,45 @@ +#!/bin/sh +######################################################################## +# Begin $network_devices/services/mtu +# +# Description : Sets MTU per interface +# +# Authors : Nathan Coulson - nathan@linuxfromscratch.org +# Jim Gifford - jim@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : This sets the maximum amount of bytes that can be +# transmitted within a packet. By default, this +# value is set to 1500. +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} +. ${IFCONFIG} + +if [ -z "${MTU}" ] +then + boot_mesg "MTU variable missing from ${IFCONFIG}, cannot continue." ${FAILURE} + echo_failure + exit 1 +fi + +case "${2}" in + up) + boot_mesg "Setting the MTU for ${1} to ${MTU}..." + echo "${MTU}" > "/sys/class/net/${1}/mtu" + evaluate_retval + ;; + + down) + ;; + + *) + echo "Usage: ${0} [interface] {up|down}" + exit 1 + ;; +esac + +# End $network_devices/services/mtu diff --git a/bootscripts/lfs/init.d/checkfs b/bootscripts/lfs/init.d/checkfs new file mode 100644 index 000000000..5a56c25e6 --- /dev/null +++ b/bootscripts/lfs/init.d/checkfs @@ -0,0 +1,131 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/checkfs +# +# Description : File System Check +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# A. Luebke - luebke@users.sourceforge.net +# +# Version : 00.00 +# +# Notes : +# +# Based on checkfs script from LFS-3.1 and earlier. +# +# From man fsck +# 0 - No errors +# 1 - File system errors corrected +# 2 - System should be rebooted +# 4 - File system errors left uncorrected +# 8 - Operational error +# 16 - Usage or syntax error +# 32 - Fsck canceled by user request +# 128 - Shared library error +# +######################################################################### + +. /etc/sysconfig/rc +. ${rc_functions} + +case "${1}" in + start) + if [ -f /fastboot ]; then + boot_mesg -n "/fastboot found, will not perform" ${INFO} + boot_mesg " file system checks as requested." + echo_ok + exit 0 + fi + + boot_mesg "Mounting root file system in read-only mode..." + mount -n -o remount,ro / >/dev/null + evaluate_retval + + if [ ${?} != 0 ]; then + echo_failure + boot_mesg -n "FAILURE:\n\nCannot check root" ${FAILURE} + boot_mesg -n " filesystem because it could not be mounted" + boot_mesg -n " in read-only mode.\n\nAfter you" + boot_mesg -n " press Enter, this system will be" + boot_mesg -n " halted and powered off." + boot_mesg -n "\n\nPress enter to continue..." ${INFO} + boot_mesg "" ${NORMAL} + read ENTER + ${rc_base}/init.d/halt stop + fi + + if [ -f /forcefsck ]; then + boot_mesg -n "/forcefsck found, forcing file" ${INFO} + boot_mesg " system checks as requested." + echo_ok + options="-f" + else + options="" + fi + + boot_mesg "Checking file systems..." + # Note: -a option used to be -p; but this fails e.g. + # on fsck.minix + fsck ${options} -a -A -C -T + error_value=${?} + + if [ "${error_value}" = 0 ]; then + echo_ok + fi + + if [ "${error_value}" = 1 ]; then + echo_warning + boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING} + boot_mesg -n " were found and have been corrected." + boot_mesg -n " You may want to double-check that" + boot_mesg -n " everything was fixed properly." + boot_mesg "" ${NORMAL} + fi + + if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then + echo_warning + boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING} + boot_mesg -n " were found and have been been" + boot_mesg -n " corrected, but the nature of the" + boot_mesg -n " errors require this system to be" + boot_mesg -n " rebooted.\n\nAfter you press enter," + boot_mesg -n " this system will be rebooted" + boot_mesg -n "\n\nPress Enter to continue..." ${INFO} + boot_mesg "" ${NORMAL} + read ENTER + reboot -f + fi + + if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then + echo_failure + boot_mesg -n "FAILURE:\n\nFile system errors" ${FAILURE} + boot_mesg -n " were encountered that could not be" + boot_mesg -n " fixed automatically. This system" + boot_mesg -n " cannot continue to boot and will" + boot_mesg -n " therefore be halted until those" + boot_mesg -n " errors are fixed manually by a" + boot_mesg -n " System Administrator.\n\nAfter you" + boot_mesg -n " press Enter, this system will be" + boot_mesg -n " halted and powered off." + boot_mesg -n "\n\nPress Enter to continue..." ${INFO} + boot_mesg "" ${NORMAL} + read ENTER + ${rc_base}/init.d/halt stop + fi + + if [ "${error_value}" -ge 16 ]; then + echo_failure + boot_mesg -n "FAILURE:\n\nUnexpected Failure" ${FAILURE} + boot_mesg -n " running fsck. Exited with error" + boot_mesg -n " code: ${error_value}." + boot_mesg "" ${NORMAL} + exit ${error_value} + fi + ;; + *) + echo "Usage: ${0} {start}" + exit 1 + ;; +esac + +# End $rc_base/init.d/checkfs diff --git a/bootscripts/lfs/init.d/cleanfs b/bootscripts/lfs/init.d/cleanfs new file mode 100644 index 000000000..9a4e18601 --- /dev/null +++ b/bootscripts/lfs/init.d/cleanfs @@ -0,0 +1,110 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/cleanfs +# +# Description : Clean file system +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +# Function to create files/directory on boot. +create_files() { + # Read in the configuration file. + exec 9>&0 < /etc/sysconfig/createfiles + while read name type perm usr grp dtype maj min junk + do + + # Ignore comments and blank lines. + case "${name}" in + ""|\#*) continue ;; + esac + + # Ignore existing files. + if [ ! -e "${name}" ]; then + # Create stuff based on its type. + case "${type}" in + dir) + mkdir "${name}" + ;; + file) + :> "${name}" + ;; + dev) + case "${dtype}" in + char) + mknod "${name}" c ${maj} ${min} + ;; + block) + mknod "${name}" b ${maj} ${min} + ;; + pipe) + mknod "${name}" p + ;; + *) + boot_mesg -n "\nUnknown device type: ${dtype}" ${WARNING} + boot_mesg "" ${NORMAL} + ;; + esac + ;; + *) + boot_mesg -n "\nUnknown type: ${type}" ${WARNING} + boot_mesg "" ${NORMAL} + continue + ;; + esac + + # Set up the permissions, too. + chown ${usr}:${grp} "${name}" + chmod ${perm} "${name}" + fi + done + exec 0>&9 9>&- +} + +case "${1}" in + start) + boot_mesg -n "Cleaning file systems:" ${INFO} + + boot_mesg -n " /tmp" ${NORMAL} + cd /tmp && + find . -xdev -mindepth 1 ! -name lost+found \ + -delete || failed=1 + + boot_mesg -n " /var/lock" ${NORMAL} + cd /var/lock && + find . -type f ! -newer /proc -exec rm -f {} \; || failed=1 + + boot_mesg " /var/run" ${NORMAL} + cd /var/run && + find . ! -type d ! -name utmp ! -newer /proc \ + -exec rm -f {} \; || failed=1 + > /var/run/utmp + if grep -q '^utmp:' /etc/group ; then + chmod 664 /var/run/utmp + chgrp utmp /var/run/utmp + fi + + (exit ${failed}) + evaluate_retval + + if egrep -qv '^(#|$)' /etc/sysconfig/createfiles 2>/dev/null; then + boot_mesg "Creating files and directories..." + create_files + evaluate_retval + fi + ;; + *) + echo "Usage: ${0} {start}" + exit 1 + ;; +esac + +# End $rc_base/init.d/cleanfs diff --git a/bootscripts/lfs/init.d/console b/bootscripts/lfs/init.d/console new file mode 100644 index 000000000..e8b853591 --- /dev/null +++ b/bootscripts/lfs/init.d/console @@ -0,0 +1,109 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/console +# +# Description : Sets keymap and screen font +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# Alexander E. Patrakov +# +# Version : 00.03 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +# Native English speakers probably don't have /etc/sysconfig/console at all +if [ -f /etc/sysconfig/console ] +then + . /etc/sysconfig/console +else + exit 0 +fi + +is_true() { + [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] +} + +failed=0 + +case "${1}" in + start) + boot_mesg "Setting up Linux console..." + # There should be no bogus failures below this line! + + # Figure out if a framebuffer console is used + [ -d /sys/class/graphics/fb0 ] && USE_FB=1 || USE_FB=0 + + # Figure out the command to set the console into the + # desired mode + is_true "${UNICODE}" && + MODE_COMMAND="${ECHO} -en '\033%G' && kbd_mode -u" || + MODE_COMMAND="${ECHO} -en '\033%@\033(K' && kbd_mode -a" + + # On framebuffer consoles, font has to be set for each vt in + # UTF-8 mode. This doesn't hurt in non-UTF-8 mode also. + + ! is_true "${USE_FB}" || [ -z "${FONT}" ] || + MODE_COMMAND="${MODE_COMMAND} && setfont ${FONT}" + + # Apply that command to all consoles mentioned in + # /etc/inittab. Important: in the UTF-8 mode this should + # happen before setfont, otherwise a kernel bug will + # show up and the unicode map of the font will not be + # used. + # FIXME: Fedora Core also initializes two spare consoles + # - do we want that? + + for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab | + grep -o '\btty[[:digit:]]*\b'` + do + openvt -f -w -c ${TTY#tty} -- \ + /bin/sh -c "${MODE_COMMAND}" || failed=1 + done + + # Set the font (if not already set above) and the keymap + is_true "${USE_FB}" || [ -z "${FONT}" ] || + setfont $FONT || + failed=1 + [ -z "${KEYMAP}" ] || + loadkeys ${KEYMAP} >/dev/null 2>&1 || + failed=1 + [ -z "${KEYMAP_CORRECTIONS}" ] || + loadkeys ${KEYMAP_CORRECTIONS} >/dev/null 2>&1 || + failed=1 + + # Linux kernel generates wrong bytes when composing + # in Unicode mode. That's why we disable dead keys in Unicode + # mode by default. If you need them, download and apply + # http://www.linuxfromscratch.org/~alexander/patches/linux-2.6.12.5-utf8_input-2.patch + # After patching, add "-m charset_of_your_keymap" to the FONT + # variable and set BROKEN_COMPOSE=false + # in /etc/sysconfig/console + + [ -n "$BROKEN_COMPOSE" ] || BROKEN_COMPOSE="$UNICODE" + ! is_true "$BROKEN_COMPOSE" || + echo "" | loadkeys -c >/dev/null 2>&1 || + failed=1 + + # Convert the keymap from $LEGACY_CHARSET to UTF-8 + [ -z "$LEGACY_CHARSET" ] || + dumpkeys -c "$LEGACY_CHARSET" | + loadkeys -u >/dev/null 2>&1 || + failed=1 + + # If any of the commands above failed, the trap at the + # top would set $failed to 1 + ( exit $failed ) + evaluate_retval + ;; + *) + echo $"Usage:" "${0} {start}" + exit 1 + ;; +esac + +# End $rc_base/init.d/console diff --git a/bootscripts/lfs/init.d/consolelog b/bootscripts/lfs/init.d/consolelog new file mode 100755 index 000000000..34b416195 --- /dev/null +++ b/bootscripts/lfs/init.d/consolelog @@ -0,0 +1,61 @@ +#!/bin/sh +# Begin $rc_base/init.d/consolelog + +######################################################################## +# +# Description : Set the kernel log level for the console +# +# Authors : Dan Nicholson - dnicholson@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : /proc must be mounted before this can run +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +# set the default loglevel +LOGLEVEL=7 +if [ -r /etc/sysconfig/console ]; then + . /etc/sysconfig/console +fi + +case "${1}" in + start) + case "$LOGLEVEL" in + [1-8]) + boot_mesg "Setting the console log level to ${LOGLEVEL}..." + dmesg -n $LOGLEVEL + evaluate_retval + ;; + *) + boot_mesg "Console log level '${LOGLEVEL}' is invalid" ${FAILURE} + echo_failure + ;; + esac + ;; + status) + # Read the current value if possible + if [ -r /proc/sys/kernel/printk ]; then + read level line < /proc/sys/kernel/printk + else + boot_mesg "Can't read the current console log level" ${FAILURE} + echo_failure + fi + + # Print the value + if [ -n "$level" ]; then + ${ECHO} -e "${INFO}The current console log level" \ + "is ${level}${NORMAL}" + fi + ;; + + *) + echo "Usage: ${0} {start|status}" + exit 1 + ;; +esac + +# End $rc_base/init.d/consolelog diff --git a/bootscripts/lfs/init.d/functions b/bootscripts/lfs/init.d/functions new file mode 100644 index 000000000..a9e13fd27 --- /dev/null +++ b/bootscripts/lfs/init.d/functions @@ -0,0 +1,769 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/functions +# +# Description : Run Level Control Functions +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : With code based on Matthias Benkmann's simpleinit-msb +# http://winterdrache.de/linux/newboot/index.html +# +######################################################################## + +## Environmental setup +# Setup default values for environment +umask 022 +export PATH="/bin:/usr/bin:/sbin:/usr/sbin" + +# Signal sent to running processes to refresh their configuration +RELOADSIG="HUP" + +# Number of seconds between STOPSIG and FALLBACK when stopping processes +KILLDELAY="3" + +## Screen Dimensions +# Find current screen size +if [ -z "${COLUMNS}" ]; then + COLUMNS=$(stty size) + COLUMNS=${COLUMNS##* } +fi + +# When using remote connections, such as a serial port, stty size returns 0 +if [ "${COLUMNS}" = "0" ]; then + COLUMNS=80 +fi + +## Measurements for positioning result messages +COL=$((${COLUMNS} - 8)) +WCOL=$((${COL} - 2)) + +## Provide an echo that supports -e and -n +# If formatting is needed, $ECHO should be used +case "`echo -e -n test`" in + -[en]*) + ECHO=/bin/echo + ;; + *) + ECHO=echo + ;; +esac + +## Set Cursor Position Commands, used via $ECHO +SET_COL="\\033[${COL}G" # at the $COL char +SET_WCOL="\\033[${WCOL}G" # at the $WCOL char +CURS_UP="\\033[1A\\033[0G" # Up one line, at the 0'th char + +## Set color commands, used via $ECHO +# Please consult `man console_codes for more information +# under the "ECMA-48 Set Graphics Rendition" section +# +# Warning: when switching from a 8bit to a 9bit font, +# the linux console will reinterpret the bold (1;) to +# the top 256 glyphs of the 9bit font. This does +# not affect framebuffer consoles +NORMAL="\\033[0;39m" # Standard console grey +SUCCESS="\\033[1;32m" # Success is green +WARNING="\\033[1;33m" # Warnings are yellow +FAILURE="\\033[1;31m" # Failures are red +INFO="\\033[1;36m" # Information is light cyan +BRACKET="\\033[1;34m" # Brackets are blue + +STRING_LENGTH="0" # the length of the current message + +#******************************************************************************* +# Function - boot_mesg() +# +# Purpose: Sending information from bootup scripts to the console +# +# Inputs: $1 is the message +# $2 is the colorcode for the console +# +# Outputs: Standard Output +# +# Dependencies: - sed for parsing strings. +# - grep for counting string length. +# +# Todo: +#******************************************************************************* +boot_mesg() +{ + local ECHOPARM="" + + while true + do + case "${1}" in + -n) + ECHOPARM=" -n " + shift 1 + ;; + -*) + echo "Unknown Option: ${1}" + return 1 + ;; + *) + break + ;; + esac + done + + ## Figure out the length of what is to be printed to be used + ## for warning messages. + STRING_LENGTH=$((${#1} + 1)) + + # Print the message to the screen + ${ECHO} ${ECHOPARM} -e "${2}${1}" + +} + +boot_mesg_flush() +{ + # Reset STRING_LENGTH for next message + STRING_LENGTH="0" +} + +boot_log() +{ + # Left in for backwards compatibility + : +} + +echo_ok() +{ + ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]" + ${ECHO} -e "${NORMAL}" + boot_mesg_flush +} + +echo_failure() +{ + ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]" + ${ECHO} -e "${NORMAL}" + boot_mesg_flush +} + +echo_warning() +{ + ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]" + ${ECHO} -e "${NORMAL}" + boot_mesg_flush +} + +print_error_msg() +{ + echo_failure + # $i is inherited by the rc script + boot_mesg -n "FAILURE:\n\nYou should not be reading this error message.\n\n" ${FAILURE} + boot_mesg -n " It means that an unforeseen error took" + boot_mesg -n " place in ${i}, which exited with a return value of" + boot_mesg " ${error_value}.\n" + boot_mesg_flush + boot_mesg -n "If you're able to track this" + boot_mesg -n " error down to a bug in one of the files provided by" + boot_mesg -n " the LFS book, please be so kind to inform us at" + boot_mesg " lfs-dev@linuxfromscratch.org.\n" + boot_mesg_flush + boot_mesg -n "Press Enter to continue..." ${INFO} + boot_mesg "" ${NORMAL} + read ENTER +} + +check_script_status() +{ + # $i is inherited by the rc script + if [ ! -f ${i} ]; then + boot_mesg "${i} is not a valid symlink." ${WARNING} + echo_warning + continue + fi + + if [ ! -x ${i} ]; then + boot_mesg "${i} is not executable, skipping." ${WARNING} + echo_warning + continue + fi +} + +evaluate_retval() +{ + error_value="${?}" + + if [ ${error_value} = 0 ]; then + echo_ok + else + echo_failure + fi + + # This prevents the 'An Unexpected Error Has Occurred' from trivial + # errors. + return 0 +} + +print_status() +{ + if [ "${#}" = "0" ]; then + echo "Usage: ${0} {success|warning|failure}" + return 1 + fi + + case "${1}" in + + success) + echo_ok + ;; + + warning) + # Leave this extra case in because old scripts + # may call it this way. + case "${2}" in + running) + ${ECHO} -e -n "${CURS_UP}" + ${ECHO} -e -n "\\033[${STRING_LENGTH}G " + boot_mesg "Already running." ${WARNING} + echo_warning + ;; + not_running) + ${ECHO} -e -n "${CURS_UP}" + ${ECHO} -e -n "\\033[${STRING_LENGTH}G " + boot_mesg "Not running." ${WARNING} + echo_warning + ;; + not_available) + ${ECHO} -e -n "${CURS_UP}" + ${ECHO} -e -n "\\033[${STRING_LENGTH}G " + boot_mesg "Not available." ${WARNING} + echo_warning + ;; + *) + # This is how it is supposed to + # be called + echo_warning + ;; + esac + ;; + + failure) + echo_failure + ;; + + esac + +} + +reloadproc() +{ + local pidfile="" + local failure=0 + + while true + do + case "${1}" in + -p) + pidfile="${2}" + shift 2 + ;; + -*) + log_failure_msg "Unknown Option: ${1}" + return 2 + ;; + *) + break + ;; + esac + done + + if [ "${#}" -lt "1" ]; then + log_failure_msg "Usage: reloadproc [-p pidfile] pathname" + return 2 + fi + + # This will ensure compatibility with previous LFS Bootscripts + if [ -n "${PIDFILE}" ]; then + pidfile="${PIDFILE}" + fi + + # Is the process running? + if [ -z "${pidfile}" ]; then + pidofproc -s "${1}" + else + pidofproc -s -p "${pidfile}" "${1}" + fi + + if [ -n "${pidlist}" ]; then + for pid in ${pidlist} + do + kill -"${RELOADSIG}" "${pid}" || failure="1" + done + + (exit ${failure}) + evaluate_retval + + else + boot_mesg "Process ${1} not running." ${WARNING} + echo_warning + fi +} + +statusproc() +{ + local pidfile="" + local base="" + local ret="" + + while true + do + case "${1}" in + -p) + pidfile="${2}" + shift 2 + ;; + -*) + log_failure_msg "Unknown Option: ${1}" + return 2 + ;; + *) + break + ;; + esac + done + + if [ "${#}" != "1" ]; then + shift 1 + log_failure_msg "Usage: statusproc [-p pidfile] pathname" + return 2 + fi + + # Get the process basename + base="${1##*/}" + + # This will ensure compatibility with previous LFS Bootscripts + if [ -n "${PIDFILE}" ]; then + pidfile="${PIDFILE}" + fi + + # Is the process running? + if [ -z "${pidfile}" ]; then + pidofproc -s "${1}" + else + pidofproc -s -p "${pidfile}" "${1}" + fi + + # Store the return status + ret=$? + + if [ -n "${pidlist}" ]; then + ${ECHO} -e "${INFO}${base} is running with Process"\ + "ID(s) ${pidlist}.${NORMAL}" + else + if [ -n "${base}" -a -e "/var/run/${base}.pid" ]; then + ${ECHO} -e "${WARNING}${1} is not running but"\ + "/var/run/${base}.pid exists.${NORMAL}" + else + if [ -n "${pidfile}" -a -e "${pidfile}" ]; then + ${ECHO} -e "${WARNING}${1} is not running"\ + "but ${pidfile} exists.${NORMAL}" + else + ${ECHO} -e "${INFO}${1} is not running.${NORMAL}" + fi + fi + fi + + # Return the status from pidofproc + return $ret +} + +# The below functions are documented in the LSB-generic 2.1.0 + +#******************************************************************************* +# Function - pidofproc [-s] [-p pidfile] pathname +# +# Purpose: This function returns one or more pid(s) for a particular daemon +# +# Inputs: -p pidfile, use the specified pidfile instead of pidof +# pathname, path to the specified program +# +# Outputs: return 0 - Success, pid's in stdout +# return 1 - Program is dead, pidfile exists +# return 2 - Invalid or excessive number of arguments, +# warning in stdout +# return 3 - Program is not running +# +# Dependencies: pidof, echo, head +# +# Todo: Remove dependency on head +# This depreciates getpids +# Test changes to pidof +# +#******************************************************************************* +pidofproc() +{ + local pidfile="" + local lpids="" + local silent="" + pidlist="" + while true + do + case "${1}" in + -p) + pidfile="${2}" + shift 2 + ;; + + -s) + # Added for legacy opperation of getpids + # eliminates several '> /dev/null' + silent="1" + shift 1 + ;; + -*) + log_failure_msg "Unknown Option: ${1}" + return 2 + ;; + *) + break + ;; + esac + done + + if [ "${#}" != "1" ]; then + shift 1 + log_failure_msg "Usage: pidofproc [-s] [-p pidfile] pathname" + return 2 + fi + + if [ -n "${pidfile}" ]; then + if [ ! -r "${pidfile}" ]; then + return 3 # Program is not running + fi + + lpids=`head -n 1 ${pidfile}` + for pid in ${lpids} + do + if [ "${pid}" -ne "$$" -a "${pid}" -ne "${PPID}" ]; then + kill -0 "${pid}" 2>/dev/null && + pidlist="${pidlist} ${pid}" + fi + + if [ "${silent}" != "1" ]; then + echo "${pidlist}" + fi + + test -z "${pidlist}" && + # Program is dead, pidfile exists + return 1 + # else + return 0 + done + + else + pidlist=`pidof -o $$ -o $PPID -x "$1"` + if [ "${silent}" != "1" ]; then + echo "${pidlist}" + fi + + # Get provide correct running status + if [ -n "${pidlist}" ]; then + return 0 + else + return 3 + fi + + fi + + if [ "$?" != "0" ]; then + return 3 # Program is not running + fi +} + +# This will ensure compatibility with previous LFS Bootscripts +getpids() +{ + if [ -z "${PIDFILE}" ]; then + pidofproc -s -p "${PIDFILE}" $@ + else + pidofproc -s $@ + fi + base="${1##*/}" +} + +#******************************************************************************* +# Function - loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args] +# +# Purpose: This runs the specified program as a daemon +# +# Inputs: -f, run the program even if it is already running +# -n nicelevel, specifies a nice level. See nice(1). +# -p pidfile, uses the specified pidfile +# pathname, pathname to the specified program +# args, arguments to pass to specified program +# +# Outputs: return 0 - Success +# return 2 - Invalid of excessive number of arguments, +# warning in stdout +# return 4 - Program or service status is unknown +# +# Dependencies: nice +# +# Todo: LSB says this should be called start_daemon +# LSB does not say that it should call evaluate_retval +# It checks for PIDFILE, which is deprecated. +# Will be removed after BLFS 6.0 +# loadproc returns 0 if program is already running, not LSB compliant +# +#******************************************************************************* +loadproc() +{ + local pidfile="" + local forcestart="" + local nicelevel="10" + +# This will ensure compatibility with previous LFS Bootscripts + if [ -n "${PIDFILE}" ]; then + pidfile="${PIDFILE}" + fi + + while true + do + case "${1}" in + -f) + forcestart="1" + shift 1 + ;; + -n) + nicelevel="${2}" + shift 2 + ;; + -p) + pidfile="${2}" + shift 2 + ;; + -*) + log_failure_msg "Unknown Option: ${1}" + return 2 #invalid or excess argument(s) + ;; + *) + break + ;; + esac + done + + if [ "${#}" = "0" ]; then + log_failure_msg "Usage: loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args]" + return 2 #invalid or excess argument(s) + fi + + if [ -z "${forcestart}" ]; then + if [ -z "${pidfile}" ]; then + pidofproc -s "${1}" + else + pidofproc -s -p "${pidfile}" "${1}" + fi + + case "${?}" in + 0) + log_warning_msg "Unable to continue: ${1} is running" + return 0 # 4 + ;; + 1) + log_warning_msg "Unable to continue: ${pidfile} exists" + return 0 # 4 + ;; + 3) + ;; + *) + log_failure_msg "Unknown error code from pidofproc: ${?}" + return 4 + ;; + esac + fi + + nice -n "${nicelevel}" "${@}" + evaluate_retval # This is "Probably" not LSB compliant, but required to be compatible with older bootscripts + return 0 +} + +#******************************************************************************* +# Function - killproc [-p pidfile] pathname [signal] +# +# Purpose: +# +# Inputs: -p pidfile, uses the specified pidfile +# pathname, pathname to the specified program +# signal, send this signal to pathname +# +# Outputs: return 0 - Success +# return 2 - Invalid of excessive number of arguments, +# warning in stdout +# return 4 - Unknown Status +# +# Dependencies: kill +# +# Todo: LSB does not say that it should call evaluate_retval +# It checks for PIDFILE, which is deprecated. +# Will be removed after BLFS 6.0 +# +#******************************************************************************* +killproc() +{ + local pidfile="" + local killsig=TERM # default signal is SIGTERM + pidlist="" + + # This will ensure compatibility with previous LFS Bootscripts + if [ -n "${PIDFILE}" ]; then + pidfile="${PIDFILE}" + fi + + while true + do + case "${1}" in + -p) + pidfile="${2}" + shift 2 + ;; + -*) + log_failure_msg "Unknown Option: ${1}" + return 2 + ;; + *) + break + ;; + esac + done + + if [ "${#}" = "2" ]; then + killsig="${2}" + elif [ "${#}" != "1" ]; then + shift 2 + log_failure_msg "Usage: killproc [-p pidfile] pathname [signal]" + return 2 + fi + + # Is the process running? + if [ -z "${pidfile}" ]; then + pidofproc -s "${1}" + else + pidofproc -s -p "${pidfile}" "${1}" + fi + + # If running, send the signal + if [ -n "${pidlist}" ]; then + for pid in ${pidlist} + do + kill -${killsig} ${pid} 2>/dev/null + + # Wait up to 3 seconds, for ${pid} to terminate + case "${killsig}" in + TERM|SIGTERM|KILL|SIGKILL) + # sleep in 1/10ths of seconds and + # multiply KILLDELAY by 10 + local dtime="${KILLDELAY}0" + while [ "${dtime}" != "0" ] + do + kill -0 ${pid} 2>/dev/null || break + sleep 0.1 + dtime=$(( ${dtime} - 1)) + done + # If ${pid} is still running, kill it + kill -0 ${pid} 2>/dev/null && kill -KILL ${pid} 2>/dev/null + ;; + esac + done + + # Check if the process is still running if we tried to stop it + case "${killsig}" in + TERM|SIGTERM|KILL|SIGKILL) + if [ -z "${pidfile}" ]; then + pidofproc -s "${1}" + else + pidofproc -s -p "${pidfile}" "${1}" + fi + + # Program was terminated + if [ "$?" != "0" ]; then + # Remove the pidfile if necessary + if [ -f "${pidfile}" ]; then + rm -f "${pidfile}" + fi + echo_ok + return 0 + else # Program is still running + echo_failure + return 4 # Unknown Status + fi + ;; + *) + # Just see if the kill returned successfully + evaluate_retval + ;; + esac + else # process not running + print_status warning not_running + fi +} + + +#******************************************************************************* +# Function - log_success_msg "message" +# +# Purpose: Print a success message +# +# Inputs: $@ - Message +# +# Outputs: Text output to screen +# +# Dependencies: echo +# +# Todo: logging +# +#******************************************************************************* +log_success_msg() +{ + ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" + ${ECHO} -e "${SET_COL}""${BRACKET}""[""${SUCCESS}"" OK ""${BRACKET}""]""${NORMAL}" + return 0 +} + +#******************************************************************************* +# Function - log_failure_msg "message" +# +# Purpose: Print a failure message +# +# Inputs: $@ - Message +# +# Outputs: Text output to screen +# +# Dependencies: echo +# +# Todo: logging +# +#******************************************************************************* +log_failure_msg() { + ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" + ${ECHO} -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}" + return 0 +} + +#******************************************************************************* +# Function - log_warning_msg "message" +# +# Purpose: print a warning message +# +# Inputs: $@ - Message +# +# Outputs: Text output to screen +# +# Dependencies: echo +# +# Todo: logging +# +#******************************************************************************* +log_warning_msg() { + ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" + ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}" + return 0 +} + +# End $rc_base/init.d/functions diff --git a/bootscripts/lfs/init.d/halt b/bootscripts/lfs/init.d/halt new file mode 100644 index 000000000..f3b016c38 --- /dev/null +++ b/bootscripts/lfs/init.d/halt @@ -0,0 +1,28 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/halt +# +# Description : Halt Script +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +case "${1}" in + stop) + halt -d -f -i -p + ;; + *) + echo "Usage: {stop}" + exit 1 + ;; +esac + +# End $rc_base/init.d/halt diff --git a/bootscripts/lfs/init.d/localnet b/bootscripts/lfs/init.d/localnet new file mode 100644 index 000000000..4e5010229 --- /dev/null +++ b/bootscripts/lfs/init.d/localnet @@ -0,0 +1,54 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/localnet +# +# Description : Loopback device +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} +. /etc/sysconfig/network + +case "${1}" in + start) + boot_mesg "Bringing up the loopback interface..." + ip addr add 127.0.0.1/8 label lo dev lo + ip link set lo up + evaluate_retval + + boot_mesg "Setting hostname to ${HOSTNAME}..." + hostname ${HOSTNAME} + evaluate_retval + ;; + + stop) + boot_mesg "Bringing down the loopback interface..." + ip link set lo down + evaluate_retval + ;; + + restart) + ${0} stop + sleep 1 + ${0} start + ;; + + status) + echo "Hostname is: $(hostname)" + ip link show lo + ;; + + *) + echo "Usage: ${0} {start|stop|restart|status}" + exit 1 + ;; +esac + +# End $rc_base/init.d/localnet diff --git a/bootscripts/lfs/init.d/modules b/bootscripts/lfs/init.d/modules new file mode 100644 index 000000000..e8fbdfa9e --- /dev/null +++ b/bootscripts/lfs/init.d/modules @@ -0,0 +1,72 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/modules +# +# Description : Module auto-loading script +# +# Authors : Zack Winkles +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +# Assure that the kernel has module support. +[ -e /proc/ksyms -o -e /proc/modules ] || exit 0 + +case "${1}" in + start) + + # Exit if there's no modules file or there are no + # valid entries + [ -r /etc/sysconfig/modules ] && + egrep -qv '^($|#)' /etc/sysconfig/modules || + exit 0 + + boot_mesg -n "Loading modules:" ${INFO} + + # Only try to load modules if the user has actually given us + # some modules to load. + while read module args; do + + # Ignore comments and blank lines. + case "$module" in + ""|"#"*) continue ;; + esac + + # Attempt to load the module, making + # sure to pass any arguments provided. + modprobe ${module} ${args} >/dev/null + + # Print the module name if successful, + # otherwise take note. + if [ $? -eq 0 ]; then + boot_mesg -n " ${module}" ${NORMAL} + else + failedmod="${failedmod} ${module}" + fi + done < /etc/sysconfig/modules + + boot_mesg "" ${NORMAL} + # Print a message about successfully loaded + # modules on the correct line. + echo_ok + + # Print a failure message with a list of any + # modules that may have failed to load. + if [ -n "${failedmod}" ]; then + boot_mesg "Failed to load modules:${failedmod}" ${FAILURE} + echo_failure + fi + ;; + *) + echo "Usage: ${0} {start}" + exit 1 + ;; +esac + +# End $rc_base/init.d/modules diff --git a/bootscripts/lfs/init.d/mountfs b/bootscripts/lfs/init.d/mountfs new file mode 100644 index 000000000..3d9262463 --- /dev/null +++ b/bootscripts/lfs/init.d/mountfs @@ -0,0 +1,54 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/mountfs +# +# Description : File System Mount Script +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +case "${1}" in + start) + boot_mesg "Remounting root file system in read-write mode..." + mount -n -o remount,rw / >/dev/null + evaluate_retval + + # Remove fsck-related file system watermarks. + rm -f /fastboot /forcefsck + + boot_mesg "Recording existing mounts in /etc/mtab..." + > /etc/mtab + mount -f / || failed=1 + mount -f /proc || failed=1 + mount -f /sys || failed=1 + (exit ${failed}) + evaluate_retval + + # This will mount all filesystems that do not have _netdev in + # their option list. _netdev denotes a network filesystem. + boot_mesg "Mounting remaining file systems..." + mount -a -O no_netdev >/dev/null + evaluate_retval + ;; + + stop) + boot_mesg "Unmounting all other currently mounted file systems..." + umount -a -d -r >/dev/null + evaluate_retval + ;; + + *) + echo "Usage: ${0} {start|stop}" + exit 1 + ;; +esac + +# End $rc_base/init.d/mountfs diff --git a/bootscripts/lfs/init.d/mountkernfs b/bootscripts/lfs/init.d/mountkernfs new file mode 100644 index 000000000..10b165a5c --- /dev/null +++ b/bootscripts/lfs/init.d/mountkernfs @@ -0,0 +1,44 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/mountkernfs +# +# Description : Mount proc and sysfs +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +case "${1}" in + start) + boot_mesg -n "Mounting kernel-based file systems:" ${INFO} + + if ! mountpoint /proc >/dev/null; then + boot_mesg -n " /proc" ${NORMAL} + mount -n /proc || failed=1 + fi + + if ! mountpoint /sys >/dev/null; then + boot_mesg -n " /sys" ${NORMAL} + mount -n /sys || failed=1 + fi + + boot_mesg "" ${NORMAL} + + (exit ${failed}) + evaluate_retval + ;; + + *) + echo "Usage: ${0} {start}" + exit 1 + ;; +esac + +# End $rc_base/init.d/mountkernfs diff --git a/bootscripts/lfs/init.d/network b/bootscripts/lfs/init.d/network new file mode 100644 index 000000000..b99ecfdb9 --- /dev/null +++ b/bootscripts/lfs/init.d/network @@ -0,0 +1,73 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/network +# +# Description : Network Control Script +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# Nathan Coulson - nathan@linuxfromscratch.org +# Kevin P. Fleming - kpfleming@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} +. /etc/sysconfig/network + +case "${1}" in + start) + # Start all network interfaces + for file in ${network_devices}/ifconfig.* + do + interface=${file##*/ifconfig.} + + # skip if $file is * (because nothing was found) + if [ "${interface}" = "*" ] + then + continue + fi + + IN_BOOT=1 ${network_devices}/ifup ${interface} + done + ;; + + stop) + # Reverse list + FILES="" + for file in ${network_devices}/ifconfig.* + do + FILES="${file} ${FILES}" + done + + # Stop all network interfaces + for file in ${FILES} + do + interface=${file##*/ifconfig.} + + # skip if $file is * (because nothing was found) + if [ "${interface}" = "*" ] + then + continue + fi + + IN_BOOT=1 ${network_devices}/ifdown ${interface} + done + ;; + + restart) + ${0} stop + sleep 1 + ${0} start + ;; + + *) + echo "Usage: ${0} {start|stop|restart}" + exit 1 + ;; +esac + +# End /etc/rc.d/init.d/network diff --git a/bootscripts/lfs/init.d/rc b/bootscripts/lfs/init.d/rc new file mode 100644 index 000000000..38d4ae2df --- /dev/null +++ b/bootscripts/lfs/init.d/rc @@ -0,0 +1,99 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/rc +# +# Description : Main Run Level Control Script +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +# This sets a few default terminal options. +stty sane + +# These 3 signals will not cause our script to exit +trap "" INT QUIT TSTP + +[ "${1}" != "" ] && runlevel=${1} + +if [ "${runlevel}" = "" ]; then + echo "Usage: ${0} <runlevel>" >&2 + exit 1 +fi + +previous=${PREVLEVEL} +[ "${previous}" = "" ] && previous=N + +if [ ! -d ${rc_base}/rc${runlevel}.d ]; then + boot_mesg "${rc_base}/rc${runlevel}.d does not exist." ${WARNING} + boot_mesg_flush + exit 1 +fi + +# Attempt to stop all service started by previous runlevel, +# and killed in this runlevel +if [ "${previous}" != "N" ]; then + for i in $(ls -v ${rc_base}/rc${runlevel}.d/K* 2> /dev/null) + do + check_script_status + + suffix=${i#$rc_base/rc$runlevel.d/K[0-9][0-9]} + prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix + sysinit_start=$rc_base/rcsysinit.d/S[0-9][0-9]$suffix + + if [ "${runlevel}" != "0" ] && [ "${runlevel}" != "6" ]; then + if [ ! -f ${prev_start} ] && [ ! -f ${sysinit_start} ]; then + boot_mesg -n "WARNING:\n\n${i} can't be" ${WARNING} + boot_mesg -n " executed because it was not" + boot_mesg -n " not started in the previous" + boot_mesg -n " runlevel (${previous})." + boot_mesg "" ${NORMAL} + boot_mesg_flush + continue + fi + fi + ${i} stop + error_value=${?} + + if [ "${error_value}" != "0" ]; then + print_error_msg + fi + done +fi + +#Start all functions in this runlevel +for i in $( ls -v ${rc_base}/rc${runlevel}.d/S* 2> /dev/null) +do + if [ "${previous}" != "N" ]; then + suffix=${i#$rc_base/rc$runlevel.d/S[0-9][0-9]} + stop=$rc_base/rc$runlevel.d/K[0-9][0-9]$suffix + prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix + + [ -f ${prev_start} ] && [ ! -f ${stop} ] && continue + fi + + check_script_status + + case ${runlevel} in + 0|6) + ${i} stop + ;; + *) + ${i} start + ;; + esac + error_value=${?} + + if [ "${error_value}" != "0" ]; then + print_error_msg + fi +done + +# End $rc_base/init.d/rc diff --git a/bootscripts/lfs/init.d/reboot b/bootscripts/lfs/init.d/reboot new file mode 100644 index 000000000..fec0c1f6f --- /dev/null +++ b/bootscripts/lfs/init.d/reboot @@ -0,0 +1,31 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/reboot +# +# Description : Reboot Scripts +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +case "${1}" in + stop) + boot_mesg "Restarting system..." + reboot -d -f -i + ;; + + *) + echo "Usage: ${0} {stop}" + exit 1 + ;; + +esac + +# End $rc_base/init.d/reboot diff --git a/bootscripts/lfs/init.d/sendsignals b/bootscripts/lfs/init.d/sendsignals new file mode 100644 index 000000000..4c3d05eda --- /dev/null +++ b/bootscripts/lfs/init.d/sendsignals @@ -0,0 +1,52 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/sendsignals +# +# Description : Sendsignals Script +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +case "${1}" in + stop) + boot_mesg "Sending all processes the TERM signal..." + killall5 -15 + error_value=${?} + + sleep ${KILLDELAY} + + if [ "${error_value}" = 0 ]; then + echo_ok + else + echo_failure + fi + + boot_mesg "Sending all processes the KILL signal..." + killall5 -9 + error_value=${?} + + sleep ${KILLDELAY} + + if [ "${error_value}" = 0 ]; then + echo_ok + else + echo_failure + fi + ;; + + *) + echo "Usage: ${0} {stop}" + exit 1 + ;; + +esac + +# End $rc_base/init.d/sendsignals diff --git a/bootscripts/lfs/init.d/setclock b/bootscripts/lfs/init.d/setclock new file mode 100644 index 000000000..a87fb2d23 --- /dev/null +++ b/bootscripts/lfs/init.d/setclock @@ -0,0 +1,49 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/setclock +# +# Description : Setting Linux Clock +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} +. /etc/sysconfig/clock + +CLOCKPARAMS= + +case "${UTC}" in + yes|true|1) + CLOCKPARAMS="${CLOCKPARAMS} --utc" + ;; + + no|false|0) + CLOCKPARAMS="${CLOCKPARAMS} --localtime" + ;; + +esac + +case ${1} in + start) + boot_mesg "Setting system clock..." + hwclock --hctosys ${CLOCKPARAMS} >/dev/null + evaluate_retval + ;; + + stop) + boot_mesg "Setting hardware clock..." + hwclock --systohc ${CLOCKPARAMS} >/dev/null + evaluate_retval + ;; + + *) + echo "Usage: ${0} {start|stop}" + ;; + +esac diff --git a/bootscripts/lfs/init.d/swap b/bootscripts/lfs/init.d/swap new file mode 100644 index 000000000..edc63f3b0 --- /dev/null +++ b/bootscripts/lfs/init.d/swap @@ -0,0 +1,50 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/swap +# +# Description : Swap Control Script +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +case "${1}" in + start) + boot_mesg "Activating all swap files/partitions..." + swapon -a + evaluate_retval + ;; + + stop) + boot_mesg "Deactivating all swap files/partitions..." + swapoff -a + evaluate_retval + ;; + + restart) + ${0} stop + sleep 1 + ${0} start + ;; + + status) + boot_mesg "Retrieving swap status." ${INFO} + echo_ok + echo + swapon -s + ;; + + *) + echo "Usage: ${0} {start|stop|restart|status}" + exit 1 + ;; +esac + +# End $rc_base/init.d/swap diff --git a/bootscripts/lfs/init.d/sysctl b/bootscripts/lfs/init.d/sysctl new file mode 100644 index 000000000..0d0b5c1b3 --- /dev/null +++ b/bootscripts/lfs/init.d/sysctl @@ -0,0 +1,39 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/sysctl +# +# Description : File uses /etc/sysctl.conf to set kernel runtime +# parameters +# +# Authors : Nathan Coulson (nathan@linuxfromscratch.org) +# Matthew Burgress (matthew@linuxfromscratch.org) +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +case "${1}" in + start) + if [ -f "/etc/sysctl.conf" ]; then + boot_mesg "Setting kernel runtime parameters..." + sysctl -q -p + evaluate_retval + fi + ;; + + status) + sysctl -a + ;; + + *) + echo "Usage: ${0} {start|status}" + exit 1 + ;; +esac + +# End $rc_base/init.d/sysctl diff --git a/bootscripts/lfs/init.d/sysklogd b/bootscripts/lfs/init.d/sysklogd new file mode 100644 index 000000000..e0a568ce6 --- /dev/null +++ b/bootscripts/lfs/init.d/sysklogd @@ -0,0 +1,57 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/sysklogd +# +# Description : Sysklogd loader +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +case "${1}" in + start) + boot_mesg "Starting system log daemon..." + loadproc syslogd -m 0 + + boot_mesg "Starting kernel log daemon..." + loadproc klogd + ;; + + stop) + boot_mesg "Stopping kernel log daemon..." + killproc klogd + + boot_mesg "Stopping system log daemon..." + killproc syslogd + ;; + + reload) + boot_mesg "Reloading system log daemon config file..." + reloadproc syslogd + ;; + + restart) + ${0} stop + sleep 1 + ${0} start + ;; + + status) + statusproc syslogd + statusproc klogd + ;; + + *) + echo "Usage: ${0} {start|stop|reload|restart|status}" + exit 1 + ;; +esac + +# End $rc_base/init.d/sysklogd diff --git a/bootscripts/lfs/init.d/template b/bootscripts/lfs/init.d/template new file mode 100644 index 000000000..69dc2a6a2 --- /dev/null +++ b/bootscripts/lfs/init.d/template @@ -0,0 +1,50 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/ +# +# Description : +# +# Authors : +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +case "${1}" in + start) + boot_mesg "Starting..." + loadproc + ;; + + stop) + boot_mesg "Stopping..." + killproc + ;; + + reload) + boot_mesg "Reloading..." + reloadproc + ;; + + restart) + ${0} stop + sleep 1 + ${0} start + ;; + + status) + statusproc + ;; + + *) + echo "Usage: ${0} {start|stop|reload|restart|status}" + exit 1 + ;; +esac + +# End $rc_base/init.d/ diff --git a/bootscripts/lfs/init.d/udev b/bootscripts/lfs/init.d/udev new file mode 100644 index 000000000..03846e6f3 --- /dev/null +++ b/bootscripts/lfs/init.d/udev @@ -0,0 +1,77 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/udev +# +# Description : Udev cold-plugging script +# +# Authors : Zack Winkles, Alexander E. Patrakov +# +# Version : 00.02 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +case "${1}" in + start) + boot_mesg "Populating /dev with device nodes..." + if ! grep -q '[[:space:]]sysfs' /proc/mounts; then + echo_failure + boot_mesg -n "FAILURE:\n\nUnable to create" ${FAILURE} + boot_mesg -n " devices without a SysFS filesystem" + boot_mesg -n "\n\nAfter you press Enter, this system" + boot_mesg -n " will be halted and powered off." + boot_mesg -n "\n\nPress Enter to continue..." ${INFO} + boot_mesg "" ${NORMAL} + read ENTER + /etc/rc.d/init.d/halt stop + fi + + # Mount a temporary file system over /dev, so that any devices + # made or removed during this boot don't affect the next one. + # The reason we don't write to mtab is because we don't ever + # want /dev to be unavailable (such as by `umount -a'). + mount -n -t tmpfs tmpfs /dev -o mode=755 + if [ ${?} != 0 ]; then + echo_failure + boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE} + boot_mesg -n " onto /dev, this system will be halted." + boot_mesg -n "\n\nAfter you press Enter, this system" + boot_mesg -n " will be halted and powered off." + boot_mesg -n "\n\nPress Enter to continue..." ${INFO} + boot_mesg "" ${NORMAL} + read ENTER + /etc/rc.d/init.d/halt stop + fi + + # Udev handles uevents itself, so we don't need to have + # the kernel call out to any binary in response to them + echo > /proc/sys/kernel/hotplug + + # Copy static device nodes to /dev + cp -a /lib/udev/devices/* /dev + + # Start the udev daemon to continually watch for, and act on, + # uevents + /sbin/udevd --daemon + + # Now traverse /sys in order to "coldplug" devices that have + # already been discovered + /sbin/udevadm trigger + + # Now wait for udevd to process the uevents we triggered + /sbin/udevadm settle + evaluate_retval + + ;; + + *) + echo "Usage ${0} {start}" + exit 1 + ;; +esac + +# End $rc_base/init.d/udev diff --git a/bootscripts/lfs/init.d/udev_retry b/bootscripts/lfs/init.d/udev_retry new file mode 100644 index 000000000..8ce819e9e --- /dev/null +++ b/bootscripts/lfs/init.d/udev_retry @@ -0,0 +1,45 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/udev_retry +# +# Description : Udev cold-plugging script (retry) +# +# Authors : Alexander E. Patrakov +# +# Version : 00.02 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +case "${1}" in + start) + boot_mesg "Retrying failed uevents, if any..." + + # From Debian: "copy the rules generated before / was mounted + # read-write": + for file in /dev/.udev/tmp-rules--*; do + dest=${file##*tmp-rules--} + [ "$dest" = '*' ] && break + cat $file >> /etc/udev/rules.d/$dest + rm -f $file + done + + # Re-trigger the failed uevents in hope they will succeed now + /sbin/udevadm trigger --retry-failed + + # Now wait for udevd to process the uevents we triggered + /sbin/udevadm settle + evaluate_retval + ;; + + *) + echo "Usage ${0} {start}" + exit 1 + ;; +esac + +# End $rc_base/init.d/udev_retry diff --git a/bootscripts/lfs/sysconfig/createfiles b/bootscripts/lfs/sysconfig/createfiles new file mode 100644 index 000000000..8d1f89dc6 --- /dev/null +++ b/bootscripts/lfs/sysconfig/createfiles @@ -0,0 +1,28 @@ +######################################################################## +# Begin /etc/sysconfig/createfiles +# +# Description : Createfiles script config file +# +# Authors : +# +# Version : 00.00 +# +# Notes : The syntax of this file is as follows: +# if type is equal to "file" or "dir" +# <filename> <type> <permissions> <user> <group> +# if type is equal to "dev" +# <filename> <type> <permissions> <user> <group> <devtype> <major> <minor> +# +# <filename> is the name of the file which is to be created +# <type> is either file, dir, or dev. +# file creates a new file +# dir creates a new directory +# dev creates a new device +# <devtype> is either block, char or pipe +# block creates a block device +# char creates a character deivce +# pipe creates a pipe, this will ignore the <major> and <minor> fields +# <major> and <minor> are the major and minor numbers used for the device. +######################################################################## + +# End /etc/sysconfig/createfiles diff --git a/bootscripts/lfs/sysconfig/modules b/bootscripts/lfs/sysconfig/modules new file mode 100644 index 000000000..1c8493d45 --- /dev/null +++ b/bootscripts/lfs/sysconfig/modules @@ -0,0 +1,18 @@ +######################################################################## +# Begin /etc/sysconfig/modules +# +# Description : Module auto-loading configuration +# +# Authors : +# +# Version : 00.00 +# +# Notes : The syntax of this file is as follows: +# <module> [<arg1> <arg2> ...] +# +# Each module should be on it's own line, and any options that you want +# passed to the module should follow it. The line deliminator is either +# a space or a tab. +######################################################################## + +# End /etc/sysconfig/modules diff --git a/bootscripts/lfs/sysconfig/network-devices/ifdown b/bootscripts/lfs/sysconfig/network-devices/ifdown new file mode 100644 index 000000000..b836cb8ef --- /dev/null +++ b/bootscripts/lfs/sysconfig/network-devices/ifdown @@ -0,0 +1,95 @@ +#!/bin/sh +######################################################################## +# Begin $network_devices/ifdown +# +# Description : Interface Down +# +# Authors : Nathan Coulson - nathan@linuxfromscratch.org +# Kevin P. Fleming - kpfleming@linuxfromscratch.org +# +# Version : 00.01 +# +# Notes : the IFCONFIG variable is passed to the scripts found +# in the services directory, to indicate what file the +# service should source to get environmental variables. +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +# Collect a list of configuration files for our interface +if [ -n "${2}" ]; then + for file in ${@#$1}; do # All parameters except $1 + FILES="${FILES} ${network_devices}/ifconfig.${1}/${file}" + done +elif [ -d "${network_devices}/ifconfig.${1}" ]; then + FILES=`echo ${network_devices}/ifconfig.${1}/*` +else + FILES="${network_devices}/ifconfig.${1}" +fi + +# Reverse the order configuration files are processed in +for file in ${FILES}; do + FILES2="${file} ${FILES2}" +done +FILES=${FILES2} + +# Process each configuration file +for file in ${FILES}; do + # skip backup files + if [ "${file}" != "${file%""~""}" ]; then + continue + fi + + if [ ! -f "${file}" ]; then + boot_mesg "${file} is not a network configuration file or directory." ${WARNING} + echo_warning + continue + fi + ( + . ${file} + + # Will not process this service if started by boot, and ONBOOT + # is not set to yes + if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then + continue + fi + + # Will not process this service if started by hotplug, and + # ONHOTPLUG is not set to yes + if [ "${IN_HOTPLUG}" = "1" -a "${ONHOTPLUG}" != "yes" ]; then + continue + fi + + # This will run the service script, if SERVICE is set + if [ -n "${SERVICE}" -a -x "${network_devices}/services/${SERVICE}" ]; then + if ip link show ${1} > /dev/null 2>&1 + then + IFCONFIG=${file} ${network_devices}/services/${SERVICE} ${1} down + else + boot_mesg "Interface ${1} doesn't exist." ${WARNING} + echo_warning + fi + else + boot_mesg -n "Unable to process ${file}. Either" ${FAILURE} + boot_mesg -n " the SERVICE variable was not set," + boot_mesg " or the specified service cannot be executed." + echo_failure + continue + fi + ) +done + +if [ -z "${2}" ]; then + link_status=`ip link show $1` + if [ -n "${link_status}" ]; then + if echo "${link_status}" | grep -q UP; then + boot_mesg "Bringing down the ${1} interface..." + ip link set ${1} down + evaluate_retval + fi + fi +fi + +# End $network_devices/ifdown diff --git a/bootscripts/lfs/sysconfig/network-devices/ifup b/bootscripts/lfs/sysconfig/network-devices/ifup new file mode 100644 index 000000000..c9dfe2fb9 --- /dev/null +++ b/bootscripts/lfs/sysconfig/network-devices/ifup @@ -0,0 +1,89 @@ +#!/bin/sh +######################################################################## +# Begin $network_devices/ifup +# +# Description : Interface Up +# +# Authors : Nathan Coulson - nathan@linuxfromscratch.org +# Kevin P. Fleming - kpfleming@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : the IFCONFIG variable is passed to the scripts found +# in the services directory, to indicate what file the +# service should source to get environmental variables. +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +# Collect a list of configuration files for our interface +if [ -n "${2}" ]; then + for file in ${@#$1} # All parameters except $1 + do + FILES="${FILES} ${network_devices}/ifconfig.${1}/${file}" + done +elif [ -d "${network_devices}/ifconfig.${1}" ]; then + FILES=`echo ${network_devices}/ifconfig.${1}/*` +else + FILES="${network_devices}/ifconfig.${1}" +fi + +boot_mesg "Bringing up the ${1} interface..." +boot_mesg_flush + +# Process each configruation file +for file in ${FILES}; do + # skip backup files + if [ "${file}" != "${file%""~""}" ]; then + continue + fi + + if [ ! -f "${file}" ]; then + boot_mesg "${file} is not a network configuration file or directory." ${WARNING} + echo_warning + continue + fi + + ( + . ${file} + + # Will not process this service if started by boot, and ONBOOT + # is not set to yes + if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then + continue + fi + # Will not process this service if started by hotplug, and + # ONHOTPLUG is not set to yes + if [ "${IN_HOTPLUG}" = "1" -a "${ONHOTPLUG}" != "yes" -a "${HOSTNAME}" != "(none)" ]; then + continue + fi + + if [ -n "${SERVICE}" -a -x "${network_devices}/services/${SERVICE}" ]; then + if [ -z "${CHECK_LINK}" -o "${CHECK_LINK}" = "y" -o "${CHECK_LINK}" = "yes" -o "${CHECK_LINK}" = "1" ]; then + if ip link show ${1} > /dev/null 2>&1; then + link_status=`ip link show ${1}` + if [ -n "${link_status}" ]; then + if ! echo "${link_status}" | grep -q UP; then + ip link set ${1} up + fi + fi + else + boot_mesg "Interface ${1} doesn't exist." ${WARNING} + echo_warning + continue + fi + fi + IFCONFIG=${file} ${network_devices}/services/${SERVICE} ${1} up + else + boot_mesg "Unable to process ${file}. Either" ${FAILURE} + boot_mesg " the SERVICE variable was not set," + boot_mesg " or the specified service cannot be executed." + echo_failure + continue + fi + ) +done + +# End $network_devices/ifup diff --git a/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static b/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static new file mode 100644 index 000000000..a550d3d2a --- /dev/null +++ b/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static @@ -0,0 +1,82 @@ +#!/bin/sh +######################################################################## +# Begin $network_devices/services/ipv4-static +# +# Description : IPV4 Static Boot Script +# +# Authors : Nathan Coulson - nathan@linuxfromscratch.org +# Kevin P. Fleming - kpfleming@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} +. ${IFCONFIG} + +if [ -z "${IP}" ]; then + boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE} + echo_failure + exit 1 +fi + +if [ -z "${PREFIX}" -a -z "${PEER}" ]; then + boot_mesg -n "PREFIX variable missing from ${IFCONFIG}," ${WARNING} + boot_mesg " assuming 24." + echo_warning + PREFIX=24 + args="${args} ${IP}/${PREFIX}" +elif [ -n "${PREFIX}" -a -n "${PEER}" ]; then + boot_mesg "PREFIX and PEER both specified in ${IFCONFIG}, cannot continue." ${FAILURE} + echo_failure + exit 1 +elif [ -n "${PREFIX}" ]; then + args="${args} ${IP}/${PREFIX}" +elif [ -n "${PEER}" ]; then + args="${args} ${IP} peer ${PEER}" +fi + +if [ -n "${BROADCAST}" ]; then + args="${args} broadcast ${BROADCAST}" +fi + +case "${2}" in + up) + boot_mesg "Adding IPv4 address ${IP} to the ${1} interface..." + ip addr add ${args} dev ${1} + evaluate_retval + + if [ -n "${GATEWAY}" ]; then + if ip route | grep -q default; then + boot_mesg "Gateway already setup; skipping." ${WARNING} + echo_warning + else + boot_mesg "Setting up default gateway..." + ip route add default via ${GATEWAY} dev ${1} + evaluate_retval + fi + fi + ;; + + down) + if [ -n "${GATEWAY}" ]; then + boot_mesg "Removing default gateway..." + ip route del default + evaluate_retval + fi + + boot_mesg "Removing IPv4 address ${IP} from the ${1} interface..." + ip addr del ${args} dev ${1} + evaluate_retval + ;; + + *) + echo "Usage: ${0} [interface] {up|down}" + exit 1 + ;; +esac + +# End $network_devices/services/ipv4-static diff --git a/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static-route b/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static-route new file mode 100644 index 000000000..378b1deff --- /dev/null +++ b/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static-route @@ -0,0 +1,97 @@ +#!/bin/sh +######################################################################## +# Begin $network_devices/services/ipv4-static-route +# +# Description : IPV4 Static Route Script +# +# Authors : Kevin P. Fleming - kpfleming@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} +. ${IFCONFIG} + +case "${TYPE}" in + ("" | "network") + need_ip=1 + need_gateway=1 + ;; + + ("default") + need_gateway=1 + args="${args} default" + desc="default" + ;; + + ("host") + need_ip=1 + ;; + + ("unreachable") + need_ip=1 + args="${args} unreachable" + desc="unreachable " + ;; + + (*) + boot_mesg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue." ${FAILURE} + echo_failure + exit 1 + ;; +esac + +if [ -n "${need_ip}" ]; then + if [ -z "${IP}" ]; then + boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE} + echo_failure + exit 1 + fi + + if [ -z "${PREFIX}" ]; then + boot_mesg "PREFIX variable missing from ${IFCONFIG}, cannot continue." ${FAILURE} + echo_failure + exit 1 + fi + + args="${args} ${IP}/${PREFIX}" + desc="${desc}${IP}/${PREFIX}" +fi + +if [ -n "${need_gateway}" ]; then + if [ -z "${GATEWAY}" ]; then + boot_mesg "GATEWAY variable missing from ${IFCONFIG}, cannot continue." ${FAILURE} + echo_failure + exit 1 + fi + args="${args} via ${GATEWAY}" +fi + +if [ -n "${SOURCE}" ]; then + args="${args} src ${SOURCE}" +fi + +case "${2}" in + up) + boot_mesg "Adding '${desc}' route to the ${1} interface..." + ip route add ${args} dev ${1} + evaluate_retval + ;; + + down) + boot_mesg "Removing '${desc}' route from the ${1} interface..." + ip route del ${args} dev ${1} + evaluate_retval + ;; + + *) + echo "Usage: ${0} [interface] {up|down}" + exit 1 + ;; +esac + +# End $network_devices/services/ipv4-static-route diff --git a/bootscripts/lfs/sysconfig/rc b/bootscripts/lfs/sysconfig/rc new file mode 100644 index 000000000..2333ff488 --- /dev/null +++ b/bootscripts/lfs/sysconfig/rc @@ -0,0 +1,18 @@ +######################################################################## +# Begin /etc/sysconfig/rc +# +# Description : rc script configuration +# +# Authors : +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +rc_base=/etc/rc.d +rc_functions=${rc_base}/init.d/functions +network_devices=/etc/sysconfig/network-devices + +# End /etc/sysconfig/rc diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 573978d68..ecb10ad34 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -34,20 +34,408 @@ </listitem> </itemizedlist> </listitem> + --> <listitem> + <para>2008-10-18</para> + <itemizedlist> + <listitem> + <para>[jhuntwork] - Fixed build locations of m4 so that it links against the + glibc built in /tools and so that no packages in chapter 6 hard-code references + to the temporarly location. Also made m4 a host prerequisite.</para> + </listitem> + </itemizedlist> + </listitem> + + + <listitem> + <para>2008-10-15</para> + <itemizedlist> + <listitem> + <para>[bdubbs] - Added --disable-libssp to glibc Pass 1 in Chapter 5 + to eliminate a build failure on some systems.</para> + </listitem> + <listitem> + <para>[dj] - Updated to udev-config-20081015.</para> + </listitem> + <listitem> + <para>[dj] - Modified udev instructions following upstream + recommendations.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para>2008-10-13</para> + <itemizedlist> + <listitem> + <para>[randy] - Modified the Chapter 5 instructions so that instead + of building the GMP and MPFR packages separately for GCC Pass2, they + are built by GCC internally.</para> + </listitem> + <listitem> + <para>[randy] - Added a configure option to the Chapter 6 Gettext + instructions so that the documentation is installed in a versioned + directory.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para>2008-10-12</para> + <itemizedlist> + <listitem> + <para>[dj] - Updated to E2fsprogs-1.41.2.</para> + </listitem> + <listitem> + <para>[dj] - Corrected installation prefixes of Iproute2 + package with DESTDIR and MANDIR paths. Thanks to Steffen Pankratz + for the fix.</para> + </listitem> + <listitem> + <para>[randy] - Modified the Chapter 6 GMP instructions to include a + method for determining all the tests in the test suite passed.</para> + </listitem> + <listitem> + <para>[randy] - Modified the GCC search for correct headers command + to account for the new include-fixed directory.</para> + </listitem> + <listitem> + <para>[randy] - Added a patch to the Chapter 6 Binutils instructions + to correct some errors in the test suite.</para> + </listitem> + <listitem> + <para>[dj] - Corrected installation of udev rule files.</para> + </listitem> + <listitem> + <para>[randy] - Moved the Chapter 6 M4 installation into alphabetical + order as it is installed in Chapter 5 now and therefore doesn't need + to precede the Bison installation.</para> + </listitem> + <listitem> + <para>[randy] - Moved the Chapter 5 M4 installation to before GCC + Pass1 so that the internal GCC build of GMP will not fail in case + M4 doesn't exist on the host. Also updated GCC's dependencies to + reflect GMP and MPFR.</para> + </listitem> + <listitem> + <para>[dj] - Changed Chapter 5 GCC Pass 1 build to static. Thanks to + Jeremy Huntwork for the suggestion and supporting text.</para> + </listitem> + <listitem> + <para>[dj] - Added note to Chapter 6 GCC about the new include-fixed + directory and changed the sample output to match.</para> + </listitem> + <listitem> + <para>[dj] - Added instruction to keep Chapter 5 Glibc from honoring + /etc/ld.so.preload. Thanks to Alexander Patrakov for the fix.</para> + </listitem> + <listitem> + <para>[randy] - Added descriptions of the configure options used + in the GMP instructions and updated the installed library + descriptions.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para>2008-10-11</para> + <itemizedlist> + <listitem> + <para>[dj] - Removed the Chapter 5 Glibc test suite information as + it requires a working C++ compiler to run.</para> + </listitem> + <listitem> + <para>[randy] - Added three configure parameters to the Chapter 6 + Util-linux-ng instructions so that additional programs are + installed. Also updated the installed programs list.</para> + </listitem> + <listitem> + <para>[randy] - Added a sed command to the Sysvinit instructions to + suppress the installation of the wall program and its man page as a + maintained version of this program is installed by + Util-linux-ng.</para> + </listitem> + <listitem> + <para>[randy] - Added commands to the Chapter 6 Binutils instructions + to suppress the installation of standards.info. Thanks to Greg + Schafer for contributing the fix.</para> + </listitem> + <listitem> + <para>[randy] - Added a patch to the Procps instructions to fix a + unicode related issue in the watch program.</para> + </listitem> + <listitem> + <para>[randy] - Added documentation installation commands to the + Chapter 6 Kbd instructions.</para> + </listitem> + <listitem> + <para>[randy] - Modified the IPRoute2 installation command so that the + docs are installed in a versioned directory.</para> + </listitem> + <listitem> + <para>[randy] - Modified the Groff installation command so that the + docs are installed in a standardized versioned directory.</para> + </listitem> + <listitem> + <para>[randy] - Added documentation installation commands to the + Chapter 6 Gawk instructions.</para> + </listitem> + <listitem> + <para>[randy] - Added commands to the Chapter 6 Flex instructions + to install a .pdf doc file.</para> + </listitem> + <listitem> + <para>[randy] - Added a parameter to the configure command in the + Automake instructions so that docs are installed in a versioned + directory.</para> + </listitem> + <listitem> + <para>[randy] - Updated Module-Init-Tools to 3.4.1.</para> + </listitem> + <listitem> + <para>[randy] - Added documentation installation commands to the + Chapter 6 Readline instructions.</para> + </listitem> + <listitem> + <para>[randy] - Added documentation installation commands to the + Chapter 6 Ncurses instructions.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para>2008-10-10</para> + <itemizedlist> + <listitem> + <para>[randy] - Added documentation enhancements to the E2fsprogs + package.</para> + </listitem> + <listitem> + <para>[randy] - Removed an unnecessary parameter from the + Util-linux-ng Chapter 6 make command. Thanks to Greg Schafer for + pointing it out.</para> + </listitem> + <listitem> + <para>[randy] - Updated the Perl instructions. Thanks to Greg Schafer + for pointing out the issues. This change also required that the Zlib + package is built right before the Perl package in Chapter 6.</para> + </listitem> + <listitem> + <para>[randy] - Updated Vim to 7.2.</para> + </listitem> + <listitem> + <para>[randy] - Updated Udev to 130.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para>2008-10-09</para> + <itemizedlist> + <listitem> + <para>[randy] - Updated File to 4.26</para> + </listitem> + <listitem> + <para>[randy] - Updated Shadow to 4.1.2.1.</para> + </listitem> + <listitem> + <para>[randy] - Updated Man-DB to 2.5.2.</para> + </listitem> + <listitem> + <para>[randy] - Updated Iproute to 2.6.26.</para> + </listitem> + <listitem> + <para>[randy] - Added a command to the Inetutils instructions to + correct an issue with GCC-&gcc-version;.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para>2008-10-07</para> + <itemizedlist> + <listitem> + <para>[randy] - Updated Autoconf to 2.63.</para> + </listitem> + <listitem> + <para>[randy] - Updated Libtool to 2.2.6a.</para> + </listitem> + <listitem> + <para>[randy] - Corrected the instruction to untar the E2fsprogs + tarball in Section 2.3. Thanks to William Immendorf for pointing + out the error.</para> + </listitem> + <listitem> + <para>[randy] - Updated Berkeley DB to 4.7.25.</para> + </listitem> + <listitem> + <para>[randy] - Updated Man-pages to 3.11.</para> + </listitem> + <listitem> + <para>[randy] - Updated Util-linux-ng to 2.14.1.</para> + </listitem> + <listitem> + <para>[randy] - Updated Texinfo to 4.13.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para>2008-10-06</para> + <itemizedlist> + <listitem> + <para>[robert] - Added -v to the cp command in the Chapter 5 Expect + instructions.</para> + </listitem> + <listitem> + <para>[randy] - Updated Tar to 1.20.</para> + </listitem> + <listitem> + <para>[randy] - Updated Perl to 5.10.0.</para> + </listitem> + <listitem> + <para>[randy] - Updated M4 to 1.4.11 and added it to the Chapter 5 + build as it is required by the GMP package in Chapter 6.</para> + </listitem> + <listitem> + <para>[randy] - Updated Findutils to 4.4.0.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para>2008-10-05</para> + <itemizedlist> + <listitem> + <para>[randy] - Updated E2fsprogs to 1.41.1.</para> + </listitem> + <listitem> + <para>[randy] - Added the Mktemp-1.5 package to the list of + removed items in the Chapter3 'What's new ...' page.</para> + </listitem> + <listitem> + <para>[randy] - Updated Coreutils to 6.12. Thanks to William + Immendorf for contributing a patch to add the mktemp program + information to the Coreutils page.</para> + </listitem> + <listitem> + <para>[randy] - Updated the Bash Fixes patch to the -8 version.</para> + </listitem> + <listitem> + <para>[randy] - Added a patch to the Expect instructions to fix an + issue with recent Tcl versions.</para> + </listitem> + <listitem> + <para>[randy] - Updated Tcl to 8.5.4.</para> + </listitem> + <listitem> + <para>[randy] - Updated the Linux kernel to 2.6.26.5.</para> + </listitem> + <listitem> + <para>[randy] - Updated Glibc to a 2.8 snapshot taken on + 9/29/2008. The tarball of this snapshot includes the libidn + data that previously was separately packaged.</para> + </listitem> + <listitem> + <para>[randy] - Added the GMP and MPFR packages to the list of + packages in Chapter 3. Thanks to Lefteris Dimitroulakis for + pointing out the omission.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para>2008-10-03</para> + <itemizedlist> + <listitem> + <para>[bdubbs] - Added version check for Perl in Host System + Requirements.</para> + </listitem> + <listitem> + <para>[randy] - Updated GCC to 4.3.2 which includes adding the + GMP-4.2.4 and MPFR-2.3.2 packages. This new version of GCC requires + the added packages. Thanks to DJ Lucas for the stimulus and initial + work resulting in this and all of the other package updates coming + up.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para>2008-07-11</para> + <itemizedlist> + <listitem> + <para>[ken] - Belatedly fixed known vulnerabilities in perl.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para>2008-06-03</para> + <itemizedlist> + <listitem> + <para>[bdubbs] - Added udev-config scripts to appendices.</para> + </listitem> + <listitem> + <para>[bdubbs] - Added lfs-bootscripts to appendices.</para> + </listitem> + <listitem> + <para>[bdubbs] - Updated license to Creative Commons with + extracted code under the MIT license.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para>2008-05-23</para> + <itemizedlist> + <listitem> + <para>[bryan] - Install a few extra rules from the + etc/udev/packages directory in udev. Thanks to Dan + Nicholson for noticing the issue.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para>2008-05-22</para> + <itemizedlist> + <listitem> + <para>[bryan] - Updated Udev to 122, udev-config to + 20080522, and lfs-bootscripts to 20080522. Also made + persistent-net rules able to be pre-generated, using + udevadm test. Fixes #2057, #2079 (I think), #2170, and + #2186.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> <para>2008-04-23</para> <itemizedlist> - <listitem> - <para>[jhuntwork] - Fixed behavior in kbd where man pages + <listitem> + <para>[jhuntwork] - Use -mtune=native for glibc. We don't + want our libc optimized for 486. It should be optimized + for the local machine.</para> + </listitem> + <listitem> + <para>[jhuntwork] - Updated Autoconf to 2.62.</para> + </listitem> + <listitem> + <para>[jhuntwork] - Updated E2fsprogs to 1.40.8. Fixes #2173. + </para> + </listitem> + <listitem> + <para>[jhuntwork] - Fixed behavior in kbd where man pages for optional programs that aren't built are installed. - Thanks Greg Schafer for spotting this. - </para> - </listitem> + Thanks Greg Schafer for spotting this. + </para> + </listitem> <listitem> <para>[jhuntwork] - Fixed kbd to install getkeycodes, - setkeycodes and resizecons. Also moved loadkeys to /bin from + setkeycodes and resizecons. Also moved loadkeys to /bin from /usr/bin. Thanks, Greg Schafer.</para> </listitem> </itemizedlist> diff --git a/chapter01/whatsnew.xml b/chapter01/whatsnew.xml index f20fb6364..5d06c4df6 100644 --- a/chapter01/whatsnew.xml +++ b/chapter01/whatsnew.xml @@ -29,9 +29,9 @@ </listitem> --> - <!--<listitem> + <listitem> <para>Autoconf &autoconf-version;</para> - </listitem>--> + </listitem> <listitem> <para>Automake &automake-version;</para> </listitem> @@ -50,9 +50,9 @@ <!--<listitem> <para>Bzip2 &bzip2-version;</para> </listitem>--> - <!--<listitem> + <listitem> <para>Coreutils &coreutils-version;</para> - </listitem>--> + </listitem> <!--<listitem> <para>DejaGNU &dejagnu-version;</para> </listitem>--> @@ -86,6 +86,9 @@ <listitem> <para>Glibc &glibc-version;</para> </listitem> + <!-- <listitem> + <para>GMP &gmp-version;</para> + </listitem> --> <listitem> <para>Grep &grep-version;</para> </listitem> @@ -122,9 +125,9 @@ <listitem> <para>Linux &linux-version;</para> </listitem> - <!--<listitem> + <listitem> <para>M4 &m4-version;</para> - </listitem>--> + </listitem> <!--<listitem> <para>Make &make-version;</para> </listitem>--> @@ -140,15 +143,18 @@ <listitem> <para>Module-Init-Tools &module-init-tools-version;</para> </listitem> + <!-- <listitem> + <para>MPFR &mpfr-version;</para> + </listitem> --> <!--<listitem> <para>Ncurses &ncurses-version;</para> </listitem>--> <!--<listitem> <para>Patch &patch-version;</para> </listitem>--> - <!--<listitem> + <listitem> <para>Perl &perl-version;</para> - </listitem>--> + </listitem> <!--<listitem> <para>Procps &procps-version;</para> </listitem>--> @@ -161,9 +167,9 @@ <!--<listitem> <para>Sed &sed-version;</para> </listitem>--> - <!--<listitem> + <listitem> <para>Shadow &shadow-version;</para> - </listitem>--> + </listitem> <listitem> <para>Sysklogd &sysklogd-version;</para> </listitem> @@ -179,18 +185,18 @@ <listitem> <para>Texinfo &texinfo-version;</para> </listitem> - <!--<listitem> + <listitem> <para>Udev &udev-version;</para> - </listitem>--> + </listitem> <listitem> <para>&udev-config;</para> </listitem> <listitem> <para>Util-Linux-NG &util-linux-ng-version;</para> </listitem> - <!--<listitem> + <listitem> <para>Vim &vim-version;</para> - </listitem>--> + </listitem> <!--<listitem> <para>Zlib &zlib-version;</para> </listitem>--> @@ -213,10 +219,38 @@ </listitem> <listitem> + <para>&binutils-configure-patch;</para> + </listitem> + + <listitem> + <para>&binutils-gcc-patch;</para> + </listitem> + + <listitem> + <para>&coreutils-old-kernel-patch;</para> + </listitem> + + <listitem> <para>&db-fixes-patch;</para> </listitem> <listitem> + <para>&expect-tcl-patch;</para> + </listitem> + + <listitem> + <para>GMP-&gmp-version;</para> + </listitem> + + <listitem> + <para>&glibc-iconv-test-fixes-patch;</para> + </listitem> + + <listitem> + <para>&glibc-ildoubl-test-fix-patch;</para> + </listitem> + + <listitem> <para>&grep-debian-patch;</para> </listitem> @@ -225,15 +259,35 @@ </listitem> <listitem> + <para>M4 to the Chapter 5 build</para> + </listitem> + + <listitem> <para>&module-init-manpages-patch;</para> </listitem> <listitem> - <para>&readline-fixes-patch;</para> + <para>MPFR-&mpfr-version;</para> + </listitem> + + <listitem> + <para>&perl-libc-patch;</para> + </listitem> + + <listitem> + <para>&perl-page-patch;</para> + </listitem> + + <listitem> + <para>&perl-security-patch;</para> </listitem> <listitem> - <para>&udev-usbid-patch;</para> + <para>&procps-watch-patch;</para> + </listitem> + + <listitem> + <para>&readline-fixes-patch;</para> </listitem> <listitem> @@ -250,7 +304,11 @@ </listitem> <listitem> - <para>db-4.5.29-fixes-1.patch</para> + <para>coreutils-6.10-i18n-1.patch</para> + </listitem> + + <listitem> + <para>db-4.5.20-fixes-1.patch</para> </listitem> <listitem> @@ -274,11 +332,23 @@ </listitem> <listitem> + <para>mktemp 1.5</para> + </listitem> + + <listitem> <para>module-init-tools-3.2.2-modprobe-1.patch</para> </listitem> <listitem> - <para>readline-5.4-fixes-4.patch</para> + <para>perl-5.8.8-libc-2.patch</para> + </listitem> + + <listitem> + <para>readline-5.2-fixes-3.patch</para> + </listitem> + + <listitem> + <para>shadow-4.0.18.1-useradd_fix-2.patch</para> </listitem> <listitem> @@ -290,7 +360,11 @@ </listitem> <listitem> - <para>vim-7.1-fixes-1.patch</para> + <para>Util-linux 2.12r</para> + </listitem> + + <listitem> + <para>vim-7.1-fixes-6.patch</para> </listitem> </itemizedlist> diff --git a/chapter02/creatingfilesystem.xml b/chapter02/creatingfilesystem.xml index 57ca2d142..51fbc1fd7 100644 --- a/chapter02/creatingfilesystem.xml +++ b/chapter02/creatingfilesystem.xml @@ -51,7 +51,7 @@ resulting binaries to re-create the filesystem on your LFS partition:</para> <screen role="nodump"><userinput>cd /tmp -tar -xjvf /path/to/sources/e2fsprogs-&e2fsprogs-version;.tar.bz2 +tar -xzvf /path/to/sources/e2fsprogs-&e2fsprogs-version;.tar.gz cd e2fsprogs-&e2fsprogs-version; mkdir -v build cd build diff --git a/chapter03/packages.xml b/chapter03/packages.xml index fd51aa359..dee6b6763 100644 --- a/chapter03/packages.xml +++ b/chapter03/packages.xml @@ -203,13 +203,22 @@ </listitem> </varlistentry> - <varlistentry> + <!-- <varlistentry> <term>Glibc LibIDN add-on (&glibc-libidn-version;) - <token>&glibc-libidn-size;</token>:</term> <listitem> <para>Home page: <ulink url="&glibc-libidn-home;"/></para> <para>Download: <ulink url="&glibc-libidn-url;"/></para> <para>MD5 sum: <literal>&glibc-libidn-md5;</literal></para> </listitem> + </varlistentry> --> + + <varlistentry> + <term>GMP (&gmp-version;) - <token>&gmp-size;</token>:</term> + <listitem> + <para>Home page: <ulink url="&gmp-home;"/></para> + <para>Download: <ulink url="&gmp-url;"/></para> + <para>MD5 sum: <literal>&gmp-md5;</literal></para> + </listitem> </varlistentry> <varlistentry> @@ -363,14 +372,14 @@ </listitem> </varlistentry> - <varlistentry> + <!-- <varlistentry> <term>Mktemp (&mktemp-version;) - <token>&mktemp-size;</token>:</term> <listitem> <para>Home page: <ulink url="&mktemp-home;"/></para> <para>Download: <ulink url="&mktemp-url;"/></para> <para>MD5 sum: <literal>&mktemp-md5;</literal></para> </listitem> - </varlistentry> + </varlistentry> --> <varlistentry> <term>Module-Init-Tools (&module-init-tools-version;) - <token>&module-init-tools-size;</token>:</term> @@ -382,6 +391,15 @@ </varlistentry> <varlistentry> + <term>MPFR (&mpfr-version;) - <token>&mpfr-size;</token>:</term> + <listitem> + <para>Home page: <ulink url="&mpfr-home;"/></para> + <para>Download: <ulink url="&mpfr-url;"/></para> + <para>MD5 sum: <literal>&mpfr-md5;</literal></para> + </listitem> + </varlistentry> + + <varlistentry> <term>Ncurses (&ncurses-version;) - <token>&ncurses-size;</token>:</term> <listitem> <para>Home page: <ulink url="&ncurses-home;"/></para> diff --git a/chapter03/patches.xml b/chapter03/patches.xml index 5a3a7b6b6..2c6f19aa4 100644 --- a/chapter03/patches.xml +++ b/chapter03/patches.xml @@ -43,6 +43,14 @@ </varlistentry> <varlistentry> + <term>Binutils GCC 4.3 Patch - <token>&binutils-gcc-patch-size;</token>:</term> + <listitem> + <para>Download: <ulink url="&patches-root;&binutils-gcc-patch;"/></para> + <para>MD5 sum: <literal>&binutils-gcc-patch-md5;</literal></para> + </listitem> + </varlistentry> + + <varlistentry> <term>Binutils Texinfo Version Patch - <token>&binutils-configure-patch-size;</token>:</term> <listitem> <para>Download: <ulink url="&patches-root;&binutils-configure-patch;"/></para> @@ -58,12 +66,20 @@ </listitem> </varlistentry> - <varlistentry> + <!-- <varlistentry> <term>Coreutils Internationalization Fixes Patch - <token>&coreutils-i18n-patch-size;</token>:</term> <listitem> <para>Download: <ulink url="&patches-root;&coreutils-i18n-patch;"/></para> <para>MD5 sum: <literal>&coreutils-i18n-patch-md5;</literal></para> </listitem> + </varlistentry> --> + + <varlistentry> + <term>Coreutils Old Kernel Patch - <token>&coreutils-old-kernel-patch-size;</token>:</term> + <listitem> + <para>Download: <ulink url="&patches-root;&coreutils-old-kernel-patch;"/></para> + <para>MD5 sum: <literal>&coreutils-old-kernel-patch-md5;</literal></para> + </listitem> </varlistentry> <varlistentry> @@ -91,7 +107,31 @@ </varlistentry> <varlistentry> - <term>Grep Debian Patch - <token>&grep-debian-patch-size;</token>;</term> + <term>Expect Tcl Patch - <token>&expect-tcl-patch-size;</token>:</term> + <listitem> + <para>Download: <ulink url="&patches-root;&expect-tcl-patch;"/></para> + <para>MD5 sum: <literal>&expect-tcl-patch-md5;</literal></para> + </listitem> + </varlistentry> + + <varlistentry> + <term>Glibc Iconv Test Fixes Patch - <token>&glibc-iconv-test-fixes-patch-size;</token>:</term> + <listitem> + <para>Download: <ulink url="&patches-root;&glibc-iconv-test-fixes-patch;"/></para> + <para>MD5 sum: <literal>&glibc-iconv-test-fixes-patch-md5;</literal></para> + </listitem> + </varlistentry> + + <varlistentry> + <term>Glibc Ildoubl Test Fix Patch - <token>&glibc-ildoubl-test-fix-patch-size;</token>:</term> + <listitem> + <para>Download: <ulink url="&patches-root;&glibc-ildoubl-test-fix-patch;"/></para> + <para>MD5 sum: <literal>&glibc-ildoubl-test-fix-patch-md5;</literal></para> + </listitem> + </varlistentry> + + <varlistentry> + <term>Grep Debian Patch - <token>&grep-debian-patch-size;</token>:</term> <listitem> <para>Download: <ulink url="&patches-root;&grep-debian-patch;"/></para> <para>MD5 sum: <literal>&grep-debian-patch-md5;</literal></para> @@ -163,30 +203,45 @@ </varlistentry> <varlistentry> - <term>Readline Fixes Patch - <token>&readline-fixes-patch-size;</token>:</term> + <term>Perl Page Patch - <token>&perl-page-patch-size;</token>:</term> <listitem> - <para>Download: <ulink url="&patches-root;&readline-fixes-patch;"/></para> - <para>MD5 sum: <literal>&readline-fixes-patch-md5;</literal></para> + <para>Download: <ulink url="&patches-root;&perl-page-patch;"/></para> + <para>MD5 sum: <literal>&perl-page-patch-md5;</literal></para> </listitem> </varlistentry> <varlistentry> - <term>Shadow Useradd Patch - <token>&shadow-useradd-patch-size;</token>:</term> + <term>Perl Security Patch - <token>&perl-security-patch-size;</token>:</term> <listitem> - <para>Download: <ulink url="&patches-root;&shadow-useradd-patch;"/></para> - <para>MD5 sum: <literal>&shadow-useradd-patch-md5;</literal></para> + <para>Download: <ulink url="&patches-root;&perl-security-patch;"/></para> + <para>MD5 sum: <literal>&perl-security-patch-md5;</literal></para> </listitem> </varlistentry> + <varlistentry> + <term>Procps Watch Patch - <token>&procps-watch-patch-size;</token>:</term> + <listitem> + <para>Download: <ulink url="&patches-root;&procps-watch-patch;"/></para> + <para>MD5 sum: <literal>&procps-watch-patch-md5;</literal></para> + </listitem> + </varlistentry> <varlistentry> - <term>Udev usb_id Segfault Patch - <token>&udev-usbid-patch-size;</token>:</term> + <term>Readline Fixes Patch - <token>&readline-fixes-patch-size;</token>:</term> <listitem> - <para>Download: <ulink url="&patches-root;&udev-usbid-patch;"/></para> - <para>MD5 sum: <literal>&udev-usbid-md5;</literal></para> + <para>Download: <ulink url="&patches-root;&readline-fixes-patch;"/></para> + <para>MD5 sum: <literal>&readline-fixes-patch-md5;</literal></para> </listitem> </varlistentry> + <!-- <varlistentry> + <term>Shadow Useradd Patch - <token>&shadow-useradd-patch-size;</token>:</term> + <listitem> + <para>Download: <ulink url="&patches-root;&shadow-useradd-patch;"/></para> + <para>MD5 sum: <literal>&shadow-useradd-patch-md5;</literal></para> + </listitem> + </varlistentry> --> + <varlistentry> <term>Vim Fixes Patch - <token>&vim-fixes-patch-size;</token>:</term> diff --git a/chapter05/chapter05.xml b/chapter05/chapter05.xml index 0340c16dd..5fa82f6da 100644 --- a/chapter05/chapter05.xml +++ b/chapter05/chapter05.xml @@ -21,6 +21,8 @@ <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="tcl.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="expect.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="dejagnu.xml"/> + <!-- <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gmp.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="mpfr.xml"/> --> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gcc-pass2.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="binutils-pass2.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="ncurses.xml"/> @@ -34,9 +36,7 @@ <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gettext.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="grep.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gzip.xml"/> -<!-- <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="m4.xml"/> - <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="bison.xml"/> - <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="flex.xml"/> --> + <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="m4.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="make.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="patch.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="perl.xml"/> diff --git a/chapter05/coreutils.xml b/chapter05/coreutils.xml index e763866ba..d36c0145f 100644 --- a/chapter05/coreutils.xml +++ b/chapter05/coreutils.xml @@ -43,6 +43,12 @@ <sect2 role="installation"> <title>Installation of Coreutils</title> + <para>There's an internal issue with Coreutils which makes some of the + programs behave abnormally if you build using an older kernel. Apply a + patch to fix the issue:</para> + +<screen><userinput remap="pre">patch -Np1 -i ../&coreutils-old-kernel-patch;</userinput></screen> + <para>Prepare Coreutils for compilation:</para> <screen><userinput remap="configure">./configure --prefix=/tools --enable-install-program=hostname</userinput></screen> diff --git a/chapter05/expect.xml b/chapter05/expect.xml index 6b486f138..7d389f448 100644 --- a/chapter05/expect.xml +++ b/chapter05/expect.xml @@ -46,13 +46,17 @@ <screen><userinput remap="pre">patch -Np1 -i ../&expect-spawn-patch;</userinput></screen> + <para>Next, fix a bug that is a result of recent Tcl changes:</para> + +<screen><userinput remap="pre">patch -Np1 -i ../&expect-tcl-patch;</userinput></screen> + <para>Next, force Expect's configure script to use <filename>/bin/stty</filename> instead of a <filename>/usr/local/bin/stty</filename> it may find on the host system. This will ensure that our testsuite tools remain sane for the final builds of our toolchain:</para> -<screen><userinput remap="pre">cp configure{,.bak} -sed 's:/usr/local/bin:/bin:' configure.bak > configure</userinput></screen> +<screen><userinput remap="pre">cp -v configure{,.orig} +sed 's:/usr/local/bin:/bin:' configure.orig > configure</userinput></screen> <para>Now prepare Expect for compilation:</para> diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml index 78fe83afb..8452e8b19 100644 --- a/chapter05/gcc-pass1.xml +++ b/chapter05/gcc-pass1.xml @@ -43,6 +43,15 @@ <sect2 role="installation"> <title>Installation of GCC</title> + <para>GCC now requires the GMP and MPFR packages. As these packages may + not be included in your host distribution, they will be built with + GCC.</para> + +<screen><userinput remap="pre">tar -jxf ../mpfr-&mpfr-version;.tar.bz2 +mv mpfr-&mpfr-version; mpfr +tar -jxf ../gmp-&gmp-version;.tar.bz2 +mv gmp-&gmp-version; gmp</userinput></screen> + <para>The GCC documentation recommends building GCC outside of the source directory in a dedicated build directory:</para> @@ -52,9 +61,8 @@ cd ../gcc-build</userinput></screen> <para>Prepare GCC for compilation:</para> <screen><userinput remap="configure">CC="gcc -B/usr/bin/" ../gcc-&gcc-version;/configure --prefix=/tools \ - --with-local-prefix=/tools --disable-nls --disable-shared \ - --enable-languages=c --disable-multilib \ - --disable-bootstrap</userinput></screen> + --with-local-prefix=/tools --disable-nls --disable-shared --disable-libssp \ + --enable-languages=c</userinput></screen> <variablelist> <title>The meaning of the configure options:</title> @@ -84,8 +92,9 @@ cd ../gcc-build</userinput></screen> <varlistentry> <term><parameter>--disable-shared</parameter></term> <listitem> - <para>This forces gcc to link its internal libraries statically. We do this - to avoid possible issues with the host system.</para> + <para>This switch forces GCC to link its internal libraries + statically. We do this to avoid possible issues with the host + system.</para> </listitem> </varlistentry> @@ -128,16 +137,15 @@ cd ../gcc-build</userinput></screen> <screen><userinput remap="install">make install</userinput></screen> - <para>Using <command>--disable-shared</command> means that the file - <filename class="libraryfile">libgcc_eh.a</filename> - isn't created and installed. The next package, Glibc, depends on this - library as it uses <command>-lgcc_eh</command> within its build system. - We can satisfy that dependency by creating a symlink to - <filename class="libraryfile">libgcc.a</filename>, since that file will - end up containing the objects normally contained in - <filename class="libraryfile">libgcc_eh.a</filename>.</para> + <para>Using <parameter>--disable-shared</parameter> means that the + <filename>libgcc_eh.a</filename> file isn't created and installed. The + Glibc package depends on this library as it uses + <parameter>-lgcc_eh</parameter> within its build system. We can satisfy + that dependency by creating a symlink to <filename>libgcc.a</filename>, + since that file will end up containing the objects normally contained in + <filename>libgcc_eh.a</filename>.</para> -<screen><userinput>ln -vs libgcc.a `gcc -print-libgcc-file-name | \ +<screen><userinput remap="install">ln -vs libgcc.a `gcc -print-libgcc-file-name | \ sed 's/libgcc/&_eh/'`</userinput></screen> <para>As a finishing touch, create a symlink. Many programs and scripts diff --git a/chapter05/gcc-pass2.xml b/chapter05/gcc-pass2.xml index b430f227e..9a47c483a 100644 --- a/chapter05/gcc-pass2.xml +++ b/chapter05/gcc-pass2.xml @@ -124,6 +124,14 @@ done</userinput></screen> sed '/MULTILIB_OSDIRNAMES/d' $file.orig > $file done</userinput></screen> + <para>As in the first build of GCC it requires the GMP and MPFR packages. + Unpack the tarballs and move them into the required directory names:</para> + +<screen><userinput remap="pre">tar -jxf ../mpfr-&mpfr-version;.tar.bz2 +mv mpfr-&mpfr-version; mpfr +tar -jxf ../gmp-&gmp-version;.tar.bz2 +mv gmp-&gmp-version; gmp</userinput></screen> + <para>Create a separate build directory again:</para> <screen><userinput remap="pre">mkdir -v ../gcc-build diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml index 49eb0f01d..3252c5a10 100644 --- a/chapter05/glibc.xml +++ b/chapter05/glibc.xml @@ -43,6 +43,11 @@ <sect2 role="installation"> <title>Installation of Glibc</title> + <para>Fix a potential issue if <filename>/etc/ld.so.preload</filename> is + used on the host system.</para> + +<screen><userinput remap="pre">sed -i 's@/etc/ld.so.preload@/tools/etc/ld.so.preload@' elf/rtld.c</userinput></screen> + <para>The Glibc documentation recommends building Glibc outside of the source directory in a dedicated build directory:</para> @@ -159,30 +164,8 @@ esac</userinput></screen> <screen><userinput remap="make">make</userinput></screen> - <para>Compilation is now complete. As mentioned earlier, running the - test suites for the temporary tools installed in this chapter is not - mandatory. To run the Glibc test suite (if desired), the following - command will do so:</para> - -<screen><userinput remap="test">make check</userinput></screen> - - <para>For a discussion of test failures that are of particular - importance, please see <xref linkend="ch-system-glibc" role="."/></para> - - <para>In this chapter, some tests can be adversely affected by - existing tools or environmental issues on the host system. Glibc test - suite failures in this chapter are typically not worrisome. The Glibc - installed in <xref linkend="chapter-building-system"/> is the one that - will ultimately end up being used, so that is the one that needs to pass - most tests (even in <xref linkend="chapter-building-system"/>, some - failures could still occur, for example, with the math tests).</para> - - <para>When experiencing a failure, make a note of it, then continue by - reissuing the <command>make check</command> command. The test suite - should pick up where it left off and continue. This stop-start sequence - can be circumvented by issuing a <command>make -k check</command> command. - If using this option, be sure to log the output so that the log file can - be examined for failures later.</para> + <para>This package does come with a test suite, however, it cannot be + run at this time because we do not have a C++ compiler yet.</para> <para>The install stage of Glibc will issue a harmless warning at the end about the absence of <filename>/tools/etc/ld.so.conf</filename>. diff --git a/chapter05/gmp.xml b/chapter05/gmp.xml new file mode 100644 index 000000000..8d76d825c --- /dev/null +++ b/chapter05/gmp.xml @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-gmp" role="wrap"> + <?dbhtml filename="gmp.html"?> + + <sect1info condition="script"> + <productname>gmp</productname> + <productnumber>&gmp-version;</productnumber> + <address>&gmp-url;</address> + </sect1info> + + <title>GMP-&gmp-version;</title> + + <indexterm zone="ch-tools-gmp"> + <primary sortas="a-GMP">GMP</primary> + <secondary>tools</secondary> + </indexterm> + + <sect2 role="package"> + <title/> + + <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" + href="../chapter06/gmp.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gmp-ch5-sbu;</seg> + <seg>&gmp-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of GMP</title> + + <para>Prepare GMP for compilation:</para> + +<screen><userinput remap="configure">./configure --prefix=/tools --enable-mpbsd</userinput></screen> + + <variablelist> + <title>The meaning of the configure option:</title> + + <varlistentry> + <term><parameter>--enable-mpbsd</parameter></term> + <listitem> + <para>This builds the Berkeley MP compatibility library</para> + </listitem> + </varlistentry> + + </variablelist> + + <para>Compile the package:</para> + +<screen><userinput remap="make">make</userinput></screen> + + <para>To test the results, issue:</para> + +<screen><userinput remap="test">make check</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">make install</userinput></screen> + + </sect2> + + <sect2 role="content"> + <title/> + + <para>Details on this package are located in + <xref linkend="contents-gmp" role="."/></para> + + </sect2> + +</sect1> diff --git a/chapter05/mpfr.xml b/chapter05/mpfr.xml new file mode 100644 index 000000000..692cefa56 --- /dev/null +++ b/chapter05/mpfr.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-mpfr" role="wrap"> + <?dbhtml filename="mpfr.html"?> + + <sect1info condition="script"> + <productname>mpfr</productname> + <productnumber>&mpfr-version;</productnumber> + <address>&mpfr-url;</address> + </sect1info> + + <title>MPFR-&mpfr-version;</title> + + <indexterm zone="ch-tools-mpfr"> + <primary sortas="a-MPFR">MPFR</primary> + <secondary>tools</secondary> + </indexterm> + + <sect2 role="package"> + <title/> + + <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" + href="../chapter06/mpfr.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&mpfr-ch5-sbu;</seg> + <seg>&mpfr-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of MPFR</title> + + <para>Prepare MPFR for compilation:</para> + +<screen><userinput remap="configure">./configure --prefix=/tools --enable-thread-safe</userinput></screen> + + <para>Compile the package:</para> + +<screen><userinput remap="make">make</userinput></screen> + + <para>To test the results, issue:</para> + +<screen><userinput remap="test">make check</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">make install</userinput></screen> + + </sect2> + + <sect2 role="content"> + <title/> + + <para>Details on this package are located in + <xref linkend="contents-mpfr" role="."/></para> + + </sect2> + +</sect1> diff --git a/chapter05/tcl.xml b/chapter05/tcl.xml index 7393709b9..88fa8021e 100644 --- a/chapter05/tcl.xml +++ b/chapter05/tcl.xml @@ -81,7 +81,7 @@ <para>Now make a necessary symbolic link:</para> -<screen><userinput remap="install">ln -sv tclsh8.4 /tools/bin/tclsh</userinput></screen> +<screen><userinput remap="install">ln -sv tclsh8.5 /tools/bin/tclsh</userinput></screen> </sect2> @@ -93,8 +93,8 @@ <segtitle>Installed library</segtitle> <seglistitem> - <seg>tclsh (link to tclsh8.4) and tclsh8.4</seg> - <seg>libtcl8.4.so</seg> + <seg>tclsh (link to tclsh8.5) and tclsh8.5</seg> + <seg>libtcl8.5.so</seg> </seglistitem> </segmentedlist> @@ -103,12 +103,12 @@ <?dbfo list-presentation="list"?> <?dbhtml list-presentation="table"?> - <varlistentry id="tclsh8.4"> - <term><command>tclsh8.4</command></term> + <varlistentry id="tclsh8.5"> + <term><command>tclsh8.5</command></term> <listitem> <para>The Tcl command shell</para> - <indexterm zone="ch-tools-tcl tclsh8.4"> - <primary sortas="b-tclsh8.4">tclsh8.4</primary> + <indexterm zone="ch-tools-tcl tclsh8.5"> + <primary sortas="b-tclsh8.5">8.5</primary> </indexterm> </listitem> </varlistentry> @@ -116,19 +116,19 @@ <varlistentry id="tclsh"> <term><command>tclsh</command></term> <listitem> - <para>A link to tclsh8.4</para> + <para>A link to tclsh8.5</para> <indexterm zone="ch-tools-tcl tclsh"> <primary sortas="b-tclsh">tclsh</primary> </indexterm> </listitem> </varlistentry> - <varlistentry id="libtcl8.4.so"> - <term><filename class="libraryfile">libtcl8.4.so</filename></term> + <varlistentry id="libtcl8.5.so"> + <term><filename class="libraryfile">libtcl8.5.so</filename></term> <listitem> <para>The Tcl library</para> - <indexterm zone="ch-tools-tcl libtcl8.4.so"> - <primary sortas="c-libtcl8.4.so">libtcl8.4.so</primary> + <indexterm zone="ch-tools-tcl libtcl8.5.so"> + <primary sortas="c-libtcl8.5.so">libtcl8.5.so</primary> </indexterm> </listitem> </varlistentry> diff --git a/chapter05/util-linux-ng.xml b/chapter05/util-linux-ng.xml index 99d9dda0e..e0badac56 100644 --- a/chapter05/util-linux-ng.xml +++ b/chapter05/util-linux-ng.xml @@ -50,14 +50,34 @@ <para>Only a few of the utilities contained in this package need to be built:</para> -<screen><userinput remap="make">make -C mount mount umount +<screen><userinput remap="make">make BLKID_LIBS="-lblkid -luuid" -C mount mount umount make -C text-utils more</userinput></screen> + <variablelist> + <title>The meaning of the make parameter:</title> + + <varlistentry> + <term><parameter>BLKID_LIBS="-lblkid -luuid"</parameter></term> + <listitem> + <para>When building only a subset of the package, the + <filename class="libraryfile">libuuid.so</filename> library is not + pulled into the build as it is supposed to. This command overrides + the default from the <filename>Makefile</filename>.</para> + </listitem> + </varlistentry> + + </variablelist> + + <!-- Not sure why this is in there. There is no test suite. Though + running 'make check' may build these programs, there is no + testing done. <para>This package comes with a test suite, but running it will cause all of the binaries to be built and tested. If you still wish to run the tests, issue:</para> -<screen><userinput remap="test">make check</userinput></screen> +<screen><userinput remap="test">make check</userinput></screen> --> + + <para>This package does not come with a test suite.</para> <para>Copy these programs to the temporary tools directory:</para> diff --git a/chapter06/autoconf.xml b/chapter06/autoconf.xml index e5e241501..89037b1fc 100644 --- a/chapter06/autoconf.xml +++ b/chapter06/autoconf.xml @@ -53,7 +53,7 @@ <screen><userinput remap="test">make check</userinput></screen> - <para>This takes a long time, about 3 SBUs. In addition, 6 tests are skipped + <para>This takes a long time, about 4.7 SBUs. In addition, 6 tests are skipped that use Automake. For full test coverage, Autoconf can be re-tested after Automake has been installed.</para> diff --git a/chapter06/automake.xml b/chapter06/automake.xml index fefa708d1..8695a9ee6 100644 --- a/chapter06/automake.xml +++ b/chapter06/automake.xml @@ -49,7 +49,7 @@ <para>Prepare Automake for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr --docdir=/usr/share/doc/automake-&automake-version;</userinput></screen> <para>Compile the package:</para> diff --git a/chapter06/binutils.xml b/chapter06/binutils.xml index e930742dd..cc67448d0 100644 --- a/chapter06/binutils.xml +++ b/chapter06/binutils.xml @@ -61,6 +61,18 @@ Ask your system administrator to create more.</computeroutput></screen> <screen><userinput remap="pre">patch -Np1 -i ../&binutils-configure-patch;</userinput></screen> + <para>Apply the following patch to prevent some failures when running the + the test suite:</para> + +<screen><userinput remap="pre">patch -Np1 -i ../&binutils-gcc-patch;</userinput></screen> + + <para>Suppress the installation of an outdated + <filename>standards.info</filename> file as a newer one is installed later + on in the Autoconf instructions:</para> + +<screen><userinput remap="pre">rm -fv etc/standards.info +sed -i.bak '/^INFO/s/standards.info //' etc/Makefile.in</userinput></screen> + <para>The Binutils documentation recommends building Binutils outside of the source directory in a dedicated build directory:</para> diff --git a/chapter06/bison.xml b/chapter06/bison.xml index 4bcaf2f3e..0d8a5ac30 100644 --- a/chapter06/bison.xml +++ b/chapter06/bison.xml @@ -55,7 +55,7 @@ <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> + <para>To test the results (about 0.5 SBU), issue:</para> <screen><userinput remap="test">make check</userinput></screen> diff --git a/chapter06/chapter06.xml b/chapter06/chapter06.xml index cdae14f31..f213f7605 100644 --- a/chapter06/chapter06.xml +++ b/chapter06/chapter06.xml @@ -22,6 +22,8 @@ <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="glibc.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="readjusting.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="binutils.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gmp.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="mpfr.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gcc.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="db.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="sed.xml"/> @@ -33,9 +35,9 @@ <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="ncurses.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="procps.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="libtool.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="zlib.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="perl.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="readline.xml"/> - <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="zlib.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="autoconf.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="automake.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="bash.xml"/> diff --git a/chapter06/coreutils.xml b/chapter06/coreutils.xml index 90c113817..8995ba1d1 100644 --- a/chapter06/coreutils.xml +++ b/chapter06/coreutils.xml @@ -50,22 +50,23 @@ i?86 | x86_64) patch -Np1 -i ../&coreutils-uname-patch; ;; esac</userinput></screen> - <para>POSIX requires that programs from Coreutils recognize character + <para>There's an internal issue with Coreutils which makes some of the + programs behave abnormally if you build using an older kernel. Apply a + patch to fix the issue:</para> + +<screen><userinput remap="pre">patch -Np1 -i ../&coreutils-old-kernel-patch;</userinput></screen> + + <!-- <para>POSIX requires that programs from Coreutils recognize character boundaries correctly even in multibyte locales. The following patch fixes this non-compliance and other internationalization-related bugs:</para> <screen><userinput remap="pre">patch -Np1 -i ../&coreutils-i18n-patch;</userinput></screen> - <para>In order for the tests added by this patch to pass, the permissions for - the test file have to be changed:</para> - -<screen><userinput remap="pre">chmod +x tests/sort/sort-mb-tests</userinput></screen> - <note> <para>In the past, many bugs were found in this patch. When reporting new bugs to Coreutils maintainers, please check first if they are reproducible without this patch.</para> - </note> + </note> --> <para>Now prepare Coreutils for compilation:</para> @@ -150,7 +151,7 @@ mv -v /usr/bin/chroot /usr/sbin</userinput></screen> cp, csplit, cut, date, dd, df, dir, dircolors, dirname, du, echo, env, expand, expr, factor, false, fmt, fold, groups, head, hostid, hostname, id, install, join, link, ln, logname, ls, md5sum, mkdir, mkfifo, mknod, - mv, nice, nl, nohup, od, paste, pathchk, pinky, pr, printenv, printf, + mktemp, mv, nice, nl, nohup, od, paste, pathchk, pinky, pr, printenv, printf, ptx, pwd, readlink, rm, rmdir, seq, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum, shred, shuf, sleep, sort, split, stat, stty, sum, sync, tac, tail, tee, test, touch, tr, true, tsort, tty, uname, @@ -609,6 +610,16 @@ mv -v /usr/bin/chroot /usr/sbin</userinput></screen> </listitem> </varlistentry> + <varlistentry id="mktemp"> + <term><command>mktemp</command></term> + <listitem> + <para>Creates temporary files in a secure manner; it is used in scripts</para> + <indexterm zone="ch-system-coreutils mktemp"> + <primary sortas="b-mktemp">mktemp</primary> + </indexterm> + </listitem> + </varlistentry> + <varlistentry id="mv"> <term><command>mv</command></term> <listitem> diff --git a/chapter06/db.xml b/chapter06/db.xml index 526fc5dc6..a52d3956a 100644 --- a/chapter06/db.xml +++ b/chapter06/db.xml @@ -61,7 +61,8 @@ <sect2 role="installation"> <title>Installation of Berkeley DB</title> - <para>There is an upstream patch for Berkeley DB that fixes a race condition. Apply it:</para> + <para>Apply an upstream patch so that replication clients can open a + sequence:</para> <screen><userinput remap="pre">patch -Np1 -i ../&db-fixes-patch;</userinput></screen> diff --git a/chapter06/e2fsprogs.xml b/chapter06/e2fsprogs.xml index 7ff43ed47..9a7ca5f89 100644 --- a/chapter06/e2fsprogs.xml +++ b/chapter06/e2fsprogs.xml @@ -46,7 +46,7 @@ <para>Fix a hardcoded path to <filename>/bin/rm</filename> in E2fsprogs' testsuite:</para> - <screen><userinput remap="pre">sed -i -e 's@/bin/rm@/tools&@' lib/blkid/test_probe.in</userinput></screen> + <screen><userinput remap="pre">sed -i 's@/bin/rm@/tools&@' lib/blkid/test_probe.in</userinput></screen> <para>The E2fsprogs documentation recommends that the package be built in a subdirectory of the source tree: </para> @@ -109,6 +109,27 @@ cd build</userinput></screen> <screen><userinput remap="install">make install-libs</userinput></screen> + <para>This package installs a gzipped + <filename class="extension">.info</filename> file but doesn't update the + system-wide <filename>dir</filename> file. Unzip this file and then update + the system <filename>dir</filename> file using the following + commands.</para> + +<screen><userinput remap="install">gunzip -v /usr/share/info/libext2fs.info.gz +install-info --dir-file=/usr/share/info/dir \ + /usr/share/info/libext2fs.info</userinput></screen> + + <para>If desired, create and install some additional documentation by + issuing the following commands:</para> + +<screen><userinput remap="install">makeinfo -o doc/com_err.info ../lib/et/com_err.texinfo +install -v -m644 doc/com_err.info /usr/share/info +install-info --dir-file=/usr/share/info/dir \ + /usr/share/info/com_err.info + +install -v -m644 -D ../doc/libblkid.txt \ + /usr/share/doc/e2fsprogs-&e2fsprogs-version;/libblkid.txt</userinput></screen> + </sect2> <sect2 id="contents-e2fsprogs" role="content"> @@ -122,7 +143,7 @@ cd build</userinput></screen> <seg>badblocks, blkid, chattr, compile_et, debugfs, dumpe2fs, e2fsck, e2image, e2label, filefrag, findfs, fsck, fsck.ext2, fsck.ext3, logsave, lsattr, mk_cmds, mke2fs, mkfs.ext2, mkfs.ext3, mklost+found, resize2fs, - tune2fs, and uuidgen.</seg> + tune2fs, uuidd and uuidgen.</seg> <seg>libblkid.{a,so}, libcom_err.{a,so}, libe2p.{a,so}, libext2fs.{a,so}, libss.{a,so}, and libuuid.{a,so}</seg> </seglistitem> @@ -394,6 +415,17 @@ cd build</userinput></screen> </listitem> </varlistentry> + <varlistentry id="uuidd"> + <term><command>uuidd</command></term> + <listitem> + <para>A daemon used by the UUID library to generate time-based + UUIDs in a secure and guranteed-unique fashion.</para> + <indexterm zone="ch-system-e2fsprogs uuidd"> + <primary sortas="b-uuidd">uuidd</primary> + </indexterm> + </listitem> + </varlistentry> + <varlistentry id="uuidgen"> <term><command>uuidgen</command></term> <listitem> diff --git a/chapter06/file.xml b/chapter06/file.xml index 78181dc73..8801318cd 100644 --- a/chapter06/file.xml +++ b/chapter06/file.xml @@ -41,6 +41,17 @@ <sect2 role="installation"> <title>Installation of File</title> + <para>Fix the man page so that it will reflect recent changes to the + <parameter>-e</parameter> (<parameter>--exclude</parameter>) + parameter:</para> + +<!-- The following sed should not be required after the next version update + as the maintainer has fixed it upstream. --> + +<screen><userinput remap="pre">sed -i -e '197,+1d' \ + -e '189,+1d' \ + -e 's/token$/tokens/' doc/file.man</userinput></screen> + <para>Prepare File for compilation:</para> <screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> @@ -49,7 +60,9 @@ <screen><userinput remap="make">make</userinput></screen> - <para>This package does not come with a test suite.</para> + <para>To test the results, issue:</para> + +<screen><userinput remap="test">make check</userinput></screen> <para>Install the package:</para> diff --git a/chapter06/flex.xml b/chapter06/flex.xml index c5942ff18..94d8af1fd 100644 --- a/chapter06/flex.xml +++ b/chapter06/flex.xml @@ -49,7 +49,7 @@ <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> + <para>To test the results (about 0.5 SBU), issue:</para> <screen><userinput remap="test">make check</userinput></screen> @@ -80,6 +80,13 @@ exec /usr/bin/flex -l "$@" EOF chmod -v 755 /usr/bin/lex</userinput></screen> + <para>If desired, install the <filename>flex.pdf</filename> documentation + file:</para> + +<screen><userinput remap="install">mkdir -v /usr/share/doc/flex-&flex-version; +cp -v doc/flex.pdf \ + /usr/share/doc/flex-&flex-version;</userinput></screen> + </sect2> <sect2 id="contents-flex" role="content"> diff --git a/chapter06/gawk.xml b/chapter06/gawk.xml index 3c5c4b28e..04ee8ae5b 100644 --- a/chapter06/gawk.xml +++ b/chapter06/gawk.xml @@ -56,6 +56,12 @@ <screen><userinput remap="install">make install</userinput></screen> + <para>If desired, install the documentation:</para> + +<screen><userinput remap="install">mkdir -v /usr/share/doc/gawk-&gawk-version; +cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} \ + /usr/share/doc/gawk-&gawk-version;</userinput></screen> + </sect2> <sect2 id="contents-gawk" role="content"> diff --git a/chapter06/gcc.xml b/chapter06/gcc.xml index 1faf8343d..7e54b47fe 100644 --- a/chapter06/gcc.xml +++ b/chapter06/gcc.xml @@ -172,7 +172,7 @@ cd ../gcc-build</userinput></screen> href="readjusting.xml" xpointer="xpointer(//*[@os='g'])"/> -<screen><userinput>grep -B3 '^ /usr/include' dummy.log</userinput></screen> +<screen><userinput>grep -B4 '^ /usr/include' dummy.log</userinput></screen> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="readjusting.xml" @@ -181,11 +181,17 @@ cd ../gcc-build</userinput></screen> <screen><computeroutput>#include <...> search starts here: /usr/local/include /usr/lib/gcc/x86_64-unknown-linux-gnu/&gcc-version;/include + /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/include-fixed /usr/include</computeroutput></screen> <para>Again, note that the directory named after your target triplet may be different than the above, depending on your architecture.</para> + <note><para>As of version 4.3.0, GCC now unconditionally installs the + <filename>limits.h</filename> file into the private + <filename class="directory">include-fixed</filename> directory, and that + directory is required to be in place.</para></note> + <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="readjusting.xml" xpointer="xpointer(//*[@os='i'])"/> diff --git a/chapter06/gettext.xml b/chapter06/gettext.xml index f88d523e3..0bce337ac 100644 --- a/chapter06/gettext.xml +++ b/chapter06/gettext.xml @@ -45,18 +45,18 @@ <para>Prepare Gettext for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr \ + --docdir=/usr/share/doc/gettext-&gettext-version;</userinput></screen> <para>Compile the package:</para> <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> + <para>To test the results (this takes a long time, around 3 SBUs), + issue:</para> <screen><userinput remap="test">make check</userinput></screen> - <para>This takes a very long time, around 5 SBUs.</para> - <para>Install the package:</para> <screen><userinput remap="install">make install</userinput></screen> diff --git a/chapter06/glibc.xml b/chapter06/glibc.xml index 854abc68b..b02beb9ad 100644 --- a/chapter06/glibc.xml +++ b/chapter06/glibc.xml @@ -61,23 +61,23 @@ Glibc autoconf tests would give false results and defeat the goal of achieving a clean build.</para> - <para>The glibc-libidn tarball adds support for internationalized domain + <!-- <para>The glibc-libidn tarball adds support for internationalized domain names (IDN) to Glibc. Many programs that support IDN require the full <filename class="libraryfile">libidn</filename> library, not this add-on (see <ulink url="&blfs-root;view/svn/general/libidn.html"/>). Unpack the tarball from within the Glibc source directory:</para> <screen><userinput remap="pre">tar -xvf ../glibc-libidn-&glibc-version;.tar.bz2 -mv glibc-libidn-&glibc-version; libidn</userinput></screen> +mv glibc-libidn-&glibc-version; libidn</userinput></screen>--> - <para>In the vi_VN.TCVN locale, <command>bash</command> enters an infinite loop + <!-- <para>In the vi_VN.TCVN locale, <command>bash</command> enters an infinite loop at startup. It is unknown whether this is a <command>bash</command> bug or a Glibc problem. Disable installation of this locale in order to avoid the problem:</para> -<screen><userinput remap="pre">sed -i '/vi_VN.TCVN/d' localedata/SUPPORTED</userinput></screen> +<screen><userinput remap="pre">sed -i '/vi_VN.TCVN/d' localedata/SUPPORTED</userinput></screen> --> - <para>When running <command>make install</command>, a script called + <!-- <para>When running <command>make install</command>, a script called <filename>test-installation.pl</filename> performs a small sanity test on our newly installed Glibc. However, because our toolchain still points to the <filename class="directory">/tools</filename> directory, the sanity @@ -88,7 +88,14 @@ mv glibc-libidn-&glibc-version; libidn</userinput></screen> awk '{print $4}' | sed -e 's@/tools@@' -e 's@]$@@') sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=$DL -o|" \ scripts/test-installation.pl -unset DL</userinput></screen> +unset DL</userinput></screen> --> + + <para>First apply two patches which correct failures in the test + suite:</para> + +<screen><userinput remap="pre">patch -Np1 -i ../&glibc-iconv-test-fixes-patch; +patch -Np1 -i ../&glibc-ildoubl-test-fix-patch;</userinput></screen> + <para>The <command>ldd</command> shell script contains Bash-specific syntax. Change its default program interpreter to <command>/bin/bash</command> @@ -140,9 +147,12 @@ esac</userinput></screen> Do not skip it under any circumstance.</para> </important> - <para>Test the results:</para> + <para>Before running the tests, copy a file from the source tree into our + build tree to prevent a couple of test failures, then test the + results:</para> -<screen><userinput remap="test">make -k check 2>&1 | tee glibc-check-log +<screen><userinput remap="test">cp -v ../glibc-&glibc-version;/iconvdata/gconv-modules iconvdata +make -k check 2>&1 | tee glibc-check-log grep Error glibc-check-log</userinput></screen> <para>You will probably see an expected (ignored) failure in the @@ -234,7 +244,7 @@ localedef -i ja_JP -f EUC-JP ja_JP</userinput></screen> <para>Then use the <command>localedef</command> command to create and install locales not listed in the <filename>glibc-&glibc-version;/localedata/SUPPORTED</filename> file - in the unlikely case if you need them.</para> + in the unlikely case you need them.</para> <!-- The Live CD patches the localedata/SUPPORTED file instead of running localedef, the results are equivalent --> @@ -539,7 +549,7 @@ EOF</userinput></screen> <varlistentry id="rpcgen"> <term><command>rpcgen</command></term> <listitem> - <para>Generates C code to implement the Remote Procecure Call (RPC) + <para>Generates C code to implement the Remote Procedure Call (RPC) protocol</para> <indexterm zone="ch-system-glibc rpcgen"> <primary sortas="b-rpcgen">rpcgen</primary> diff --git a/chapter06/gmp.xml b/chapter06/gmp.xml new file mode 100644 index 000000000..a7b6fc7af --- /dev/null +++ b/chapter06/gmp.xml @@ -0,0 +1,140 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-system-gmp" role="wrap"> + <?dbhtml filename="gmp.html"?> + + <sect1info condition="script"> + <productname>gmp</productname> + <productnumber>&gmp-version;</productnumber> + <address>&gmp-url;</address> + </sect1info> + + <title>GMP-&gmp-version;</title> + + <indexterm zone="ch-system-gmp"> + <primary sortas="a-GMP">GMP</primary> + </indexterm> + + <sect2 role="package"> + <title/> + + <para>The GMP package contains math libraries. These have useful functions + for arbitrary precision arithmetic.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gmp-ch6-sbu;</seg> + <seg>&gmp-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of GMP</title> + + <para>Prepare GMP for compilation:</para> + +<screen><userinput remap="configure">./configure --prefix=/usr --enable-cxx --enable-mpbsd</userinput></screen> + + <variablelist> + <title>The meaning of the new configure option:</title> + + <varlistentry> + <term><parameter>--enable-cxx</parameter></term> + <listitem> + <para>This parameter enables C++ support</para> + </listitem> + </varlistentry> + + </variablelist> + + <para>Compile the package:</para> + +<screen><userinput remap="make">make</userinput></screen> + + <important> + <para>The test suite for GMP in this section is considered critical. + Do not skip it under any circumstances.</para> + </important> + + <para>Test the results:</para> + +<screen><userinput remap="test">make check 2>&1 | tee gmp-check-log</userinput></screen> + + <para>Ensure that all 139 tests in the test suite ran successfully by + issuing the following command:</para> + +<screen><userinput remap="test">awk '/tests passed/{total+=$2} ; END{print total}' gmp-check-log</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">make install</userinput></screen> + + <para>If desired, install the documentation:</para> + +<screen><userinput remap="install">mkdir -v /usr/share/doc/gmp-&gmp-version; +cp -v doc/{isa_abi_headache,configuration} doc/*.html \ + /usr/share/doc/gmp-&gmp-version;</userinput></screen> + + </sect2> + + <sect2 id="contents-gmp" role="content"> + <title>Contents of GMP</title> + + <segmentedlist> + <segtitle>Installed Libraries</segtitle> + + <seglistitem> + <seg>libgmp.{a,so}, libgmpxx.{a,so}, and libmp.{a,so}</seg> + </seglistitem> + </segmentedlist> + + <variablelist> + <bridgehead renderas="sect3">Short Descriptions</bridgehead> + <?dbfo list-presentation="list"?> + <?dbhtml list-presentation="table"?> + + <varlistentry id="libgmp"> + <term><command>libgmp</command></term> + <listitem> + <para>Contains precision math functions.</para> + <indexterm zone="ch-system-gmp libgmp"> + <primary sortas="c-libgmp">libgmp</primary> + </indexterm> + </listitem> + </varlistentry> + + <varlistentry id="libgmpxx"> + <term><command>libgmpxx</command></term> + <listitem> + <para>Contains C++ precision math functions.</para> + <indexterm zone="ch-system-gmp libgmpxx"> + <primary sortas="c-libgmpxx">libgmpxx</primary> + </indexterm> + </listitem> + </varlistentry> + + <varlistentry id="libmp"> + <term><command>libmp</command></term> + <listitem> + <para>Contains the Berkeley MP math functions.</para> + <indexterm zone="ch-system-gmp libmp"> + <primary sortas="c-libmp">libmp</primary> + </indexterm> + </listitem> + </varlistentry> + + </variablelist> + + </sect2> + +</sect1> diff --git a/chapter06/groff.xml b/chapter06/groff.xml index 31843cb55..a2507f45b 100644 --- a/chapter06/groff.xml +++ b/chapter06/groff.xml @@ -79,7 +79,7 @@ <para>Install the package:</para> -<screen><userinput remap="install">make install</userinput></screen> +<screen><userinput remap="install">make docdir=/usr/share/doc/groff-&groff-version; install</userinput></screen> <para>Some documentation programs, such as <command>xman</command>, will not work properly without the following symlinks:</para> diff --git a/chapter06/inetutils.xml b/chapter06/inetutils.xml index 814c8eb0f..e1e87b1c9 100644 --- a/chapter06/inetutils.xml +++ b/chapter06/inetutils.xml @@ -47,6 +47,12 @@ <screen><userinput remap="pre">patch -Np1 -i ../&inetutils-man_pages-patch;</userinput></screen> + <para>Inetutils has a minor issue with GCC-&gcc-version;. Fix it by + issuing the following command:</para> + +<screen><userinput remap="pre">sed -i 's@<sys/types.h>@<sys/types.h>\n#include <stdlib.h>@' \ + libicmp/icmp_timestamp.c</userinput></screen> + <para>Prepare Inetutils for compilation:</para> <screen><userinput remap="configure">./configure --prefix=/usr --libexecdir=/usr/sbin \ diff --git a/chapter06/iproute2.xml b/chapter06/iproute2.xml index 1934f0fbe..7e7705389 100644 --- a/chapter06/iproute2.xml +++ b/chapter06/iproute2.xml @@ -43,10 +43,19 @@ <para>Compile the package:</para> -<screen><userinput remap="make">make SBINDIR=/sbin</userinput></screen> +<screen><userinput remap="make">make DESTDIR= SBINDIR=/sbin</userinput></screen> <variablelist> - <title>The meaning of the make option:</title> + <title>The meaning of the make options:</title> + + <varlistentry> + <term><parameter>DESTDIR=</parameter></term> + <listitem> + <para>This ensures that the IPRoute2 binaries will install into + the correct directory. By default, <parameter>DESTDIR</parameter> is + set to <filename class="directory">/usr</filename>.</para> + </listitem> + </varlistentry> <varlistentry> <term><parameter>SBINDIR=/sbin</parameter></term> @@ -71,7 +80,8 @@ <para>Install the package:</para> -<screen><userinput remap="install">make SBINDIR=/sbin install</userinput></screen> +<screen><userinput remap="install">make DESTDIR= SBINDIR=/sbin MANDIR=/usr/share/man \ + DOCDIR=/usr/share/doc/iproute2-&iproute2-version; install</userinput></screen> <para>The <command>arpd</command> binary links against the Berkeley DB libraries that reside in <filename class="directory">/usr</filename> and diff --git a/chapter06/kbd.xml b/chapter06/kbd.xml index af999a6eb..67c110d3b 100644 --- a/chapter06/kbd.xml +++ b/chapter06/kbd.xml @@ -112,6 +112,12 @@ unset var</userinput></screen> <screen><userinput remap="install">mv -v /usr/bin/{kbd_mode,loadkeys,openvt,setfont} /bin</userinput></screen> + <para>If desired, install the documentation:</para> + +<screen><userinput remap="install">mkdir -v /usr/share/doc/kbd-&kbd-version; +cp -R -v doc/* \ + /usr/share/doc/kbd-&kbd-version;</userinput></screen> + </sect2> <sect2 id="contents-kbd" role="content"> diff --git a/chapter06/libtool.xml b/chapter06/libtool.xml index cd659e1a2..3679a81aa 100644 --- a/chapter06/libtool.xml +++ b/chapter06/libtool.xml @@ -50,7 +50,7 @@ <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> + <para>To test the results (about 3.0 SBU), issue:</para> <screen><userinput remap="test">make check</userinput></screen> diff --git a/chapter06/man-db.xml b/chapter06/man-db.xml index ce0ef20bb..bb1fefced 100644 --- a/chapter06/man-db.xml +++ b/chapter06/man-db.xml @@ -41,15 +41,23 @@ <sect2 role="installation"> <title>Installation of Man-DB</title> - <para>Two adjustments need to be made to the sources of Man-DB.</para> + <!-- <para>Two adjustments need to be made to the sources of Man-DB.</para> <para>The first change is a <command>sed</command> substitution to delete the <quote>/usr/man</quote> and <quote>/usr/local/man</quote> lines in the <filename>man_db.conf</filename> file to prevent redundant results + when using programs such as <command>whatis</command>:</para> --> + + <para>Use a <command>sed</command> substitution to delete + the <quote>/usr/man</quote> and <quote>/usr/local/man</quote> lines in + the <filename>man_db.conf</filename> file to prevent redundant results when using programs such as <command>whatis</command>:</para> <screen><userinput remap="pre">sed -i -e '\%\t/usr/man%d' -e '\%\t/usr/local/man%d' src/man_db.conf.in</userinput></screen> + <!-- This is removed and the same thing is done using the configure + command, which seems to be the more proper method + <para>The second change accounts for programs that Man-DB should be able to find at runtime, but that haven't been installed yet:</para> @@ -69,10 +77,14 @@ EOF</userinput></screen> manual pages. They are not part of LFS or BLFS, but you should be able to install them yourself after finishing LFS if you wish to do so.</para> + --> + <para>Prepare Man-DB for compilation:</para> <screen><userinput remap="configure">./configure --prefix=/usr --libexecdir=/usr/lib --sysconfdir=/etc \ - --disable-setuid</userinput></screen> + --disable-setuid --with-browser=/usr/bin/lynx \ + --with-col=/usr/bin/col --with-vgrind=/usr/bin/vgrind \ + --with-grap=/usr/bin/grap</userinput></screen> <variablelist> <title>The meaning of the configure options:</title> @@ -85,6 +97,21 @@ EOF</userinput></screen> </listitem> </varlistentry> + <varlistentry> + <term><parameter>--with-...</parameter></term> + <listitem> + <para>These four parameters are used to set some default programs. + The <command>col</command> program is a part of the Util-linux-ng + package, <command>lynx</command> is a text-based web browser (see BLFS + for installation instructions), <command>vgrind</command> converts + program sources to Groff input, and <command>grap</command> is useful + for typesetting graphs in Groff documents. The <command>vgrind</command> + and <command>grap</command> programs are not normally needed for viewing + manual pages. They are not part of LFS or BLFS, but you should be able + to install them yourself after finishing LFS if you wish to do so.</para> + </listitem> + </varlistentry> + </variablelist> <para>Compile the package:</para> @@ -318,7 +345,7 @@ make install</userinput></screen> <segtitle>Installed programs</segtitle> <seglistitem> - <seg>accessdb, apropos, catman, convert-mans, lexgrog, man, mandb, + <seg>apropos, catman, convert-mans, lexgrog, man, mandb, manpath, whatis, and zsoelim</seg> </seglistitem> </segmentedlist> @@ -328,7 +355,7 @@ make install</userinput></screen> <?dbfo list-presentation="list"?> <?dbhtml list-presentation="table"?> - <varlistentry id="accessdb"> + <!-- <varlistentry id="accessdb"> <term><command>accessdb</command></term> <listitem> <para>Dumps the <command>whatis</command> database contents in @@ -337,7 +364,7 @@ make install</userinput></screen> <primary sortas="b-accessdb">accessdb</primary> </indexterm> </listitem> - </varlistentry> + </varlistentry> --> <varlistentry id="apropos"> <term><command>apropos</command></term> diff --git a/chapter06/man-pages.xml b/chapter06/man-pages.xml index 9513306c6..11256800c 100644 --- a/chapter06/man-pages.xml +++ b/chapter06/man-pages.xml @@ -23,7 +23,7 @@ <sect2 role="package"> <title/> - <para>The Man-pages package contains over 3,000 man pages.</para> + <para>The Man-pages package contains over 1,900 man pages.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> diff --git a/chapter06/module-init-tools.xml b/chapter06/module-init-tools.xml index 2df4ea164..cea92a17b 100644 --- a/chapter06/module-init-tools.xml +++ b/chapter06/module-init-tools.xml @@ -51,9 +51,9 @@ <para>The testsuite of this package is geared towards the needs of its Maintainer. The command <command>make check</command> builds a specially wrapped version of modprobe which is useless for normal operation. To run - this, issue the following commands (note that the <command>make clean</command> - command is required to clean up the source tree before recompiling for - normal use):</para> + this (about 0.2 SBU), issue the following commands (note that the + <command>make clean</command> command is required to clean up the source + tree before recompiling for normal use):</para> <screen><userinput remap="test">./configure make check diff --git a/chapter06/mpfr.xml b/chapter06/mpfr.xml new file mode 100644 index 000000000..40ddff135 --- /dev/null +++ b/chapter06/mpfr.xml @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-system-mpfr" role="wrap"> + <?dbhtml filename="mpfr.html"?> + + <sect1info condition="script"> + <productname>mpfr</productname> + <productnumber>&mpfr-version;</productnumber> + <address>&mpfr-url;</address> + </sect1info> + + <title>MPFR-&mpfr-version;</title> + + <indexterm zone="ch-system-mpfr"> + <primary sortas="a-MPFR">MPFR</primary> + </indexterm> + + <sect2 role="package"> + <title/> + + <para>The MPFR package contains functions for multiple precision + math.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&mpfr-ch6-sbu;</seg> + <seg>&mpfr-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of MPFR</title> + + <para>Prepare MPFR for compilation:</para> + +<screen><userinput remap="configure">./configure --prefix=/usr --enable-thread-safe</userinput></screen> + + <para>Compile the package:</para> + +<screen><userinput remap="make">make</userinput></screen> + + <important> + <para>The test suite for MPFR in this section is considered critical. + Do not skip it under any circumstances.</para> + </important> + + <para>Test the results and ensure that all 134 tests passed:</para> + +<screen><userinput remap="test">make check</userinput></screen> + + <para>Install the package:</para> + +<screen><userinput remap="install">make install</userinput></screen> + + </sect2> + + + <sect2 id="contents-mpfr" role="content"> + <title>Contents of MPFR</title> + + <segmentedlist> + <segtitle>Installed Libraries</segtitle> + + <seglistitem> + <seg>mpfr.so</seg> + </seglistitem> + </segmentedlist> + + <variablelist> + <bridgehead renderas="sect3">Short Descriptions</bridgehead> + <?dbfo list-presentation="list"?> + <?dbhtml list-presentation="table"?> + + <varlistentry id="mpfr"> + <term><command>mpfr</command></term> + <listitem> + <para>Contains multiple-precision math functions.</para> + <indexterm zone="ch-system-mpfr mpfr"> + <primary sortas="c-mpfr">mpfr</primary> + </indexterm> + </listitem> + </varlistentry> + + </variablelist> + + </sect2> + +</sect1> diff --git a/chapter06/ncurses.xml b/chapter06/ncurses.xml index 8b99eb872..0deef544c 100644 --- a/chapter06/ncurses.xml +++ b/chapter06/ncurses.xml @@ -140,6 +140,11 @@ ln -sfv libncurses.so /usr/lib/libcurses.so ln -sfv libncursesw.a /usr/lib/libcursesw.a ln -sfv libncurses.a /usr/lib/libcurses.a</userinput></screen> + <para>If desired, install the Ncurses documentation:</para> + +<screen><userinput remap="install">mkdir -v /usr/share/doc/ncurses-&ncurses-version; +cp -v -R doc/* /usr/share/doc/ncurses-&ncurses-version;</userinput></screen> + <note> <para>The instructions above don't create non-wide-character Ncurses libraries since no package installed by compiling from sources would diff --git a/chapter06/perl.xml b/chapter06/perl.xml index 10f5f2ce4..721809dbe 100644 --- a/chapter06/perl.xml +++ b/chapter06/perl.xml @@ -47,9 +47,30 @@ <screen><userinput remap="pre">echo "127.0.0.1 localhost $(hostname)" > /etc/hosts</userinput></screen> + <para>The following patch fixes known vulnerabilities:</para> + +<screen><userinput remap="pre">patch -Np1 -i ../&perl-security-patch;</userinput></screen> + + <para>The following patch fixes an incompatibility with + Glibc-&glibc-version;:</para> + +<screen><userinput remap="pre">patch -Np1 -i ../&perl-page-patch;</userinput></screen> + + <!-- Confirmed that this is not required any longer <para>Fix an incompatibility with gcc-&gcc-version;:</para> <screen><userinput remap="pre">sed -i 's/command /command[ -]/' makedepend.SH</userinput></screen> + --> + + <para>This version of Perl now builds the Compress::Raw::Zlib module. By + default Perl will use an internal copy of the Zlib source for the build. + Issue the following command so that Perl will use the Zlib library + installed on the system:</para> + +<screen><userinput remap="pre">sed -i -e "s|BUILD_ZLIB\s*= True|BUILD_ZLIB = False|" \ + -e "s|INCLUDE\s*= ./zlib-src|INCLUDE = /usr/include|" \ + -e "s|LIB\s*= ./zlib-src|LIB = /usr/lib|" \ + ext/Compress/Raw/Zlib/config.in</userinput></screen> <para>To have full control over the way Perl is set up, you can run the interactive <command>Configure</command> script and hand-pick the way this @@ -88,7 +109,7 @@ <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> + <para>To test the results (approximately 2.5 SBU), issue:</para> <screen><userinput remap="test">make test</userinput></screen> diff --git a/chapter06/procps.xml b/chapter06/procps.xml index c2329b2cb..40c73cbf4 100644 --- a/chapter06/procps.xml +++ b/chapter06/procps.xml @@ -38,15 +38,20 @@ </sect2> <sect2 role="installation"> - <title>Installation of Procps</title> + <title>Installation of Procps</title> - <para>Compile the package:</para> + <para>Apply a patch to fix a unicode related issue in the + <command>watch</command> program:</para> + +<screen><userinput remap="pre">patch -Np1 -i ../&procps-watch-patch;</userinput></screen> + + <para>Compile the package:</para> <screen><userinput remap="make">make</userinput></screen> - <para>This package does not come with a test suite.</para> + <para>This package does not come with a test suite.</para> - <para>Install the package:</para> + <para>Install the package:</para> <screen><userinput remap="install">make install</userinput></screen> diff --git a/chapter06/readline.xml b/chapter06/readline.xml index 48174821b..3f3279257 100644 --- a/chapter06/readline.xml +++ b/chapter06/readline.xml @@ -96,6 +96,12 @@ sed -i '/{OLDSUFF}/c:' support/shlib-install</userinput></screen> ln -sfv ../../lib/libreadline.so.5 /usr/lib/libreadline.so ln -sfv ../../lib/libhistory.so.5 /usr/lib/libhistory.so</userinput></screen> + <para>If desired, install the documentation:</para> + +<screen><userinput remap="install">mkdir -v /usr/share/doc/readline-&readline-version; +install -v -m644 doc/*.{ps,pdf,html,dvi} \ + /usr/share/doc/readline-&readline-version;</userinput></screen> + </sect2> <sect2 id="contents-readline" role="content"> diff --git a/chapter06/shadow.xml b/chapter06/shadow.xml index 7fd226a51..0b09986a8 100644 --- a/chapter06/shadow.xml +++ b/chapter06/shadow.xml @@ -44,50 +44,33 @@ <note> <para>If you would like to enforce the use of strong passwords, refer to <ulink url="&blfs-root;view/svn/postlfs/cracklib.html"/> for installing - Cracklib prior to building Shadow. Then add + CrackLib prior to building Shadow. Then add <parameter>--with-libcrack</parameter> to the <command>configure</command> command below.</para> </note> - <para>Fix a bug in the <command>useradd</command> and + <!-- <para>Fix a bug in the <command>useradd</command> and <command>usermod</command> programs which prevent them from accepting group names rather than group ID numbers to the <option>-g</option> option:</para> <screen><userinput remap="pre">patch -Np1 -i ../&shadow-useradd-patch;</userinput></screen> - - <para>Prepare Shadow for compilation:</para> - -<screen><userinput remap="configure">./configure --libdir=/lib --sysconfdir=/etc --enable-shared \ - --without-selinux</userinput></screen> - - <variablelist> - <title>The meaning of the configure options:</title> - - <varlistentry> - <term><parameter>--without-selinux</parameter></term> - <listitem> - <para>Support for selinux is enabled by default, but selinux is not - built in a base LFS system. The <command>configure</command> script - will fail if this option is not used.</para> - </listitem> - </varlistentry> - - </variablelist> + --> <para>Disable the installation of the <command>groups</command> program and its man pages, as Coreutils provides a better version:</para> -<screen><userinput remap="configure">sed -i 's/groups$(EXEEXT) //' src/Makefile -find man -name Makefile -exec sed -i 's/groups\.1 / /' {} \;</userinput></screen> +<screen><userinput remap="configure">sed -i 's/groups$(EXEEXT) //' src/Makefile.in +find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;</userinput></screen> <para>Disable the installation of Chinese and Korean manual pages, since Man-DB cannot format them properly:</para> -<screen><userinput remap="configure">sed -i -e 's/ ko//' -e 's/ zh_CN zh_TW//' man/Makefile</userinput></screen> +<screen><userinput remap="configure">sed -i -e 's/ ko//' -e 's/ zh_CN zh_TW//' man/Makefile.in</userinput></screen> <para>Shadow supplies other manual pages in a UTF-8 encoding. Man-DB can display these in the recommended encodings by using the - <command>convert-mans</command> script which we installed:</para> + <command>convert-mans</command> script which was installed during the + Man-DB package:</para> <screen><userinput remap="configure">for i in de es fi fr id it pt_BR; do convert-mans UTF-8 ISO-8859-1 man/${i}/*.? @@ -109,8 +92,8 @@ convert-mans UTF-8 ISO-8859-9 man/tr/*.?</userinput></screen> for user mailboxes that Shadow uses by default to the <filename class="directory">/var/mail</filename> location used currently:</para> -<screen><userinput remap="configure">sed -i -e 's@#MD5_CRYPT_ENAB.no@MD5_CRYPT_ENAB yes@' \ - -e 's@/var/spool/mail@/var/mail@' etc/login.defs</userinput></screen> +<screen><userinput remap="configure">sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD MD5@' \ + -e 's@/var/spool/mail@/var/mail@' etc/login.defs</userinput></screen> <note> <para>If you chose to build Shadow with Cracklib support, run the following:</para> @@ -119,6 +102,29 @@ convert-mans UTF-8 ISO-8859-9 man/tr/*.?</userinput></screen> etc/login.defs</userinput></screen> </note> + <para>Prepare Shadow for compilation:</para> + +<!-- Keeping this in case we revert to an older version +<screen><userinput remap="configure">./configure -libdir=/lib -sysconfdir=/etc -enable-shared \ + -without-selinux</userinput></screen> +--> + +<screen><userinput remap="configure">./configure --sysconfdir=/etc</userinput></screen> + + <!-- <variablelist> + <title>The meaning of the configure options:</title> + + <varlistentry> + <term><parameter>-without-selinux</parameter></term> + <listitem> + <para>Support for selinux is enabled by default, but selinux is not + built in a base LFS system. The <command>configure</command> script + will fail if this option is not used.</para> + </listitem> + </varlistentry> + + </variablelist> --> + <para>Compile the package:</para> <screen><userinput remap="make">make</userinput></screen> @@ -133,11 +139,11 @@ convert-mans UTF-8 ISO-8859-9 man/tr/*.?</userinput></screen> <screen><userinput remap="install">mv -v /usr/bin/passwd /bin</userinput></screen> - <para>Move Shadow's libraries to more appropriate locations:</para> + <!-- <para>Move Shadow's libraries to more appropriate locations:</para> <screen><userinput remap="install">mv -v /lib/libshadow.*a /usr/lib rm -v /lib/libshadow.so -ln -sfv ../../lib/libshadow.so.0 /usr/lib/libshadow.so</userinput></screen> +ln -sfv ../../lib/libshadow.so.0 /usr/lib/libshadow.so</userinput></screen> --> </sect2> @@ -167,12 +173,52 @@ ln -sfv ../../lib/libshadow.so.0 /usr/lib/libshadow.so</userinput></screen> <screen><userinput>grpconv</userinput></screen> <para>Shadow's stock configuration for the <command>useradd</command> - utility is not suitable for LFS systems. Use the following commands to - change the default home directory for new users and prevent the creation of - mail spool files:</para> + utility has a few caveats that need some explanation. First, the default + action for the <command>useradd</command> utility is to create the user and + a group of the same name as the user. By default the user ID (UID) and + group ID (GID) numbers will begin with 1000. This means if you don't pass + parameters to <command>useradd</command>, each user will be a member of a + unique group on the system. If this behaviour is undesireable, you'll need + to pass the <parameter>-g</parameter> parameter to + <command>useradd</command>. The default parameters are stored in the + <filename>/etc/default/useradd</filename> file. You may need to modify two + parameters in this file to suit your particular needs.</para> + + <variablelist> + <title><filename>/etc/default/useradd</filename> Parameter Explanations</title> + + <varlistentry> + <term><parameter>GROUP=1000</parameter></term> + <listitem> + <para>This parameter sets the beginning of the group numbers used in + the /etc/group file. You can modify it to anything you desire. Note + that <command>useradd</command> will never reuse a UID or GID. If the + number identified in this parameter is used, it will use the next + available number after this. Note also that if you don't have a group + 1000 on your system the first time you use <command>useradd</command> + without the <parameter>-g</parameter> parameter, you'll get a message + displayed on the terminal that says: + <computeroutput>useradd: unknown GID 1000</computeroutput>. You may + disregard this message and group number 1000 will be used.</para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>CREATE_MAIL_SPOOL=yes</parameter></term> + <listitem> + <para>This parameter causes <command>useradd</command> to create a + mailbox file for the newly created user. <command>useradd</command> + will make the group ownership of this file to the + <systemitem class="groupname">mail</systemitem> group with 0660 + permissions. If you would prefer that these mailbox files are not + created by <command>useradd</command>, issue the following + command:</para> + +<screen><userinput>sed -i 's/yes/no/' /etc/default/useradd</userinput></screen> + </listitem> + </varlistentry> + + </variablelist> -<screen><userinput>useradd -D -b /home -sed -i 's/yes/no/' /etc/default/useradd</userinput></screen> </sect2> @@ -191,7 +237,6 @@ sed -i 's/yes/no/' /etc/default/useradd</userinput></screen> <segmentedlist> <segtitle>Installed programs</segtitle> - <segtitle>Installed libraries</segtitle> <seglistitem> <seg>chage, chfn, chgpasswd, chpasswd, chsh, expiry, faillog, gpasswd, @@ -199,7 +244,6 @@ sed -i 's/yes/no/' /etc/default/useradd</userinput></screen> lastlog, login, logoutd, newgrp, newusers, nologin, passwd, pwck, pwconv, pwunconv, sg (link to newgrp), su, useradd, userdel, usermod, vigr (link to vipw), and vipw</seg> - <seg>libshadow.{a,so}</seg> </seglistitem> </segmentedlist> @@ -551,16 +595,6 @@ sed -i 's/yes/no/' /etc/default/useradd</userinput></screen> </listitem> </varlistentry> - <varlistentry id="libshadow"> - <term><filename class="libraryfile">libshadow</filename></term> - <listitem> - <para>Contains functions used by most programs in this package</para> - <indexterm zone="ch-system-shadow libshadow"> - <primary sortas="c-libshadow">libshadow</primary> - </indexterm> - </listitem> - </varlistentry> - </variablelist> </sect2> diff --git a/chapter06/sysvinit.xml b/chapter06/sysvinit.xml index dddd77408..aee6a6861 100644 --- a/chapter06/sysvinit.xml +++ b/chapter06/sysvinit.xml @@ -55,6 +55,13 @@ <screen><userinput remap="pre">sed -i 's@Sending processes@& configured via /etc/inittab@g' \ src/init.c</userinput></screen> + <para>A maintained version of the <command>wall</command> program is + installed later on during the Util-linux-ng installation. Suppress the + installation of this program and its man page:</para> + +<screen><userinput remap="make">sed -i -e 's/utmpdump wall/utmpdump/' \ + -e 's/mountpoint.1 wall.1/mountpoint.1/' src/Makefile</userinput></screen> + <para>Compile the package:</para> <screen><userinput remap="make">make -C src</userinput></screen> @@ -123,7 +130,7 @@ EOF</userinput></screen> <seg>bootlogd, halt, init, killall5, last, lastb (link to last), mesg, mountpoint, pidof (link to killall5), poweroff (link to halt), reboot (link to halt), runlevel, shutdown, sulogin, - telinit (link to init), utmpdump, and wall</seg> + telinit (link to init), and utmpdump</seg> </seglistitem> </segmentedlist> @@ -311,16 +318,6 @@ EOF</userinput></screen> </listitem> </varlistentry> - <varlistentry id="wall"> - <term><command>wall</command></term> - <listitem> - <para>Writes a message to all logged-in users</para> - <indexterm zone="ch-system-sysvinit wall"> - <primary sortas="b-wall">wall</primary> - </indexterm> - </listitem> - </varlistentry> - </variablelist> </sect2> diff --git a/chapter06/tar.xml b/chapter06/tar.xml index dd91e51c4..a5baf9431 100644 --- a/chapter06/tar.xml +++ b/chapter06/tar.xml @@ -48,12 +48,10 @@ <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> + <para>To test the results (about 1 SBU), issue:</para> -<screen><userinput remap="test">make check || true</userinput></screen> +<screen><userinput remap="test">make check</userinput></screen> - <para>Note that tests 26 and 29 are known to fail intermittently.</para> - <para>Install the package:</para> <screen><userinput remap="install">make install</userinput></screen> diff --git a/chapter06/texinfo.xml b/chapter06/texinfo.xml index 447580764..110438379 100644 --- a/chapter06/texinfo.xml +++ b/chapter06/texinfo.xml @@ -51,7 +51,7 @@ <para>To test the results, issue:</para> -<screen><userinput remap="test">make -k check</userinput></screen> +<screen><userinput remap="test">make check</userinput></screen> <para>Install the package:</para> diff --git a/chapter06/udev.xml b/chapter06/udev.xml index 8d7e820ae..a2c1a84ec 100644 --- a/chapter06/udev.xml +++ b/chapter06/udev.xml @@ -47,70 +47,51 @@ <screen><userinput remap="pre">tar -xvf ../&udev-config;.tar.bz2</userinput></screen> <para>Create some devices and directories that Udev cannot handle due to - them being required very early in the boot process:</para> + them being required very early in the boot process, or by Udev itself:</para> <screen><userinput remap="install">install -dv /lib/{firmware,udev/devices/{pts,shm}} mknod -m0666 /lib/udev/devices/null c 1 3 +mknod -m0600 /lib/udev/devices/kmsg c 1 11 ln -sv /proc/self/fd /lib/udev/devices/fd ln -sv /proc/self/fd/0 /lib/udev/devices/stdin ln -sv /proc/self/fd/1 /lib/udev/devices/stdout ln -sv /proc/self/fd/2 /lib/udev/devices/stderr ln -sv /proc/kcore /lib/udev/devices/core</userinput></screen> - <para><command>usb_id</command> is known to segfault under certain kernel - configurations. Fix the issue by applying the following patch:</para> + <para>Prepare the package for compilation:</para> -<screen><userinput remap="pre">patch -Np1 -i ../&udev-usbid-patch;</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr \ + --exec-prefix= \ + --sysconfdir=/etc</userinput></screen> <para>Compile the package:</para> -<screen><userinput remap="make">make EXTRAS="`echo extras/*/`"</userinput></screen> +<screen><userinput remap="make">make</userinput></screen> - <variablelist> - <title>The meaning of the make option:</title> - - <varlistentry> - <term><parameter>EXTRAS=...</parameter></term> - <listitem> - <para>This builds the helper binaries that can aid in writing custom - Udev rules.</para> - </listitem> - </varlistentry> - - </variablelist> - - <para>To test the results, issue:</para> - -<screen><userinput remap="test">make test</userinput></screen> - - <para>Note that the Udev testsuite will produce numerous messages in - the host system's logs. These are harmless and can be ignored.</para> + <para>This package does not come with a test suite.</para> <para>Install the package:</para> -<screen><userinput remap="install">make DESTDIR=/ EXTRAS="`echo extras/*/`" install</userinput></screen> +<screen><userinput remap="install">make install</userinput></screen> - <variablelist> - <title>The meaning of the make parameter:</title> + <para>Udev has to be configured in order to work properly, as its default + configuration does not cover all devices. First install two extra rules + files from Udev to help support device-mapper and RAID setups:</para> - <varlistentry> - <term><parameter>DESTDIR=/</parameter></term> - <listitem> - <para>This prevents the Udev build process from killing any - <command>udevd</command> processes that may be running on the - host system.</para> - </listitem> - </varlistentry> +<screen><userinput remap="install">install -m644 -v rules/packages/64-*.rules \ + /lib/udev/rules.d/</userinput></screen> - </variablelist> + <para>Now install a file to create symlinks for certain hand-held devices:</para> - <para>Udev has to be configured in order to work properly, as it only - installs a few configuration files by default. First install the - commonly-used rules files provided by Udev:</para> +<screen><userinput remap="install">install -m644 -v rules/packages/40-pilot-links.rules \ + /lib/udev/rules.d/</userinput></screen> -<screen><userinput remap="install">cp -v etc/udev/rules.d/[0-9]* /etc/udev/rules.d/</userinput></screen> + <!-- There are more files available in the packages/ directory, if we want + to consider using them. Most are probably irrelevant to LFS though. + "alsa" isn't, but we already have those rules, using a better set of + matches. Most of the files in packages/ are for other architectures. --> - <para>Now install the LFS-specific rules files:</para> + <para>Now install the LFS-specific custom rules files:</para> <screen><userinput remap="install">cd &udev-config; make install</userinput></screen> @@ -129,7 +110,7 @@ make install</userinput></screen> rules:</para> <screen><userinput remap="install">cd .. -install -m644 -v docs/writing_udev_rules/index.html \ +install -m644 -v -D docs/writing_udev_rules/index.html \ /usr/share/doc/udev-&udev-version;/index.html</userinput></screen> </sect2> @@ -143,11 +124,10 @@ install -m644 -v docs/writing_udev_rules/index.html \ <segtitle>Installed directory</segtitle> <seglistitem> - <seg>ata_id, cdrom_id, create_floppy_devices, edd_id, firmware.sh, - path_id, scsi_id, udevcontrol, udevd, udevinfo, udevmonitor, udevsettle, - udevtest, udevtrigger, usb_id, vol_id, write_cd_rules, and - write_net_rules</seg> - <seg>libvolume_id</seg> + <seg>ata_id, cdrom_id, collect, create_floppy_devices, edd_id, + firmware.sh, fstab_import, path_id, scsi_id, udevadm, udevd, + usb_id, vol_id, write_cd_rules, and write_net_rules</seg> + <seg>libudev and libvolume_id</seg> <seg>/etc/udev</seg> </seglistitem> </segmentedlist> @@ -179,6 +159,18 @@ install -m644 -v docs/writing_udev_rules/index.html \ </listitem> </varlistentry> + <varlistentry id="collect"> + <term><command>collect</command></term> + <listitem> + <para>Given an ID for the current uevent and a list of + IDs (for all target uevents), registers the current ID + and indicates whether all target IDs have been registered</para> + <indexterm zone="ch-system-udev collect"> + <primary sortas="b-collect">collect</primary> + </indexterm> + </listitem> + </varlistentry> + <varlistentry id="create_floppy_devices"> <term><command>create_floppy_devices</command></term> <listitem> @@ -209,6 +201,18 @@ install -m644 -v docs/writing_udev_rules/index.html \ </listitem> </varlistentry> + <varlistentry id="fstab_import"> + <term><command>fstab_import</command></term> + <listitem> + <para>Finds an entry in <filename>/etc/fstab</filename> that + matches the current device, and provides its information to + Udev</para> + <indexterm zone="ch-system-udev fstab_import"> + <primary sortas="b-fstab_import">fstab_import</primary> + </indexterm> + </listitem> + </varlistentry> + <varlistentry id="path_id"> <term><command>path_id</command></term> <listitem> @@ -232,13 +236,15 @@ install -m644 -v docs/writing_udev_rules/index.html \ </listitem> </varlistentry> - <varlistentry id="udevcontrol"> - <term><command>udevcontrol</command></term> + <varlistentry id="udevadm"> + <term><command>udevadm</command></term> <listitem> - <para>Configures a number of options for the running - <command>udevd</command> daemon, such as the log level.</para> - <indexterm zone="ch-system-udev udevcontrol"> - <primary sortas="b-udevcontrol">udevcontrol</primary> + <para>Generic udev administration tool: controls the udevd daemon, + provides info from the Udev database, monitors uevents, waits for + uevents to finish, tests Udev configuration, and triggers uevents + for a given device</para> + <indexterm zone="ch-system-udev udevadm"> + <primary sortas="b-udevadm">udevadm</primary> </indexterm> </listitem> </varlistentry> @@ -255,64 +261,6 @@ install -m644 -v docs/writing_udev_rules/index.html \ </listitem> </varlistentry> - <varlistentry id="udevinfo"> - <term><command>udevinfo</command></term> - <listitem> - <para>Allows users to query the Udev database for - information on any device currently present on the system; it also - provides a way to query any device in the <systemitem - class="filesystem">sysfs</systemitem> tree to help create udev - rules</para> - <indexterm zone="ch-system-udev udevinfo"> - <primary sortas="b-udevinfo">udevinfo</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="udevmonitor"> - <term><command>udevmonitor</command></term> - <listitem> - <para>Prints the event received from the kernel and the environment - which Udev sends out after rule processing</para> - <indexterm zone="ch-system-udev udevmonitor"> - <primary sortas="b-udevmonitor">udevmonitor</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="udevsettle"> - <term><command>udevsettle</command></term> - <listitem> - <para>Watches the Udev event queue and exits if all current uevents - have been handled</para> - <indexterm zone="ch-system-udev udevsettle"> - <primary sortas="b-udevsettle">udevsettle</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="udevtest"> - <term><command>udevtest</command></term> - <listitem> - <para>Simulates a uevent for the given device, and prints out the - name of the node the real <command>udevd</command> would have created, - or the name of the renamed network interface</para> - <indexterm zone="ch-system-udev udevtest"> - <primary sortas="b-udevtest">udevtest</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="udevtrigger"> - <term><command>udevtrigger</command></term> - <listitem> - <para>Triggers kernel device uevents to be replayed</para> - <indexterm zone="ch-system-udev udevtrigger"> - <primary sortas="b-udevtrigger">udevtrigger</primary> - </indexterm> - </listitem> - </varlistentry> - <varlistentry id="usb_id"> <term><command>usb_id</command></term> <listitem> @@ -358,10 +306,20 @@ install -m644 -v docs/writing_udev_rules/index.html \ </listitem> </varlistentry> + <varlistentry id="libudev"> + <term><command>libudev</command></term> + <listitem> + <para>A library interface to udev device information</para> + <indexterm zone="ch-system-udev libudev"> + <primary sortas="c-libudev">libudev</primary> + </indexterm> + </listitem> + </varlistentry> + <varlistentry id="libvolume_id"> <term><command>libvolume_id</command></term> <listitem> - <para></para> + <para>A library interface to read volume labels and uuids</para> <indexterm zone="ch-system-udev libvolume_id"> <primary sortas="c-libvolume_id">libvolume_id</primary> </indexterm> diff --git a/chapter06/util-linux-ng.xml b/chapter06/util-linux-ng.xml index 5cb412262..ebe43640c 100644 --- a/chapter06/util-linux-ng.xml +++ b/chapter06/util-linux-ng.xml @@ -58,12 +58,40 @@ mkdir -pv /var/lib/hwclock</userinput></screen> <sect2 role="installation"> <title>Installation of Util-linux-ng</title> -<screen><userinput remap="configure">./configure</userinput></screen> +<screen><userinput remap="configure">./configure --enable-arch --enable-partx --enable-write</userinput></screen> + + <variablelist> + <title>The meaning of the configure options:</title> + + <varlistentry> + <term><parameter>--enable-arch</parameter></term> + <listitem> + <para>Enables building the <command>arch</command> program</para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>--enable-partx</parameter></term> + <listitem> + <para>Enables building the <command>addpart</command>, + <command>delpart</command> and <command>partx</command> + programs</para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>--enable-write</parameter></term> + <listitem> + <para>Enables building the <command>write</command> program</para> + </listitem> + </varlistentry> + + </variablelist> <para>Compile the package:</para> <screen><userinput remap="make">make</userinput></screen> + <para>This package does not come with a test suite.</para> + <para>Install the package:</para> <screen><userinput remap="install">make install</userinput></screen> @@ -77,15 +105,16 @@ mkdir -pv /var/lib/hwclock</userinput></screen> <segtitle>Installed programs</segtitle> <seglistitem> - <seg>agetty, arch, blockdev, cal, cfdisk, chkdupexe, col, colcrt, - colrm, column, ctrlaltdel, cytune, ddate, dmesg, elvtune, fdformat, - fdisk, flock, fsck.cramfs, fsck.minix, getopt, hexdump, hwclock, ipcrm, - ipcs, isosize, line, logger, look, losetup, mcookie, mkfs, mkfs.bfs, - mkfs.cramfs, mkfs.minix, mkswap, more, mount, namei, pg, pivot_root, - ramsize (link to rdev), raw, rdev, readprofile, rename, renice, rev, - rootflags (link to rdev), script, setfdprm, setsid, setterm, sfdisk, - swapoff (link to swapon), swapon, tailf, tunelp, ul, umount, - vidmode (link to rdev), whereis, and write</seg> + + <seg>addpart, agetty, arch, blockdev, cal, cfdisk, chkdupexe, chrt, + col, colcrt, colrm, column, ctrlaltdel, cytune, ddate, delpart, dmesg, + fdformat, fdisk, flock, fsck.cramfs, fsck.minix, getopt, hexdump, + hwclock, ionice, ipcrm, ipcs, isosize, ldattach, line, logger, look, + losetup, mcookie, mkfs, mkfs.bfs, mkfs.cramfs, mkfs.minix, mkswap, + more, mount, namei, partx, pg, pivot_root, readprofile, rename, renice, + rev, rtcwake, script, scriptreplay, setarch, setsid, setterm, sfdisk, + swapon, tailf, taskset, tunelp, ul, umount, wall, whereis, + and write</seg> </seglistitem> </segmentedlist> @@ -94,6 +123,16 @@ mkdir -pv /var/lib/hwclock</userinput></screen> <?dbfo list-presentation="list"?> <?dbhtml list-presentation="table"?> + <varlistentry id="addpart"> + <term><command>addpart</command></term> + <listitem> + <para>Informs the Linux kernel of new partitions</para> + <indexterm zone="ch-system-util-linux-ng addpart"> + <primary sortas="b-addpart">addpart</primary> + </indexterm> + </listitem> + </varlistentry> + <varlistentry id="agetty"> <term><command>agetty</command></term> <listitem> @@ -156,6 +195,16 @@ mkdir -pv /var/lib/hwclock</userinput></screen> </listitem> </varlistentry> + <varlistentry id="chrt"> + <term><command>chrt</command></term> + <listitem> + <para>Manipulates real-time attributes of a process</para> + <indexterm zone="ch-system-util-linux-ng chrt"> + <primary sortas="b-chrt">chrt</primary> + </indexterm> + </listitem> + </varlistentry> + <varlistentry id="col"> <term><command>col</command></term> <listitem> @@ -230,23 +279,22 @@ mkdir -pv /var/lib/hwclock</userinput></screen> </listitem> </varlistentry> - <varlistentry id="dmesg"> - <term><command>dmesg</command></term> + <varlistentry id="delpart"> + <term><command>delpart</command></term> <listitem> - <para>Dumps the kernel boot messages</para> - <indexterm zone="ch-system-util-linux-ng dmesg"> - <primary sortas="b-dmesg">dmesg</primary> + <para>Asks the Linux kernel to remove a partition</para> + <indexterm zone="ch-system-util-linux-ng delpart"> + <primary sortas="b-delpart">delpart</primary> </indexterm> </listitem> </varlistentry> - <varlistentry id="elvtune"> - <term><command>elvtune</command></term> + <varlistentry id="dmesg"> + <term><command>dmesg</command></term> <listitem> - <para>Tunes the performance and interactivity of a block - device</para> - <indexterm zone="ch-system-util-linux-ng elvtune"> - <primary sortas="b-elvtune">elvtune</primary> + <para>Dumps the kernel boot messages</para> + <indexterm zone="ch-system-util-linux-ng dmesg"> + <primary sortas="b-dmesg">dmesg</primary> </indexterm> </listitem> </varlistentry> @@ -337,6 +385,16 @@ mkdir -pv /var/lib/hwclock</userinput></screen> </listitem> </varlistentry> + <varlistentry id="ionice"> + <term><command>ionice</command></term> + <listitem> + <para>Gets or sets the io scheduling class and priority for a program</para> + <indexterm zone="ch-system-util-linux-ng ionice"> + <primary sortas="b-ionice">ionice</primary> + </indexterm> + </listitem> + </varlistentry> + <varlistentry id="ipcrm"> <term><command>ipcrm</command></term> <listitem> @@ -367,6 +425,16 @@ mkdir -pv /var/lib/hwclock</userinput></screen> </listitem> </varlistentry> + <varlistentry id="ldattach"> + <term><command>ldattach</command></term> + <listitem> + <para>Attaches a line discipline to a serial line</para> + <indexterm zone="ch-system-util-linux-ng ldattach"> + <primary sortas="b-ldattach">ldattach</primary> + </indexterm> + </listitem> + </varlistentry> + <varlistentry id="line"> <term><command>line</command></term> <listitem> @@ -501,6 +569,17 @@ mkdir -pv /var/lib/hwclock</userinput></screen> </listitem> </varlistentry> + <varlistentry id="partx"> + <term><command>partx</command></term> + <listitem> + <para>Tells the kernel about the presence and numbering of on-disk + partitions</para> + <indexterm zone="ch-system-util-linux-ng partx"> + <primary sortas="b-partx">partx</primary> + </indexterm> + </listitem> + </varlistentry> + <varlistentry id="pg"> <term><command>pg</command></term> <listitem> @@ -522,38 +601,6 @@ mkdir -pv /var/lib/hwclock</userinput></screen> </listitem> </varlistentry> - <varlistentry id="ramsize"> - <term><command>ramsize</command></term> - <listitem> - <para>Sets the size of the RAM disk in a bootable image</para> - <indexterm zone="ch-system-util-linux-ng ramsize"> - <primary sortas="b-ramsize">ramsize</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="raw"> - <term><command>raw</command></term> - <listitem> - <para>Used to bind a Linux raw character device to a block - device</para> - <indexterm zone="ch-system-util-linux-ng raw"> - <primary sortas="b-raw">raw</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="rdev"> - <term><command>rdev</command></term> - <listitem> - <para>Queries and sets the root device, among other things, in a - bootable image</para> - <indexterm zone="ch-system-util-linux-ng rdev"> - <primary sortas="b-rdev">rdev</primary> - </indexterm> - </listitem> - </varlistentry> - <varlistentry id="readprofile"> <term><command>readprofile</command></term> <listitem> @@ -595,12 +642,13 @@ mkdir -pv /var/lib/hwclock</userinput></screen> </listitem> </varlistentry> - <varlistentry id="rootflags"> - <term><command>rootflags</command></term> + <varlistentry id="rtcwake"> + <term><command>rtcwake</command></term> <listitem> - <para>Sets the rootflags in a bootable image</para> - <indexterm zone="ch-system-util-linux-ng rootflags"> - <primary sortas="b-rootflags">rootflags</primary> + <para>Used to enter a system sleep state until specified wakeup + time</para> + <indexterm zone="ch-system-util-linux-ng rtcwake"> + <primary sortas="b-rtcwake">rtcwake</primary> </indexterm> </listitem> </varlistentry> @@ -615,12 +663,23 @@ mkdir -pv /var/lib/hwclock</userinput></screen> </listitem> </varlistentry> - <varlistentry id="setfdprm"> - <term><command>setfdprm</command></term> + <varlistentry id="scriptreplay"> + <term><command>scriptreplay</command></term> + <listitem> + <para>Plays back typescripts using timing information</para> + <indexterm zone="ch-system-util-linux-ng scriptreplay"> + <primary sortas="b-scriptreplay">scriptreplay</primary> + </indexterm> + </listitem> + </varlistentry> + + <varlistentry id="setarch"> + <term><command>setarch</command></term> <listitem> - <para>Sets user-provided floppy disk parameters</para> - <indexterm zone="ch-system-util-linux-ng setfdprm"> - <primary sortas="b-setfdprm">setfdprm</primary> + <para>Changes reported architecture in a new program environment and + sets personality flags</para> + <indexterm zone="ch-system-util-linux-ng setarch"> + <primary sortas="b-setarch">setarch</primary> </indexterm> </listitem> </varlistentry> @@ -655,16 +714,6 @@ mkdir -pv /var/lib/hwclock</userinput></screen> </listitem> </varlistentry> - <varlistentry id="swapoff"> - <term><command>swapoff</command></term> - <listitem> - <para>Disables devices and files for paging and swapping</para> - <indexterm zone="ch-system-util-linux-ng swapoff"> - <primary sortas="b-swapoff">swapoff</primary> - </indexterm> - </listitem> - </varlistentry> - <varlistentry id="swapon"> <term><command>swapon</command></term> <listitem> @@ -688,6 +737,16 @@ mkdir -pv /var/lib/hwclock</userinput></screen> </listitem> </varlistentry> + <varlistentry id="taskset"> + <term><command>taskset</command></term> + <listitem> + <para>Retrieves or sets a process' CPU affinity</para> + <indexterm zone="ch-system-util-linux-ng taskset"> + <primary sortas="b-taskset">taskset</primary> + </indexterm> + </listitem> + </varlistentry> + <varlistentry id="tunelp"> <term><command>tunelp</command></term> <listitem> @@ -719,12 +778,13 @@ mkdir -pv /var/lib/hwclock</userinput></screen> </listitem> </varlistentry> - <varlistentry id="vidmode"> - <term><command>vidmode</command></term> + <varlistentry id="wall"> + <term><command>wall</command></term> <listitem> - <para>Sets the video mode in a bootable image</para> - <indexterm zone="ch-system-util-linux-ng vidmode"> - <primary sortas="b-vidmode">vidmode</primary> + <para>Displays the contents of a file or, by default, its standard + input, on the terminals of all currently logged in users</para> + <indexterm zone="ch-system-util-linux-ng wall"> + <primary sortas="b-wall">wall</primary> </indexterm> </listitem> </varlistentry> diff --git a/chapter07/network.xml b/chapter07/network.xml index f3159a571..cf6762e5c 100644 --- a/chapter07/network.xml +++ b/chapter07/network.xml @@ -39,7 +39,9 @@ <para>Pre-generate the rules to ensure the same names get assigned to the same devices at every boot, including the first:</para> -<screen><userinput>/lib/udev/write_net_rules all_interfaces</userinput></screen> +<screen><userinput>for NIC in /sys/class/net/* ; do + INTERFACE=${NIC##*/} udevadm test --action=add --subsystem=net $NIC +done</userinput></screen> <para>Now, inspect the <filename>/etc/udev/rules.d/70-persistent-net.rules</filename> file, to find out which name was assigned to which network device:</para> @@ -48,14 +50,14 @@ <para>The file begins with a comment block followed by two lines for each NIC. The first line for each NIC is a commented description showing its - hardware IDs (e.g. its PC vendor and device IDs, if it's a PCI card), + hardware IDs (e.g. its PCI vendor and device IDs, if it's a PCI card), along with its driver in parentheses, if the driver can be found. Neither the hardware ID nor the driver is used to determine which name to give an - interface. The second line is the Udev rule that matches this NIC and - actually assigns it a name.</para> + interface; this information is only for reference. The second line is the + Udev rule that matches this NIC and actually assigns it a name.</para> <para>All Udev rules are made up of several keys, separated by commas and - optional whitespace. This rule's keys and an explanations of each of them + optional whitespace. This rule's keys and an explanation of each of them are as follows:</para> <itemizedlist> @@ -64,22 +66,34 @@ devices that are not network cards.</para> </listitem> <listitem> + <para><literal>ACTION=="add"</literal> - This tells Udev to ignore this + rule for a uevent that isn't an add ("remove" and "change" uevents also + happen, but don't need to rename network interfaces).</para> + </listitem> + <listitem> <para><literal>DRIVERS=="?*"</literal> - This exists so that Udev will ignore VLAN or bridge sub-interfaces (because these sub-interfaces do not have drivers). These sub-interfaces are skipped because the name that would be assigned would collide with their parent devices.</para> </listitem> <listitem> - <para><literal>ATTRS{type}=="1"</literal> - Optional. This key will - only be added if this NIC is a wireless NIC whose driver creates - multiple virtual interfaces; it ensures the rule only matches the - primary interface. The secondary interfaces are not matched for the - same reason that VLAN and bridge sub-interfaces are not matched: there - would be a name collision.</para> + <para><literal>ATTR{address}</literal> - The value of this key is the + NIC's MAC address.</para> + </listitem> + <listitem> + <para><literal>ATTR{type}=="1"</literal> - This ensures the rule only + matches the primary interface in the case of certain wireless drivers, + which create multiple virtual interfaces. The secondary interfaces are + skipped for the same reason that VLAN and bridge sub-interfaces are + skipped: there would be a name collision otherwise.</para> </listitem> <listitem> - <para><literal>ATTRS{address}</literal> - The value of this key is the - NIC's MAC address.</para> + <para><literal>KERNEL=="eth*"</literal> - This key was added to the + Udev rule generator to handle machines that have multiple network + interfaces, all with the same MAC address (the PS3 is one such + machine). If the independent interfaces have different basenames, + this key will allow Udev to tell them apart. This is generally not + necessary for most Linux From Scratch users, but does not hurt.</para> </listitem> <listitem> <para><literal>NAME</literal> - The value of this key is the name that diff --git a/chapter07/symlinks.xml b/chapter07/symlinks.xml index 4b0aafeed..1ddfa62ea 100644 --- a/chapter07/symlinks.xml +++ b/chapter07/symlinks.xml @@ -63,7 +63,7 @@ <filename class="directory">/sys/block/hdd</filename>) and run a command similar to the following:</para> -<screen role="nodump"><userinput>udevtest /sys/block/hdd</userinput></screen> +<screen role="nodump"><userinput>udevadm test /sys/block/hdd</userinput></screen> <para>Look at the lines containing the output of various *_id programs. The <quote>by-id</quote> mode will use the ID_SERIAL value if it exists and @@ -124,7 +124,7 @@ Figure out the attributes that identify the device uniquely (usually, vendor and product IDs and/or serial numbers work):</para> -<screen role="nodump"><userinput>udevinfo -a -p /sys/class/video4linux/video0</userinput></screen> +<screen role="nodump"><userinput>udevadm info -a -p /sys/class/video4linux/video0</userinput></screen> <para>Then write rules that create the symlinks, e.g.:</para> diff --git a/chapter07/udev.xml b/chapter07/udev.xml index e64fdf191..00afb06e7 100644 --- a/chapter07/udev.xml +++ b/chapter07/udev.xml @@ -105,14 +105,14 @@ class="directory">/lib/udev/devices</filename> to <filename class="directory">/dev</filename>. This is necessary because some devices, directories, and symlinks are needed before the dynamic device handling - processes are available during the early stages of booting a system. - Creating static device nodes in <filename - class="directory">/lib/udev/devices</filename> also provides an easy - workaround for devices that are not supported by the dynamic device - handling infrastructure. The bootscript then starts the Udev daemon, - <command>udevd</command>, which will act on any uevents it receives. - Finally, the bootscript forces the kernel to replay uevents for any - devices that have already been registered and then waits for + processes are available during the early stages of booting a system, or + are required by <command>udevd</command> itself. Creating static device + nodes in <filename class="directory">/lib/udev/devices</filename> also + provides an easy workaround for devices that are not supported by the + dynamic device handling infrastructure. The bootscript then starts the + Udev daemon, <command>udevd</command>, which will act on any uevents it + receives. Finally, the bootscript forces the kernel to replay uevents for + any devices that have already been registered and then waits for <command>udevd</command> to handle them.</para> </sect3> @@ -155,9 +155,9 @@ <filename>/sys/bus/pci/devices/0000:00:0d.0/modalias</filename> file might contain the string <quote>pci:v00001319d00000801sv00001319sd00001319bc04sc01i00</quote>. - The rules that LFS installs will cause <command>udevd</command> to call - out to <command>/sbin/modprobe</command> with the contents of the - <envar>MODALIAS</envar> uevent environment variable (that should be the + The default rules provided with Udev will cause <command>udevd</command> + to call out to <command>/sbin/modprobe</command> with the contents of the + <envar>MODALIAS</envar> uevent environment variable (which should be the same as the contents of the <filename>modalias</filename> file in sysfs), thus loading all modules whose aliases match this string after wildcard expansion.</para> @@ -268,7 +268,8 @@ <para>This usually happens if a rule unexpectedly matches a device. For example, a poorly-writen rule can match both a SCSI disk (as desired) and the corresponding SCSI generic device (incorrectly) by vendor. - Find the offending rule and make it more specific.</para> + Find the offending rule and make it more specific, with the help of the + <command>udevadm info</command> command.</para> </sect3> @@ -281,8 +282,8 @@ For now, you can work around it by creating a rule that waits for the used <systemitem class="filesystem">sysfs</systemitem> attribute and appending it to the <filename>/etc/udev/rules.d/10-wait_for_sysfs.rules</filename> - file. Please notify the LFS Development list if you do so and it - helps.</para> + file (create this file if it does not exist). Please notify the LFS + Development list if you do so and it helps.</para> </sect3> diff --git a/chapter08/fstab.xml b/chapter08/fstab.xml index 6979b0a62..026ec000c 100644 --- a/chapter08/fstab.xml +++ b/chapter08/fstab.xml @@ -30,7 +30,7 @@ proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 devpts /dev/pts devpts gid=4,mode=620 0 0 -shm /dev/shm tmpfs defaults 0 0 +tmpfs /dev/shm tmpfs defaults 0 0 # End /etc/fstab</literal> EOF</userinput></screen> diff --git a/chapter08/kernel.xml b/chapter08/kernel.xml index de0e4b1df..ca3fd9145 100644 --- a/chapter08/kernel.xml +++ b/chapter08/kernel.xml @@ -116,7 +116,7 @@ <para>The path to the kernel image may vary depending on the platform being used. The following command assumes an x86 architecture:</para> -<screen><userinput remap="install">cp -v arch/i386/boot/bzImage /boot/lfskernel-&linux-version;</userinput></screen> +<screen><userinput remap="install">cp -v arch/x86/boot/bzImage /boot/lfskernel-&linux-version;</userinput></screen> <para><filename>System.map</filename> is a symbol file for the kernel. It maps the function entry points of every function in the kernel API, diff --git a/general.ent b/general.ent index 012c9e0f8..75f5524cb 100644 --- a/general.ent +++ b/general.ent @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="ISO-8859-1"?> -<!ENTITY version "SVN-JH-20080423"> -<!ENTITY releasedate "April 23, 2008"> +<!ENTITY version "SVN-JH-20081019"> +<!ENTITY releasedate "October 19, 2008"> +<!ENTITY copyrightdate "1999–2008"> <!ENTITY milestone "7.0"> <!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" --> @@ -41,6 +41,9 @@ <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="appendices/acronymlist.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="appendices/acknowledgments.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="appendices/dependencies.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="appendices/scripts.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="appendices/udev-rules.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="appendices/license.xml"/> </part> <index/> diff --git a/make-aux-files.sh b/make-aux-files.sh new file mode 100755 index 000000000..c57352a9d --- /dev/null +++ b/make-aux-files.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +rm -f lfs-bootscripts*.tar.bz2 + +# Get base file name and move bootscripts directory to that name +version=`grep "ENTITY lfs-bootscripts-version" packages.ent |cut -d'"' -f2` +mv bootscripts lfs-bootscripts-$version + +# Create the tarball and clean up +tar -cjf lfs-bootscripts-$version.tar.bz2 --exclude .svn lfs-bootscripts-$version +mv lfs-bootscripts-$version bootscripts + +rm -f udev-config*.bz2 + +# Get file name and move udev config directory to that name +version=`grep "ENTITY udev-config " packages.ent |cut -d'"' -f2` +mv udev-config $version + +# Create the tarball and clean up +tar -cjf $version.tar.bz2 --exclude .svn $version +mv $version udev-config + diff --git a/packages.ent b/packages.ent index 58866713e..265d7036f 100644 --- a/packages.ent +++ b/packages.ent @@ -7,12 +7,12 @@ Allowed deviation in disk usage : 2% --> -<!ENTITY autoconf-version "2.61"> -<!ENTITY autoconf-size "1,018 KB"> +<!ENTITY autoconf-version "2.63"> +<!ENTITY autoconf-size "1,195 KB"> <!ENTITY autoconf-url "&gnu;autoconf/autoconf-&autoconf-version;.tar.bz2"> -<!ENTITY autoconf-md5 "36d3fe706ad0950f1be10c46a429efe0"> +<!ENTITY autoconf-md5 "7565809ed801bb5726da0631ceab3699"> <!ENTITY autoconf-home "&gnu-software;autoconf/"> -<!ENTITY autoconf-ch6-du "8.1 MB"> +<!ENTITY autoconf-ch6-du "14.3 MB testsuite included"> <!ENTITY autoconf-ch6-sbu "less than 0.1 SBU"> <!ENTITY automake-version "1.10.1"> @@ -70,23 +70,23 @@ <!ENTITY bzip2-ch6-du "6.5 MB"> <!ENTITY bzip2-ch6-sbu "less than 0.1 SBU"> -<!ENTITY coreutils-version "6.10"> -<!ENTITY coreutils-size "8,978 KB"> +<!ENTITY coreutils-version "6.12"> +<!ENTITY coreutils-size "9,001 KB"> <!ENTITY coreutils-url "&gnu;coreutils/coreutils-&coreutils-version;.tar.gz"> -<!ENTITY coreutils-md5 "eca0de1bf7389694305d7e52cd76a472"> +<!ENTITY coreutils-md5 "2ca9ac69823dbd567b905a9e9f53c4f6"> <!ENTITY coreutils-home "&gnu-software;coreutils/"> -<!ENTITY coreutils-ch5-du "67.6 MB"> -<!ENTITY coreutils-ch5-sbu "0.5 SBU"> -<!ENTITY coreutils-ch6-du "72.4 MB"> -<!ENTITY coreutils-ch6-sbu "1.0 SBU"> +<!ENTITY coreutils-ch5-du "83 MB"> +<!ENTITY coreutils-ch5-sbu "0.7 SBU"> +<!ENTITY coreutils-ch6-du "89 MB testsuite included"> +<!ENTITY coreutils-ch6-sbu "1.7 SBU testsuite included"> -<!ENTITY db-version "4.6.21"> -<!ENTITY db-size "11,603 KB"> +<!ENTITY db-version "4.7.25"> +<!ENTITY db-size "13,124 KB"> <!ENTITY db-url "http://download-east.oracle.com/berkeley-db/db-&db-version;.tar.gz"> -<!ENTITY db-md5 "718082e7e35fc48478a2334b0bc4cd11"> +<!ENTITY db-md5 "ec2b87e833779681a0c3a814aa71359e"> <!ENTITY db-home "http://www.oracle.com/technology/software/products/berkeley-db/index.html"> -<!ENTITY db-ch6-du "77 MB"> -<!ENTITY db-ch6-sbu "1.2 SBU"> +<!ENTITY db-ch6-du "120 MB"> +<!ENTITY db-ch6-sbu "1.9 SBU"> <!ENTITY dejagnu-version "1.4.4"> <!ENTITY dejagnu-size "1,056 KB"> @@ -109,15 +109,15 @@ <!-- NOTE: When updating e2fsprogs, remember to check the list of acceptable features that can be shown by debugfs in chapter02/creatingfilesystem.xml --> -<!ENTITY e2fsprogs-version "1.40.6"> -<!ENTITY e2fsprogs-size "3,977 KB"> +<!ENTITY e2fsprogs-version "1.41.2"> +<!ENTITY e2fsprogs-size "4,268 KB"> <!ENTITY e2fsprogs-url "&sourceforge;e2fsprogs/e2fsprogs-&e2fsprogs-version;.tar.gz"> -<!ENTITY e2fsprogs-md5 "d219b7be4f7170400c646f5611c0b702"> +<!ENTITY e2fsprogs-md5 "1c1c5177aea9a23b45b9b3f5b3241819"> <!ENTITY e2fsprogs-home "http://e2fsprogs.sourceforge.net/"> -<!ENTITY e2fsprogs-ch5-du "31.2 MB"> +<!ENTITY e2fsprogs-ch5-du "38 MB"> <!ENTITY e2fsprogs-ch5-sbu "0.4 SBU"> -<!ENTITY e2fsprogs-ch6-du "31.2 MB"> -<!ENTITY e2fsprogs-ch6-sbu "0.4 SBU"> +<!ENTITY e2fsprogs-ch6-du "54 MB testsuite included"> +<!ENTITY e2fsprogs-ch6-sbu "0.7 SBU testsuite included"> <!ENTITY expect-version "5.43.0"> <!ENTITY expect-lib-version "5.43"> @@ -128,23 +128,23 @@ <!ENTITY expect-ch5-du "4 MB"> <!ENTITY expect-ch5-sbu "0.1 SBU"> -<!ENTITY file-version "4.23"> -<!ENTITY file-size "551 KB"> -<!ENTITY file-url "ftp://ftp.gw.com/mirrors/unix/file/file-&file-version;.tar.gz"> -<!ENTITY file-md5 "014a69979a8d5225a6ca2bcc4d7e967e"> -<!ENTITY file-home " "> -<!ENTITY file-ch6-du "7.9 MB"> +<!ENTITY file-version "4.26"> +<!ENTITY file-size "584 KB"> +<!ENTITY file-url "ftp://ftp.astron.com/pub/file/file-&file-version;.tar.gz"> +<!ENTITY file-md5 "74cd5466416136da30a4e69f74dbc7a0"> +<!ENTITY file-home "http://www.darwinsys.com/file/"> +<!ENTITY file-ch6-du "8.9 MB"> <!ENTITY file-ch6-sbu "0.1 SBU"> -<!ENTITY findutils-version "4.2.33"> -<!ENTITY findutils-size "1,421 KB"> +<!ENTITY findutils-version "4.4.0"> +<!ENTITY findutils-size "2,029 KB"> <!ENTITY findutils-url "&gnu;findutils/findutils-&findutils-version;.tar.gz"> -<!ENTITY findutils-md5 "b7e35aa175778c84942b1fee4144988b"> +<!ENTITY findutils-md5 "49e769ac4382fae6f104f99d54d0a112"> <!ENTITY findutils-home "&gnu-software;findutils/"> -<!ENTITY findutils-ch5-du "13.6 MB"> -<!ENTITY findutils-ch5-sbu "0.2 SBU"> -<!ENTITY findutils-ch6-du "13.6 MB"> -<!ENTITY findutils-ch6-sbu "0.2 SBU"> +<!ENTITY findutils-ch5-du "20 MB"> +<!ENTITY findutils-ch5-sbu "0.3 SBU"> +<!ENTITY findutils-ch6-du "22 MB"> +<!ENTITY findutils-ch6-sbu "0.4 SBU"> <!ENTITY flex-version "2.5.35"> <!ENTITY flex-size "1,229 KB"> @@ -153,7 +153,7 @@ <!ENTITY flex-home "http://flex.sourceforge.net"> <!ENTITY flex-ch5-du "8.4 MB"> <!ENTITY flex-ch5-sbu "0.1 SBU"> -<!ENTITY flex-ch6-du "10.1 MB"> +<!ENTITY flex-ch6-du "28 MB testsuite included"> <!ENTITY flex-ch6-sbu "0.2 SBU"> <!ENTITY gawk-version "3.1.6"> @@ -161,48 +161,58 @@ <!ENTITY gawk-url "&gnu;gawk/gawk-&gawk-version;.tar.bz2"> <!ENTITY gawk-md5 "c9926c0bc8c177cb9579708ce67f0d75"> <!ENTITY gawk-home "&gnu-software;gawk/"> -<!ENTITY gawk-ch5-du "18.2 MB"> -<!ENTITY gawk-ch5-sbu "0.2 SBU"> -<!ENTITY gawk-ch6-du "18.2 MB"> -<!ENTITY gawk-ch6-sbu "0.2 SBU"> +<!ENTITY gawk-ch5-du "19 MB"> +<!ENTITY gawk-ch5-sbu "0.3 SBU"> +<!ENTITY gawk-ch6-du "21 MB"> +<!ENTITY gawk-ch6-sbu "0.3 SBU"> -<!ENTITY gcc-version "4.2.3"> -<!ENTITY gcc-size "43,413 KB"> +<!ENTITY gcc-version "4.3.2"> +<!ENTITY gcc-size "58,929 KB"> <!ENTITY gcc-url "&gnu;gcc/gcc-&gcc-version;/gcc-&gcc-version;.tar.bz2"> -<!ENTITY gcc-md5 "ef2a4d9991b3644115456ea05b2b8163"> +<!ENTITY gcc-md5 "5dfac5da961ecd5f227c3175859a486d"> <!ENTITY gcc-home "http://gcc.gnu.org/"> -<!ENTITY gcc-ch5p1-du "655 MB"> -<!ENTITY gcc-ch5p1-sbu "9.2 SBU"> -<!ENTITY gcc-ch5p2-du "553 MB"> -<!ENTITY gcc-ch5p2-sbu "4.2 SBU"> -<!ENTITY gcc-ch6-du "681 MB testsuite included"> -<!ENTITY gcc-ch6-sbu "22 SBU testsuite included"> +<!ENTITY gcc-ch5p1-du "1.1 GB"> +<!ENTITY gcc-ch5p1-sbu "22 SBU"> +<!ENTITY gcc-ch5p2-du "865 MB"> +<!ENTITY gcc-ch5p2-sbu "6.5 SBU"> +<!ENTITY gcc-ch6-du "1.1 GB testsuite included"> +<!ENTITY gcc-ch6-sbu "25 SBU testsuite included"> <!ENTITY gettext-version "0.17"> <!ENTITY gettext-size "11,368 KB"> <!ENTITY gettext-url "&gnu;gettext/gettext-&gettext-version;.tar.gz"> <!ENTITY gettext-md5 "58a2bc6d39c0ba57823034d55d65d606"> <!ENTITY gettext-home "&gnu-software;gettext/"> -<!ENTITY gettext-ch5-du "43 MB"> -<!ENTITY gettext-ch5-sbu "0.4 SBU"> -<!ENTITY gettext-ch6-du "65 MB"> -<!ENTITY gettext-ch6-sbu "1 SBU"> - -<!ENTITY glibc-version "2.7"> -<!ENTITY glibc-size "15,602 KB"> -<!ENTITY glibc-url "&gnu;glibc/glibc-&glibc-version;.tar.bz2"> -<!ENTITY glibc-md5 "065c5952b439deba40083ccd67bcc8f7"> +<!ENTITY gettext-ch5-du "83 MB"> +<!ENTITY gettext-ch5-sbu "0.8 SBU"> +<!ENTITY gettext-ch6-du "128 MB"> +<!ENTITY gettext-ch6-sbu "2.2 SBU"> + +<!ENTITY glibc-version "2.8-20080929"> +<!ENTITY glibc-size "16,231 KB"> +<!ENTITY glibc-url "ftp://sources.redhat.com/pub/glibc/snapshots/glibc-&glibc-version;.tar.bz2"> +<!ENTITY glibc-md5 "ef223822e84f38dc6b3762bcf3bd6c5e"> <!ENTITY glibc-home "&gnu-software;libc/"> -<!ENTITY glibc-ch5-du "342 MB"> -<!ENTITY glibc-ch5-sbu "7 SBU"> -<!ENTITY glibc-ch6-du "556 MB testsuite included"> -<!ENTITY glibc-ch6-sbu "19.5 SBU testsuite included"> +<!ENTITY glibc-ch5-du "407 MB"> +<!ENTITY glibc-ch5-sbu "7.6 SBU"> +<!ENTITY glibc-ch6-du "801 MB testsuite included"> +<!ENTITY glibc-ch6-sbu "17.7 SBU testsuite included"> <!ENTITY glibc-libidn-version "&glibc-version;"> <!ENTITY glibc-libidn-size "100 KB"> <!ENTITY glibc-libidn-url "&gnu;glibc/glibc-libidn-&glibc-libidn-version;.tar.bz2"> <!ENTITY glibc-libidn-md5 "226809992fb1f3dc6ea23e0f26952ea4"> <!ENTITY glibc-libidn-home " "> +<!ENTITY gmp-version "4.2.4"> +<!ENTITY gmp-size "1,170 KB"> +<!ENTITY gmp-url "&gnu;gmp/gmp-&gmp-version;.tar.bz2"> +<!ENTITY gmp-md5 "fc1e3b3a2a5038d4d74138d0b9cf8dbe"> +<!ENTITY gmp-home "&gnu-software;gmp/"> +<!ENTITY gmp-ch5-du "22.9 MB"> +<!ENTITY gmp-ch5-sbu "0.8 SBU"> +<!ENTITY gmp-ch6-du "39.4 MB testsuite included"> +<!ENTITY gmp-ch6-sbu "1.5 SBU testsuite included"> + <!ENTITY grep-version "2.5.3"> <!ENTITY grep-size "604 KB"> <!ENTITY grep-url "&gnu;grep/grep-&grep-version;.tar.bz2"> @@ -243,7 +253,7 @@ <!ENTITY iana-etc-size "204 KB"> <!ENTITY iana-etc-url "http://sethwklein.net/iana-etc-&iana-etc-version;.tar.bz2"> <!ENTITY iana-etc-md5 "3ba3afb1d1b261383d247f46cb135ee8"> -<!ENTITY iana-etc-home "http://sethwklein.net/iana-etc/"> +<!ENTITY iana-etc-home "http://sethwklein.net/iana-etc"> <!ENTITY iana-etc-ch6-du "2.1 MB"> <!ENTITY iana-etc-ch6-sbu "less than 0.1 SBU"> @@ -252,15 +262,15 @@ <!ENTITY inetutils-url "&gnu;inetutils/inetutils-&inetutils-version;.tar.gz"> <!ENTITY inetutils-md5 "aeacd11d19bf25c89d4eff38346bdfb9"> <!ENTITY inetutils-home "&gnu-software;inetutils/"> -<!ENTITY inetutils-ch6-du "8.9 MB"> -<!ENTITY inetutils-ch6-sbu "0.2 SBU"> +<!ENTITY inetutils-ch6-du "12 MB"> +<!ENTITY inetutils-ch6-sbu "0.3 SBU"> -<!ENTITY iproute2-version "2.6.23"> -<!ENTITY iproute2-size "334 KB"> +<!ENTITY iproute2-version "2.6.26"> +<!ENTITY iproute2-size "359 KB"> <!ENTITY iproute2-url "http://developer.osdl.org/dev/iproute2/download/iproute2-&iproute2-version;.tar.bz2"> -<!ENTITY iproute2-md5 "2e59da739ef19990408cf0a5cb0cae3e"> +<!ENTITY iproute2-md5 "7d221e735cba05709341cd46401c4ecd"> <!ENTITY iproute2-home "http://linux-net.osdl.org/index.php/Iproute2"> -<!ENTITY iproute2-ch6-du "4.8 MB"> +<!ENTITY iproute2-ch6-du "5.6 MB"> <!ENTITY iproute2-ch6-sbu "0.2 SBU"> <!ENTITY kbd-version "1.14.1"> @@ -279,48 +289,48 @@ <!ENTITY less-ch6-du "2.8 MB"> <!ENTITY less-ch6-sbu "0.1 SBU"> -<!ENTITY lfs-bootscripts-version "20070813"> -<!ENTITY lfs-bootscripts-size "39 KB"> +<!ENTITY lfs-bootscripts-version "20080522"> <!-- Scripts depend on this format --> +<!ENTITY lfs-bootscripts-size "BOOTSCRIPTS-SIZE KB"> <!-- Updated in Makefile --> <!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.bz2"> -<!ENTITY lfs-bootscripts-md5 "0ecbdd3b774d519fc535a0a595aa5b86"> +<!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM"> <!-- Updated in Makefile --> <!ENTITY lfs-bootscripts-home " "> -<!ENTITY lfs-bootscripts-ch7-du "0.4 MB"> +<!ENTITY lfs-bootscripts-ch7-du "BOOTSCRIPTS-INSTALL-KB KB"> <!-- Updated in Makefile --> <!ENTITY lfs-bootscripts-ch7-sbu "less than 0.1 SBU"> -<!ENTITY libtool-version "1.5.26"> -<!ENTITY libtool-size "2,893 KB"> +<!ENTITY libtool-version "2.2.6a"> +<!ENTITY libtool-size "2,870 KB"> <!ENTITY libtool-url "&gnu;libtool/libtool-&libtool-version;.tar.gz"> -<!ENTITY libtool-md5 "aa9c5107f3ec9ef4200eb6556f3b3c29"> +<!ENTITY libtool-md5 "8ca1ea241cd27ff9832e045fe9afe4fd"> <!ENTITY libtool-home "&gnu-software;libtool/"> -<!ENTITY libtool-ch6-du "16.6 MB"> +<!ENTITY libtool-ch6-du "36 MB testsuite included"> <!ENTITY libtool-ch6-sbu "0.1 SBU"> <!ENTITY linux-major-version "2.6"> -<!ENTITY linux-minor-version "24"> -<!ENTITY linux-patch-version "4"> +<!ENTITY linux-minor-version "26"> +<!ENTITY linux-patch-version "5"> <!ENTITY linux-version "&linux-major-version;.&linux-minor-version;.&linux-patch-version;"> <!-- <!ENTITY linux-version "&linux-major-version;.&linux-minor-version;"> --> -<!ENTITY linux-size "45,689 KB"> +<!ENTITY linux-size "49,450 KB"> <!ENTITY linux-url "&kernel;linux/kernel/v&linux-major-version;/linux-&linux-version;.tar.bz2"> -<!ENTITY linux-md5 "91d3ae8d362c8da73a0aa17d5452207d"> +<!ENTITY linux-md5 "98261b39a558cf0739703ffea7db9f43"> <!ENTITY linux-home "http://www.kernel.org/"> -<!ENTITY linux-ch8-du "350 - 450 MB"> -<!ENTITY linux-ch8-sbu "1.5 - 3.5 SBU"> +<!ENTITY linux-ch8-du "350 - 500 MB"> +<!ENTITY linux-ch8-sbu "1.5 - 5.0 SBU"> -<!ENTITY linux-headers-ch5-du "286 MB"> -<!ENTITY linux-headers-ch5-sbu "less than 0.1 SBU"> -<!ENTITY linux-headers-ch6-du "286 MB"> -<!ENTITY linux-headers-ch6-sbu "less than 0.1 SBU"> +<!ENTITY linux-headers-ch5-du "341 MB"> +<!ENTITY linux-headers-ch5-sbu "0.1 SBU"> +<!ENTITY linux-headers-ch6-du "341 MB"> +<!ENTITY linux-headers-ch6-sbu "0.1 SBU"> -<!ENTITY m4-version "1.4.10"> -<!ENTITY m4-size "722 KB"> +<!ENTITY m4-version "1.4.11"> +<!ENTITY m4-size "928 KB"> <!ENTITY m4-url "&gnu;m4/m4-&m4-version;.tar.bz2"> -<!ENTITY m4-md5 "0a35bab2f5d605e08083d7e3cbd4b8b0"> +<!ENTITY m4-md5 "96ec473c2a6f203976c028e896a01b28"> <!ENTITY m4-home "&gnu-software;m4/"> -<!ENTITY m4-ch5-du "5 MB"> -<!ENTITY m4-ch5-sbu "less than 0.1 SBU"> -<!ENTITY m4-ch6-du "5 MB"> -<!ENTITY m4-ch6-sbu "less than 0.1 SBU"> +<!ENTITY m4-ch5-du "10 MB"> +<!ENTITY m4-ch5-sbu "0.2 SBU"> +<!ENTITY m4-ch6-du "12 MB"> +<!ENTITY m4-ch6-sbu "0.3 SBU testsuite included"> <!ENTITY make-version "3.81"> <!ENTITY make-size "1,125 KB"> @@ -332,20 +342,20 @@ <!ENTITY make-ch6-du "9.6 MB"> <!ENTITY make-ch6-sbu "0.1 SBU"> -<!ENTITY man-db-version "2.5.1"> -<!ENTITY man-db-size "1,624 KB"> -<!ENTITY man-db-url "http://savannah.nongnu.org/download/man-db/man-db-&man-db-version;.tar.gz"> -<!ENTITY man-db-md5 "e592eefd14679575b776f60c6a48e781"> +<!ENTITY man-db-version "2.5.2"> +<!ENTITY man-db-size "1,772 KB"> +<!ENTITY man-db-url "http://download.savannah.gnu.org/releases/man-db/man-db-&man-db-version;.tar.gz"> +<!ENTITY man-db-md5 "9529aadae273566a170dee4e18aad6c1"> <!ENTITY man-db-home "http://www.nongnu.org/man-db/"> -<!ENTITY man-db-ch6-du "9 MB"> -<!ENTITY man-db-ch6-sbu "0.2 SBU"> +<!ENTITY man-db-ch6-du "20 MB"> +<!ENTITY man-db-ch6-sbu "0.3 SBU"> -<!ENTITY man-pages-version "2.78"> -<!ENTITY man-pages-size "1,823 KB"> +<!ENTITY man-pages-version "3.11"> +<!ENTITY man-pages-size "987 KB"> <!ENTITY man-pages-url "&kernel;linux/docs/manpages/Archive/man-pages-&man-pages-version;.tar.bz2"> -<!ENTITY man-pages-md5 "0b58773dbdc6eaeecadfad65b66bfb9a"> +<!ENTITY man-pages-md5 "f66e01df3a22e18d25c5865925dd9288"> <!ENTITY man-pages-home " "> -<!ENTITY man-pages-ch6-du "37.4 MB"> +<!ENTITY man-pages-ch6-du "21 MB"> <!ENTITY man-pages-ch6-sbu "less than 0.1 SBU"> <!ENTITY mktemp-version "1.5"> @@ -356,14 +366,24 @@ <!ENTITY mktemp-ch6-du "0.4 MB"> <!ENTITY mktemp-ch6-sbu "less than 0.1 SBU"> -<!ENTITY module-init-tools-version "3.4"> -<!ENTITY module-init-tools-size "186 KB"> -<!ENTITY module-init-tools-url "http://www.kernel.org/pub/linux/kernel/people/jcm/module-init-tools/module-init-tools-&module-init-tools-version;.tar.bz2"> -<!ENTITY module-init-tools-md5 "db6ac059e80e8dd4389dbe81ee61f3c6"> +<!ENTITY module-init-tools-version "3.4.1"> +<!ENTITY module-init-tools-size "195 KB"> +<!ENTITY module-init-tools-url "http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/module-init-tools-&module-init-tools-version;.tar.bz2"> +<!ENTITY module-init-tools-md5 "e253b066a1bab1d727ca0d54f001b49c"> <!ENTITY module-init-tools-home "http://www.kerneltools.org/KernelTools.org"> <!ENTITY module-init-tools-ch6-du "8 MB"> <!ENTITY module-init-tools-ch6-sbu "less than 0.1 SBU"> +<!ENTITY mpfr-version "2.3.2"> +<!ENTITY mpfr-size "986 KB"> +<!ENTITY mpfr-url "http://www.mpfr.org/mpfr-current/mpfr-&mpfr-version;.tar.bz2"> +<!ENTITY mpfr-md5 "527147c097874340cb9cee0579dacf3b"> +<!ENTITY mpfr-home "http://www.mpfr.org/"> +<!ENTITY mpfr-ch5-du "19.3 MB"> +<!ENTITY mpfr-ch5-sbu "0.5 SBU"> +<!ENTITY mpfr-ch6-du "39.4 MB testsuite included"> +<!ENTITY mpfr-ch6-sbu "1.2 SBU testsuite included"> + <!ENTITY ncurses-version "5.6"> <!-- <!ENTITY ncurses-date "20050319"> --> <!ENTITY ncurses-size "2,346 KB"> @@ -385,15 +405,15 @@ <!ENTITY patch-ch6-du "1.6 MB"> <!ENTITY patch-ch6-sbu "less than 0.1 SBU"> -<!ENTITY perl-version "5.8.8"> -<!ENTITY perl-size "9,887 KB"> -<!ENTITY perl-url "http://ftp.funet.fi/pub/CPAN/src/perl-&perl-version;.tar.bz2"> -<!ENTITY perl-md5 "a377c0c67ab43fd96eeec29ce19e8382"> -<!ENTITY perl-home "http://www.perl.com/"> -<!ENTITY perl-ch5-du "84 MB"> -<!ENTITY perl-ch5-sbu "0.7 SBU"> -<!ENTITY perl-ch6-du "143 MB"> -<!ENTITY perl-ch6-sbu "1.5 SBU"> +<!ENTITY perl-version "5.10.0"> +<!ENTITY perl-size "15,595 KB"> +<!ENTITY perl-url "http://cpan.org/src/perl-&perl-version;.tar.gz"> +<!ENTITY perl-md5 "d2c39b002ebfd2c3c5dba589365c5a71"> +<!ENTITY perl-home "http://cpan.org/"> +<!ENTITY perl-ch5-du "108 MB"> +<!ENTITY perl-ch5-sbu "0.9 SBU"> +<!ENTITY perl-ch6-du "178 MB testsuite included"> +<!ENTITY perl-ch6-sbu "2.5 SBU"> <!ENTITY procps-version "3.2.7"> <!ENTITY procps-size "275 KB"> @@ -426,18 +446,15 @@ <!ENTITY sed-home "&gnu-software;sed/"> <!ENTITY sed-ch5-du "6.1 MB"> <!ENTITY sed-ch5-sbu "0.1 SBU"> -<!ENTITY sed-ch6-du "6.4 MB"> -<!ENTITY sed-ch6-sbu "0.1 SBU"> - -<!ENTITY shadow-version "4.0.18.1"> -<!ENTITY shadow-size "1,481 KB"> -<!-- This site is dead. Use anduin instead. -<!ENTITY shadow-url "ftp://ftp.pld.org.pl/software/shadow/shadow-&shadow-version;.tar.bz2"> ---> -<!ENTITY shadow-url "&anduin-sources;shadow-&shadow-version;.tar.bz2"> -<!ENTITY shadow-md5 "e7751d46ecf219c07ae0b028ab3335c6"> -<!ENTITY shadow-home " "> -<!ENTITY shadow-ch6-du "20.7 MB"> +<!ENTITY sed-ch6-du "10 MB"> +<!ENTITY sed-ch6-sbu "0.2 SBU"> + +<!ENTITY shadow-version "4.1.2.1"> +<!ENTITY shadow-size "1,697 KB"> +<!ENTITY shadow-url "ftp://pkg-shadow.alioth.debian.org/pub/pkg-shadow/shadow-&shadow-version;.tar.bz2"> +<!ENTITY shadow-md5 "c178e49c45495e296dabbe4ae01a0fbe"> +<!ENTITY shadow-home "http://pkg-shadow.alioth.debian.org/"> +<!ENTITY shadow-ch6-du "28 MB"> <!ENTITY shadow-ch6-sbu "0.3 SBU"> <!ENTITY sysklogd-version "1.5"> @@ -456,70 +473,71 @@ <!ENTITY sysvinit-ch6-du "1 MB"> <!ENTITY sysvinit-ch6-sbu "less than 0.1 SBU"> -<!ENTITY tar-version "1.19"> -<!ENTITY tar-size "1,838 KB"> +<!ENTITY tar-version "1.20"> +<!ENTITY tar-size "1,912 KB"> <!ENTITY tar-url "&gnu;tar/tar-&tar-version;.tar.bz2"> -<!ENTITY tar-md5 "bcc2e19b19823b9ab68c94586067a792"> +<!ENTITY tar-md5 "1a7e17f27abf583b3b0bc059a827e68b"> <!ENTITY tar-home "&gnu-software;tar/"> <!ENTITY tar-ch5-du "19.9 MB"> <!ENTITY tar-ch5-sbu "0.3 SBU"> <!ENTITY tar-ch6-du "19.9 MB"> <!ENTITY tar-ch6-sbu "0.3 SBU"> -<!ENTITY tcl-version "8.4.18"> -<!ENTITY tcl-size "3,568 KB"> +<!ENTITY tcl-version "8.5.4"> +<!ENTITY tcl-major-version "8.5"> +<!ENTITY tcl-size "4,402 KB"> <!ENTITY tcl-url "&sourceforge;tcl/tcl&tcl-version;-src.tar.gz"> -<!ENTITY tcl-md5 "7d8bc95036f797b1a2b62a5a382d2cc1"> +<!ENTITY tcl-md5 "15032a6a43f3bfbe9223b95186849472"> <!ENTITY tcl-home "http://tcl.sourceforge.net/"> -<!ENTITY tcl-ch5-du "24 MB"> -<!ENTITY tcl-ch5-sbu "0.3 SBU"> +<!ENTITY tcl-ch5-du "36 MB"> +<!ENTITY tcl-ch5-sbu "0.6 SBU"> -<!ENTITY texinfo-version "4.11"> -<!ENTITY texinfo-size "1,621 KB"> -<!ENTITY texinfo-url "&gnu;texinfo/texinfo-&texinfo-version;.tar.bz2"> -<!ENTITY texinfo-md5 "c6bf13df4fbeff8ce874aacd6a51e814"> +<!ENTITY texinfo-version "4.13"> +<!ENTITY texinfo-size "2,751 KB"> +<!ENTITY texinfo-url "&gnu;texinfo/texinfo-&texinfo-version;.tar.gz"> +<!ENTITY texinfo-md5 "71ba711519209b5fb583fed2b3d86fcb"> <!ENTITY texinfo-home "&gnu-software;texinfo/"> -<!ENTITY texinfo-ch5-du "16.3 MB"> -<!ENTITY texinfo-ch5-sbu "0.2 SBU"> -<!ENTITY texinfo-ch6-du "16.6 MB"> -<!ENTITY texinfo-ch6-sbu "0.2 SBU"> +<!ENTITY texinfo-ch5-du "20 MB"> +<!ENTITY texinfo-ch5-sbu "0.3 SBU"> +<!ENTITY texinfo-ch6-du "20 MB"> +<!ENTITY texinfo-ch6-sbu "0.3 SBU"> -<!ENTITY udev-version "113"> -<!ENTITY udev-size "191 KB"> +<!ENTITY udev-version "130"> +<!ENTITY udev-size "442 KB"> <!ENTITY udev-url "&kernel;linux/utils/kernel/hotplug/udev-&udev-version;.tar.bz2"> -<!ENTITY udev-md5 "cb9a227206b9d85ae8cfc88fc51c1710"> +<!ENTITY udev-md5 "eaaac3c45b8c87d81a82fed254ecee25"> <!ENTITY udev-home "&kernel;linux/utils/kernel/hotplug/udev.html"> -<!ENTITY udev-ch6-du "5.8 MB"> -<!ENTITY udev-ch6-sbu "0.1 SBU"> +<!ENTITY udev-ch6-du "10 MB"> +<!ENTITY udev-ch6-sbu "0.2 SBU"> -<!ENTITY udev-config "udev-config-20070731"> -<!ENTITY udev-config-size "13 KB"> +<!ENTITY udev-config "udev-config-20081015"> <!-- Scripts depend on this format --> +<!ENTITY udev-config-size "UDEV-SIZE KB"> <!-- Updated in Makefile --> <!ENTITY udev-config-url "&downloads-root;&udev-config;.tar.bz2"> -<!ENTITY udev-config-md5 "49c72e712f38c18884bd11a9a3b7e968"> +<!ENTITY udev-config-md5 "UDEV-MD5SUM"> <!-- Updated in Makefile --> <!ENTITY udev-config-home " "> -<!ENTITY util-linux-ng-version "2.13.1"> -<!ENTITY util-linux-ng-size "2,788 KB"> -<!ENTITY util-linux-ng-url "&kernel;linux/utils/util-linux-ng/v2.13/util-linux-ng-&util-linux-ng-version;.tar.bz2"> -<!ENTITY util-linux-ng-md5 "424badc1832e4b5291a2ec04e9e244f4"> +<!ENTITY util-linux-ng-version "2.14.1"> +<!ENTITY util-linux-ng-size "2,929 KB"> +<!ENTITY util-linux-ng-url "&kernel;linux/utils/util-linux-ng/v2.14/util-linux-ng-&util-linux-ng-version;.tar.bz2"> +<!ENTITY util-linux-ng-md5 "9aab772ee9b1f4e67dff98169f3cb380"> <!ENTITY util-linux-ng-home "http://userweb.kernel.org/~kzak/util-linux-ng/"> -<!ENTITY util-linux-ng-ch5-du "8.9 MB"> +<!ENTITY util-linux-ng-ch5-du "19 MB"> <!ENTITY util-linux-ng-ch5-sbu "less than 0.1 SBU"> -<!ENTITY util-linux-ng-ch6-du "17.2 MB"> -<!ENTITY util-linux-ng-ch6-sbu "0.2 SBU"> +<!ENTITY util-linux-ng-ch6-du "29 MB"> +<!ENTITY util-linux-ng-ch6-sbu "0.3 SBU"> -<!ENTITY vim-version "7.1"> -<!ENTITY vim-docdir "vim/vim71"> -<!ENTITY vim-size "6,714 KB"> +<!ENTITY vim-version "7.2"> +<!ENTITY vim-docdir "vim/vim72"> +<!ENTITY vim-size "7,203 KB"> <!ENTITY vim-url "ftp://ftp.vim.org/pub/vim/unix/vim-&vim-version;.tar.bz2"> -<!ENTITY vim-md5 "44c6b4914f38d6f9aa959640b89da329"> +<!ENTITY vim-md5 "f0901284b338e448bfd79ccca0041254"> <!ENTITY vim-home "http://www.vim.org"> -<!ENTITY vim-ch6-du "47.4 MB"> -<!ENTITY vim-ch6-sbu "0.4 SBU"> +<!ENTITY vim-ch6-du "67 MB"> +<!ENTITY vim-ch6-sbu "0.8 SBU"> <!ENTITY vim-lang-version "&vim-version;"> -<!ENTITY vim-lang-size "1,161 KB"> +<!ENTITY vim-lang-size "1,365 KB"> <!ENTITY vim-lang-url "ftp://ftp.vim.org/pub/vim/extra/vim-&vim-lang-version;-lang.tar.gz"> -<!ENTITY vim-lang-md5 "144aa049ba70621acf4247f0459f3ee7"> +<!ENTITY vim-lang-md5 "d8884786979e0e520c112faf2e176f05"> <!ENTITY vim-lang-home "http://www.vim.org"> <!ENTITY zlib-version "1.2.3"> diff --git a/patches.ent b/patches.ent index 2debdd681..ff60869d7 100644 --- a/patches.ent +++ b/patches.ent @@ -6,32 +6,42 @@ <!ENTITY automake-test-patch-size "3 KB"> -<!ENTITY bash-fixes-patch "bash-&bash-version;-fixes-7.patch"> -<!ENTITY bash-fixes-patch-md5 "63ca4c26a1ae0c4a5b7da910d611d534"> -<!ENTITY bash-fixes-patch-size "55 KB"> +<!ENTITY bash-fixes-patch "bash-&bash-version;-fixes-8.patch"> +<!ENTITY bash-fixes-patch-md5 "7729e8bb1adb57c8d3c4c3a34a5bbab0"> +<!ENTITY bash-fixes-patch-size "66 KB"> <!ENTITY binutils-configure-patch "binutils-&binutils-version;-configure-1.patch"> <!ENTITY binutils-configure-patch-md5 "83877c299e3e3080952214e479396f23"> <!ENTITY binutils-configure-patch-size "1 KB"> +<!ENTITY binutils-gcc-patch "binutils-&binutils-version;-GCC43-1.patch"> +<!ENTITY binutils-gcc-patch-md5 "d77fa789b4cae8b1ef7bc10e6220a529"> +<!ENTITY binutils-gcc-patch-size "1.1 KB"> + <!ENTITY bzip2-docs-patch "bzip2-&bzip2-version;-install_docs-1.patch"> <!ENTITY bzip2-docs-patch-md5 "6a5ac7e89b791aae556de0f745916f7f"> <!ENTITY bzip2-docs-patch-size "1.6 KB"> -<!ENTITY coreutils-i18n-patch "coreutils-&coreutils-version;-i18n-1.patch"> +<!-- <!ENTITY coreutils-i18n-patch "coreutils-&coreutils-version;-i18n-1.patch"> <!ENTITY coreutils-i18n-patch-md5 "791df67d25a45d846c1af4dadf2612c8"> -<!ENTITY coreutils-i18n-patch-size "102 KB"> +<!ENTITY coreutils-i18n-patch-size "102 KB"> --> + +<!ENTITY coreutils-old-kernel-patch "coreutils-&coreutils-version;-old_build_kernel-1.patch"> +<!ENTITY coreutils-old-kernel-patch-md5 "5e8622abe6c6d81901b910383c6fb611"> +<!ENTITY coreutils-old-kernel-patch-size "3.3 KB"> <!ENTITY coreutils-uname-patch "coreutils-&coreutils-version;-uname-1.patch"> <!ENTITY coreutils-uname-patch-md5 "c05b735710fbd62239588c07084852a0"> <!ENTITY coreutils-uname-patch-size "4.6 KB"> -<!ENTITY db-fixes-patch "db-&db-version;-fixes-1.patch"> -<!ENTITY db-fixes-patch-md5 "0e1f3a1db6c3ab10f79c4d6dff0c8f31"> -<!ENTITY db-fixes-patch-size "2.3 KB"> + +<!ENTITY db-fixes-patch "db-&db-version;-upstream_fixes-1.patch"> +<!ENTITY db-fixes-patch-md5 "dfe0d2a27439454fbafdeeef65fefade"> +<!ENTITY db-fixes-patch-size "1.9 KB"> + <!ENTITY diffutils-i18n-patch "diffutils-&diffutils-version;-i18n-1.patch"> <!ENTITY diffutils-i18n-patch-md5 "c8d481223db274a33b121fb8c25af9f7"> @@ -43,6 +53,20 @@ <!ENTITY expect-spawn-patch-size "6.8 KB"> +<!ENTITY expect-tcl-patch "expect-&expect-version;-tcl_8.5.4_fix-1.patch"> +<!ENTITY expect-tcl-patch-md5 "6904a384960ce0e8f0d0b32f7903d7a1"> +<!ENTITY expect-tcl-patch-size "4.1 KB"> + + +<!ENTITY glibc-iconv-test-fixes-patch "glibc-&glibc-version;-iconv_tests-1.patch"> +<!ENTITY glibc-iconv-test-fixes-patch-md5 "cc5e95e418e0b2f8a54b14cf90c7c3b2"> +<!ENTITY glibc-iconv-test-fixes-patch-size "1.7 KB"> + +<!ENTITY glibc-ildoubl-test-fix-patch "glibc-&glibc-version;-ildoubl_test-1.patch"> +<!ENTITY glibc-ildoubl-test-fix-patch-md5 "4dc864a487eee8426413542591d19edb"> +<!ENTITY glibc-ildoubl-test-fix-patch-size "1.0 KB"> + + <!ENTITY grep-debian-patch "grep-&grep-version;-debian_fixes-1.patch"> <!ENTITY grep-debian-patch-md5 "337d017202d7e3b08d428a89da3ee572"> <!ENTITY grep-debian-patch-size "27 KB"> @@ -71,9 +95,9 @@ <!ENTITY kbd-backspace-patch-size "13 KB"> -<!ENTITY mktemp-tempfile-patch "mktemp-&mktemp-version;-add_tempfile-3.patch"> +<!-- <!ENTITY mktemp-tempfile-patch "mktemp-&mktemp-version;-add_tempfile-3.patch"> <!ENTITY mktemp-tempfile-patch-md5 "65d73faabe3f637ad79853b460d30a19"> -<!ENTITY mktemp-tempfile-patch-size "3.5 KB"> +<!ENTITY mktemp-tempfile-patch-size "3.5 KB"> --> <!ENTITY module-init-manpages-patch "module-init-tools-&module-init-tools-version;-manpages-1.patch"> <!ENTITY module-init-manpages-patch-md5 "2271047586981ae23adf01cc13d97791"> @@ -85,29 +109,37 @@ <!ENTITY ncurses-coverity-patch-size "16.8 KB"> -<!ENTITY perl-libc-patch "perl-&perl-version;-libc-2.patch"> +<!ENTITY perl-libc-patch "perl-&perl-version;-libc-1.patch"> <!ENTITY perl-libc-patch-md5 "3bf8aef1fb6eb6110405e699e4141f99"> <!ENTITY perl-libc-patch-size "1.1 KB"> +<!ENTITY perl-page-patch "perl-&perl-version;-page-1.patch"> +<!ENTITY perl-page-patch-md5 "16abf98d92d896601250ca610243cdf5"> +<!ENTITY perl-page-patch-size "0.7 KB"> + +<!ENTITY perl-security-patch "perl-&perl-version;-security_fix-1.patch"> +<!ENTITY perl-security-patch-md5 "4b1384ba595abd070824c2519d1d3176"> +<!ENTITY perl-security-patch-size "0.8 KB"> + + +<!ENTITY procps-watch-patch "procps-&procps-version;-watch_unicode-1.patch"> +<!ENTITY procps-watch-patch-md5 "2e5b57608177bd54349c718db9b5843d"> +<!ENTITY procps-watch-patch-size "3.6 KB"> + <!ENTITY readline-fixes-patch "readline-&readline-version;-fixes-5.patch"> <!ENTITY readline-fixes-patch-md5 "7390b2296b7b11209829646537294ebb"> <!ENTITY readline-fixes-patch-size "18 KB"> -<!ENTITY shadow-useradd-patch "shadow-&shadow-version;-useradd_fix-2.patch"> +<!-- <!ENTITY shadow-useradd-patch "shadow-&shadow-version;-useradd_fix-2.patch"> <!ENTITY shadow-useradd-patch-md5 "5f35528f38d5432d5fa2dd79d04bdfdd"> -<!ENTITY shadow-useradd-patch-size "6.1 KB"> - - -<!ENTITY udev-usbid-patch "udev-&udev-version;-usb_id-1.patch"> -<!ENTITY udev-usbid-md5 "247614818827422b99672ea8bf3909ec"> -<!ENTITY udev-usbid-patch-size "3.2 KB"> +<!ENTITY shadow-useradd-patch-size "6.1 KB"> --> -<!ENTITY vim-fixes-patch "vim-&vim-version;-fixes-6.patch"> -<!ENTITY vim-fixes-patch-md5 "a1e9ed80bac0ac8175bc3ed89867ca2e"> -<!ENTITY vim-fixes-patch-size "422 KB"> +<!ENTITY vim-fixes-patch "vim-&vim-version;-fixes-3.patch"> +<!ENTITY vim-fixes-patch-md5 "4b526f493995d2eb6fd415eb62ff43d8"> +<!ENTITY vim-fixes-patch-size "29.3 KB"> <!ENTITY vim-mandir-patch "vim-&vim-version;-mandir-1.patch"> <!ENTITY vim-mandir-patch-md5 "b6426eb4192faba1e867ddd502323f5b"> diff --git a/process-scripts.sh b/process-scripts.sh new file mode 100644 index 000000000..44518c423 --- /dev/null +++ b/process-scripts.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Boot scripts +for s in bootscripts/lfs/init.d/* \ + bootscripts/lfs/sysconfig/* \ + bootscripts/lfs/sysconfig/network-devices/* \ + bootscripts/lfs/sysconfig/network-devices/services/* +do + script=$(basename $s) + + # Skip directories + [ $script == 'network-devices' ] && continue + [ $script == 'services' ] && continue + + # Disambiguate duplicate file names + [ $s == 'bootscripts/lfs/sysconfig/rc' ] && script='rc-sysinit'; + [ $s == 'bootscripts/lfs/sysconfig/modules' ] && script='modules-sysinit'; + + sed -e 's/\&/\&\;/g' -e 's/</\<\;/g' -e 's/>/\>\;/g' \ + -e "s/'/\&apos\;/g" -e 's/"/\"\;/g' -e 's/\t/ /g' \ + $s > appendices/${script}.script +done + +# Udev rules +for s in udev-config/*.rules +do + script=$(basename $s) + + sed -e 's/\&/\&\;/g' -e 's/</\<\;/g' -e 's/>/\>\;/g' \ + -e "s/'/\&apos\;/g" -e 's/"/\"\;/g' -e 's/\t/ /g' \ + $s > appendices/${script}.script +done diff --git a/prologue/bookinfo.xml b/prologue/bookinfo.xml index 6f5037fe2..2c10a3f20 100644 --- a/prologue/bookinfo.xml +++ b/prologue/bookinfo.xml @@ -19,47 +19,21 @@ <copyright id="copyright"> - <year>1999–2008</year> + <year>©rightdate;</year> <holder>Gerard Beekmans</holder> </copyright> <legalnotice> - <para>Copyright (c) 1999–2007, Gerard Beekmans</para> + <para>Copyright © ©rightdate;, Gerard Beekmans</para> <para>All rights reserved.</para> - <para>Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met:</para> + <para>This book is licensed under a <xref linkend="CC"/>.</para> + <para>Computer instructions may be extracted from the book under the + <xref linkend="MIT"/>.</para> - <itemizedlist> - <listitem> - <para>Redistributions in any form must retain the above copyright - notice, this list of conditions and the following disclaimer</para> - </listitem> - <listitem> - <para>Neither the name of <quote>Linux From Scratch</quote> nor the - names of its contributors may be used to endorse or promote products - derived from this material without specific prior written - permission</para> - </listitem> - <listitem> - <para>Any material derived from Linux From Scratch must contain - a reference to the <quote>Linux From Scratch</quote> project</para> - </listitem> - </itemizedlist> - - <para>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - <quote>AS IS</quote> 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.</para> + <para><trademark class='registered'>Linux</trademark> is a registered trademark of + Linus Torvalds.</para> </legalnotice> diff --git a/prologue/hostreqs.xml b/prologue/hostreqs.xml index 21d2ea71f..281956c41 100644 --- a/prologue/hostreqs.xml +++ b/prologue/hostreqs.xml @@ -22,7 +22,7 @@ <listitem> <para><emphasis role="strong">Bash-2.05a</emphasis> (/bin/sh - must be a symbolic or hard link to bash)</para> + should be a symbolic or hard link to bash)</para> </listitem> <listitem> @@ -33,7 +33,7 @@ <listitem> <para><emphasis role="strong">Bison-1.875</emphasis> (/usr/bin/yacc - must be a link to bison or small script that executes bison)</para> + should be a link to bison or small script that executes bison)</para> </listitem> <listitem> @@ -55,7 +55,7 @@ <listitem> <para><emphasis role="strong">Gawk-3.0</emphasis> (/usr/bin/awk - must be a link to gawk)</para> + should be a link to gawk)</para> </listitem> <listitem> @@ -102,6 +102,10 @@ </listitem> <listitem> + <para><emphasis role="strong">M4-1.4</emphasis></para> + </listitem> + + <listitem> <para><emphasis role="strong">Make-3.79.1</emphasis></para> </listitem> @@ -128,7 +132,15 @@ </itemizedlist> - <para>To see whether your host system has all the appropriate versions, run the following:</para> + <para>Note that the symlinks mentioned above are required to build an LFS + system using the instructions contained within this book. Symlinks that + point to other software (such as dash, mawk, etc.) may work, but are not + tested or supported by the LFS development team, and may require either + deviation from the instructions or additional patches to some + packages.</para> + + <para>To see whether your host system has all the appropriate versions, and + the ability to compile programs, run the following:</para> <screen role="nodump"><userinput>cat > version-check.sh << "EOF" <literal>#!/bin/bash @@ -154,11 +166,16 @@ gcc --version | head -n1 grep --version | head -n1 gzip --version | head -n1 cat /proc/version +m4 --version | head -n1 make --version | head -n1 patch --version | head -n1 +echo Perl `perl -V:version` sed --version | head -n1 tar --version | head -n1 makeinfo --version | head -n1 +echo 'main(){}' > dummy.c && gcc -o dummy dummy.c +if [ -x dummy ]; then echo "Compilation OK"; else echo "Compilation failed"; fi +rm -f dummy.c dummy </literal> EOF diff --git a/prologue/typography.xml b/prologue/typography.xml index b4f4bf357..801985807 100644 --- a/prologue/typography.xml +++ b/prologue/typography.xml @@ -21,6 +21,16 @@ otherwise noted in the surrounding text. It is also used in the explanation sections to identify which of the commands is being referenced.</para> + <para>In some cases, a logical line is extended to two or more physical lines + with a backslash at the end of the line.</para> + +<screen role="nodump"><userinput>CC="gcc -B/usr/bin/" ../binutils-2.18/configure \ + --prefix=/tools --disable-nls --disable-werror</userinput></screen> + + <para>Note that the backslash must be followed by an immediate return. Other + whitespace characters like spaces or tab characters will create incorrect + results.</para> + <screen><computeroutput>install-info: unknown option '--dir-file=/mnt/lfs/usr/info/dir'</computeroutput></screen> <para>This form of text (fixed-width text) shows screen output, probably as diff --git a/udev-config/55-lfs.rules b/udev-config/55-lfs.rules new file mode 100644 index 000000000..a1750150d --- /dev/null +++ b/udev-config/55-lfs.rules @@ -0,0 +1,105 @@ +# /etc/udev/rules.d/25-lfs.rules: Rule definitions for LFS. + +# Core kernel devices + +# override both of these +KERNEL=="random", MODE="0444" +KERNEL=="urandom", MODE="0444" + +KERNEL=="aio", MODE="0444" +KERNEL=="kmsg", MODE="0600" +KERNEL=="rtc", MODE="0666" + +# Comms devices + +KERNEL=="rfcomm[0-9]*", GROUP="uucp" +KERNEL=="ippp[0-9]*", GROUP="uucp" +KERNEL=="isdn[0-9]*", GROUP="uucp" +KERNEL=="isdnctrl[0-9]*", GROUP="uucp" +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi?*", NAME="capi/%n", GROUP="uucp" +KERNEL=="dcbri[0-9]*", GROUP="uucp" + +# ALSA devices go in their own subdirectory + +KERNEL=="controlC[0-9]*", GROUP="audio", NAME="snd/%k" +KERNEL=="hwC[0-9]*D[0-9]*", GROUP="audio", NAME="snd/%k" +KERNEL=="pcmC[0-9]*D[0-9]*[cp]", GROUP="audio", NAME="snd/%k" +KERNEL=="midiC[0-9]*D[0-9]*", GROUP="audio", NAME="snd/%k" +KERNEL=="timer", GROUP="audio", NAME="snd/%k" +KERNEL=="seq", GROUP="audio", NAME="snd/%k" + +# Sound devices + +KERNEL=="admmidi*", GROUP="audio" +KERNEL=="adsp*", GROUP="audio" +KERNEL=="aload*", GROUP="audio" +KERNEL=="amidi*", GROUP="audio" +KERNEL=="amixer*", GROUP="audio" +KERNEL=="audio*", GROUP="audio" +KERNEL=="dmfm*", GROUP="audio" +KERNEL=="dmmidi*", GROUP="audio" +KERNEL=="dsp*", GROUP="audio" +KERNEL=="midi*", GROUP="audio" +KERNEL=="mixer*", GROUP="audio" +KERNEL=="music", GROUP="audio" +KERNEL=="sequencer*", GROUP="audio" + +# Input devices + +# override MODE on these four +KERNEL=="mice", MODE="0644", SYMLINK+="mouse" +KERNEL=="mouse*", MODE="0644" +KERNEL=="event*", MODE="0644" +KERNEL=="ts*", MODE="0644" + +KERNEL=="psaux", MODE="0644" +KERNEL=="js", MODE="0644" +KERNEL=="djs", MODE="0644" + +# USB devices go in their own subdirectory + +KERNEL=="hiddev*", NAME="usb/%k" +KERNEL=="legousbtower*", NAME="usb/%k" +KERNEL=="dabusb*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" + +# DRI devices are managed by the X server, so prevent udev from creating them + +KERNEL=="card*", OPTIONS+="ignore_device" + +# Video devices + +KERNEL=="fb[0-9]*", GROUP="video" +KERNEL=="video[0-9]*", GROUP="video" +KERNEL=="radio[0-9]*", GROUP="video" +KERNEL=="vbi[0-9]*", GROUP="video" +KERNEL=="vtx[0-9]*", GROUP="video" + +# DVB devices + +SUBSYSTEM=="dvb", GROUP="video" + +# Storage/memory devices + +# override: make group-writable +SUBSYSTEM=="block", MODE="0660" + +# dmsetup and lvm2 related programs create devicemapper devices so we prevent +# udev from creating them + +KERNEL=="dm-*", OPTIONS+="ignore_device" + +# Tape devices + +# override all these +KERNEL=="ht[0-9]*", GROUP="tape" +KERNEL=="nht[0-9]*", GROUP="tape" +KERNEL=="pt[0-9]*", GROUP="tape" +KERNEL=="npt[0-9]*", GROUP="tape" +KERNEL=="st[0-9]*", GROUP="tape" +KERNEL=="nst[0-9]*", GROUP="tape" + +# Override floppy devices +KERNEL=="fd[0-9]", GROUP="floppy" +KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0660 -G floppy $root/%k" diff --git a/udev-config/61-cdrom.rules b/udev-config/61-cdrom.rules new file mode 100644 index 000000000..5a38a7210 --- /dev/null +++ b/udev-config/61-cdrom.rules @@ -0,0 +1,3 @@ +# /etc/udev/rules.d/81-cdrom.rules: Set CD-ROM permissions. + +ACTION=="add", SUBSYSTEM=="block", ENV{ID_TYPE}=="cd", GROUP="cdrom" diff --git a/udev-config/ChangeLog b/udev-config/ChangeLog new file mode 100644 index 000000000..be9eef85d --- /dev/null +++ b/udev-config/ChangeLog @@ -0,0 +1,204 @@ +2008-10-15 DJ Lucas <dj@linuxfromscratch.org> + * 55-lfs.rules: Override default perms on floppy disk devices provided + by 50-udev-default.rules. Thanks to Bruce Dubbs for the fix. Closes + LFS ticket #2076. + +2008-05-21 Bryan Kadzban <bryan@linuxfromscratch.org> + * 81-firmware.rules, doc/81-firmware.txt: Remove. This rule is + already handled by udev's 50-udev-default.rules file. The docs + can be added back later if needed. + * Makefile: Don't install the above deleted files. + * 55-lfs.rules: Remove the device-mapper rule, since the upstream + 50-udev-default.rules file handles it properly. + +2008-04-02 Bryan Kadzban <bryan@linuxfromscratch.org> + * Makefile: Make the package DESTDIR-friendly by installing the docs + into a fixed $(PREFIX)/share/doc/udev-config directory, instead of + trying to figure out what version of udev was just installed. + +2007-10-30 Bryan Kadzban <bryan@linuxfromscratch.org> + * 55-lfs.rules: Since the dialout group was renamed to uucp, delete + the rules that override upstream's assignment of the dialout group. + Replace "dialout" with "uucp" on the remaining rules. + +2007-10-29 Bryan Kadzban <bryan@linuxfromscratch.org> + * 51-lfs.rules: Move to 55-lfs.rules. + * doc/51-lfs.rules: Move to doc/55-lfs.rules. + +2007-10-27 Bryan Kadzban <bryan@linuxfromscratch.org> + * 25-lfs.rules: Some rules in here are duplicates of rules from udev's + new 50-udev-defaults.rules file; remove them. Override permissions + where needed elsewhere (and document overrides in comments). + * 26-modprobe.rules: Provided by udev's 80-drivers.rules and built-in + modaliases for SCSI device-type modules in 2.6.22+ kernels; remove. + + * 25-lfs.rules: Move to 51-lfs.rules. + * 27-firmware.rules: Move to 81-firmware.rules. + * 81-cdrom.rules: Move to 61-cdrom.rules. + + * doc/25-lfs.txt: Rename to 51-lfs.txt. + * doc/26-modprobe.txt: Rename to 80-drivers.txt, and modify to reflect + the upstream rules. + * doc/27-firmware.txt: Rename to 81-firmware.txt. + * doc/81-cdrom.txt: Rename to 61-cdrom.txt. + + * Makefile: Use new filenames. + +2007-07-31 Dan Nicholson <dnicholson@linuxfromscratch.org> + * 25-lfs.rules: Changed the usb_device rule tto create /dev/bus/usb + nodes if the usb_device in 2.6.22+ kernels. The rule was also changed + to only trigger on "add" events. This change is not backwards + compatible with older kernels. + +2007-06-12 Dan Nicholson <dnicholson@linuxfromscratch.org> + * 25-lfs.rules: Fix the CPUID nodes from cpu/%n/cpu to cpu/%n/cpuid, + which is what's expected in userspace apps such as x86info. + +2007-06-08 Bryan Kadzban <bryan@linuxfromscratch.org> + * 25-lfs.rules: Add rules for DVB devices (create nodes in /dev/dvb/) + and floppies (create extra nodes based on CMOS type), copied from + the SuSE rules file. Thanks to Alexander Patrakov for the bugreport. + +2007-03-04 Matthew Burgess <matthew@linuxfromscratch.org> + * Makefile: Use `udevd --version' to work out what version of Udev is + installed (requires Udev >= 106) + +2007-01-02 Bryan Kadzban <bryan@linuxfromscratch.org> + * 25-lfs.rules: Change CPU devices (cpu, msr, microcode) to be in + /dev/cpu/ and /dev/cpu/N/, to match Documentation/devices.txt. + +2006-10-21 Bryan Kadzban <bryan@linuxfromscratch.org> + * Makefile: Add a missing backslash in install-extra-doc. + + * 05-udev-early.rules, 60-persistent-input.rules, + 60-persistent-storage.rules, 95-udev-late.rules: Remove. The book + will install these files from udev's etc/udev/rules.d directory + instead. + * Makefile: Don't install these rules files after all. Also, only + install corresponding docs if requested. + +2006-10-20 Bryan Kadzban <bryan@linuxfromscratch.org> + * Makefile: Added; contains targets to install rules and doc files. + From Dan Nicholson. + +2006-10-14 Bryan Kadzban <bryan@linuxfromscratch.org> + * 05-udev-early.rules, 60-persistent-storage.rules: Sync up with + upstream sample rules files (from udev-102), except for one rule + which is more specific in our tarball and should probably be changed + upstream. + * doc/60-persistent-storage.txt: Modify to match the changes. Also + fix a couple typos. + + * 25-lfs.rules: Remove duplicate rules (ttyS[0-9]* is also matched by + tty[BC...S...][0-9]*, and ttyUSB[0-9]* is in there twice). + + * 25-lfs.rules: Fix Alsa device KERNEL rules. Udev uses shell-style + glob matching, not regular expressions, so the old rules would match + nonsense device names like hw0asdf and pcmDzxcv. As long as the first + character after the "fixed" portion was in the list, the rule would + match; it wouldn't apply the same character range to later characters. + + * doc/25-lfs.txt: Add a note on interaction between permissions and + symlinks. + +2006-10-09 Bryan Kadzban <bryan@linuxfromscrtach.org> + * 25-lfs.rules: Fix fb[0-9]* device permissions (should use the default + 0660). + + * doc/25-lfs.txt: Fix typo: /dev/ptmx is given mode 0666, not 0660. + Also tweak the comment about other TTY devices. + +2006-10-04 Bryan Kadzban <bryan@linuxfromscratch.org> + * 05-udev-early.rules: Remove WAIT_FOR_SYSFS="bus" rule. With kernel + 2.6.18, this rule is no longer required. + + * doc/05-udev-early.txt: Update to match. + +2006-09-28 Bryan Kadzban <bryan@linuxfromscratch.org> + * doc/60-persistent-storage.txt: Explain persistent storage rules, or + at least the parts I understand. (I don't use DASD or netblock or + several other supported configurations.) + + * doc/81-cdrom.txt: Explain 81-cdrom.rules. + + * doc/95-udev-late.txt: Explain 95-udev-late.rules. Documentation is + now finished. + +2006-09-26 Bryan Kadzban <bryan@linuxfromscratch.org> + * doc/60-persistent-input.txt: Explain (in probably too much detail) + 60-persistent-input.rules. + +2006-09-24 Bryan Kadzban <bryan@linuxfromscratch.org> + * doc/05-udev-early.txt: Rewrap to fit 80 columns. + + * doc/26-modprobe.txt: Explain 26-modprobe.rules, and modaliases. + + * doc/27-firmware.txt: Explain 27-firmware.rules. + +2006-09-24 Bryan Kadzban <bryan@linuxfromscratch.org> + * doc/25-lfs.txt: Explain 25-lfs.rules. + + * 25-lfs.rules: Use SYMLINK+= for isdn/capi20 also. + +2006-09-23 Bryan Kadzban <bryan@linuxfromscratch.org> + * doc: New subdirectory to contain documentation of rules + * doc/README: New file, top-level documentation + * doc/*.txt: New documentation files, one for each rules file. Only + 05-udev-early.txt has anything in it. + +2006-09-23 Bryan Kadzban <bryan@linuxfromscratch.org> + * 25-lfs.rules: Add "ignore_device" to OPTIONS for DRI devices, instead + of setting NAME to an empty string. This matches the way we ignore + devmapper / LVM devices. + +2006-09-22 Bryan Kadzban <bryan@linuxfromscratch.org> + * 60-persistent-input.rules, 95-udev-late.rules: Import from udev-100. + 60-persistent-input.rules creates persistent symlinks for input + devices, and 95-udev-late.rules enables udevmonitor. + + * 60-persistent-storage.rules: Replace ATTRS{../removable} with just + ATTRS{removable} on partition devices. Replace ATTRS{removable} + with ATTR{removable} on whole-disk devices. + +2006-09-20 Bryan Kadzban <bryan@linuxfromscratch.org> + * 05-early.rules: Missed a rule in the last change. ENV{PHYSDEVBUS} + in the rule that waits for the "bus" symlink should be replaced by + SUBSYSTEMS. + +2006-09-20 Bryan Kadzban <bryan@linuxfromscratch.org> + * Adapted rules to the new matches used in udev-098 and above (e.g., + SYSFS becomes ATTRS). Prevents warnings, and support for the old + matches will be removed eventually. These rules will not work with + udev-097 and before! + * Fixed several bugs in the rules left over from previous udev + versions (missing commas, overwriting user symlinks using ="..." + instead of +="...", and matching against "*" instead of "?*"). + + * Renamed CHANGELOG to ChangeLog, started using pseudo-GNU-format + entries. (See standards.info; search it for "changelog" to get + the general gist.) + +dnicholson - Jul 14, 2006 + * Fixed usbdev PROGRAM so that it works with the BusyBox sh. Thanks + to Anthony Wright. + +n/a - Jul 12, 2006 + * Added options so temporary nodes are not created with device-mapper + * Adapted cdrom rules to identify CD-ROM drives correctly by adding + SUBSYSTEM=="block" test. + * Added simple 81-cdrom.rules file to set cdrom group ownership + +n/a - Jun 07, 2006 + * Removed nvidia rules + * Removed bug reporting rule + * Moved Debian-based persistent CD-ROM rules to contrib + * Adapted firmware rule to udev-093 + +n/a - May 15, 2006 + * Part one of 25-lfs.rules rewrite + * Some minor tweaking of the layout + +n/a - May 12, 2006 + * Initial import of the udev-config directory. + * Reorganized and modularized the rules files. + * Added explanatory comments diff --git a/udev-config/Makefile b/udev-config/Makefile new file mode 100644 index 000000000..18451cd48 --- /dev/null +++ b/udev-config/Makefile @@ -0,0 +1,42 @@ +# Makefile to install udev rules and documentation + +PREFIX = /usr +RULES_DIR = /etc/udev/rules.d +INSTALL = install +INSTALL_DATA = $(INSTALL) -m644 +RULES_FILES = \ + 55-lfs.rules \ + 61-cdrom.rules +DOC_FILES = $(RULES_FILES:.rules=.txt) + +EXTRA_DOC_FILES = \ + 05-udev-early.txt \ + 60-persistent-input.txt \ + 60-persistent-storage.txt \ + 80-drivers.txt \ + 95-udev-late.txt + +# Location to install the docs +DOC_DIR = $(PREFIX)/share/doc/udev-config + +all: + +install: install-rules + +install-rules: + $(INSTALL) -d $(DESTDIR)$(RULES_DIR) + for rule in $(RULES_FILES); do \ + $(INSTALL_DATA) $$rule $(DESTDIR)$(RULES_DIR) || exit 1; \ + done; + +install-doc: + $(INSTALL) -d $(DESTDIR)$(DOC_DIR) + for doc in $(DOC_FILES); do \ + $(INSTALL_DATA) doc/$$doc $(DESTDIR)$(DOC_DIR) || exit 1; \ + done + +install-extra-doc: + $(INSTALL) -d $(DESTDIR)$(DOC_DIR) + for doc in $(EXTRA_DOC_FILES); do \ + $(INSTALL_DATA) doc/$$doc $(DESTDIR)$(DOC_DIR) || exit 1; \ + done diff --git a/udev-config/contrib/debian/81-cdrom.rules b/udev-config/contrib/debian/81-cdrom.rules new file mode 100644 index 000000000..cb7ea5748 --- /dev/null +++ b/udev-config/contrib/debian/81-cdrom.rules @@ -0,0 +1,3 @@ +# /etc/udev/rules.d/81-cdrom.rules: Set CD-ROM permissions and get device capabilities + +ACTION=="add", SUBSYSTEM=="block", ENV{ID_TYPE}=="cd", IMPORT{program}="cdrom_id --export $tempnode", GROUP="cdrom" diff --git a/udev-config/contrib/debian/83-cdrom-symlinks.rules b/udev-config/contrib/debian/83-cdrom-symlinks.rules new file mode 100644 index 000000000..4713c0b92 --- /dev/null +++ b/udev-config/contrib/debian/83-cdrom-symlinks.rules @@ -0,0 +1,12 @@ +# /etc/udev/rules.d/83-cdrom-symlinks.rules: Determine CD drive capability. + +ACTION!="add", GOTO="cd_aliases_generator_end" +SUBSYSTEM!="block", GOTO="cd_aliases_generator_end" +ENV{GENERATED}=="?*", GOTO="cd_aliases_generator_end" + +# Fail the uevent if the autogenerated rules cannot be saved +ENV{ID_CDROM}=="?*", PROGRAM="/bin/grep -c ' / [^[:space:]]* rw' /proc/mounts", RESULT!="2", RUN+="/bin/false", GOTO="cd_aliases_generator_end" + +ENV{ID_CDROM}=="?*", PROGRAM="write_cd_aliases", SYMLINK+="%c" + +LABEL="cd_aliases_generator_end" diff --git a/udev-config/contrib/debian/write_cd_aliases b/udev-config/contrib/debian/write_cd_aliases new file mode 100644 index 000000000..6443b6dcf --- /dev/null +++ b/udev-config/contrib/debian/write_cd_aliases @@ -0,0 +1,111 @@ +#!/bin/sh -e + +RULES_FILE="/etc/udev/rules.d/82-persistent-cd.rules" + +############################################################################## +lock_rules_file() { + RULES_LOCK="/dev/.udev/.lock-${RULES_FILE##*/}" + + retry=30 + while ! mkdir $RULES_LOCK 2> /dev/null; do + if [ $retry -eq 0 ]; then + echo "Cannot lock $RULES_FILE!" >&2 + exit 2 + fi + sleep 1 + retry=$(($retry - 1)) + done +} + +unlock_rules_file() { + rmdir $RULES_LOCK || true +} + +############################################################################## +find_next_available() { + # use echo to convert newlines to spaces + local links=`echo $(find_all_symlinks $1)` + local basename=${links%%[ 0-9]*} + local max=-1 + for name in $links; do + local num=${name#$basename} + [ "$num" ] || num=0 + [ $num -gt $max ] && max=$num + done + + max=$(($max + 1)) + # "name0" actually is just "name" + [ $max -eq 0 ] && return + echo "$max" +} + +find_all_symlinks() { + local linkre="$1" + local match="$2" + + [ -e $RULES_FILE ] || return + + local search='.*[[:space:],]SYMLINK+="\('"$linkre"'\)"[[:space:]]*\(,.*\|\\\|\)$' + + sed -n -e "${match}s/${search}/\1/p" $RULES_FILE +} + +write_rule() { + local match="$1" + local link="$2" + local comment="$3" + + [ -e "$RULES_FILE" ] || PRINT_HEADER=1 + { + if [ "$PRINT_HEADER" ]; then + PRINT_HEADER= + echo "# This file was automatically generated by the $0" + echo "# program, probably run by the 83-cdrom.rules rules file." + echo "#" + echo "# You can modify it, as long as you keep each rule on a single line" + echo "# and set the \$GENERATED variable." + echo "" + fi + + [ "$comment" ] && echo "# $comment" + echo "ACTION==\"add\", SUBSYSTEM==\"block\", $match, ENV{ID_CDROM}==\"1\", SYMLINK+=\"$link\", ENV{GENERATED}=\"1\"" + } >> $RULES_FILE + SYMLINKS="$SYMLINKS $link" +} + +############################################################################## +if [ -z "$DEVPATH" ]; then + echo "Missing \$DEVPATH." >&2 + exit 1 +fi +if [ -z "$ID_CDROM" ]; then + echo "$DEVPATH is not a CD reader." >&2 + exit 1 +fi + +# Prevent parallel processes from modifying the file at the same time. +lock_rules_file + +link_num=$(find_next_available 'cdrom[0-9]*') + +#match="ENV{ID_PATH}==\"$ID_PATH\"" + +#kernel=${DEVPATH##*/} +#match="KERNEL==\"$kernel\"" + +id=${PHYSDEVPATH##*/} +match="BUS==\"$PHYSDEVBUS\", ID==\"$id\"" + +comment="$ID_MODEL ($ID_PATH)" + + write_rule "$match" "cdrom$link_num" "$comment" +[ "$ID_CDROM_CD_RW" ] && write_rule "$match" "cdrw$link_num" +[ "$ID_CDROM_DVD" ] && write_rule "$match" "dvd$link_num" +[ "$ID_CDROM_DVD_RW" ] && write_rule "$match" "dvdrw$link_num" + +unlock_rules_file + +echo $SYMLINKS + +exit 0 + diff --git a/udev-config/doc/05-udev-early.txt b/udev-config/doc/05-udev-early.txt new file mode 100644 index 000000000..9c0fb4fb8 --- /dev/null +++ b/udev-config/doc/05-udev-early.txt @@ -0,0 +1,33 @@ +Purpose of rules file: + +The kernel does not always fully populate a given kobject's attributes before +sending the uevent for that kobject. This means that a given sysfs directory +may not have all the required files in it (each directory corresponds to a +kobject, and each file corresponds to an attribute). + +Therefore, we must sometimes wait for attributes to show up when devices are +discovered. This is accomplished by udev's WAIT_FOR_SYSFS rule types. + + +Description of rules: + +All rules in this file match ACTION="add", because none of them apply when +devices are being removed. + +SUBSYSTEM is the kernel subsystem that the device uses. Current kernels have +some issues with SCSI device attributes being created too late. For any device +with a SUBSYSTEM of scsi, we must wait for the ioerr_cnt attribute. (This is +the last attribute created for SCSI devices, so when this attribute appears, +the kobject is fully populated.) + +It is also possible to use SUBSYSTEMS in Udev rules. Using SUBSYSTEMS would +cause Udev to search up the device tree for a matching SUBSYSTEM value. (Note +that "the device tree" is not necessarily the same as the path under /sys (the +DEVPATH). Rather, "up the device tree" is the path followed by udevinfo when +it is given the argument "-a".) + +We do not use SUBSYSTEMS in this rule, because we only care about the SUBSYSTEM +of the kobject in question. We don't care about devices that are children of +SCSI devices, only the SCSI device itself. We will use SUBSYSTEMS in later +rules, though. + diff --git a/udev-config/doc/55-lfs.txt b/udev-config/doc/55-lfs.txt new file mode 100644 index 000000000..7b09c79a0 --- /dev/null +++ b/udev-config/doc/55-lfs.txt @@ -0,0 +1,94 @@ +Purpose of rules file: + +This is the core rules file for Udev on LFS. If these rules were not included, +most devices would either only work for root, or would not work at all. + + +Description of rules: + +By default, Udev creates device nodes with UID 0, GID 0, and permissions 0660, +and in one flat directory structure with all nodes in /dev. This does not +always work well. + +KERNEL=="ptmx" + +Any uevent generated by the kernel with a name matching "ptmx" will match this +rule. Note that the matching done by Udev is shell-style; these are not regex +matches. For the ptmx device, we first change the permisions, by assigning to +the MODE value: + +KERNEL=="ptmx", MODE="0666" + +We also assign a different GID to /dev/ptmx (also all other TTY devices), by +assigning to the GROUP value: + +KERNEL=="ptmx", MODE="0666", "GROUP="tty" + + +There are also devices that should not be in /dev, because historically they +have been created in subdirectories instead. For instance, all Alsa devices +have traditionally been put into the /dev/snd subdirectory: + +KERNEL=="controlC[0-9]*", <...>, NAME="snd/%k" + +"%k" expands into "the original value of KERNEL" (note: not the pattern that was +matched against). This type of rule puts any matching device into the snd/ +subdirectory. + +Sometimes we need to move devices based on more than just their name. For +example, USB printer devices need to be moved to /dev/usb/lpX, but we can't +match only "lp[0-9]*", because that would also match parallel port printers. +So we match both KERNEL and SUBSYSTEMS in this case, to move USB printers only. + + +Some devices also commonly have symlinks pointing to them -- for example, +/dev/mouse is usually a symlink to /dev/input/mice. We acheive this by +assigning to the SYMLINK value. But note that SYMLINK can store multiple values +(because each device node could have multiple symlinks pointing to it), so we +need to add to the list of symlinks, not overwrite the whole list: + +KERNEL=="mice", <...>, SYMLINK+="mouse" + +If we needed to add multiple symlinks, they would be space-separated inside the +double quotes. + +Of course, symlinks, permissions, and device names can all be combined in a +rule if needed. But note that if you combine permissions and symlinks, or if +you combine GROUP and symlinks, the permissions of the symlink will not be +modified, only those of the target device. (This is because the kernel does +not pay any attention to the permissions on symlinks, only the permissions on +their targets, and there's no reason to change something that won't be used.) + + +Finally, we have this rule: + +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k; X=$${X#usbdev}; B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", NAME="%c" + +This rule matches any device under the SUBSYSTEM of usb_device. (All devices +that were traditionally created under /proc/bus/usb/ use this subsystem.) We +tell Udev to run the specified PROGRAM; Udev will save the output of this +program (it will be available under %c later). + +The program itself is a shell that starts by setting the variable X to the +original kernel name (which is "usbdevB.D" for these devices, where B and D are +the bus and device numbers of the USB device). Then, the rule re-sets X to the +value of X with the string "usbdev" removed from the start. So now, X has the +value "B.D". Then, the rule sets B to the value of X after a period, and all +characters following it, have been removed from the end; this sets B to just +the string "B" (just the bus number of the USB device). Then, the rule sets D +to the value of X after a period, and all characters before it, have been +removed from the beginning; this sets D to just the string "D" (just the device +number). + +Then, the rule echoes "bus/usb/$B/$D" (bus/usb/bus-number/device-number), so +Udev will capture that value. The rule sets NAME="%c" to put the device node +at /dev/bus/usb/bus-number/device-number. (This is the same layout that the +/proc/bus/usb/ devices used.) + +Most of the doubled characters in this rule are doubled so that Udev does not +interpret them. The rule looks all the more confusing because of this method +of escaping special characters. + + +A final word of caution: Any particular rule must be written on one line, and a +comma must separate each part of the rule. diff --git a/udev-config/doc/60-persistent-input.txt b/udev-config/doc/60-persistent-input.txt new file mode 100644 index 000000000..45030723f --- /dev/null +++ b/udev-config/doc/60-persistent-input.txt @@ -0,0 +1,86 @@ +Purpose of rules file: + +This rules file provides nonvolatile, unique names (in the form of symlinks) +for input devices that cooperate. + + +Description of rules: + +This file starts off with a few rules that make Udev skip the entire file if +the current uevent is not input related. If ACTION is not "add", or SUBSYSTEM +is not "input", or KERNEL (the device node) matches "input[0-9]*", then Udev +will GOTO the LABEL named "persistent_input_end", which is the last rule in +this file. (input[0-9]* uevents are skipped because they do not create device +nodes.) + +This type of "skip this list of rules if X" operation is done in both the +persistent input and persistent storage rules files. The reason is efficiency +-- if Udev had to go run the usb_id and/or path_id programs for non-input and +non-storage rules, those rules would take much longer to process for no good +reason. + + +First in this file is a set of rules for by-ID style symlinks. These attempt +to uniquely identify a device based on its serial number, but there are some +issues with this. Many USB manufacturers do not provide a unique serial number +for each device -- for instance, my Microsoft Intellimouse Optical has a USB +serial number of "Microsoft_Microsoft_IntelliMouse_Optical". This kind of +nonsensical "serial number" means that if you plug in two Intellimouse Optical +devices, they will both get the same by-id symlink, and the device that the +symlink points to will be random. This defeats the purpose of by-ID symlinks. +(However, I believe this behavior is technically valid according to the USB +standard. I believe it is not recommended, though.) + +Anyway, first in the by-ID rules, we have a rule that runs for any (input) +device hanging anywhere off a USB bus. It uses the IMPORT{program} option to +run the "/lib/udev/usb_id -x" program. usb_id looks at the environment to find +out which device to look at, generates a list of environment-variable VAR=value +pairs, and prints them. Udev stores this output away while the process is +running. After the process exits, Udev modifies the current environment to +include the VARs that usb_id printed. (It assigns the "value"s that usb_id +printed to each of those VARs.) Specifically, usb_id prints ID_VENDOR, +ID_MODEL, ID_REVISION, ID_SERIAL, ID_TYPE, and ID_BUS (at least in the case of +the aforementioned USB optical mouse). These variable names will all be set in +the environment. + +Then, we have a set of rules to set ID_CLASS for various types of devices. The +rules first check for a "usb"-bus device that has a "bInterfaceClass" of 03 and +a "bInterfaceProtocol" of 01. If the interface class is 03, this is an HID +device. If the protocol is 01, it's a keyboard device. So we set ID_CLASS to +"kbd". The next rule checks whether the interface protocol is 02, and if so, +sets ID_CLASS to "mouse" (HID devices with a protocol of 02 are mice). + +Any input device that the "pcspkr" driver claims must be a speaker. Any input +device that the "atkbd" driver claims must be a keyboard. Any input device +that the "psmouse" driver claims must be a mouse. If there's a sysfs attribute +named "name", whose contents contain "dvb", "DVB", or " IR ", then we set +ID_CLASS to "ir". + +Then, we have a rule to search the tree and find the first parent that has a +modalias. If that modalias matches the big long ugly string in the rules file, +we assume this is a joystick device, and set ID_CLASS appropriately. (This +parent should be the kobject for the joystick device itself. The reason we +search the tree is that the current uevent is for a device node, not the +physical joystick device.) + +Once the ID_CLASS variable is set properly, we have one more modification to +perform: if the ID_SERIAL variable was not set at all by the usb_id program, we +set it to "noserial". + +Now that all the environment variables are set up properly, we start generating +the by-ID symlinks in /dev/input/by-id/. If the current device node's name +starts with "event", we add "event" into the symlink name. Otherwise, we don't +add anything for mice. (Other device types don't get a persistent by-ID +symlink.) + + +Next, we create by-path symlinks. The /lib/udev/path_id program takes the path +of the device as an argument, and prints out "ID_PATH=string", where "string" +is the "shortest physical path" to the device. We import this value into the +environment. + +If the path is non-empty, and the device node name starts with "mouse" or +"event", we add a by-path symlink based on the path and the device class (and +we also add "event" if it's an event device). This symlink should be stable as +long as the device never moves to a different port. + diff --git a/udev-config/doc/60-persistent-storage.txt b/udev-config/doc/60-persistent-storage.txt new file mode 100644 index 000000000..32062c559 --- /dev/null +++ b/udev-config/doc/60-persistent-storage.txt @@ -0,0 +1,95 @@ +Purpose of rules file: + +This rules file provides nonvolatile, unique names (in the form of symlinks) +for various types of storage devices -- both IDE/ATA and SCSI. + + +Description of rules: + +First, similar to the 60-persistent-input.rules file, we skip the entire file +for uevents that this rules file should not apply to, as an optimization. The +file does not apply to removal uevents or non-block devices. It does not apply +to ramdisks, loopback-mount devices, floppy disks, netblock devices, or device- +mapper devices. It also should not apply to removable devices (that is, non- +partition devices with attributes named "removable" with the value "1", or +partition devices whose parents have "removable" set to "1" -- partition +kobjects don't have the "removable" attribute, only whole-disk kobjects do). + +For partition devices, we use the IMPORT{parent} option to pull in all the +environment variables that get set for the parent device. (The parent of a +partition device is the containing whole-disk device.) The IMPORT{parent} +option is documented in the udev(7) manpage, but basically the value that we +assign is used as a filter of environment variable names to import. + +Now, we start with rules to create by-ID symlinks (similar to the by-ID links +created for input devices). For hd* whole-disk devices (they're IDE/ATA, since +they start with hd), we run the ata_id program in --export mode. The ata_id +program requires a device node to be passed, so we also use the $tempnode Udev +variable -- this causes Udev to create a temporary device node somewhere and +substitute its name where $tempnode appears in the program command line. + +The ata_id program, in --export mode, prints several ID_* values. If we're +looking at a whole-disk device, and if ID_SERIAL is among those, we add a +symlink containing the device's ID_MODEL and ID_SERIAL values. If we're +looking at a partition device, we create an ID_MODEL- and ID_SERIAL-based +symlink also, but we add -partX to the end of the link name (where X is the +partition number). + +For SCSI devices, we first make some modifications to the environment. If the +device's kobject has a parent with a non-empty "ieee1394_id" attribute, then +the device is Firewire, so we set the ID_SERIAL environment variable to the +value of that attribute, and we set ID_BUS to "ieee1394". Now, if ID_SERIAL is +not set, we run usb_id, which (if this is a USB storage device) will print +various values. If ID_SERIAL is still unset, we run scsi_id with a set of +parameters designed to get an ID_SERIAL by querying the device itself. If that +still fails, we try running scsi_id in a mode that prints the information even +if the disk doesn't support so-called "vital product data" pages. If the +uevent is for a DASD device, we run dasd_id. + +If one of these *_id programs gave us an ID_SERIAL, then for whole-disk devices +we create a by-ID symlink using the ID_BUS and ID_SERIAL. For partition +devices, we create a by-ID symlink that has the same form except we add -partX +to the end (just like for IDE/ATA devices). + + +Now we have some rules to create by-path persistent symlinks. We start by +running the path_id program on the DEVPATH (%p) value. For whole-disk devices +and SCSI ROM type devices, we create a symlink directly, using the environment +variable ID_PATH, under the /dev/disk/by-path directory. But for SCSI tape +devices, we create a by-path symlink in the /dev/tape/by-path directory (we +base the symlink on the same information, though: the ID_PATH value printed by +path_id). Now, for both SCSI ROM and SCSI tape devices, we skip everything +that's left in the rules file (this is another optimization: neither SCSI ROM +nor SCSI tape devices have UUIDs, labels, or EDD information). + +For partition devices, we now create a by-path symlink of the same form as the +other partition device persistent symlinks (that is, with the same name as the +parent device, but with -partX added). We know that ID_PATH is set whenever it +applies, because we ran the path_id program on the parent device, and we did an +IMPORT{parent} on ID_* earlier in the rules file. + +Now we create by-label and by-uuid symlinks. These use properties of various +filesystems to generate a persistent name for a partition. For instance, if +you use the ext2 filesystem, you can use e2label to assign a label, and mke2fs +assigns a UUID when the filesystem is created. MS-DOS compatible filesystems +also assign a "UUID" (actually it's just a serial number, created based on the +date and time the partition was formatted, so it is not unique), which these +rules will also use. But for removable partitions, we skip the rules (for the +same reason as we skipped them above for removable disks). + +We run the vol_id program to get ID_FS_USAGE, ID_FS_UUID, and ID_FS_LABEL_SAFE +values. (vol_id supports other values as well, but we do not use them here.) +ID_FS_USAGE corresponds to the way the filesystem is supposed to be used; if it +gets set to "filesystem", "other", or "crypto", we create a symlink. If +ID_FS_UUID is set, we use it in a by-uuid symlink. If ID_FS_LABEL_SAFE is set, +we use it in a by-label symlink. + +Finally, we create EDD-based symlinks in the by-id directory. For whole-disk +devices, we run edd_id to get the EDD-generated ID string. (For partition +devices, we import this string from the parent.) If edd_id yields an ID_EDD +value, we use it in a symlink, for both whole disks and partitions. + + +The last rule in the file is merely a LABEL that various other rules use to +bypass the file (or the rest of the file) when needed. + diff --git a/udev-config/doc/61-cdrom.txt b/udev-config/doc/61-cdrom.txt new file mode 100644 index 000000000..ff7887fe3 --- /dev/null +++ b/udev-config/doc/61-cdrom.txt @@ -0,0 +1,16 @@ +Purpose of rules file: + +This file re-assigns CD-ROM type devices to the "cdrom" group. + + +Description of rules: + +There is only one rule here. It depends on the 60-persistent-storage file, +though, because it requires the ID_TYPE environment variable to be set properly +for CD devices. Normally the rules in the 60-persistent-storage.rules file +will run the correct *_id programs to do this properly. + +If ID_TYPE is "cd", and this is a block device, and it's an add event, then we +assign the device to the "cdrom" group. Simple, once the *_id programs have +all been run. + diff --git a/udev-config/doc/80-drivers.txt b/udev-config/doc/80-drivers.txt new file mode 100644 index 000000000..e5cfcefb3 --- /dev/null +++ b/udev-config/doc/80-drivers.txt @@ -0,0 +1,69 @@ +Purpose of rules file: + +The rules in this file allow Udev to fully replace the old /sbin/hotplug +script. They automatically load kernel modules as devices are discovered. + + +Description of rules: + +All rules in this file match ACTION=="add", so they only run when devices are +being added. + +ENV{MODALIAS} is the value of the environment variable named MODALIAS. This +environment variable is sent by the kernel when it sends a uevent for any +device that has a modalias. Modaliases are strings that can be used to load +the appropriate kernel module driver. + +Generally a modalias will contain information like vendor ID, device ID, and +possibly other IDs depending on the bus the device is connected to. (USB, for +instance, has the concept of a "device class" and a "device interface", which +are basically just ways to standardize the USB protocol for various types of +devices. This is what allows a single kernel module such as hid.ko to drive +many different vendors' USB input devices: all devices that support the USB +HID interface expose the HID interface number in their modalias, and so the +hid.ko driver can be loaded for each device. When it loads, hid.ko attaches +to the HID interface and does whatever is needed to work with each device.) + +Kernel modules that drive hardware expose a list of modaliases. These +modaliases are matched against the device modalias by /sbin/modprobe (after +shell-style expansion), with the help of /sbin/depmod's modules.alias file. +The upshot of all this is, you can tell Udev to run "/sbin/modprobe modalias", +and it will load the module that claims it can drive the "modalias" device. + +The rule that does this inspects ENV{MODALIAS} to ensure it is not empty. It +does this by comparing it to "?*" -- inside a match, "*" would match *any* +string, including the empty string, so to ensure MODALIAS is not empty, we need +to match against "?*" instead. ("?" matches any one character.) + +The Udev RUN+="" option adds a program to run when the rule matches. In this +case, we tell Udev to run "/sbin/modprobe $env{MODALIAS}". Note that Udev does +not do path searches; if the executable is not specified with a fully-qualified +path, it *must* be located under the /lib/udev directory. If it is not, you +*must* specify a fully-qualified path, as we do here. Also, "$env{string}" is +replaced by the value of the environment variable "string" when the command +runs, so this adds the modalias to the modprobe command. The modprobe program +will do the rest. Finally, the {ignore_error} option is added to the RUN key; +this prevents Udev from failing the uevent if the modprobe command fails. (The +modprobe command will fail when run during cold-plugging, if the driver was +configured into the kernel instead of as a module, for instance.) + +There is still one feature of the old hotplug shell-script system that Udev +cannot provide: blacklisting modules from being auto-loaded. To accomplish +this, we must use module-init-tools. In /etc/modprobe.conf, if you use the +"blacklist <module-name>" syntax, modprobe will not load <module-name> under +any name except its real module name. Any modaliases exposed by that module +will not be honored. + + +There are also rules in this file for various other types of driver loading. +PNP-BIOS devices, for instance, expose a list of PNP IDs in their sysfs "id" +attribute, instead of exposing a single MODALIAS, so one rule loops through +each ID and tries to load the appropriate module. Several other types of +devices require an extra module before they will work properly; one example +of this is IDE tapes, which require the ide-scsi module. Finally, whenever +any SCSI device is found, the file uses the TEST key to check whether the +/sys/module/sg directory exists. If not, then the "sg" module -- the SCSI +generic driver -- is loaded. (That driver creates the module/sg directory, +so the module/sg test is just to see whether the driver has already been +loaded.) + diff --git a/udev-config/doc/95-udev-late.txt b/udev-config/doc/95-udev-late.txt new file mode 100644 index 000000000..00ea17c61 --- /dev/null +++ b/udev-config/doc/95-udev-late.txt @@ -0,0 +1,18 @@ +Purpose of rules file: + +Sends all uevents to a Unix-domain socket, where they can be monitored by other +programs. + + +Description of rules: + +There is only one rule, which matches all uevents. It uses Udev's RUN key to +specify a socket to send each uevent to. Normally RUN is used to start up a +process, but if the pathname starts with "socket:", Udev instead interprets +the rest of the name as a Unix-domain socket to send the uevent to. In this +case, we send send the uevent to the socket named /org/kernel/udev/monitor, +which is created by the udevmonitor program. Udevmonitor is used to watch +uevents as they come to Udev. Its only purpose is for debugging, but sending +the uevent to a socket that doesn't exist is a very cheap operation, so we +enable this rule for all uevents. + diff --git a/udev-config/doc/README b/udev-config/doc/README new file mode 100644 index 000000000..01216694c --- /dev/null +++ b/udev-config/doc/README @@ -0,0 +1,6 @@ +This directory contains documentation for each rule file used in LFS. + +Each .rules file should contain a corresponding .txt file in this directory, +which explains both the overall purpose of the rules file, and each type of +rule contained therein. + |