source: /cluster/svnroot/bccd-ng/branches/skylar/bccd-3.4.0/bin/build_livecd.pl @ 4815

Last change on this file since 4815 was 4815, checked in by skylar, 7 years ago

no longer need to copy networking (#860)

  • Property Copyright set to Copyright (C) 2010 Andrew Fitz Gibbon, Paul Gray, Kevin Hunter, Dave Joiner, Sam Leeman-Munk, Tom Murphy, Charlie Peck, Skylar Thompson, & Aaron Weeden
  • Property License set to
    GNU GENERAL PUBLIC LICENSE
    Version 3, 29 June 2007

    Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
    Everyone is permitted to copy and distribute verbatim copies
    of this license document, but changing it is not allowed.

    Preamble

    The GNU General Public License is a free, copyleft license for
    software and other kinds of works.

    The licenses for most software and other practical works are designed
    to take away your freedom to share and change the works. By contrast,
    the GNU General Public License is intended to guarantee your freedom to
    share and change all versions of a program--to make sure it remains free
    software for all its users. We, the Free Software Foundation, use the
    GNU General Public License for most of our software; it applies also to
    any other work released this way by its authors. You can apply it to
    your programs, too.

    When we speak of free software, we are referring to freedom, not
    price. Our General Public Licenses are designed to make sure that you
    have the freedom to distribute copies of free software (and charge for
    them if you wish), that you receive source code or can get it if you
    want it, that you can change the software or use pieces of it in new
    free programs, and that you know you can do these things.

    To protect your rights, we need to prevent others from denying you
    these rights or asking you to surrender the rights. Therefore, you have
    certain responsibilities if you distribute copies of the software, or if
    you modify it: responsibilities to respect the freedom of others.

    For example, if you distribute copies of such a program, whether
    gratis or for a fee, you must pass on to the recipients the same
    freedoms that you received. You must make sure that they, too, receive
    or can get the source code. And you must show them these terms so they
    know their rights.

    Developers that use the GNU GPL protect your rights with two steps:
    (1) assert copyright on the software, and (2) offer you this License
    giving you legal permission to copy, distribute and/or modify it.

    For the developers' and authors' protection, the GPL clearly explains
    that there is no warranty for this free software. For both users' and
    authors' sake, the GPL requires that modified versions be marked as
    changed, so that their problems will not be attributed erroneously to
    authors of previous versions.

    Some devices are designed to deny users access to install or run
    modified versions of the software inside them, although the manufacturer
    can do so. This is fundamentally incompatible with the aim of
    protecting users' freedom to change the software. The systematic
    pattern of such abuse occurs in the area of products for individuals to
    use, which is precisely where it is most unacceptable. Therefore, we
    have designed this version of the GPL to prohibit the practice for those
    products. If such problems arise substantially in other domains, we
    stand ready to extend this provision to those domains in future versions
    of the GPL, as needed to protect the freedom of users.

    Finally, every program is threatened constantly by software patents.
    States should not allow patents to restrict development and use of
    software on general-purpose computers, but in those that do, we wish to
    avoid the special danger that patents applied to a free program could
    make it effectively proprietary. To prevent this, the GPL assures that
    patents cannot be used to render the program non-free.

    The precise terms and conditions for copying, distribution and
    modification follow.

    TERMS AND CONDITIONS

    0. Definitions.

    "This License" refers to version 3 of the GNU General Public License.

    "Copyright" also means copyright-like laws that apply to other kinds of
    works, such as semiconductor masks.

    "The Program" refers to any copyrightable work licensed under this
    License. Each licensee is addressed as "you". "Licensees" and
    "recipients" may be individuals or organizations.

    To "modify" a work means to copy from or adapt all or part of the work
    in a fashion requiring copyright permission, other than the making of an
    exact copy. The resulting work is called a "modified version" of the
    earlier work or a work "based on" the earlier work.

    A "covered work" means either the unmodified Program or a work based
    on the Program.

    To "propagate" a work means to do anything with it that, without
    permission, would make you directly or secondarily liable for
    infringement under applicable copyright law, except executing it on a
    computer or modifying a private copy. Propagation includes copying,
    distribution (with or without modification), making available to the
    public, and in some countries other activities as well.

    To "convey" a work means any kind of propagation that enables other
    parties to make or receive copies. Mere interaction with a user through
    a computer network, with no transfer of a copy, is not conveying.

    An interactive user interface displays "Appropriate Legal Notices"
    to the extent that it includes a convenient and prominently visible
    feature that (1) displays an appropriate copyright notice, and (2)
    tells the user that there is no warranty for the work (except to the
    extent that warranties are provided), that licensees may convey the
    work under this License, and how to view a copy of this License. If
    the interface presents a list of user commands or options, such as a
    menu, a prominent item in the list meets this criterion.

    1. Source Code.

    The "source code" for a work means the preferred form of the work
    for making modifications to it. "Object code" means any non-source
    form of a work.

    A "Standard Interface" means an interface that either is an official
    standard defined by a recognized standards body, or, in the case of
    interfaces specified for a particular programming language, one that
    is widely used among developers working in that language.

    The "System Libraries" of an executable work include anything, other
    than the work as a whole, that (a) is included in the normal form of
    packaging a Major Component, but which is not part of that Major
    Component, and (b) serves only to enable use of the work with that
    Major Component, or to implement a Standard Interface for which an
    implementation is available to the public in source code form. A
    "Major Component", in this context, means a major essential component
    (kernel, window system, and so on) of the specific operating system
    (if any) on which the executable work runs, or a compiler used to
    produce the work, or an object code interpreter used to run it.

    The "Corresponding Source" for a work in object code form means all
    the source code needed to generate, install, and (for an executable
    work) run the object code and to modify the work, including scripts to
    control those activities. However, it does not include the work's
    System Libraries, or general-purpose tools or generally available free
    programs which are used unmodified in performing those activities but
    which are not part of the work. For example, Corresponding Source
    includes interface definition files associated with source files for
    the work, and the source code for shared libraries and dynamically
    linked subprograms that the work is specifically designed to require,
    such as by intimate data communication or control flow between those
    subprograms and other parts of the work.

    The Corresponding Source need not include anything that users
    can regenerate automatically from other parts of the Corresponding
    Source.

    The Corresponding Source for a work in source code form is that
    same work.

    2. Basic Permissions.

    All rights granted under this License are granted for the term of
    copyright on the Program, and are irrevocable provided the stated
    conditions are met. This License explicitly affirms your unlimited
    permission to run the unmodified Program. The output from running a
    covered work is covered by this License only if the output, given its
    content, constitutes a covered work. This License acknowledges your
    rights of fair use or other equivalent, as provided by copyright law.

    You may make, run and propagate covered works that you do not
    convey, without conditions so long as your license otherwise remains
    in force. You may convey covered works to others for the sole purpose
    of having them make modifications exclusively for you, or provide you
    with facilities for running those works, provided that you comply with
    the terms of this License in conveying all material for which you do
    not control copyright. Those thus making or running the covered works
    for you must do so exclusively on your behalf, under your direction
    and control, on terms that prohibit them from making any copies of
    your copyrighted material outside their relationship with you.

    Conveying under any other circumstances is permitted solely under
    the conditions stated below. Sublicensing is not allowed; section 10
    makes it unnecessary.

    3. Protecting Users' Legal Rights From Anti-Circumvention Law.

    No covered work shall be deemed part of an effective technological
    measure under any applicable law fulfilling obligations under article
    11 of the WIPO copyright treaty adopted on 20 December 1996, or
    similar laws prohibiting or restricting circumvention of such
    measures.

    When you convey a covered work, you waive any legal power to forbid
    circumvention of technological measures to the extent such circumvention
    is effected by exercising rights under this License with respect to
    the covered work, and you disclaim any intention to limit operation or
    modification of the work as a means of enforcing, against the work's
    users, your or third parties' legal rights to forbid circumvention of
    technological measures.

    4. Conveying Verbatim Copies.

    You may convey verbatim copies of the Program's source code as you
    receive it, in any medium, provided that you conspicuously and
    appropriately publish on each copy an appropriate copyright notice;
    keep intact all notices stating that this License and any
    non-permissive terms added in accord with section 7 apply to the code;
    keep intact all notices of the absence of any warranty; and give all
    recipients a copy of this License along with the Program.

    You may charge any price or no price for each copy that you convey,
    and you may offer support or warranty protection for a fee.

    5. Conveying Modified Source Versions.

    You may convey a work based on the Program, or the modifications to
    produce it from the Program, in the form of source code under the
    terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7. This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy. This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged. This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

    A compilation of a covered work with other separate and independent
    works, which are not by their nature extensions of the covered work,
    and which are not combined with it such as to form a larger program,
    in or on a volume of a storage or distribution medium, is called an
    "aggregate" if the compilation and its resulting copyright are not
    used to limit the access or legal rights of the compilation's users
    beyond what the individual works permit. Inclusion of a covered work
    in an aggregate does not cause this License to apply to the other
    parts of the aggregate.

    6. Conveying Non-Source Forms.

    You may convey a covered work in object code form under the terms
    of sections 4 and 5, provided that you also convey the
    machine-readable Corresponding Source under the terms of this License,
    in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source. This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge. You need not require recipients to copy the
    Corresponding Source along with the object code. If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source. Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

    A separable portion of the object code, whose source code is excluded
    from the Corresponding Source as a System Library, need not be
    included in conveying the object code work.

    A "User Product" is either (1) a "consumer product", which means any
    tangible personal property which is normally used for personal, family,
    or household purposes, or (2) anything designed or sold for incorporation
    into a dwelling. In determining whether a product is a consumer product,
    doubtful cases shall be resolved in favor of coverage. For a particular
    product received by a particular user, "normally used" refers to a
    typical or common use of that class of product, regardless of the status
    of the particular user or of the way in which the particular user
    actually uses, or expects or is expected to use, the product. A product
    is a consumer product regardless of whether the product has substantial
    commercial, industrial or non-consumer uses, unless such uses represent
    the only significant mode of use of the product.

    "Installation Information" for a User Product means any methods,
    procedures, authorization keys, or other information required to install
    and execute modified versions of a covered work in that User Product from
    a modified version of its Corresponding Source. The information must
    suffice to ensure that the continued functioning of the modified object
    code is in no case prevented or interfered with solely because
    modification has been made.

    If you convey an object code work under this section in, or with, or
    specifically for use in, a User Product, and the conveying occurs as
    part of a transaction in which the right of possession and use of the
    User Product is transferred to the recipient in perpetuity or for a
    fixed term (regardless of how the transaction is characterized), the
    Corresponding Source conveyed under this section must be accompanied
    by the Installation Information. But this requirement does not apply
    if neither you nor any third party retains the ability to install
    modified object code on the User Product (for example, the work has
    been installed in ROM).

    The requirement to provide Installation Information does not include a
    requirement to continue to provide support service, warranty, or updates
    for a work that has been modified or installed by the recipient, or for
    the User Product in which it has been modified or installed. Access to a
    network may be denied when the modification itself materially and
    adversely affects the operation of the network or violates the rules and
    protocols for communication across the network.

    Corresponding Source conveyed, and Installation Information provided,
    in accord with this section must be in a format that is publicly
    documented (and with an implementation available to the public in
    source code form), and must require no special password or key for
    unpacking, reading or copying.

    7. Additional Terms.

    "Additional permissions" are terms that supplement the terms of this
    License by making exceptions from one or more of its conditions.
    Additional permissions that are applicable to the entire Program shall
    be treated as though they were included in this License, to the extent
    that they are valid under applicable law. If additional permissions
    apply only to part of the Program, that part may be used separately
    under those permissions, but the entire Program remains governed by
    this License without regard to the additional permissions.

    When you convey a copy of a covered work, you may at your option
    remove any additional permissions from that copy, or from any part of
    it. (Additional permissions may be written to require their own
    removal in certain cases when you modify the work.) You may place
    additional permissions on material, added by you to a covered work,
    for which you have or can give appropriate copyright permission.

    Notwithstanding any other provision of this License, for material you
    add to a covered work, you may (if authorized by the copyright holders of
    that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

    All other non-permissive additional terms are considered "further
    restrictions" within the meaning of section 10. If the Program as you
    received it, or any part of it, contains a notice stating that it is
    governed by this License along with a term that is a further
    restriction, you may remove that term. If a license document contains
    a further restriction but permits relicensing or conveying under this
    License, you may add to a covered work material governed by the terms
    of that license document, provided that the further restriction does
    not survive such relicensing or conveying.

    If you add terms to a covered work in accord with this section, you
    must place, in the relevant source files, a statement of the
    additional terms that apply to those files, or a notice indicating
    where to find the applicable terms.

    Additional terms, permissive or non-permissive, may be stated in the
    form of a separately written license, or stated as exceptions;
    the above requirements apply either way.

    8. Termination.

    You may not propagate or modify a covered work except as expressly
    provided under this License. Any attempt otherwise to propagate or
    modify it is void, and will automatically terminate your rights under
    this License (including any patent licenses granted under the third
    paragraph of section 11).

    However, if you cease all violation of this License, then your
    license from a particular copyright holder is reinstated (a)
    provisionally, unless and until the copyright holder explicitly and
    finally terminates your license, and (b) permanently, if the copyright
    holder fails to notify you of the violation by some reasonable means
    prior to 60 days after the cessation.

    Moreover, your license from a particular copyright holder is
    reinstated permanently if the copyright holder notifies you of the
    violation by some reasonable means, this is the first time you have
    received notice of violation of this License (for any work) from that
    copyright holder, and you cure the violation prior to 30 days after
    your receipt of the notice.

    Termination of your rights under this section does not terminate the
    licenses of parties who have received copies or rights from you under
    this License. If your rights have been terminated and not permanently
    reinstated, you do not qualify to receive new licenses for the same
    material under section 10.

    9. Acceptance Not Required for Having Copies.

    You are not required to accept this License in order to receive or
    run a copy of the Program. Ancillary propagation of a covered work
    occurring solely as a consequence of using peer-to-peer transmission
    to receive a copy likewise does not require acceptance. However,
    nothing other than this License grants you permission to propagate or
    modify any covered work. These actions infringe copyright if you do
    not accept this License. Therefore, by modifying or propagating a
    covered work, you indicate your acceptance of this License to do so.

    10. Automatic Licensing of Downstream Recipients.

    Each time you convey a covered work, the recipient automatically
    receives a license from the original licensors, to run, modify and
    propagate that work, subject to this License. You are not responsible
    for enforcing compliance by third parties with this License.

    An "entity transaction" is a transaction transferring control of an
    organization, or substantially all assets of one, or subdividing an
    organization, or merging organizations. If propagation of a covered
    work results from an entity transaction, each party to that
    transaction who receives a copy of the work also receives whatever
    licenses to the work the party's predecessor in interest had or could
    give under the previous paragraph, plus a right to possession of the
    Corresponding Source of the work from the predecessor in interest, if
    the predecessor has it or can get it with reasonable efforts.

    You may not impose any further restrictions on the exercise of the
    rights granted or affirmed under this License. For example, you may
    not impose a license fee, royalty, or other charge for exercise of
    rights granted under this License, and you may not initiate litigation
    (including a cross-claim or counterclaim in a lawsuit) alleging that
    any patent claim is infringed by making, using, selling, offering for
    sale, or importing the Program or any portion of it.

    11. Patents.

    A "contributor" is a copyright holder who authorizes use under this
    License of the Program or a work on which the Program is based. The
    work thus licensed is called the contributor's "contributor version".

    A contributor's "essential patent claims" are all patent claims
    owned or controlled by the contributor, whether already acquired or
    hereafter acquired, that would be infringed by some manner, permitted
    by this License, of making, using, or selling its contributor version,
    but do not include claims that would be infringed only as a
    consequence of further modification of the contributor version. For
    purposes of this definition, "control" includes the right to grant
    patent sublicenses in a manner consistent with the requirements of
    this License.

    Each contributor grants you a non-exclusive, worldwide, royalty-free
    patent license under the contributor's essential patent claims, to
    make, use, sell, offer for sale, import and otherwise run, modify and
    propagate the contents of its contributor version.

    In the following three paragraphs, a "patent license" is any express
    agreement or commitment, however denominated, not to enforce a patent
    (such as an express permission to practice a patent or covenant not to
    sue for patent infringement). To "grant" such a patent license to a
    party means to make such an agreement or commitment not to enforce a
    patent against the party.

    If you convey a covered work, knowingly relying on a patent license,
    and the Corresponding Source of the work is not available for anyone
    to copy, free of charge and under the terms of this License, through a
    publicly available network server or other readily accessible means,
    then you must either (1) cause the Corresponding Source to be so
    available, or (2) arrange to deprive yourself of the benefit of the
    patent license for this particular work, or (3) arrange, in a manner
    consistent with the requirements of this License, to extend the patent
    license to downstream recipients. "Knowingly relying" means you have
    actual knowledge that, but for the patent license, your conveying the
    covered work in a country, or your recipient's use of the covered work
    in a country, would infringe one or more identifiable patents in that
    country that you have reason to believe are valid.

    If, pursuant to or in connection with a single transaction or
    arrangement, you convey, or propagate by procuring conveyance of, a
    covered work, and grant a patent license to some of the parties
    receiving the covered work authorizing them to use, propagate, modify
    or convey a specific copy of the covered work, then the patent license
    you grant is automatically extended to all recipients of the covered
    work and works based on it.

    A patent license is "discriminatory" if it does not include within
    the scope of its coverage, prohibits the exercise of, or is
    conditioned on the non-exercise of one or more of the rights that are
    specifically granted under this License. You may not convey a covered
    work if you are a party to an arrangement with a third party that is
    in the business of distributing software, under which you make payment
    to the third party based on the extent of your activity of conveying
    the work, and under which the third party grants, to any of the
    parties who would receive the covered work from you, a discriminatory
    patent license (a) in connection with copies of the covered work
    conveyed by you (or copies made from those copies), or (b) primarily
    for and in connection with specific products or compilations that
    contain the covered work, unless you entered into that arrangement,
    or that patent license was granted, prior to 28 March 2007.

    Nothing in this License shall be construed as excluding or limiting
    any implied license or other defenses to infringement that may
    otherwise be available to you under applicable patent law.

    12. No Surrender of Others' Freedom.

    If conditions are imposed on you (whether by court order, agreement or
    otherwise) that contradict the conditions of this License, they do not
    excuse you from the conditions of this License. If you cannot convey a
    covered work so as to satisfy simultaneously your obligations under this
    License and any other pertinent obligations, then as a consequence you may
    not convey it at all. For example, if you agree to terms that obligate you
    to collect a royalty for further conveying from those to whom you convey
    the Program, the only way you could satisfy both those terms and this
    License would be to refrain entirely from conveying the Program.

    13. Use with the GNU Affero General Public License.

    Notwithstanding any other provision of this License, you have
    permission to link or combine any covered work with a work licensed
    under version 3 of the GNU Affero General Public License into a single
    combined work, and to convey the resulting work. The terms of this
    License will continue to apply to the part which is the covered work,
    but the special requirements of the GNU Affero General Public License,
    section 13, concerning interaction through a network will apply to the
    combination as such.

    14. Revised Versions of this License.

    The Free Software Foundation may publish revised and/or new versions of
    the GNU General Public License from time to time. Such new versions will
    be similar in spirit to the present version, but may differ in detail to
    address new problems or concerns.

    Each version is given a distinguishing version number. If the
    Program specifies that a certain numbered version of the GNU General
    Public License "or any later version" applies to it, you have the
    option of following the terms and conditions either of that numbered
    version or of any later version published by the Free Software
    Foundation. If the Program does not specify a version number of the
    GNU General Public License, you may choose any version ever published
    by the Free Software Foundation.

    If the Program specifies that a proxy can decide which future
    versions of the GNU General Public License can be used, that proxy's
    public statement of acceptance of a version permanently authorizes you
    to choose that version for the Program.

    Later license versions may give you additional or different
    permissions. However, no additional obligations are imposed on any
    author or copyright holder as a result of your choosing to follow a
    later version.

    15. Disclaimer of Warranty.

    THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
    APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
    HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
    OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
    IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
    ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

    16. Limitation of Liability.

    IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
    WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
    THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
    GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
    USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
    DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
    PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
    EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
    SUCH DAMAGES.

    17. Interpretation of Sections 15 and 16.

    If the disclaimer of warranty and limitation of liability provided
    above cannot be given local legal effect according to their terms,
    reviewing courts shall apply local law that most closely approximates
    an absolute waiver of all civil liability in connection with the
    Program, unless a warranty or assumption of liability accompanies a
    copy of the Program in return for a fee.

    END OF TERMS AND CONDITIONS

    How to Apply These Terms to Your New Programs

    If you develop a new program, and you want it to be of the greatest
    possible use to the public, the best way to achieve this is to make it
    free software which everyone can redistribute and change under these terms.

    To do so, attach the following notices to the program. It is safest
    to attach them to the start of each source file to most effectively
    state the exclusion of warranty; and each file should have at least
    the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year> <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.

    Also add information on how to contact you by electronic and paper mail.

    If the program does terminal interaction, make it output a short
    notice like this when it starts in an interactive mode:

    <program> Copyright (C) <year> <name of author>
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

    The hypothetical commands `show w' and `show c' should show the appropriate
    parts of the General Public License. Of course, your program's commands
    might be different; for a GUI interface, you would use an "about box".

    You should also get your employer (if you work as a programmer) or school,
    if any, to sign a "copyright disclaimer" for the program, if necessary.
    For more information on this, and how to apply and follow the GNU GPL, see
    <http://www.gnu.org/licenses/>.

    The GNU General Public License does not permit incorporating your program
    into proprietary programs. If your program is a subroutine library, you
    may consider it more useful to permit linking proprietary applications with
    the library. If this is what you want to do, use the GNU Lesser General
    Public License instead of this License. But first, please read
    <http://www.gnu.org/philosophy/why-not-lgpl.html>.
  • Property svn:executable set to *
  • Property svn:keywords set to Id Rev Author Date
File size: 40.5 KB
Line 
1#!/usr/bin/env perl
2
3# $Id: build_livecd.pl 4815 2014-07-20 02:45:38Z skylar $
4
5# This file is part of BCCD, an open-source live CD for computational science
6# education.
7#
8# Copyright (C) 2011 Andrew Fitz Gibbon, Paul Gray, Kevin Hunter, Dave Joiner,
9#   Sam Leeman-Munk, Tom Murphy, Charlie Peck, Skylar Thompson, & Aaron Weeden
10
11#
12# This program is free software: you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation, either version 3 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
25#BCCD ISO build script
26
27use strict;
28use warnings;
29use lib "../trees/usr/local/lib/site_perl";
30use Getopt::Long;
31use Pod::Usage;
32use File::Path;
33use File::Temp;
34use File::Copy;
35use File::Basename;
36use WWW::Mechanize;
37use POSIX;
38use Bccd;
39use Cwd;
40use Bccd::TestDb qw/open_db insert_results/;
41use Readonly;
42use IO::Handle;
43
44# Autoflush both stdout and stderr
45STDERR->autoflush(1);
46STDOUT->autoflush(1);
47
48$ENV{LANGUAGE} = "C";
49$ENV{LC_ALL} = "C";
50$ENV{LANG} = "C";
51
52Readonly my $CONF_FILE => "bin/build_livecd.conf";
53
54my %opts;
55
56my($debmirror,$workspace,$rc,$out,$ft,$tmpdir,$cwd,$svnrev,
57   $Bccd,$allout,$rpkgs,$nouid,$nogid,$debmirror_host,
58   $debmirror_name,$debsecmirror,$dir,$release,$kern_deb);
59my(@lsof,@pids,@rd);
60
61$Bccd = new Bccd();
62
63$Bccd->log_and_cont('DEBUG','main',"Jenkins workspace is $ENV{WORKSPACE}");
64Readonly my $WORKSPACE => $ENV{WORKSPACE};
65
66# Load configuration file first
67if(-f $CONF_FILE) {
68    %opts = %{$Bccd->run_test(
69        "read_yaml",
70        "",
71        "Read $CONF_FILE",
72        "$CONF_FILE"
73        )};
74}
75
76# Then override with command-line options
77GetOptions(
78    'arch=s'        =>  \$opts{'ARCH'},
79    'outdir=s'      =>  \$opts{'OUTDIR'},
80    'suite=s'       =>  \$opts{'SUITE'},
81    'nocleanup'     =>  \$opts{'NOCLEANUP'},
82    'updatedb=s'    =>  \$opts{'UPDATEDB'},
83    'loglevel=s'    =>  \$opts{'LOGLEVEL'},
84    'debmirror=s'   =>  \$opts{'DEBMIRROR'},
85    'dir=s'         =>  \$opts{'DIR'},
86    'release=s'     =>  \$opts{'RELEASE'},
87    'help'          =>  \$opts{'help'}
88    );
89
90if($opts{'help'}) {
91    pod2usage(-verbose => 2);
92}
93
94if(!$opts{'ARCH'} ||
95   !$opts{'OUTDIR'} ||
96   !$opts{'SUITE'}
97    ) {
98    pod2usage(-verbose => 2);
99}
100
101Readonly my $PROJECT => 'bccd';
102$ft = new File::Temp();
103if(defined($opts{'DIR'})) {
104        $dir = $opts{'DIR'};
105} else {
106        $dir = File::Spec->tmpdir;
107}
108
109if(defined($opts{'NOCLEANUP'})) {
110        print "Disabled automatic cleanup\n";
111        $ft = File::Temp->newdir("/tmp/$PROJECT.XXXXXXX",CLEANUP => 0);
112}
113else {
114        print "Enabled automatic cleanup\n";
115        $ft = File::Temp->newdir("/tmp/$PROJECT.XXXXXXX",DIR=>$dir,CLEANUP => 1);
116}
117$tmpdir = $ft->dirname();
118
119if(defined($opts{'DEBMIRROR'})) {
120        $debmirror_host = $opts{'DEBMIRROR'};
121} else {
122        $debmirror_host = "debmirror.cluster.earlham.edu";
123}
124$debmirror = "http://$debmirror_host";
125
126Readonly my $BUILDDIR   => $tmpdir."/build-bccd/";
127Readonly my $SOFTWARE   => "/bccd/software/";
128Readonly my $PROJDIR    => $BUILDDIR."/diskless/bccd/";
129Readonly my $BCCDCLIENT => $BUILDDIR."/diskless/clients/";
130Readonly my $NEWHOME    => "$BUILDDIR/UNIONFS/home";
131Readonly my $CHECKIN    => "$NEWHOME/meta/nodes/";
132Readonly my $LIBFETCH   => "/root/liberate";
133Readonly my $KERNREV    => '3.14.0bccd-02979-gbb71e91-dirty';
134$ENV{DEBIAN_FRONTEND}    = "noninteractive";
135Readonly my $PERLDIR        => "/usr/local/lib/site_perl/";
136Readonly my $TESTNAME       => "build_livecd";
137Readonly my $STAGE          => $Bccd->get_stage();
138Readonly my $KNOPDIR        => "$tmpdir/KNOPPIX";
139Readonly my $USER           => "$PROJECT";
140Readonly my @TIME           => localtime();
141Readonly my $FORMAT_DATE    => ($TIME[5]+1900)."-".($TIME[4]+1)."-".$TIME[3];
142Readonly my $SPLASH_FILE    => 'bccd_logo_new.png';
143Readonly my $HEAD_NODE      => 'node000';
144Readonly my @MINIRT_MODS    => (
145                                "BusLogic.ko",
146                                "NCR53c406a.ko",
147                                "a100u2w.ko",
148                                "advansys.ko",
149                                "aic7xxx.ko",
150                                "dc395x.ko",
151                                "dtc.ko",
152                                "eata.ko",
153                                "ehci-hcd.ko",
154                                "fdomain.ko",
155                                "ff-memless.ko",
156                                "forcedeth.ko",
157                                "gdth.ko",
158                                "ieee1394.ko",
159                                "initio.ko",
160                                "usb-libusual.ko",
161                                "loop.ko",
162                                "mptbase.ko",
163                                "mptscsih.ko",
164                                "ohci-hcd.ko",
165                                "ohci1394.ko",
166                                "pas16.ko",
167                                "psi240i.ko",
168                                "sbp2.ko",
169                                "sym53c8xx.ko",
170                                "t128.ko",
171                                "tmscsim.ko",
172                                "u14-34f.ko",
173                                "uhci-hcd.ko",
174                                "ultrastor.ko",
175                                "usb-storage.ko",
176                                "usbcore.ko",
177                                "usbhid.ko",
178                                "wd7000.ko",
179                'xhci-hcd.ko',
180                                );
181
182# Revision fetch
183
184if(defined($opts{'LOGLEVEL'})) {
185    if($opts{'LOGLEVEL'} =~ m{INFO|DEBUG}) {
186        $Bccd->set_debug($opts{'LOGLEVEL'});
187    }
188    else {
189        $Bccd->log_and_die('ERROR','main',"Invalid loglevel $opts{'LOGLEVEL'}");
190    }
191}
192
193if($opts{'UPDATEDB'}) {
194    $Bccd->redirect_stdio("$tmpdir");
195}
196
197# Jenkins will set this, else can be set by user
198if(defined($ENV{SVN_REVISION})) {
199    $svnrev = $ENV{SVN_REVISION};
200}
201else {
202    $svnrev = 'HEAD';
203}
204
205if (defined($opts{'RELEASE'})) {
206        $release = $opts{'RELEASE'};
207
208        if ($release =~ /\d+\.\d+\.\d+/) {
209                $release .= ".$svnrev";
210        } else {
211                print "not ok - Malformed release number; Bailing out\n";
212                exit;
213        }
214} else {
215        $release = $svnrev;
216}
217
218Readonly my $OUTISO => "$opts{'OUTDIR'}/bccd-$release.$opts{'ARCH'}.iso";
219
220my $PACKAGES = $Bccd->run_test(
221    "read_yaml",
222    "",
223    "Read package manifest.",
224    "$WORKSPACE/packages/packages.conf",
225);
226
227# Make sure linux-image in packages.conf has the proper kernel revision
228for(my $i=0;$i<$#{$PACKAGES->{BASE}};$i++) {
229    if($PACKAGES->{BASE}->[$i] eq 'linux-image') {
230        $PACKAGES->{BASE}->[$i] .= "-$KERNREV";
231    }
232}
233
234$Bccd->run_test(
235    "chdir",
236    "",
237    "cd'd into $tmpdir.",
238    "$tmpdir",
239);
240
241$Bccd->run_test(
242    "system",
243    "",
244    "Built initial install tree.",
245    [
246        '/usr/sbin/debootstrap',
247        '--exclude=linux-image-2.6.32-5,linux-image-2.6.32-5-amd64,linux-image-2.6.32-5-i686',
248        '--arch',
249        $opts{'ARCH'},
250        $opts{'SUITE'},
251        $BUILDDIR,
252        $debmirror,
253    ],
254);
255
256$Bccd->run_test(
257    "system",
258    "",
259    "Copied /dev to $BUILDDIR/dev.",
260    [
261        '/bin/cp',
262        '-R',
263        '/dev',
264        "$BUILDDIR/dev",
265    ],
266);
267
268$Bccd->run_test(
269    "system",
270    "",
271    "Mounted /proc into $BUILDDIR.",
272    [
273        '/bin/mount',
274        '-t',
275        'proc',
276        'none',
277        "$BUILDDIR/proc",
278    ],
279);
280
281$Bccd->run_test(
282    "system",
283    "",
284    "Mounted /sys into $BUILDDIR.",
285    [
286        '/bin/mount',
287        '-t',
288        'sysfs',
289        'none',
290        "$BUILDDIR/sys",
291    ],
292);
293
294$Bccd->run_test(
295    "fwrite",
296    "",
297    "Disabled apt-get package authentication.",
298    "a",
299    "$BUILDDIR/etc/apt/apt.conf",
300    "APT::Get::AllowUnauthenticated 1 ;",
301);
302
303$Bccd->run_test(
304    "system",
305    "",
306    "Installed Perl testing modules in install tree.",
307    [
308        '/usr/sbin/chroot',
309        $BUILDDIR,
310        '/usr/bin/apt-get',
311        '-y',
312        'install',
313        'libtest-base-perl',
314    ],
315);
316
317$Bccd->run_test(
318    "system",
319    "",
320    "Installed Perl testing modules in install tree.",
321    [
322        '/usr/sbin/chroot',
323        $BUILDDIR,
324        '/usr/bin/apt-get',
325        '-y',
326        'install',
327        'libtest-base-perl',
328    ],
329);
330
331foreach my $file ( "$BUILDDIR/etc/apt/sources.list","$BUILDDIR/etc/apt/apt.conf","$BUILDDIR/etc/dhcp/dhcpd.conf","$BUILDDIR/etc/dhcp/dhclient.conf","$BUILDDIR/etc/ssh/ssh_config","$BUILDDIR/etc/ssh/sshd_config","$BUILDDIR/etc/profile","$BUILDDIR/etc/default/useradd","$BUILDDIR/etc/default/tftpd-hpa","$BUILDDIR/etc/rc.local", ) {
332    if( -f $file ) {
333        $Bccd->run_test(
334            "unlink",
335            "",
336            "rm'd existing cfg file $file",
337            "$file",
338        );
339    }
340}
341
342foreach my $dir ( $BCCDCLIENT, $PROJDIR, "$BUILDDIR/etc/network",
343    "$BUILDDIR/etc/dhcp", "$BUILDDIR/etc/ssh", "$BUILDDIR/$SOFTWARE",
344    "$BUILDDIR/root/.ssh", "$BUILDDIR/nfs", "$BUILDDIR/$LIBFETCH",
345    "$BUILDDIR/var/log/apache2","$BUILDDIR/run/network",
346    "$BUILDDIR/etc/apt/preferences.d/",
347    "$BUILDDIR/var/lib/initramfs-tools", ) {
348    if( !(-d $dir) ) {
349        $Bccd->run_test(
350            "mkpath",
351            "",
352            "Made $dir directory.",
353            "$dir",
354        );
355    }
356}
357
358$Bccd->run_test(
359    'fcopy',
360    '',
361    "Copied debconf preseed into $BUILDDIR/tmp",
362    "$WORKSPACE/packages/debconf.preseed",
363    "$BUILDDIR/tmp/debconf.preseed",
364);
365
366$Bccd->run_test(
367    "system",
368    "",
369    "Set debconf selections.",
370    [
371        '/usr/sbin/chroot',
372        $BUILDDIR,
373        '/usr/bin/debconf-set-selections',
374        "/tmp/debconf.preseed",
375    ],
376);
377
378$Bccd->run_test(
379    'unlink',
380    '',
381    "Removing $BUILDDIR/tmp/debconf.preseed",
382    "$BUILDDIR/tmp/debconf.preseed",
383);
384
385$Bccd->run_test(
386    "fcopy",
387    "",
388    "Copied apt source list.",
389    "$WORKSPACE/packages/etc/apt/sources.list",
390    "$BUILDDIR/etc/apt/sources.list",
391);
392
393$Bccd->run_test(
394    "regexsub_file",
395    "",
396    "Changed DEBMIRROR template in sources list to $debmirror_host.",
397    "$BUILDDIR/etc/apt/sources.list",
398    "!DEBMIRROR!",
399    "$debmirror_host",
400);
401
402$Bccd->run_test(
403    "fcopy",
404    "",
405    "Fetched network interfaces.compute cfg.",
406    "$WORKSPACE/packages/etc/network/interfaces.compute",
407    "$BUILDDIR/etc/network/interfaces.compute",
408);
409
410$Bccd->run_test(
411    "mkpath",
412    "",
413    "mkdir /etc/X11/xinit",
414    "$BUILDDIR/etc/X11/xinit",
415);
416
417# Make apt work
418
419foreach my $dir ( "/var/cache/apt/archives", "/var/cache/apt/archives/partial" ) {
420    $Bccd->run_test(
421        "mkpath",
422        "",
423        "mkdir $dir",
424        "$BUILDDIR/$dir",
425    );
426}
427
428# /etc fetch
429foreach my $file ( "hosts", "hosts.compute", "hosts.allow", "hosts.deny",
430    "profile", "modules", "modules.net",
431    "passwd.compute", "group.compute", "shadow.compute", "exports.compute",
432    "nsswitch.conf", "unionfs.conf", "X11/xinit/xinitrc", "X11/xinit/xserverrc",
433    "dpkg/dpkg.cfg", "ld.so.conf.d/software.conf", "sudoers",
434    "init.d/bccd-bootflags",
435    "init.d/bccd-automated", "init.d/bccd-passwd","init.d/bccd-dhcp",
436    "init.d/bccd-sshd", "X11/xorg.conf","lam.conf", "init.d/bccd-nfs",
437    "init.d/bccd-unite-sw", "init.d/bccd-dhcp-conf",
438    "init.d/bccd-route", "init.d/bccd-keyboard", "rc.local",
439    "init.d/bccd-fsrw", "init.d/bccd-mail", "ld.so.conf.d/CUDA.conf",
440    "init.d/networking","init.d/nfs-common","init.d/bccd-liberate") {
441    $Bccd->run_test(
442        "fcopy",
443        "",
444        "Copied /etc/$file file.",
445        "$WORKSPACE/packages/etc/$file",
446        "$BUILDDIR/etc/$file",
447    );
448}
449
450$Bccd->run_test(
451    "chmod",
452    "",
453    "Set $BUILDDIR/etc/sudoers user/group readable only.",
454    0440,
455    "$BUILDDIR/etc/sudoers",
456);
457
458foreach my $file ( "bccd-networking", "bccd-passwd", "bccd-dhcp", "bccd-sshd",
459    "bccd-nfs", "bccd-unite-sw", "networking","bccd-dhcp-conf",
460    "bccd-route", "bccd-keyboard", "bccd-fsrw", "bccd-mail", "bccd-bootflags",
461    "bccd-automated", "nfs-common", "bccd-liberate", ) {
462    $Bccd->run_test(
463        "chmod",
464        "",
465        "Set $BUILDDIR/etc/init.d/$file executable.",
466        0755,
467        "$BUILDDIR/etc/init.d/$file",
468    );
469}
470
471$Bccd->run_test(
472    "chmod",
473    "",
474    "Set $BUILDDIR/etc/rc.local executable.",
475    0755,
476    "$BUILDDIR/etc/rc.local",
477);
478
479$cwd = getcwd();
480
481$Bccd->run_test(
482    "chdir",
483    "",
484    "cd $BUILDDIR",
485    "$BUILDDIR",
486);
487
488foreach my $dir ("lib","opt","bin","sbin","etc","root",) {
489    $Bccd->run_test(
490        "rsync",
491        "",
492        "Copied in $dir.",
493        "$WORKSPACE/trees/$dir/",
494        "$BUILDDIR/$dir/",
495        "$WORKSPACE/bin/rsync_svn.exclude",
496    );
497}
498
499$Bccd->run_test(
500    "chmod",
501    "",
502    "chmod 0755 $BUILDDIR/etc/skel/.bash_profile",
503    0755,
504    "$BUILDDIR/etc/skel/.bash_profile",
505);
506
507if(-f "$BUILDDIR/etc/skel/.bashrc") {
508    $Bccd->run_test(
509        "unlink",
510        "",
511        "Removed default .bashrc",
512        "$BUILDDIR/etc/skel/.bashrc",
513    );
514}
515
516$Bccd->run_test(
517    "fcopy",
518    "",
519    "Copied liberate script.",
520    "$WORKSPACE/packages/liberate.pl",
521    "$BUILDDIR/root/liberate.pl",
522);
523
524$Bccd->run_test(
525    "fcopy",
526    "",
527    "Copied liberate rsync exclude file.",
528    "$WORKSPACE/packages/rsync_liberate.exclude",
529    "$BUILDDIR/root/rsync_liberate.exclude",
530);
531
532$Bccd->run_test(
533    "fcopy",
534    "", 
535    "Copied build USB script.",
536    "$WORKSPACE/bin/build_bootable_USB.sh",
537    "$BUILDDIR/root/build_bootable_USB.sh",
538);
539
540$Bccd->run_test(
541    "chmod",
542    "",
543    "Set $BUILDDIR/root/build_bootable_USB.sh executable.",
544    0755,
545    "$BUILDDIR/root/build_bootable_USB.sh",
546);
547
548$Bccd->run_test(
549    "fcopy",
550    "",
551    "Copied /etc/default/useradd file.",
552    "$WORKSPACE/packages/etc/default/useradd",
553    "$BUILDDIR/etc/default/useradd",
554);
555
556$Bccd->run_test(
557    "fwrite",
558    "",
559    "Allowing initrd kernel upgrade.",
560    "a",
561    "$BUILDDIR/etc/kernel-img.conf",
562    "do_initrd=yes",
563);
564
565$Bccd->run_test(
566    "system",
567    "",
568    "Disabled bccd-sshd.",
569    [
570        '/usr/sbin/chroot',
571        $BUILDDIR,
572        '/usr/sbin/update-rc.d',
573        '-f',
574        'bccd-sshd',
575        'remove',
576    ],
577);
578
579$Bccd->run_test(
580    "system",
581    "",
582    "Enabled bccd-sshd.",
583    [
584        '/usr/sbin/chroot',
585        $BUILDDIR,
586        '/usr/sbin/update-rc.d',
587        'bccd-sshd',
588        'defaults',
589    ],
590);
591
592$Bccd->run_test(
593    "unlink",
594    0,
595    "Removing apt lists.",
596    "</var/lib/apt/lists/*>",
597);
598
599$Bccd->run_test(
600    "unlink",
601    0,
602    "Removing partial apt lists.",
603    "</var/lib/apt/lists/partial/*>",
604);
605
606$Bccd->run_test(
607    "system",
608    "",
609    "Cleaned apt cache.",
610    [
611        '/usr/sbin/chroot',
612        $BUILDDIR,
613        '/usr/bin/apt-get',
614        'clean',
615    ],
616);
617
618$Bccd->run_test(
619    "system",
620    "",
621    "Installed Oracle VBox apt key.",
622    [
623        '/usr/sbin/chroot',
624        $BUILDDIR,
625        '/bin/bash',
626        '-c',
627        q{/usr/bin/wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | /usr/bin/apt-key add -},
628    ],
629);
630
631$Bccd->run_test(
632    "system",
633    "",
634    "Updated apt cache.",
635    [
636        '/usr/sbin/chroot',
637        $BUILDDIR,
638        '/usr/bin/apt-get',
639        'update',
640    ],
641);
642
643$Bccd->run_test(
644    "system",
645    "",
646    "Fetched pre-install dependencies.",
647    [
648        '/usr/sbin/chroot',
649        $BUILDDIR,
650        '/usr/bin/apt-get',
651        '-y',
652        '--allow-unauthenticated',
653        'install',
654        'debian-archive-keyring',
655        'initramfs-tools',
656    ],
657);
658
659if($opts{'ARCH'} eq 'i386') {
660        $Bccd->run_test(
661            "system",
662            "0",
663            "Fetched Debian packages.",
664            [
665            '/usr/sbin/chroot',
666            $BUILDDIR,
667            '/usr/bin/aptitude',
668            '--allow-untrusted',
669            '-y',
670            'install',
671            @{$PACKAGES->{BASE}},
672            @{$PACKAGES->{EXTRA}},
673        ],
674    );
675}
676elsif($opts{'ARCH'} eq 'amd64') {
677        $Bccd->run_test(
678            "system",
679            "0",
680            "Fetched Debian packages.",
681            [
682            '/usr/sbin/chroot',
683            $BUILDDIR,
684            '/usr/bin/aptitude',
685            '--allow-untrusted',
686            '-y',
687            'install',
688            @{$PACKAGES->{BASE}},
689            @{$PACKAGES->{EXTRA}},
690            @{$PACKAGES->{AMD64}},
691        ],
692    );
693}
694
695$Bccd->run_test(
696        "system",
697        0,
698        "Fetching tftpd-hpa separately.",
699        [
700        '/usr/sbin/chroot',
701        $BUILDDIR,
702        '/usr/bin/apt-get',
703        '--force-yes',
704        '-y',
705        'install',
706        'tftpd-hpa',
707    ],
708);
709
710$Bccd->run_test(
711        "system",
712        0,
713        "Removed unneeded packages.",
714    [
715        '/usr/sbin/chroot',
716        $BUILDDIR,
717        '/usr/bin/apt-get',
718        '-y',
719        'remove',
720        @{$PACKAGES->{REMOVE}},
721    ],
722);
723
724$Bccd->run_test(
725    "system",
726    "",
727    "Deleted cached deb packages.",
728    [
729        '/usr/sbin/chroot',
730        $BUILDDIR,
731        '/usr/bin/apt-get',
732        'clean',
733    ],
734);
735
736$Bccd->run_test(
737    "system",
738    "",
739    "Deleted unneeded packages.",
740    [
741        '/usr/sbin/chroot',
742        $BUILDDIR,
743        '/usr/bin/apt-get',
744        '-y',
745        'autoremove',
746        @{$PACKAGES->{REMOVE}},
747    ],
748);
749
750$Bccd->run_test(
751    "fcopy",
752    "",
753    "Copied tftpd-hpa configuration.",
754    "$WORKSPACE/trees/etc/default/tftpd-hpa",
755    "$BUILDDIR/etc/default/tftpd-hpa",
756);
757
758$Bccd->run_test(
759    "mkpath",
760    "",
761    "Making $KERNREV modules directory.",
762    "$BUILDDIR/lib/modules/$KERNREV",
763);
764
765$Bccd->run_test(
766    "fcopy",
767    "",
768    "Copied ssh_config file.",
769    "$WORKSPACE/packages/etc/ssh/ssh_config",
770    "$BUILDDIR/etc/ssh/ssh_config",
771);
772
773$Bccd->run_test(
774    "fcopy",
775    "",
776    "Copied sshd_config file.",
777    "$WORKSPACE/packages/etc/ssh/sshd_config",
778    "$BUILDDIR/etc/ssh/sshd_config",
779);
780
781$Bccd->run_test(
782    "mkpath",
783    "",
784    "mkdir $BUILDDIR/etc/udev/rules.d",
785    "$BUILDDIR/etc/udev/rules.d",
786);
787
788$Bccd->run_test(
789    "fcopy",
790    "",
791    "Copied USB automounting udev rule.",
792    "$WORKSPACE/packages/etc/udev/rules.d/99-automount_usb.rules",
793    "$BUILDDIR/etc/udev/rules.d/99-automount_usb.rules",
794);
795
796# Revision write
797
798$Bccd->run_test(
799    "fwrite",
800    "",
801    "Opened $BUILDDIR/etc/$PROJECT-revision for writing.",
802    "w",
803    "$BUILDDIR/etc/$PROJECT-revision",
804    "$release",
805);
806
807# Install software
808
809$Bccd->run_test(
810    "mkpath",
811    "",
812    "Created node checkin directory.",
813    "$CHECKIN",
814);
815
816$nouid = $Bccd->run_test(
817    "getuseruid",
818    "",
819    "Got uid for nobody user.",
820    "nobody",
821);
822
823$nogid = $Bccd->run_test(
824    "getusergid",
825    "",
826    "Got gid for nobody user.",
827    "nobody",
828);
829
830$Bccd->run_test(
831    "chown",
832    "",
833    "chown'd checkin directory $CHECKIN to $nouid:$nogid.",
834    "$nouid",
835    "$nogid",
836    "$CHECKIN",
837);
838#
839# Mobeen: This section was added to solve the problem of missing std C++ library softlink.
840# "Linked libstdc++.so.6.0.13 to libstdc++.so",
841# "Linked /usr/lib32/libstdc++.so to  /usr/lib32/libstdc++.so.6",
842if($opts{'ARCH'} eq 'amd64') {
843    $Bccd->run_test(
844        "system",
845        "",
846        "Linked /usr/lib32/libstdc++.so.6.0.13 to /usr/lib32/libstdc++.so",
847        [
848            '/usr/sbin/chroot',
849            $BUILDDIR,
850            '/bin/ln',
851            '-s',
852            '/usr/lib32/libstdc++.so.6',
853            '/usr/lib32/libstdc++.so',
854        ],
855    );
856}
857elsif($opts{'ARCH'} eq 'i386') {
858    $Bccd->run_test(
859        "system",
860        "",
861        "Linked /usr/lib/libstdc++.so.6.0.13 to /usr/lib/libstdc++.so",
862        [
863            '/usr/sbin/chroot',
864            $BUILDDIR,
865            '/bin/ln',
866            '-s',
867            '/usr/lib/libstdc++.so.6',
868            '/usr/lib/libstdc++.so',
869        ],
870    );
871}
872
873$Bccd->run_test(
874    "system",
875    "",
876    "Linked VBoxService into /usr/sbin.",
877    [
878        '/usr/sbin/chroot',
879        $BUILDDIR,
880        '/bin/ln',
881        '-s',
882        '/opt/VBoxGuestAdditions-3.2.8/sbin/VBoxService',
883        '/usr/sbin/VBoxService',
884    ],
885);
886
887foreach my $vb ("VBoxClient","VBoxControl") {
888    $Bccd->run_test(
889        "system",
890        "",
891        "Linked $vb into /usr/bin.",
892        [
893            '/usr/sbin/chroot',
894            $BUILDDIR,
895            '/bin/ln',
896            '-s',
897            "/opt/VBoxGuestAdditions-3.2.8/bin/$vb",
898            "/usr/bin/$vb",
899        ],
900    );
901}
902
903$Bccd->run_test(
904    "mkpath",
905    "",
906    "Made $BUILDDIR/srv/tftp/pxelinux.cfg",
907    "$BUILDDIR/srv/tftp/pxelinux.cfg",
908);
909
910$Bccd->run_test(
911    "fcopy",
912    "",
913    "Copied pxelinux to tftpboot.",
914    "$BUILDDIR/usr/lib/syslinux/pxelinux.0",
915    "$BUILDDIR/srv/tftp/pxelinux.0",
916);
917
918foreach my $file ( "dhcpd.conf", "dhclient.conf", "dhclient.conf-bccd",
919    "dhclient.conf-any" ) {
920    $Bccd->run_test(
921        "fcopy",
922        "",
923        "Copied DHCP $file configuration.",
924        "$WORKSPACE/packages/etc/dhcp/$file",
925        "$BUILDDIR/etc/dhcp/$file",
926    );
927}
928
929# Needed down here to prevent hang with debconf
930foreach my $file ( "exports", "hosts.equiv", "gpm.conf", "inittab",
931    "pdnsd.conf", "default/pdnsd", ) {
932    $Bccd->run_test(
933        "fcopy",
934        "",
935        "Copied /etc/$file file.",
936        "$WORKSPACE/packages/etc/$file",
937        "$BUILDDIR/etc/$file",
938    );
939}
940
941$Bccd->run_test(
942    "system",
943    "",
944    "Setting LSB parsing of init scripts.",
945    [
946        '/usr/bin/touch',
947        "$BUILDDIR/etc/update-rc.d-lsbparse",
948    ],
949);
950
951$Bccd->run_test(
952    "system",
953    "",
954    "Disabling hardware-optimized ld.so directories.",
955    [
956        '/usr/bin/touch',
957        "$BUILDDIR/etc/ld.so.nohwcap",
958    ],
959);
960
961foreach my $script ("nis", "ssh-host-keys", "nfs-kernel-server", "ssh",
962    "isc-dhcp-server", "dbus", "hal", "apache2","mpd",
963    "networking","bccd-usage",
964    "bccd-mount-virtfs",) {
965    $Bccd->run_test(
966        "system",
967        "",
968        "Disabled $script.",
969        [
970            '/usr/sbin/chroot',
971            $BUILDDIR,
972            '/usr/sbin/update-rc.d',
973            '-f',
974            $script,
975            'remove',
976        ],
977    );
978}
979
980foreach my $script ("nfs-common", "vboxadd", "vboxadd-service",
981    "bccd-nvidia", "bccd-mail","networking",
982    "bccd-unite-sw","bccd-networking","mpd","torque-mom",
983    "torque-server","torque-scheduler","bccd-mount-virtfs",
984    "bccd-liberate","ssh",) {
985    $Bccd->run_test(
986        "system",
987        "",
988        "Enabled $script at boot time.",
989        [
990            '/usr/sbin/chroot',
991            $BUILDDIR,
992            '/usr/sbin/update-rc.d',
993            $script,
994            'defaults',
995        ],
996    );
997}
998
999# This must run before 20 (bccd-passwd)
1000foreach my $script ("bccd-unite-sw", "perfctr","bccd-automated") {
1001    $Bccd->run_test(
1002        "system",
1003        "",
1004        "Enabling $script config.",
1005        [
1006            '/usr/sbin/chroot',
1007            $BUILDDIR,
1008            '/usr/sbin/update-rc.d',
1009            $script,
1010            'defaults',
1011            '18',
1012        ],
1013    );
1014}
1015
1016# Based on virtualbox install script
1017foreach my $script ("vboxadd","vboxadd-x11",) {
1018    $Bccd->run_test(
1019        "system",
1020        "",
1021        "Enabling $script config.",
1022        [
1023            '/usr/sbin/chroot',
1024            $BUILDDIR,
1025            '/usr/sbin/update-rc.d',
1026            $script,
1027            'defaults',
1028            '30',
1029        ],
1030    );
1031}
1032
1033$Bccd->run_test(
1034    "system",
1035    "",
1036    "Enabling vboxadd-service config.",
1037    [
1038        '/usr/sbin/chroot',
1039        $BUILDDIR,
1040        '/usr/sbin/update-rc.d',
1041        'vboxadd-service',
1042        'defaults',
1043        '35',
1044    ],
1045);
1046
1047$Bccd->run_test(
1048        "system",
1049        "",
1050        "Enabled script to write /etc/issue.",
1051    [
1052        '/usr/sbin/chroot',
1053        $BUILDDIR,
1054        '/usr/sbin/update-rc.d',
1055        'bccd-usage',
1056        'start',
1057        '99',
1058        '2',
1059        '.',
1060    ],
1061);
1062
1063$Bccd->run_test(
1064        "system",
1065        "",
1066        "Enabled script to write /etc/issue.",
1067    [
1068        '/usr/sbin/chroot',
1069        $BUILDDIR,
1070        '/usr/sbin/update-rc.d',
1071        'bccd-issue',
1072        'defaults',
1073    ],
1074);
1075
1076$Bccd->run_test(
1077        "system",
1078        "",
1079        "Enabling home directory overlay cleaning.",
1080    [
1081        '/usr/sbin/chroot',
1082        $BUILDDIR,
1083        '/usr/sbin/update-rc.d',
1084        'bccd-clean-home',
1085        'start',
1086        '11',
1087        'S',
1088        '.',
1089    ],
1090);
1091
1092$Bccd->run_test(
1093    "system",
1094    "",
1095    "Enabling bccd-dhcp-conf config.",
1096    [
1097        '/usr/sbin/chroot',
1098        $BUILDDIR,
1099        '/usr/sbin/update-rc.d',
1100        'bccd-dhcp-conf',
1101        'start',
1102        '38',
1103        'S',
1104        '.',
1105    ],
1106);
1107
1108$Bccd->run_test(
1109    "system",
1110    "",
1111    "Enabling bccd-route config.",
1112    [
1113        '/usr/sbin/chroot',
1114        $BUILDDIR,
1115        '/usr/sbin/update-rc.d',
1116        'bccd-route',
1117        'start',
1118        '41',
1119        'S',
1120        '.',
1121    ],
1122);
1123
1124$Bccd->run_test(
1125    "system",
1126    "",
1127    "Enabling bccd-fsrw config.",
1128    [
1129        '/usr/sbin/chroot',
1130        $BUILDDIR,
1131        '/usr/sbin/update-rc.d',
1132        'bccd-fsrw',
1133        'start',
1134        '11',
1135        'S',
1136        '.',
1137    ],
1138);
1139
1140$Bccd->run_test(
1141    "system",
1142    "",
1143    "Enabling bccd-keyboard config.",
1144    [
1145        '/usr/sbin/chroot',
1146        $BUILDDIR,
1147        '/usr/sbin/update-rc.d',
1148        'bccd-keyboard',
1149        'start',
1150        '18',
1151        'S',
1152        '.',
1153    ],
1154);
1155
1156$Bccd->run_test(
1157    "system",
1158    "",
1159    "Enabling bccd-nfs config.",
1160    [
1161        '/usr/sbin/chroot',
1162        $BUILDDIR,
1163        '/usr/sbin/update-rc.d',
1164        'bccd-nfs',
1165        'start',
1166        '20',
1167        '2',
1168        'S',
1169        '.',
1170    ],
1171);
1172
1173$Bccd->run_test(
1174    "system",
1175    "",
1176    "Enabling bccd-passwd config.",
1177    [
1178        '/usr/sbin/chroot',
1179        $BUILDDIR,
1180        '/usr/sbin/update-rc.d',
1181        'bccd-passwd',
1182        'start',
1183        '20',
1184        'S',
1185        '.',
1186    ],
1187);
1188
1189$Bccd->run_test(
1190    "system",
1191    "",
1192    "Enabling bccd-sshd config.",
1193    [
1194        '/usr/sbin/chroot',
1195        $BUILDDIR,
1196        '/usr/sbin/update-rc.d',
1197        'bccd-sshd',
1198        'start',
1199        '20',
1200        '2',
1201        'S',
1202        '.',
1203    ],
1204);
1205
1206$Bccd->run_test(
1207    "system",
1208    "",
1209    "Enabling bccd-dhcp config.",
1210    [
1211        '/usr/sbin/chroot',
1212        $BUILDDIR,
1213        '/usr/sbin/update-rc.d',
1214        'bccd-dhcp',
1215        'start',
1216        '40',
1217        'S',
1218        '.',
1219    ],
1220);
1221
1222$Bccd->run_test(
1223    "system",
1224    "",
1225    "Building /bccd_boot_flags.",
1226    [
1227        '/usr/sbin/chroot',
1228        $BUILDDIR,
1229        '/usr/sbin/update-rc.d',
1230        'bccd-bootflags',
1231        'start',
1232        '01',
1233        'S',
1234        '.',
1235    ],
1236);
1237
1238$Bccd->run_test(
1239    "system",
1240    "",
1241    "Added root password.",
1242    [
1243        '/usr/sbin/chroot',
1244        $BUILDDIR,
1245        '/usr/sbin/usermod',
1246        '-p',
1247        '\$1\$erNdlHdL\$EV6C0eBbe6M3bVaK9m4If0',
1248        'root',
1249    ],
1250);
1251
1252# User creation
1253
1254# Manual writes to keep NIS from interfering with static uid/gid
1255
1256$Bccd->run_test(
1257    "fwrite",
1258    "",
1259    "Wrote out sshd user.",
1260    "a",
1261    "$BUILDDIR/etc/passwd",
1262    "sshd:x:103:65534::/var/run/sshd:/usr/sbin/nologin",
1263);
1264
1265$Bccd->run_test(
1266    "fwrite",
1267    "",
1268    "Wrote out sshd group.",
1269    "a",
1270    "$BUILDDIR/etc/shadow",
1271    "sshd:!:13625:0:99999:7:::",
1272);
1273
1274$Bccd->run_test(
1275    "system",
1276    "",
1277    "Creating non-root-group account.",
1278    [
1279        '/usr/sbin/chroot',
1280        $BUILDDIR,
1281        '/usr/sbin/groupadd',
1282        '-g',
1283        '1000',
1284        'bccd',
1285    ],
1286);
1287
1288$Bccd->run_test(
1289    "system",
1290    "",
1291    "Created non-root user account.",
1292    [
1293        '/usr/sbin/chroot',
1294        $BUILDDIR,
1295        '/usr/sbin/useradd',
1296        '-s',
1297        '/bin/bash',
1298        '-G',
1299        'video,fuse,adm',
1300        '-u',
1301        '1000',
1302        '-g',
1303        '1000',
1304        '-d',
1305        "/home/$USER",
1306        '-m',
1307        '-p',
1308        '\$1\$Agm0SXPB\$JnObEvwBQdg4WCovvMKST1',
1309        $USER,
1310    ],
1311);
1312
1313$Bccd->run_test(
1314    "system",
1315    "",
1316    "Created vbox user account.",
1317    [
1318        '/usr/sbin/chroot',
1319        $BUILDDIR,
1320        '/usr/sbin/useradd',
1321        '-s',
1322        '/bin/sh',
1323        '-G',
1324        'daemon',
1325        '-d',
1326        '/var/run/vboxadd',
1327        'vboxadd',
1328    ],
1329);
1330
1331$Bccd->run_test(
1332    "system",
1333    "",
1334    "Altered non-root account directory for KNOPPIX.",
1335    [
1336        '/usr/sbin/chroot',
1337        $BUILDDIR,
1338        '/usr/sbin/usermod',
1339        '-d',
1340        "/UNIONFS/home/$USER",
1341        $USER,
1342    ],
1343);
1344
1345# Bccd perl modules
1346
1347$Bccd->run_test(
1348    "mkpath",
1349    "",
1350    "mkdir $BUILDDIR/$PERLDIR",
1351    "$BUILDDIR/$PERLDIR",
1352);
1353
1354$Bccd->run_test(
1355    "chdir",
1356    "",
1357    "cd'd to $BUILDDIR/$PERLDIR/../",
1358    "$BUILDDIR/$PERLDIR/../",
1359);
1360
1361
1362$Bccd->run_test(
1363    "rsync",
1364    "",
1365    "Checked out Bccd perl modules.",
1366    "$WORKSPACE/trees/$PERLDIR/",
1367    "$BUILDDIR/$PERLDIR/",
1368    "$WORKSPACE/bin/rsync_svn.exclude",
1369);
1370
1371$Bccd->run_test(
1372    "chdir",
1373    "",
1374    "cd'd to $tmpdir.",
1375    "$tmpdir",
1376);
1377
1378# Torque setup
1379
1380foreach my $file (  '/etc/torque/server_name',
1381                    '/var/spool/torque/mom_priv/config' ) {
1382    my $path = "$BUILDDIR/$file";
1383    $Bccd->run_test(
1384        "fwrite",
1385        "",
1386        "Writing out $HEAD_NODE to $path",
1387        'w',
1388        $path,
1389        $HEAD_NODE,
1390    );
1391}
1392
1393# Starting hwsetup init scripts
1394foreach my $script ( "knoppix-autoconfig", "xserver-xorg" ) {
1395    $Bccd->run_test(
1396        "system",
1397        "",
1398        "Enabled $script.",
1399        [
1400            '/usr/sbin/chroot',
1401            $BUILDDIR,
1402            '/usr/sbin/update-rc.d',
1403            $script,
1404            'start',
1405            '20',
1406            '2',
1407            '3',
1408            '4',
1409            '5',
1410            '.',
1411        ],
1412    );
1413}
1414
1415# Software install
1416
1417$Bccd->run_test(
1418    "chdir",
1419    "",
1420    "cd'd to $BUILDDIR",
1421    "$BUILDDIR",
1422);
1423
1424$Bccd->run_test(
1425    "system",
1426    "",
1427    "Changed $SOFTWARE to bccd:bccd.",
1428    [
1429        '/usr/sbin/chroot',
1430        $BUILDDIR,
1431        '/bin/chown',
1432        '-R',
1433        'bccd:bccd',
1434        $SOFTWARE,
1435    ],
1436);
1437
1438foreach my $prog ( <$BUILDDIR/bccd/software/*/bin/*> ) {
1439    $Bccd->run_test(
1440        "chmod",
1441        "",
1442        "chmod 0755 $prog",
1443        0755,
1444        "$prog",
1445    );
1446}
1447
1448$Bccd->run_test(
1449    "chdir",
1450    "",
1451    "cd $BUILDDIR/",
1452    "$BUILDDIR/",
1453);
1454
1455$Bccd->run_test(
1456    "rsync",
1457    "",
1458    "Copied test tree.",
1459    "$WORKSPACE/trees/home/",
1460    "$BUILDDIR/home/",
1461    "$WORKSPACE/bin/rsync_svn.exclude",
1462);
1463
1464$Bccd->run_test(
1465    "system",
1466    "",
1467    "chown'd $BUILDDIR/home/bccd to bccd:bccd",
1468    [
1469        '/usr/sbin/chroot',
1470        $BUILDDIR,
1471        'chown',
1472        '-R',
1473        "$USER:$USER",
1474        '/home/bccd',
1475    ],
1476);
1477
1478$Bccd->run_test(
1479    "chmod",
1480    "",
1481    "chmod 0600 $BUILDDIR/home/bccd/.mpd.conf",
1482    0600,
1483    "$BUILDDIR/home/bccd/.mpd.conf",
1484);
1485
1486$Bccd->run_test(
1487    "chmod",
1488    "",
1489    "chmod 0755 $BUILDDIR/root/.ssh/",
1490    0755,
1491    "$BUILDDIR/root/.ssh/",
1492);
1493
1494$Bccd->run_test(
1495    "chmod",
1496    "",
1497    "chmod 0755 $BUILDDIR/home/$USER/.ssh",
1498    0755,
1499    "$BUILDDIR/home/$USER/.ssh",
1500);
1501
1502$Bccd->run_test(
1503    "chmod",
1504    "",
1505    "chmod 0755 $BUILDDIR/home/$USER",
1506    0755,
1507    "$BUILDDIR/home/$USER",
1508);
1509
1510foreach my $file ( "$BUILDDIR/root/.ssh/bccd", "$BUILDDIR/root/.ssh/config" ) {
1511    $Bccd->run_test(
1512        "chmod",
1513        "",
1514        "chmod 0600 $file",
1515        0600,
1516        "$file",
1517    );
1518}
1519
1520foreach my $key ( <$BUILDDIR/etc/ssh/ssh*key*> ) {
1521    $Bccd->run_test(
1522        "unlink",
1523        "",
1524        "Removed ssh key $key.",
1525        "$key",
1526    );
1527}
1528
1529$Bccd->run_test(
1530    "system",
1531    "",
1532    "Fixing cstddef for openmpi.",
1533    [
1534        '/usr/bin/perl',
1535        '-wpli',
1536        '-e',
1537        's/#include_next/#include/g',
1538        "$BUILDDIR/usr/include/c++/4.3/cstddef",
1539    ],
1540);
1541
1542# Make us LIVE
1543
1544$Bccd->run_test(
1545    "fwrite",
1546    "",
1547    "Made us LIVE.",
1548    "w",
1549    "$BUILDDIR/etc/$PROJECT-stage",
1550    "LIVE",
1551);
1552
1553# Setting up menus
1554
1555foreach my $file (<$BUILDDIR/usr/share/menu/*>) {
1556    $Bccd->run_test(
1557        "unlink",
1558        "",
1559        "rm'd X menu item $file",
1560        "$file",
1561    );
1562}
1563
1564$cwd = getcwd();
1565
1566$Bccd->run_test(
1567    "chdir",
1568    "",
1569    "cd $BUILDDIR/",
1570    "$BUILDDIR/",
1571);
1572
1573$Bccd->run_test(
1574    "rsync",
1575    "",
1576    "Copied /usr items.",
1577    "$WORKSPACE/trees/usr/",
1578    "$BUILDDIR/usr/",
1579    "$WORKSPACE/bin/rsync_svn.exclude",
1580);
1581
1582$Bccd->run_test(
1583    "rsync",
1584    "",
1585    "Copied architecure-specific items for $opts{'ARCH'}.",
1586    "$WORKSPACE/trees/arch/$opts{'ARCH'}/",
1587    "$BUILDDIR/",
1588    "$WORKSPACE/bin/rsync_svn.exclude",
1589);
1590
1591$Bccd->run_test(
1592    "chdir",
1593    "",
1594    "Changed back to old directory.",
1595    "$cwd",
1596);
1597
1598$Bccd->run_test(
1599    "system",
1600    "",
1601    "Updated desktop menus.",
1602    [
1603        '/usr/sbin/chroot',
1604        $BUILDDIR,
1605        '/usr/bin/update-menus',
1606    ],
1607);
1608
1609# Software end
1610
1611# Pre-fetching liberation stuff
1612
1613$Bccd->run_test(
1614    "fcopy",
1615    "",
1616    "Copied BCCD splash screen.",
1617    "$WORKSPACE/packages/$SPLASH_FILE",
1618    "$BUILDDIR/$LIBFETCH/$SPLASH_FILE",
1619);
1620
1621$Bccd->run_test(
1622    "fcopy",
1623    "",
1624    "Fetched liberation exports file.",
1625    "$WORKSPACE/packages/etc/exports.liberate",
1626    "$BUILDDIR/$LIBFETCH/exports",
1627);
1628
1629$Bccd->run_test(
1630    "chdir",
1631    "",
1632    "cd'ing to $BUILDDIR/$LIBFETCH/.",
1633    "$BUILDDIR/$LIBFETCH",
1634);
1635
1636$Bccd->run_test(
1637    "system",
1638    "",
1639    "Tar'd up linux_aufs.",
1640    [
1641        '/bin/tar',
1642        '-C',
1643        $BUILDDIR,
1644        '-cjvf',
1645        "$BUILDDIR/$LIBFETCH/lib-linux.tar.bz2",
1646        'boot',
1647        'lib/modules',
1648        'var/lib/tftpboot',
1649    ],
1650);
1651
1652foreach my $file (grep(-f $_,
1653        (<$BUILDDIR/var/lib/apt/lists/*>, <$BUILDDIR/var/log/*>))) {
1654    $Bccd->run_test(
1655        "unlink",
1656        "",
1657        "Removed $file from file lists.",
1658        "$file",
1659    );
1660}
1661
1662$Bccd->run_test(
1663        "mkpath",
1664        "",
1665        "Adding empty /var/log",
1666        "$BUILDDIR/var/log",
1667);
1668
1669$Bccd->run_test(
1670        "mkpath",
1671        "",
1672        "Adding empty /var/log",
1673        "$BUILDDIR/var/log",
1674);
1675
1676$Bccd->run_test(
1677        "rmtree",
1678        "",
1679        "Removing docs to save space.",
1680        "$BUILDDIR/usr/share/doc",
1681);
1682
1683$Bccd->run_test(
1684        "system",
1685        "0",
1686        "Removed all fonts possible.",
1687    [
1688        '/usr/sbin/chroot',
1689        $BUILDDIR,
1690        '/sbin/bccd-rm-fonts',
1691    ],
1692);
1693
1694$Bccd->run_test(
1695    "rsync",
1696    "",
1697    "Copied diskless directory.",
1698    "$WORKSPACE/trees/diskless/",
1699    "$BUILDDIR/diskless/",
1700    "$WORKSPACE/bin/rsync_svn.exclude",
1701);
1702
1703$Bccd->run_test(
1704    "chdir",
1705    "",
1706    "Reverted to $cwd.",
1707    "$cwd",
1708);
1709
1710$Bccd->run_test(
1711    "fcopy",
1712    "",
1713    "Copied grub configs.",
1714    "$WORKSPACE/packages/boot/grub/grub.cfg",
1715    "$BUILDDIR/$LIBFETCH/grub.cfg",
1716);
1717
1718$Bccd->run_test(
1719    "fcopy",
1720    "",
1721    "Copied grub menu.",
1722    "$WORKSPACE/packages/boot/grub/menu.lst",
1723    "$BUILDDIR/$LIBFETCH/grub_menu.lst",
1724);
1725
1726$Bccd->run_test(
1727    "lsofkill",
1728    "",
1729    "Killing procs in $BUILDDIR: ",
1730    "$BUILDDIR",
1731);
1732
1733# Make here so automount doesn't destroy it
1734
1735$Bccd->run_test(
1736    "chdir",
1737    "",
1738    "cd'd to $tmpdir for Knoppix fetch.",
1739    "$tmpdir",
1740);
1741
1742$Bccd->run_test(
1743    "rsync",
1744    "",
1745    "Copied KNOPPIX sans root filesystem.",
1746    "$WORKSPACE/trees/KNOPPIX/",
1747    "$tmpdir/KNOPPIX/",
1748    "$WORKSPACE/bin/rsync_svn.exclude",
1749);
1750
1751$Bccd->run_test(
1752    "fcopy",
1753    "",
1754    "Copying Linux kernel into KNOPPIX image.",
1755    "$BUILDDIR/boot/vmlinuz-$KERNREV",
1756    "$tmpdir/KNOPPIX/boot/isolinux/linux",
1757);
1758
1759$Bccd->run_test(
1760        "system",
1761        "",
1762        "Making network initramfs.",
1763    [
1764        '/usr/sbin/chroot',
1765        $BUILDDIR,
1766        '/usr/sbin/mkinitramfs',
1767        '-d',
1768        '/etc/initramfs-tools.diskless',
1769        '-o',
1770        "/srv/tftp/initramfs-$KERNREV",
1771        $KERNREV,
1772    ],
1773);
1774
1775$Bccd->run_test(
1776    "fmove",
1777    "",
1778    "Renaming $BUILDDIR/srv/tftp/initramfs-$KERNREV to initramfs-$KERNREV.gz",
1779    "$BUILDDIR/srv/tftp/initramfs-$KERNREV",
1780    "$BUILDDIR/srv/tftp/initramfs-$KERNREV.gz",
1781);
1782
1783$Bccd->run_test(
1784    "system",
1785    "",
1786    "Uncompressing initramfs modules for KNOPPIX minirt.",
1787    [
1788        '/bin/gzip',
1789        '-d',
1790        "$BUILDDIR/srv/tftp/initramfs-$KERNREV.gz",
1791    ],
1792);
1793
1794$Bccd->run_test(
1795    "extract_cpio",
1796    "",
1797    "Unpacked initramfs modules for KNOPPIX minirt.",
1798    "lib/modules/$KERNREV/*",
1799    "$BUILDDIR/srv/tftp/initramfs-$KERNREV",
1800);
1801
1802$Bccd->run_test(
1803    "rename",
1804    "",
1805    "Moved initramfs modules into KNOPPIX minirt.",
1806    "$tmpdir/lib/modules/",
1807    "$tmpdir/KNOPPIX/boot/isolinux/minirt/modules",
1808);
1809
1810$Bccd->run_test(
1811        "unlink",
1812        "",
1813        "Removing temporary net initramfs.",
1814        "$BUILDDIR/srv/tftp/initramfs-$KERNREV",
1815);
1816
1817$Bccd->run_test(
1818    "system",
1819    "",
1820    "Unmounted $BUILDDIR/proc.",
1821    [
1822        '/bin/umount',
1823        '-l',
1824        "$BUILDDIR/proc",
1825    ],
1826);
1827
1828$Bccd->run_test(
1829    "system",
1830    "",
1831    "Unmounted $BUILDDIR/sys.",
1832    [
1833        '/bin/umount',
1834        '-l',
1835        "$BUILDDIR/sys",
1836    ],
1837);
1838
1839$Bccd->run_test(
1840        "fcopy",
1841        "",
1842        "Copied minirt device configuration.",
1843        "$WORKSPACE/packages/mknod.y",
1844        "$tmpdir/mknod.y",
1845);
1846
1847$Bccd->run_test(
1848        "mknods",
1849        "",
1850        "Created minirt device nodes.",
1851        "$tmpdir/mknod.y",
1852        "$tmpdir/KNOPPIX/boot/isolinux/minirt",
1853);
1854
1855$Bccd->run_test(
1856        "system",
1857        "",
1858        "Created minirt filesystem.",
1859    [
1860        '/bin/dd',
1861        'if=/dev/zero',
1862        "of=$tmpdir/minirt",
1863        'bs=1k',
1864        'count=20000',
1865    ],
1866);
1867
1868$Bccd->run_test(
1869        "system",
1870        "",
1871        "Made ext2 filesystem in minirt filesystem.",
1872    [
1873        '/sbin/mke2fs',
1874        '-F',
1875        "$tmpdir/minirt",
1876    ],
1877);
1878
1879$Bccd->run_test(
1880        "mkpath",
1881        "",
1882        "Made loop directory.",
1883        "$tmpdir/loop",
1884);
1885
1886$Bccd->run_test(
1887        "system",
1888        "",
1889        "Mounted minirt on loop directory.",
1890    [
1891        '/bin/mount',
1892        '-t',
1893        'ext2',
1894        '-o',
1895        'loop',
1896        "$tmpdir/minirt",
1897        "$tmpdir/loop",
1898    ],
1899);
1900
1901$Bccd->run_test(
1902        "system",
1903        "",
1904        "Copied minirt into loop filesystem.",
1905    [
1906        '/usr/bin/rsync',
1907        '-a',
1908        '--delete',
1909        "--exclude-from=$WORKSPACE/bin/rsync_svn.exclude",
1910        "$tmpdir/KNOPPIX/boot/isolinux/minirt/",
1911        "$tmpdir/loop/",
1912    ],
1913);
1914
1915$Bccd->run_test(
1916        "mkpath",
1917        "",
1918        "Made modules directory in loop filesystem.",
1919        "$tmpdir/loop/modules/",
1920);
1921
1922
1923$Bccd->run_test(
1924        "system",
1925        "",
1926        "Unmounted loop filesystem.",
1927    [
1928        '/bin/umount',
1929        "$tmpdir/loop/",
1930    ],
1931);
1932
1933$Bccd->run_test(
1934        "rmtree",
1935        "",
1936        "Removed minirt tree.",
1937        "$tmpdir/KNOPPIX/boot/isolinux/minirt/",
1938);
1939
1940$Bccd->run_test(
1941    "fcopy",
1942    "",
1943    "Copied minirt into $tmpdir/KNOPPIX/boot/isolinux",
1944    "$tmpdir/minirt",
1945    "$tmpdir/KNOPPIX/boot/isolinux/minirt",
1946);
1947
1948$Bccd->run_test(
1949        "system",
1950        "",
1951        "Compressed $tmpdir/KNOPPIX/boot/isolinux/minirt",
1952    [
1953        '/bin/gzip',
1954        "$tmpdir/KNOPPIX/boot/isolinux/minirt",
1955    ],
1956);
1957
1958$Bccd->run_test(
1959    "fcopy",
1960    "",
1961    "Copied background image.",
1962    "$WORKSPACE/packages/$SPLASH_FILE",
1963    "$tmpdir/$SPLASH_FILE",
1964);
1965
1966$Bccd->run_test(
1967    "system",
1968    "",
1969    "Creating isolinux splash image.",
1970    [
1971        "$WORKSPACE/bin/pngtolss16",
1972        '-i',
1973        "$tmpdir/$SPLASH_FILE",
1974        '-o',
1975        "$tmpdir/KNOPPIX/boot/isolinux/logo.16",
1976    ],
1977);
1978
1979$Bccd->run_test(
1980    "regexsub_file",
1981    "",
1982    "Adding version to KNOPPIX boot file.",
1983    "$tmpdir/KNOPPIX/boot/isolinux/boot.msg",
1984    "==REVISION==",
1985    "$release",
1986);
1987
1988$Bccd->run_test(
1989    "regexsub_file",
1990    "",
1991    "Adding date to KNOPPIX boot file.",
1992    "$tmpdir/KNOPPIX/boot/isolinux/boot.msg",
1993    "==DATE==",
1994    "$FORMAT_DATE",
1995);
1996
1997$Bccd->run_test(
1998        "fwrite",
1999        "",
2000        "Writing out date to /etc/$PROJECT-build-date.",
2001        "w",
2002        "$BUILDDIR/etc/$PROJECT-build-date",
2003        "$FORMAT_DATE",
2004);
2005
2006# Default host name will be node000
2007foreach my $file ( "mailname", "hostname", ) {
2008    $Bccd->run_test(
2009        "fwrite",
2010        "",
2011        "Writing out default hostname to $BUILDDIR/etc/$file",
2012        "w",
2013        "$BUILDDIR/etc/$file",
2014        "node000",
2015    );
2016}
2017
2018$Bccd->run_test(
2019        "rmtree",
2020        0,
2021        "Removing linux_aufs fetch for $BUILDDIR.",
2022        "$BUILDDIR/$opts{'ARCH'}",
2023);
2024
2025$Bccd->run_test(
2026    "chdir",
2027    "",
2028    "cd $tmpdir",
2029    $tmpdir,
2030);
2031
2032$Bccd->run_test(
2033    "system",
2034    "",
2035    "Created compressed root filesystem.",
2036    [
2037        '/usr/local/bin/mksquashfs',
2038        'build-bccd',
2039        "$tmpdir/KNOPPIX/KNOPPIX/KNOPPIX",
2040        '-comp',
2041        'xz',
2042    ],
2043);
2044
2045$Bccd->run_test(
2046    "system",
2047    "",
2048    "Created bootable ISO image at $OUTISO.",
2049    [
2050        '/usr/bin/genisoimage',
2051        '-pad',
2052        '-l',
2053        '-r',
2054        '-J',
2055        '-v',
2056        '-V',
2057        "BCCDv3-$svnrev",
2058        '-no-emul-boot',
2059        '-boot-load-size',
2060        '4',
2061        '-boot-info-table',
2062        '-b',
2063        'boot/isolinux/isolinux.bin',
2064        '-c',
2065        'boot/isolinux/boot.cat',
2066        '-hide-rr-moved',
2067        '-o',
2068        $OUTISO,
2069        "$tmpdir/KNOPPIX",
2070    ],
2071);
2072
2073$Bccd->run_test(
2074    'md5file',
2075    '',
2076    "Generated MD5 sum for $OUTISO at $OUTISO.md5",
2077    "$OUTISO",
2078    "$OUTISO.md5",
2079);
2080
2081print "Passed ".$Bccd->get_passed()." out of ".$Bccd->get_total()." total tests.\n";
2082
2083if($opts{'UPDATEDB'}) {
2084    my $dbh = open_db("$opts{'UPDATEDB'}");
2085    if( $Bccd->get_passed() < $Bccd->get_total() ) {
2086        insert_results($TESTNAME,$STAGE,$svnrev,$Bccd->snarf_file("$tmpdir/allout"),"FAILURE",$dbh);
2087    } else {
2088        insert_results($TESTNAME,$STAGE,$svnrev,$Bccd->snarf_file("$tmpdir/allout"),"SUCCESS",$dbh);
2089    }
2090    $Bccd->close_stdio();
2091    $dbh->disconnect;
2092}
2093
2094chdir $ENV{HOME};
2095
2096exit $Bccd->get_total()-$Bccd->get_passed();
2097
2098__END__
2099
2100build_livecd.pl - Build process based on Knoppix Live CD creation
2101
2102=head1 - SYNOPSIS
2103
2104This script is based on KNOPPIX project documentation for creating a
2105                #Test for running system commands
2106Debian-based Live CD using cloop.
2107
2108Set SVN_REVISION in the calling shell environment to the revision you
2109wish to build to.
2110
2111=head1 - OPTIONS
2112
2113=over 8
2114
2115=item B<--builddir> I<path-to-dir>
2116
2117Path to build directory for live CD. Will be cleaned up after the work is
2118done.
2119
2120=item B<--arch> I<arch>
2121
2122Architecture to build for.
2123
2124=item B<--outdor> I<path-to-dir>
2125
2126Where to output the bccd ISO image.
2127
2128=item B<--websvn> I<websvn-url>
2129
2130Path to bccd's websvn branch, i.e. http://cluster.earlham.edu/svn/bccd-ng/trunk.
2131
2132=item B<--suite> I<release-name>
2133
2134Name of the Debian release suite to download.
2135
2136=item B<--nocleanup>
2137
2138Preserve the /tmp directory for investigation.
2139
2140=item B<--help>
2141
2142This message.
2143
2144=cut
Note: See TracBrowser for help on using the repository browser.