debirf/0000755000000000000000000000000011667234136007210 5ustar debirf/COPYING0000644000000000000000000010550011667234136010244 0ustar Debirf is a tool for making images of DEBian on InitRamFs. It is free software, written by Jameson Rollins and Daniel Kahn Gillmor . Debirf 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. Debirf Copyright 2007-2011, and are all released under the GPL, version 3 or later. GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. 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. Copyright (C) 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 . 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: Copyright (C) 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 . 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 . debirf/doc/0000755000000000000000000000000011666457247007766 5ustar debirf/doc/README0000644000000000000000000000552211666457247010652 0ustar debirf is a system that will create diskless, all-in-ram images (kernel and initramfs) that boot entirely into ram and leaves the user in a fully functional Debian system. debirf has a modular architecture that allows users to easily customize the images that they build, using simple shell scripts, to do basically anything that Debian can do. Some included example "profiles" are: minimal: very minimal system with no extras, including no man pages or udev. - requires ~230M of disk space to build, and produces a ~47M initramfs. rescue: includes a full complement of system repair utilities,including mdadm, lvm2, testdisk, foremost, etc. - requires ~250M of disk space to build, and produces a ~51M initramfs. xkiosk: run a simple clean GUI interface for public-access web browsing. you can pass it the "browse=URL" boot parameter to specify a startup URL. - requires ~600M of disk space to build, and produces a ~127M initramfs. gzipped archives of these profiles are included with debirf in /usr/share/doc/debirf/example-profiles/. Each of these profiles includes a debirf.conf, and a modules directory that includes links to the various modules that the profile uses. Start by unpacking one of the example profiles. For example, to start working with the minimal profile in a debirf subdirectory of your homedir: $ mkdir ~/debirf $ cd ~/debirf $ tar xzf /usr/share/doc/debirf/example-profiles/minimal.tgz Before building, you can modify the debirf.conf as desired to specify alternate build locations (the profile directory itself is the default buildd), and which Debian mirror and distro to use (ala. debootstrap). Once you have your profile ready, build it with the debirf build script. Following the example above: $ cd ~/debirf $ debirf make minimal The debirf script creates the root filesystem for the new image using debootstrap, then uses the debirf modules to customize the root fs and prepare it for diskless booting. Finally the kernel is extracted, and the root fs is archived into an initramfs. The kernel and initramfs can be placed into a system boot partition, burnt to read-only media, or supplied by a netboot server. You can also create a burnable CD image from your profile. After making a minimal debirf profile (following the example above), convert it into an iso image by running: $ debirf makeiso minimal If this run is successful, there should be a bootable ISO image stored at ~/debirf/minimal/debirf-minimal.iso. You can burn this to a CD using a tool like wodim. Have fun! Create new modules and profiles for your specific needs. If you think your module or profile would be generally useful, please let us know and we'll include it with future versions of debirf. Also please let us know of any issues, bugs, or requests. debirf is a CMRG project: http://cmrg.fifthhorseman.net/wiki/debirf debirf@fifthhorseman.net debirf/doc/example-profiles/0000755000000000000000000000000012022451352013214 5ustar debirf/doc/example-profiles/rescue/0000755000000000000000000000000012022440651014502 5ustar debirf/doc/example-profiles/rescue/modules/0000755000000000000000000000000011542214026016153 5ustar debirf/doc/example-profiles/rescue/modules/serial-terminal0000777000000000000000000000000011542214026031073 2/usr/share/debirf/modules/serial-terminalustar debirf/doc/example-profiles/rescue/modules/rescue0000777000000000000000000000000011542214026025467 2/usr/share/debirf/modules/rescueustar debirf/doc/example-profiles/rescue/modules/network0000777000000000000000000000000011542214026026075 2/usr/share/debirf/modules/networkustar debirf/doc/example-profiles/rescue/modules/a0_add_security_repos0000777000000000000000000000000011542214026033431 2/usr/share/debirf/modules/a0_add_security_reposustar debirf/doc/example-profiles/rescue/modules/a0_motd0000777000000000000000000000000011542214026025561 2/usr/share/debirf/modules/a0_motdustar debirf/doc/example-profiles/rescue/modules/install-manpages0000777000000000000000000000000011542214026031411 2/usr/share/debirf/modules/install-manpagesustar debirf/doc/example-profiles/rescue/modules/bootlog0000777000000000000000000000000011542214026026025 2/usr/share/debirf/modules/bootlogustar debirf/doc/example-profiles/rescue/modules/z1_clean-root0000777000000000000000000000000011542214026030045 2/usr/share/debirf/modules/z1_clean-rootustar debirf/doc/example-profiles/rescue/modules/z0_remove-locales0000777000000000000000000000000011542214026031567 2/usr/share/debirf/modules/z0_remove-localesustar debirf/doc/example-profiles/rescue/modules/root-bashrc0000777000000000000000000000000011542214026027361 2/usr/share/debirf/modules/root-bashrcustar debirf/doc/example-profiles/rescue/modules/a0_prep-root0000777000000000000000000000000011542214026027531 2/usr/share/debirf/modules/a0_prep-rootustar debirf/doc/example-profiles/rescue/modules/a0_add_extra_repos0000777000000000000000000000000011542214026032161 2/usr/share/debirf/modules/a0_add_extra_reposustar debirf/doc/example-profiles/rescue/modules/install-kernel0000777000000000000000000000000011542214026030563 2/usr/share/debirf/modules/install-kernelustar debirf/doc/example-profiles/rescue/debirf.conf0000644000000000000000000000264712022440651016615 0ustar # DEBIRF configuration file: this will be sourced by bash # Label for debirf system (for hostname and initrd). "debirf" will be # used if unspecified. # DEBIRF_LABEL="debirf-rescue" # Where shoud debirf build the image? By default, debirf will build # in the profile directory. # #DEBIRF_BUILDD= # What suite should be used? The default is determined by # lsb_release, and falls back to "sid". # #DEBIRF_SUITE= # The default distro (eg. "debian" or "ubuntu") is based on the distro # of the suite specified. If you want to use a suite from a # non-Debian/Ubuntu distro, specify the distro explicitly here (all # lowercase). # #DEBIRF_DISTRO= # What mirror should debirf pull the suite from? By default, this is # based on the DEBIRF_DISTRO # (eg. "http://mirrors.kernel.org/${DEBIRF_DISTRO}"). # #DEBIRF_MIRROR= # What keyring should be used to verify the debootstrap for the # specified suite? This is also based on the DEBIRF_DISTRO by # default. If you are trying to build a non-Debian/Ubuntu version of # debirf, then you will need to specify the keyring explicitly here if # you want to verify the debootstrap. Otherwise, uncomment the # variable but leave the definition blank to have debirf skip the # debootstrap verification. # #DEBIRF_KEYRING= # Use a web proxy for downloading the packages (the "export" in front # of the variable is necessary to have it recognized by all internal # functions). # #export http_proxy= debirf/doc/example-profiles/minimal/0000755000000000000000000000000012022440651014642 5ustar debirf/doc/example-profiles/minimal/modules/0000755000000000000000000000000011667234136016327 5ustar debirf/doc/example-profiles/minimal/modules/serial-terminal0000777000000000000000000000000011542214026031233 2/usr/share/debirf/modules/serial-terminalustar debirf/doc/example-profiles/minimal/modules/network0000777000000000000000000000000011542214026026235 2/usr/share/debirf/modules/networkustar debirf/doc/example-profiles/minimal/modules/a0_motd0000777000000000000000000000000011542214026025721 2/usr/share/debirf/modules/a0_motdustar debirf/doc/example-profiles/minimal/modules/z1_clean-root0000777000000000000000000000000011542214026030205 2/usr/share/debirf/modules/z1_clean-rootustar debirf/doc/example-profiles/minimal/modules/z0_remove-locales0000777000000000000000000000000011542214026031727 2/usr/share/debirf/modules/z0_remove-localesustar debirf/doc/example-profiles/minimal/modules/root-bashrc0000777000000000000000000000000011542214026027521 2/usr/share/debirf/modules/root-bashrcustar debirf/doc/example-profiles/minimal/modules/a0_prep-root0000777000000000000000000000000011542214026027671 2/usr/share/debirf/modules/a0_prep-rootustar debirf/doc/example-profiles/minimal/modules/install-kernel0000777000000000000000000000000011542214026030723 2/usr/share/debirf/modules/install-kernelustar debirf/doc/example-profiles/minimal/debirf.conf0000644000000000000000000000265012022440651016747 0ustar # DEBIRF configuration file: this will be sourced by bash # Label for debirf system (for hostname and initrd). "debirf" will be # used if unspecified. # DEBIRF_LABEL="debirf-minimal" # Where shoud debirf build the image? By default, debirf will build # in the profile directory. # #DEBIRF_BUILDD= # What suite should be used? The default is determined by # lsb_release, and falls back to "sid". # #DEBIRF_SUITE= # The default distro (eg. "debian" or "ubuntu") is based on the distro # of the suite specified. If you want to use a suite from a # non-Debian/Ubuntu distro, specify the distro explicitly here (all # lowercase). # #DEBIRF_DISTRO= # What mirror should debirf pull the suite from? By default, this is # based on the DEBIRF_DISTRO # (eg. "http://mirrors.kernel.org/${DEBIRF_DISTRO}"). # #DEBIRF_MIRROR= # What keyring should be used to verify the debootstrap for the # specified suite? This is also based on the DEBIRF_DISTRO by # default. If you are trying to build a non-Debian/Ubuntu version of # debirf, then you will need to specify the keyring explicitly here if # you want to verify the debootstrap. Otherwise, uncomment the # variable but leave the definition blank to have debirf skip the # debootstrap verification. # #DEBIRF_KEYRING= # Use a web proxy for downloading the packages (the "export" in front # of the variable is necessary to have it recognized by all internal # functions). # #export http_proxy= debirf/doc/example-profiles/xkiosk/0000755000000000000000000000000012022440651014524 5ustar debirf/doc/example-profiles/xkiosk/modules/0000755000000000000000000000000011667234136016211 5ustar debirf/doc/example-profiles/xkiosk/modules/serial-terminal0000777000000000000000000000000011542214026031115 2/usr/share/debirf/modules/serial-terminalustar debirf/doc/example-profiles/xkiosk/modules/lock-root-passwd0000777000000000000000000000000011542545745031374 2/usr/share/debirf/modules/lock-root-passwdustar debirf/doc/example-profiles/xkiosk/modules/a0_add_security_repos0000777000000000000000000000000011542214026033453 2/usr/share/debirf/modules/a0_add_security_reposustar debirf/doc/example-profiles/xkiosk/modules/a0_motd0000777000000000000000000000000011542214026025603 2/usr/share/debirf/modules/a0_motdustar debirf/doc/example-profiles/xkiosk/modules/network-dhcp0000777000000000000000000000000011542214026027747 2/usr/share/debirf/modules/network-dhcpustar debirf/doc/example-profiles/xkiosk/modules/install-runit0000777000000000000000000000000011542214026030347 2/usr/share/debirf/modules/install-runitustar debirf/doc/example-profiles/xkiosk/modules/xkiosk0000777000000000000000000000000011542214026025555 2/usr/share/debirf/modules/xkioskustar debirf/doc/example-profiles/xkiosk/modules/z1_clean-root0000777000000000000000000000000011542214026030067 2/usr/share/debirf/modules/z1_clean-rootustar debirf/doc/example-profiles/xkiosk/modules/z0_remove-locales0000777000000000000000000000000011542214026031611 2/usr/share/debirf/modules/z0_remove-localesustar debirf/doc/example-profiles/xkiosk/modules/root-bashrc0000777000000000000000000000000011542214026027403 2/usr/share/debirf/modules/root-bashrcustar debirf/doc/example-profiles/xkiosk/modules/a0_prep-root0000777000000000000000000000000011542214026027553 2/usr/share/debirf/modules/a0_prep-rootustar debirf/doc/example-profiles/xkiosk/modules/a0_add_extra_repos0000777000000000000000000000000011542214026032203 2/usr/share/debirf/modules/a0_add_extra_reposustar debirf/doc/example-profiles/xkiosk/modules/install-kernel0000777000000000000000000000000011542214026030605 2/usr/share/debirf/modules/install-kernelustar debirf/doc/example-profiles/xkiosk/debirf.conf0000644000000000000000000000264712022440651016637 0ustar # DEBIRF configuration file: this will be sourced by bash # Label for debirf system (for hostname and initrd). "debirf" will be # used if unspecified. # DEBIRF_LABEL="debirf-xkiosk" # Where shoud debirf build the image? By default, debirf will build # in the profile directory. # #DEBIRF_BUILDD= # What suite should be used? The default is determined by # lsb_release, and falls back to "sid". # #DEBIRF_SUITE= # The default distro (eg. "debian" or "ubuntu") is based on the distro # of the suite specified. If you want to use a suite from a # non-Debian/Ubuntu distro, specify the distro explicitly here (all # lowercase). # #DEBIRF_DISTRO= # What mirror should debirf pull the suite from? By default, this is # based on the DEBIRF_DISTRO # (eg. "http://mirrors.kernel.org/${DEBIRF_DISTRO}"). # #DEBIRF_MIRROR= # What keyring should be used to verify the debootstrap for the # specified suite? This is also based on the DEBIRF_DISTRO by # default. If you are trying to build a non-Debian/Ubuntu version of # debirf, then you will need to specify the keyring explicitly here if # you want to verify the debootstrap. Otherwise, uncomment the # variable but leave the definition blank to have debirf skip the # debootstrap verification. # #DEBIRF_KEYRING= # Use a web proxy for downloading the packages (the "export" in front # of the variable is necessary to have it recognized by all internal # functions). # #export http_proxy= debirf/doc/autobuilder0000755000000000000000000000736511545211351012222 0ustar #!/bin/sh # automatically build each of the shipped example profiles, log the # build process, and create indexes and sha256sums of the whole deal. # NOTE: this will take long time, and consume a lot of disk space. i # advise pointing the http_proxy environment variable at a nearby # proxy. # Author: Daniel Kahn Gillmor # Copyright 2011, released under the GPL version 3 or later. PROFILE_LOC=/usr/share/doc/debirf/example-profiles DATE_NOW=$(date +%F) SUITES="stable unstable" ARCH="$(dpkg --print-architecture)" if ! dpkg -l grub-common syslinux-common xorriso >/dev/null ; then printf "Please install the missing packages to do a full debirf autobuild\n" >&2 exit 1 fi mkdir -p "profiles/$ARCH" "logs/$ARCH" errors=0 cat > "profiles/$ARCH/index.html" < debirf $ARCH autobuilt images ($DATE_NOW)

autobuilt $ARCH images for debirf

These $ARCH images were auto-generated on $DATE_NOW on $(hostname --fqdn) ($(uname -o)).

To download these images for your own use, you probably want either:

  • a kernel (vmlinu*) and
  • an initramfs (*.cgz)

or

  • a CD image (*.iso)

You almost certainly do not need all three files.

Please make sure to review the checksums after downloading.

EOF printf "# debirf %s autobuilt images (generated %s on %s)\n" "$ARCH" "$DATE_NOW" "$(hostname --fqdn)" > "profiles/$ARCH/sha256sums.txt" for DEBIRF_SUITE in $SUITES; do export DEBIRF_SUITE mkdir -p "profiles/$ARCH/$DEBIRF_SUITE" cat >> "profiles/$ARCH/index.html" <$DEBIRF_SUITE images
EOF for profile in $(cd "$PROFILE_LOC" && printf "%s " *.tgz); do profile=$(basename "$profile" .tgz) rm -rf "profiles/$ARCH/$DEBIRF_SUITE/$profile" tar xzf "$PROFILE_LOC"/${profile}.tgz -C "profiles/$ARCH/$DEBIRF_SUITE" if ! debirf make "profiles/$ARCH/$DEBIRF_SUITE/$profile" > "logs/${ARCH}/${DEBIRF_SUITE}-${profile}.log" 2>&1 ; then printf "Failed to make %s (%s)\n" "$profile" "$DEBIRF_SUITE" errors=$(( $errors + 1 )) else for bootloader in isolinux grub; do if ! DEBIRF_ISO_BOOTLOADER="$bootloader" debirf makeiso "profiles/$ARCH/$DEBIRF_SUITE/$profile" > "logs/${ARCH}/${DEBIRF_SUITE}-${profile}.iso-${bootloader}.log" 2>&1 ; then printf "Failed to makeiso[%s] %s (%s)\n" "$bootloader" "$profile" "$DEBIRF_SUITE" errors=$(( $errors + 1 )) fi done fi kernel= (cd "profiles/$ARCH" printf "
%s
    \n" "$DEBIRF_SUITE" "$profile" "$profile" >> index.html for file in \ "$DEBIRF_SUITE/$profile/vmlinu"* \ "$DEBIRF_SUITE/$profile/"*.cgz \ "$DEBIRF_SUITE/$profile/"*.iso do if [ -e "$file" ]; then printf "
  • %s (%siB)
  • \n" "$file" "$(basename "$file")" "$(du -h "$file" | cut -f1)" >> index.html sha256sum "$file" >> sha256sums.txt fi done printf "
\n" >>index.html ) done printf "
\n" >> "profiles/$ARCH/index.html" done printf "\n\n" >> "profiles/$ARCH/index.html" if [ "$errors" -gt 0 ]; then exit 1 fi debirf/man/0000755000000000000000000000000011542214026007747 5ustar debirf/man/man1/0000755000000000000000000000000012022443401010576 5ustar debirf/man/man1/debirf.10000644000000000000000000001530411667234136012137 0ustar .TH DEBIRF "1" "Dec 2011" "debirf 0.32" "User Commands" .SH NAME debirf \- build an initrd to boot a full Debian system entirely from RAM .SH SYNOPSIS .B debirf [options] [args] .SH DESCRIPTION .PP \fBdebirf\fP (DEBian on Initial Ram Filesystem) is a set of tools designed to create and prepare a kernel and initial ram filesystem that can run a full-blown Debian environment entirely from RAM. .PP \fBdebirf\fP has various subcommands (see \fBSUBCOMMANDS\fP) which act on a specified debirf profile (see \fBPROFILES\fP). .PP The debirf system is outlined at: .PP http://cmrg.fifthhorseman.net/wiki/debirf .PD .SH EXAMPLES .PP Make a stock debirf rescue image using the default settings: .nf $ tar xzf /usr/share/doc/debirf/example-profiles/rescue.tgz $ debirf make rescue .fi .PP Make a debirf rescue image, specifying the mirror and a local HTTP proxy: .nf $ tar xzf /usr/share/doc/debirf/example-profiles/rescue.tgz $ DEBIRF_MIRROR=http://ftp.debian.org/debian http_proxy=http://127.0.0.1:3128/ debirf make rescue .fi .SH SUBCOMMANDS \fBdebirf\fP takes various subcommands: .PD .TP .B make [options] PROFILE Create a debirf system based on profile PROFILE. This will create the root for the profile, run all modules on the root, and then generate the kernel image (see \fBKERNEL\fP) and debirf initramfs. This subcommand takes various options (see \fBOPTIONS\fP). .TP .B enter PROFILE Chroot into root of profile PROFILE, with full profile environment. .TP .B makeiso PROFILE Create a bootable CD-ROM image from the kernel and initramfs in PROFILE. This requires a bootloader to be available. If grub-mkrescue (in the grub-common package on debian) is available, it will be used. Otherwise, isolinux (from the syslinux-common package) is used if it is available. You may use the \fBDEBIRF_ISO_BOOTLOADER\fP environment variable to specify a preference manually (see below). .TP .B help Output a brief usage summary. .PD .SH OPTIONS (for make subcommand only) .PP .TP \fB\-c\fR, \fB\-\-check-vars\fR check variables before make .TP \fB\-n\fR, \fB\-\-new\fR create new root, even if old one exists .TP \fB\-o\fR, \fB\-\-overwrite\fR debootstrap on top of old root if it exists .TP \fB\-s\fR, \fB\-\-skip\fR skip debootstrap step altogether if old root exists .TP \fB\-r\fR, \fB\-\-root-build\fR use real chroot to build instead of fakechroot (requires superuser privileges or CAP_SYS_CHROOT) .TP \fB\-w\fR, \fB\-\-no-warning\fR skip superuser warning .TP \fB\-i\fR, \fB\-\-initrd-only\fR remake initramfs from existing root (skip debootstrap and module stages) .TP \fB\-k\fR, \fB\-\-kernel-deb=KERNEL\fR install KERNEL .deb, instead of default kernel .PD .SH PROFILES .PP A debirf profile is a directory containing a debirf.conf config file and a modules sub-directory (see \fBMODULES\fP). .PD .SH MODULES .PP \fBModules\fP are used to configure the debirf system, and can be used to extend the capabilities of debirf. Modules are bash shell scripts that are executed in alpha-numeric order by \fBrun-parts\fP in a chroot in the debirf root during the module stage of the debirf build. The module stage is right after the debirf debootstrap stage, and right before the initramfs archive is created. All shell variables beginning with "DEBIRF_", including those defined in the \fIdebirf.conf\fP file, are available to the modules. .PP \fBNOTE:\fP Some modules are more important to the proper functioning of debirf than others, and the ordering of modules is important. Some modules may depend on certain other modules having already been, or not yet been, run. For instance, the module that cleans the debirf apt cache ("z1_clean_root") should be the last module run at the end of the module stage. .PD .SH KERNEL .PP The \fBdebirf\fP "install-kernel" module will try to pick the most up-to-date kernel for the suite you are installing (versions 2.6 only), with the arch determined by the kernel running on the host build system. .PP .SH FUNCTIONS .PP A set of pre-defined bash shell functions are available to the modules to fasciliate configuring the debirf system: .PD 1 .TP .B debirf_exec Execute within debirf root (\fBDEBIRF_ROOT\fP) with chroot. .TP .B msg Output a message to standard out during the build process. .TP .B failure Cause debirf script to fail with , and to stderr. .TP .B debirf_info_sh Write one line of sh code to the \fIdebirf.info\fP file on the debirf root. .TP .B debirf_info_comment Write one line of comment to the \fIdebirf.info\fP file on the debirf root. .RE .PD .SH ENVIRONMENT .PP The following environment variables are used by debirf: .PD 1 .TP .B DEBIRF_LABEL debirf label (default: debirf) .TP .B DEBIRF_BUILDD where to build the debirf (default: ./) .TP .B DEBIRF_ARCH architecture to build (default is the architecture of the build machine) .TP .B DEBIRF_SUITE suite to build from (default determined from lsb_release, otherwise "sid") .TP .B DEBIRF_DISTRO distro for suite (default determined from lsb_release, otherwise "debian") .TP .B DEBIRF_MIRROR mirror to pull suite (default determined by DEBIRF_DISTRO) .TP .B DEBIRF_KEYRING keyring to verify debootstrap (default determined by DEBIRF_DISTRO) .TP .B DEBIRF_KERNEL_FLAVOR the flavor of kernel debirf should install. Supply everything from a typical debian package name after the version number. e.g. 486, vserver-686-bigmem, openvz-amd64. (default chosen based on currently-running kernel) .TP .B DEBIRF_ISO_BOOTLOADER whether to use "grub" or "isolinux" as the El Torito bootloader for \fBdebirf makeiso\fR. if not specified, "grub" is the default. .PD .SH FILES .PD 1 .TP $DEBIRF_PROFILE/debirf.conf Debirf profile configuration file. Contains values for the various debirf environment variables (see \fBENVIRONMENT\fP). Variables specified in the debirf.conf override those specified on the command line. .TP $DEBIRF_ROOT/etc/debirf/debirf.info File that stores various information about the debirf build. This is a bash-sourceable file. .PD .SH AUTHOR Written by Jameson Rollins and Daniel Kahn Gillmor. .SH "BUGS" Debirf does not work as a non-privileged user across different versions of libc. . In particular, this means that you probably won't be able to build an image from a different version of the operating system than you're using without building as root. .PP Please report bugs in debirf via the debian BTS: http://bugs.debian.org/ .SH COPYRIGHT Copyright \(co 2007-2011 Jameson Rollins and Daniel Kahn Gillmor .br This is free software. You may redistribute copies of it under the terms of the GNU General Public License . There is NO WARRANTY, to the extent permitted by law. .SH "SEE ALSO" .BR /usr/share/doc/debirf/README, .BR debootstrap (8), .BR fakechroot (1) debirf/Makefile0000755000000000000000000000261411542256253010652 0ustar #!/usr/bin/make -f # Makefile for debirf # (c) 2008-2011 Jameson Graef Rollins # Daniel Kahn Gillmor # Licensed under GPL v3 or later VERSION := `head -n1 debian/changelog | sed 's/.*(\([^-]*\).*/\1/'` PREFIX ?= /usr MANPREFIX ?= $(PREFIX)/share/man PROFILES = doc/example-profiles/minimal.tgz doc/example-profiles/rescue.tgz doc/example-profiles/xkiosk.tgz default: $(PROFILES) doc/example-profiles/%.tgz: doc/example-profiles/% (cd doc/example-profiles && tar c --exclude='*~' $(notdir $<)) | gzip -9 -n > "$@" install: installman profiles mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/share/doc/debirf/example-profiles mkdir -p $(DESTDIR)$(PREFIX)/share/debirf/modules install src/debirf $(DESTDIR)$(PREFIX)/bin install src/common $(DESTDIR)$(PREFIX)/share/debirf install --mode=644 src/devices.tar.gz $(DESTDIR)$(PREFIX)/share/debirf install src/modules/* $(DESTDIR)$(PREFIX)/share/debirf/modules install doc/README $(DESTDIR)$(PREFIX)/share/doc/debirf install doc/autobuilder $(DESTDIR)$(PREFIX)/share/doc/debirf install doc/example-profiles/*.tgz $(DESTDIR)$(PREFIX)/share/doc/debirf/example-profiles installman: mkdir -p $(DESTDIR)$(MANPREFIX)/man1 gzip -n man/*/* install man/man1/* $(DESTDIR)$(MANPREFIX)/man1 gzip -d man/*/* clean: rm -f $(PROFILES) .PHONY: default install installman profiles clean debirf/debian/0000755000000000000000000000000012022451352010415 5ustar debirf/debian/rules0000755000000000000000000000003511542214156011500 0ustar #!/usr/bin/make -f %: dh $@ debirf/debian/control0000644000000000000000000000236112022443260012021 0ustar Source: debirf Section: admin Priority: extra Maintainer: Jameson Graef Rollins Uploaders: Daniel Kahn Gillmor Build-Depends: debhelper (>= 7.0) Standards-Version: 3.9.3 Homepage: http://cmrg.fifthhorseman.net/wiki/debirf Vcs-Git: git://finestructure.net/debirf Dm-Upload-Allowed: yes Package: debirf Architecture: all Depends: debootstrap, cpio, apt, fakeroot, fakechroot, klibc-utils, ${misc:Depends} Recommends: lsb-release, xorriso, grub-common (>= 1.98+20100804) | syslinux-common Description: build a kernel and initrd to run Debian from RAM debirf (DEBian on Initial Ram Filesystem) is a set of tools designed to create and prepare a kernel and initial ram filesystem that can run a full-blown Debian environment entirely from RAM. . The kernel and initramfs pair created by debirf can be used for a myriad of purposes, from quick-and-easy system repair to diskless thin clients. The kernel and initrd can be placed in your system boot partition, burnt to read-only media, or supplied by a netboot server. . The debirf tools use a module architecture which allows you to customize debirf for any possible purpose by specifying what components are included in the generated image. debirf/debian/changelog0000644000000000000000000004154012022451264012275 0ustar debirf (0.33) unstable; urgency=low [ Jameson Rollins ] * fix comments about default suite in example config files. Thanks, Simon Elsbrock! (Closes: #656138) [ Matt Taggart ] * ddrescue was dropped in favor of gddrescue (Closes: #685138) [ Daniel Kahn Gillmor ] * removed scsitools from rescue module due to maintainer script breakage under fakechroot (see #686881) * work around flakey insserv under debootstrap --variant=fakechroot (see #686965) * the above two changes suffice to: (Closes: #655555) * debian/changelog: bumped Standards-Version to 3.9.3 (no changes needed) * only provisionally install smp-utils, since it was introduced in wheezy. -- Daniel Kahn Gillmor Fri, 07 Sep 2012 16:01:51 -0400 debirf (0.32) unstable; urgency=low [ Daniel Kahn Gillmor ] * make rootfs mode 0755 (Closes: #622808) * add several good packages for rescue module (Closes: #644576) Thanks, Matt Taggart! * updated debian/copyright to latest DEP5 spec * Standards-Version: 3.9.2 (no changes needed) [ Jameson Graef Rollins ] * remove dependency on busybox * fix builds for sid/sid and stable/stable (cross builds are still not working, unfortunately) * remove aptitude from image * other minor bug fixes -- Jameson Graef Rollins Sun, 27 Nov 2011 12:32:59 -0800 debirf (0.31) unstable; urgency=low * update autobuilder to generate index and checksums and be explicit about what architecture it is building. * modules/rescue: select u-boot-tools preferentially if available in the requested distro. * modules/rescue: adding screen and bonnie++ * modules/serial-terminal: automate selection of serial port and bit rate for getty based on kernel params. * fix pack_rootfs() (Closes: #620323) -- Daniel Kahn Gillmor Tue, 05 Apr 2011 23:08:59 -0400 debirf (0.30) unstable; urgency=low * Fix silly error in install-runit module (should fix xkiosk) * root-passwd module is now lock-root-passwd (avoids operator interaction) -- Daniel Kahn Gillmor Thu, 24 Mar 2011 00:08:11 -0400 debirf (0.29) unstable; urgency=low [ Daniel Kahn Gillmor ] * Switch to native packaging. * mknod without absolute paths to work around #611156 (Closes: #618260) * added grub2 to the rescue image (Closes: #596708) (might need to change if the grub2 dummy package goes away) * relying on grub2's better implementation of terminal choosing (Closes: #606425) * do not add security repositories for sid/unstable (Closes: #619331) * use xorriso instead of genisoimage [ Jameson Rollins ] * clear TMPDIR when working in chroot * add scrub and wipe to rescue image -- Jameson Graef Rollins Tue, 22 Mar 2011 19:11:36 -0700 debirf (0.28-1) UNRELEASED; urgency=low * New Upstream Release: - enable passing kernel architecture. Thanks, Guido Günther! (Closes: #570778) * Bumped Standards-Version to 3.9.1 (no changes needed) -- Jameson Graef Rollins Fri, 05 Nov 2010 11:11:28 -0400 debirf (0.27-1) unstable; urgency=low * New Upstream Release: - grub-mkrescue has changed, and is now arch-indep. adjust makeiso to match. - fix buggy selection of kernel and initramfs during makeiso. - use DEBIRF_ISO_BOOTLOADER instead of DEBIRF_ELTORITO, making way for other possible bootloaders (yaboot?) for makeiso subcommand. - add security repositories for rescue and xkiosk - enable extra repos to allow karmic rescue to work (closes CMRG: #108) - don't require partimage for rescue image on ubuntu, since it is not available on amd64 there (see LP 198724) * Bumped Standards-Version to 3.8.4 (no changes needed) * included revision number in debian/copyright for DEP5 -- Daniel Kahn Gillmor Wed, 17 Feb 2010 01:39:34 -0500 debirf (0.26-1) unstable; urgency=low * add cpio to deboostrap INCLUDE -- Jameson Graef Rollins Wed, 09 Dec 2009 12:16:20 -0500 debirf (0.25-1) unstable; urgency=low * use busybox cpio in nest now that's it's been fixed (closes CMRG: #54) * remove no longer needed install-udev module (udev installed by default) * improve grub menu configuration (Closes: #544409) * updated README, and makeiso checking (Closes: #554020) * ubuntu debirf installs now default to Karmic Koala. * redirect log out to stderr * use more generic kernel package name to find kernel name (LP: #474739) * formalize Debian copyright file -- Jameson Graef Rollins Sun, 29 Nov 2009 21:41:13 -0500 debirf (0.24-1) unstable; urgency=low * "absolutize" BUILDD path to get around bug in getcwd in fakechroot (#548691) * update makeiso to use grub-mkrescue from the grub2 grub-pc package. support for using isolinux from the syslinux-common package is also now included (Closes: #548712). * bumped standards version to 3.8.3 (no changes needed). * explicitly delete root passwd -- Jameson Graef Rollins Wed, 30 Sep 2009 09:24:14 +0200 debirf (0.23-1) unstable; urgency=low [ Daniel Kahn Gillmor ] * updated my e-mail address * added ntfsprogs, fatresize, tofrodos, dosfstools to the rescue module to help recover Windows filesystems with debirf. * added hfsprogs, hfsutils, hfsplus to the rescue module to help recover MacOS filesystems with debirf. * added e2undel, recover, e2tools, reiserfstools to the rescue module to help recover Linux filesystems with debirf. * added parted to rescue module for dealing with various kinds of partition tables. * fixed broken sed expression in nest library search (thanks, Guido Günther) (Closes: #509381) * bumped policy to 3.8.1 (no changes needed). -- Daniel Kahn Gillmor Tue, 16 Jun 2009 13:34:05 -0400 debirf (0.22-1) unstable; urgency=low [ Daniel Kahn Gillmor ] * fixed nest on 64-bit architectures (Closes: #509381). [ Jameson Graef Rollins ] * add DEBIRF_ARCH variable to allow for specifying different architecture than default (thanks to Gary Kramlich for patch). * fix initramfs determination in makeiso (thanks again Gary Kramlich). -- Jameson Graef Rollins Sat, 20 Dec 2008 15:21:34 -0500 debirf (0.21-1) unstable; urgency=low [ Daniel Kahn Gillmor ] * fixing makeiso image name generation * placing serial-console boot stanza in menu.lst for ISO * debian/control: swapped Maintainer and Uploader, updated my e-mail address. * xkiosk uses modern runit controls instead of explicitly symlinking servicedirs [ Jameson Graef Rollins ] * canonicalize paths in makeiso function * strip tailing slashes off of profile names to avoid weird problems with fakechroot when entering a debirf profile. * fix kernel arch determination. * change shebang line for all modules that call debirf_exec to /bin/bash, so they will work properly when /bin/sh is not /bin/bash. this also includes changes to enter subcommand to compensate (closes CMRG #99) (Closes: #508041). * add -e to all module shebang lines as well, so all errors are properly caught. * fix path in fakeroot_if_needed to not include $PATH, to bypass problems with the path of the calling user. * have setup_environment handle setup of DEBIRF_PROFILE variable. -- Jameson Graef Rollins Tue, 09 Dec 2008 17:35:12 -0500 debirf (0.20-1) unstable; urgency=low * new upstream packaging/build system. all-inclusive makefile, and simplified debhelper rules. -- Jameson Graef Rollins Tue, 04 Nov 2008 15:30:13 -0500 debirf (0.19-3) unstable; urgency=low * update debhelper version, and remove unused debhelper scripts. * add more info to 0.19-2 changelog entry. * fix Uploader info (email address). -- Jameson Graef Rollins Thu, 30 Oct 2008 00:00:27 -0400 debirf (0.19-2) unstable; urgency=low * closes ITP bug with wnpp (Closes: #503625) -- Jameson Graef Rollins Mon, 27 Oct 2008 21:30:28 -0400 debirf (0.19-1) unstable; urgency=low * use genisoimage, instead of the now-obsolete mkisofs, to make iso's, and fixed some small bugs in iso generation. * update standards version to 3.8.0. * add cryptsetup to resuce module. -- Jameson Graef Rollins Mon, 27 Oct 2008 16:12:50 -0400 debirf (0.18-2) unstable; urgency=low * change Depends: to allow for busybox-static. -- Jameson Rollins Sun, 30 Mar 2008 12:50:29 -0400 debirf (0.18-1) unstable; urgency=low * fix shebang in a0_prep-root to call bash instead of sh, because of bashism in script. * add DEBIRF_KEYRING variable to debirf.conf files. * change DISTRO to SUITE (closes CMRG #89) * go back to default dhcp client (dhcp3-client instead of udhcpd) (closes CMRG #88) * smarter determination of default suite, distro, mirror, and keyring. better defaults for Ubuntu (closes CMRG #87) * change to smarter option setting for debootstrap in the create_debootstrap function that actually works now (works for files with spaces in them). -- Jameson Rollins Fri, 07 Mar 2008 17:19:22 -0500 debirf (0.17-1) unstable; urgency=low * actually release really stupid bugs in getopt code associated with gpg debootstrap verification. * edited README to align with new debirf verbs, and to make the examples more concrete. * made error messages a bit friendlier. * gpg verification of debootstrap can now use relative paths. -- Daniel Kahn Gillmor Thu, 28 Feb 2008 19:00:29 -0500 debirf (0.16-1) unstable; urgency=low * have xkiosk module purge session on restart (closes CMRG #83) * added partimage to rescue module * new "makeiso" subcommand to build a bootable CD-ROM image, at least on i386 and amd64 architectures. (closes CMRG #63) * set up cryptographic verification of the debootstrap step. -- Daniel Kahn Gillmor Wed, 30 Jan 2008 18:29:06 -0500 debirf (0.15-1) unstable; urgency=low * fixed problem with stale fakeroot state files (close CMRG #81) -- Jameson Rollins Tue, 15 Jan 2008 11:34:24 -0500 debirf (0.14-1) unstable; urgency=low * changed name of main build script to 'debirf' from 'make-debirf' * added subcommand architecture (make, enter, help) (closes CMRG #65) * and "enter" subcommand to enter root (closes CMRG #73) * removed separate specification of debirf root directory * added install-manpages module (no longer installing manpages by default) * pruned more unnecessary packages from make * remove build-debirf-kernel, since no longer needed * improved install-kernel module to only download need kernel package (closes CMRG #67) * move bootstap.log to $DEBIRF_BUILDD/.bootstrap.log * set debconf frontend to Noninteractive in prep-root module * now handling break={top,preunpack,bottom} kernel parameters in nest (closes CMRG #55) * new install-runit module, jumps through hoops to overcome limitations of runit postinst script (closes CMRG #71) * added "no-initrd" option to make subcommand * added "network-dhcp" module to automatically bring up nic dhcp (added it to dependency list of xkiosk module) (closes CMRG #78) * changed old "networking" module to "network" * added root-passwd module, and added it to xkiosk profile. * added Vcs-Svn, Vcs-Browser, and XS-Dm-Upload-Allowed fields to debian/control * make xkiosk back off if there are 5 restarts in under a minute (closes CMRG #74) * remove PCI device ID from default xorg.conf (autodetection seems to work better) -- Jameson Rollins Sun, 13 Jan 2008 22:01:57 -0500 debirf (0.13-1) unstable; urgency=low * example profiles are now tgz archives (closes CMRG #46) * added new full devices.tar.gz to create fuller device tree, therefore not requiring the install-udev module (closes CMRG #60) * transition to non-native packaging (closes CMRG #26) * added exit-on-error to modules install run-parts * removed old useless create_initrd functions * fixed path problem for fakeroot_if_needed * add more info to select when root exists -- Jameson Rollins Wed, 09 Jan 2008 18:46:02 -0500 debirf (0.12) unstable; urgency=low * change name of "plugins" to "modules". hopefully this will elliminate at least my uneasyness about the requirement of some of the modules. this will require people to rename their existing "plugins" directories to be "modules". * re-added prep-root module * expanded info in debirf.conf on image, includes debirf version (ticket #21) -- Jameson Rollins Fri, 21 Dec 2007 17:21:22 -0500 debirf (0.11) unstable; urgency=low * finally, working fakechroot/non-privileged build method! superuser privileges no longer required (and are in fact now discouraged) * udev is now required for non-pirvileged builds to function, though. * make tmpfs 10G by default * prune some unneeded packages (cron, logrotate, ed, tcpd, tasksel) -- Jameson Rollins Thu, 20 Dec 2007 09:17:02 -0500 debirf (0.10) unstable; urgency=low * moved all files to GPLv3 (closes CMRG #50) * simplify kernel installation. now will accept deb as command line parameter, or make-debirf will just figure out the kernel itself (closes CMRG #48) * updated man page -- Jameson Rollins Tue, 11 Dec 2007 15:31:22 -0500 debirf (0.9) unstable; urgency=low * added DEBIRF_KERNEL_PACKAGE to debirf.conf * added more informative error message when profile is malformed. -- Jameson Rollins Mon, 10 Dec 2007 17:52:43 -0500 debirf (0.8) unstable; urgency=low * simplified profile checking. * fixed/cleaned-up install-kernel plugin to extract kernel rather than install (ticket #49). * added install-udev plugin. -- Jameson Rollins Mon, 10 Dec 2007 12:12:04 -0500 debirf (0.7) unstable; urgency=low * added ability to just create initramfs from pre-build root. -- Jameson Rollins Mon, 03 Dec 2007 23:13:34 -0500 debirf (0.6) unstable; urgency=low * new create_initrd_nested build function, boots debirf into tmpfs, which is cleaner and more stable and is now the default. * added ability to run make-debirf with fakechroot ('-f' option). there are problems creating the device tree with this method, though, so it is still underdevelopment. * modified debootstrap, plugin run-parts, and debirf_exec to also use fakechroot * being root *should* no longer be necessary to make-debirf, therefore make-debirf has been moved to /usr/bin/ * debirf can now function in rootfs with stock debian kernels (as of 2.6.22) * removed /var/lib/debirf * removed /etc/debirf in favor of doc/example-profiles * added xkiosk plugin to start X session with browser on startup * added xkiosk profile * added getopt for command line argument checking * added command line arguments to skip some checking/user interaction * can now pass kernel package name to make-debirf, instead of just deb, although proper package checking is not fully working -- Jameson Rollins Mon, 03 Dec 2007 00:40:46 -0500 debirf (0.5) unstable; urgency=low * fixed old broken references to DEBIAN_PATH environment variable * fix apt-get-disk-rescue plugin to stop mdadm daemon after install (was preventing /proc from being unmounted) * tweaked install-kernel plugin * mknod /dev/ttyS0 in serial-terminal plugin * moved profiles directory to /etc/debirf/profiles * added 'minimal' profile -- Jameson Rollins Mon, 05 Nov 2007 00:53:26 -0500 debirf (0.4) unstable; urgency=low * added more options when existing DEBIRF_ROOT found * fixed bug about where initrd is written (closes CMRG #16) * added new profiles structure, with default pre-configured "disk-rescue" profile * added motd plugin -- Jameson Rollins Fri, 11 May 2007 00:21:10 -0400 debirf (0.3) unstable; urgency=low * simplified plugin infrastructure (only single plugin directory now) * updated man pages * added license information to all files -- Jameson Rollins Sat, 24 Mar 2007 16:29:49 -0400 debirf (0.2) unstable; urgency=low * added kernel-package, fakeroot, and linux-patch-inittmpfs to Recommends: to encourage use of build-debirf-kernel -- Daniel Kahn Gillmor Thu, 15 Mar 2007 03:17:36 -0400 debirf (0.1) unstable; urgency=low * initial debian packaging -- Daniel Kahn Gillmor Thu, 15 Mar 2007 00:58:17 -0400 debirf/debian/debirf.docs0000644000000000000000000000001311542214156012521 0ustar doc/README debirf/debian/copyright0000644000000000000000000000141111667234136012362 0ustar Upstream-Name: debirf Format: http://anonscm.debian.org/viewvc/dep/web/deps/dep5.mdwn?view=markup&pathrev=208 Source: http://cmrg.fifthhorseman.net/wiki/debirf Upstream-Contact: debirf developers Files: * Copyright: Copyright 2007-2011 Jameson Rollins , Daniel Kahn Gillmor , License: GPL-3+ License: GPL-3+ This package 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. . On Debian systems, the complete text of the GNU General Public License version 3 can be found in file "/usr/share/common-licenses/GPL-3". debirf/debian/compat0000644000000000000000000000000211542214156011620 0ustar 7 debirf/debian/NEWS0000644000000000000000000000062211542214156011121 0ustar debirf (0.24-1) unstable; urgency=low * Due to incompatibilities between squeeze and lenny, it is currently not possible to build a lenny debirf image on a squeeze or newer system. Squeeze is now the default distro for debirf images. For more info, see: http://cmrg.fifthhorseman.net/ticket/105 -- Jameson Graef Rollins Tue, 29 Sep 2009 18:03:27 +0200 debirf/debian/source/0000755000000000000000000000000011542216222011716 5ustar debirf/debian/source/format0000644000000000000000000000001511542216051013125 0ustar 3.0 (native) debirf/debian/gbp.conf0000644000000000000000000000005211542267052012041 0ustar [DEFAULT] debian-tag = debirf/%(version)s debirf/src/0000755000000000000000000000000012022440651007762 5ustar debirf/src/devices.tar.gz0000644000000000000000000000345611542214026012544 0ustar (Gdevices.tar]rFSk.I> e@-o>sژ`ֺI [kQN4TA|] ןߪ6sJUպaQ9׫S O\#5&kjm9Eſ}CM&3f~&ދlOQ_C?~~DpHU_ZMa}kOM:V' o?x/λWweo.J[W *OOO_! X+d+ſMjLgP_!]9"O/[p;RoZ2B?kc9?+}gDRoh3cq;)Wj_'BJ 3B?g!E1 #`\c(H/ Xki]5 ?'a@__A5wcb1_&i/4IO1?bA{3`yzLmہ#-_ν3/h\#?[*#e+*G_ݩ\#ƻcr=?$LO rs] ՠ4SQ5=$D_-k8jW3m{?1GZ'-G5k5Pܣ,[v_l~6lk!Jo(ix׈AӨ1 o,߬HicW?EXSL?P?V5S^;?W;iO;?@}`oNK"E)RH"E)RH rdebirf/src/common0000755000000000000000000000354311667234136011222 0ustar #!/bin/bash # pre-defined common functions for the debirf script. # this file is sourced after the debirf.conf file, # which defines most of the shell variables # # The debirf scripts were written by # Jameson Graef Rollins # and # Daniel Kahn Gillmor . # # They are Copyright 2007-2011, and are all released under the GPL, # version 3 or later. ############################################################### ### VARIABLES # set locale default export LC_CTYPE="C" export LC_ALL="C" export LANGUAGE="C" export LANG="C" ############################################################### # cause debirf to exit immediately with message and exit code # failure message failure() { echo "$@" >&2 exit ${2:-'1'} } export -f failure # output debirf message to stdout msg() { echo "debirf> $@" >&2 } export -f msg fakeroot_if_needed() { if [ "$ROOT_BUILD" = 'true' ] ; then "$@" else if [ ! -e "$DEBIRF_FAKEROOT_STATE" ] ; then failure "Debirf fakeroot state file '$DEBIRF_FAKEROOT_STATE' does not exist." fi # set up $PATH and $HOME as though we are superuser HOME=/root PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin fakeroot -i "$DEBIRF_FAKEROOT_STATE" -s "$DEBIRF_FAKEROOT_STATE" "$@" fi } export -f fakeroot_if_needed # execute command in debirf system using chroot debirf_exec() { if [ "$ROOT_BUILD" = 'true' ] ; then TMPDIR= chroot "$DEBIRF_ROOT" "$@" else TMPDIR= fakechroot chroot "$DEBIRF_ROOT" "$@" fi } export -f debirf_exec # write comment to debirf.info file debirf_info_comment() { echo "$@" | sed 's|^\(.\)|\# \1|' >> "${DEBIRF_ROOT}/etc/debirf/debirf.info" } export -f debirf_info_comment # write command to debirf.info file debirf_info_sh() { echo "$@" >> "${DEBIRF_ROOT}/etc/debirf/debirf.info" } export -f debirf_info_sh debirf/src/modules/0000755000000000000000000000000012022450707011435 5ustar debirf/src/modules/serial-terminal0000755000000000000000000000265211667234136014472 0ustar #!/bin/bash -e # debirf module: serial-terminal # add serial terminal # # The debirf scripts were written by # Jameson Rollins # and # Daniel Kahn Gillmor . # # They are Copyright 2007,2011, and are all released under the GPL, # version 3 or later. INITTAB="$DEBIRF_ROOT/etc/inittab" SCRIPTED_GETTY="/usr/local/sbin/debirf-console-getty" cat >>"${DEBIRF_ROOT}${SCRIPTED_GETTY}" <<'EOF' #!/bin/sh # find the first serial console kernel parameter and place a getty there: for param in $(cat /proc/cmdline); do if printf "%s" "$param" | egrep -q '^console=ttyS[0-9]+,[0-9]+n8$'; then port="$(printf "%s" "$param" | cut -f2 -d= | cut -f1 -d,)" speed="$(printf "%s" "$param" | cut -f2 -d, | cut -f1 -dn)" exec /sbin/getty -L "$port" "$speed" fi done # did not find a kernel serial console; default to /dev/ttyS0 115200 exec /sbin/getty -L ttyS0 115200 EOF chmod a+x "${DEBIRF_ROOT}${SCRIPTED_GETTY}" debirf_exec chown root:root "${SCRIPTED_GETTY}" # make sure the basic serial devices are present debirf_exec mknod dev/ttyS0 c 4 64 debirf_exec mknod dev/ttyS1 c 4 65 debirf_exec mknod dev/ttyS2 c 4 66 debirf_exec mknod dev/ttyS3 c 4 67 if grep "$SCRIPTED_GETTY" "$INITTAB" | grep -q -v "^[[:space:]]*#" ; then echo "inittab already has a getty on the console." else cat <> "$INITTAB" # debirf: added serial console login prompt: T0:23:respawn:$SCRIPTED_GETTY EOF fi debirf/src/modules/lock-root-passwd0000755000000000000000000000062011542537657014611 0ustar #!/bin/bash -e # debirf module: root-passwd # lock password for root # # The debirf scripts were written by # Jameson Rollins # and # Daniel Kahn Gillmor . # # They are Copyright 2007-2011, and are all released under the GPL, # version 3 or later. echo "Locking out $DEBIRF_LABEL superuser from password-based access:" debirf_exec passwd -l root debirf/src/modules/rescue0000755000000000000000000000424112022450707012652 0ustar #!/bin/bash -e # debirf module: rescue # remove/install extra packages for disk rescue with apt-get # # The debirf scripts were written by # Jameson Rollins # and # Daniel Kahn Gillmor . # # They are Copyright 2007-2011, and are all released under the GPL, # version 3 or later. # preseed. helpful link: # http://blog.hjksolutions.com/articles/category/solutions debirf_exec debconf-set-selections < # and # Daniel Kahn Gillmor . # # They are Copyright 2007-2011, and are all released under the GPL, # version 3 or later. # reset default udev persistent-net rule rm -f "${DEBIRF_ROOT}"/etc/udev/rules.d/*_persistent-net.rules # write /etc/network/interfaces cat < "${DEBIRF_ROOT}/etc/network/interfaces" # Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or # /usr/share/doc/ifupdown/examples for more information. auto lo iface lo inet loopback # a default dynamic ethernet address. # if you have eth0, you can use this with "ifup eth0=dhcp" iface dhcp inet dhcp EOF # reset /etc/resolv.conf > "${DEBIRF_ROOT}/etc/resolv.conf" # add network note to /etc/motd.tail cat <> "${DEBIRF_ROOT}/etc/motd.tail" If you have a network interface (ie. "eth0"), you can bring it up with: ifup eth0=dhcp (you can list available network interfaces with 'ifconfig -a') ================================================== EOF debirf/src/modules/a0_add_security_repos0000644000000000000000000000177511666462146015656 0ustar #!/bin/sh -e # debirf module: add_security_repos # # add security repositories # # The debirf scripts were written by # Jameson Rollins # and # Daniel Kahn Gillmor . # # This script is Copyright 2010 and is released under the GPL, # version 3 or later. mkdir -p "${DEBIRF_ROOT}/etc/apt/sources.list.d" case "${DEBIRF_DISTRO}" in debian) case "$DEBIRF_SUITE" in sid|unstable) echo "not adding security repository for sid/unstable" ;; *) cat < "${DEBIRF_ROOT}/etc/apt/sources.list.d/security_repos.list" deb http://security.debian.org/ ${DEBIRF_SUITE}/updates main contrib non-free EOF ;; esac ;; ubuntu) cat < "${DEBIRF_ROOT}/etc/apt/sources.list.d/security_repos.list" deb http://security.ubuntu.com/ubuntu ${DEBIRF_SUITE}-security main restricted universe multiverse EOF ;; esac ## nothing to do for other distros. debirf/src/modules/a0_motd0000755000000000000000000000137611666462154012731 0ustar #!/bin/sh -e # debirf module: motd # custom /etc/motd.tail file # # The debirf scripts were written by # Jameson Rollins # and # Daniel Kahn Gillmor . # # They are Copyright 2007, and are all released under the GPL, # version 3 or later. cat < "${DEBIRF_ROOT}/etc/motd.tail" ================================================== Welcome to debirf: DEBian on InitRamFs The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. ================================================== EOF debirf/src/modules/network-dhcp0000755000000000000000000000123411542214026013766 0ustar #!/bin/sh -e # debirf module: network-dhcp # setup network interface to automatically come up with dhcp # # The debirf scripts were written by # Jameson Rollins # and # Daniel Kahn Gillmor . # # They are Copyright 2007, and are all released under the GPL, # version 3 or later. # reset default udev persistent-net rule rm -f "${DEBIRF_ROOT}"/etc/udev/rules.d/*_persistent-net.rules ### configure network to come up automatically cat < "${DEBIRF_ROOT}/etc/network/interfaces" auto lo iface lo inet loopback auto eth0=dhcp iface dhcp inet dhcp EOF # reset /etc/resolv.conf > "${DEBIRF_ROOT}/etc/resolv.conf" debirf/src/modules/install-runit0000755000000000000000000000324411542536657014212 0ustar #!/bin/bash -e # debirf module: install-runit # Set up the runit package supervisory process. # # The debirf scripts were written by # Jameson Rollins # and # Daniel Kahn Gillmor . # # Copyright 2008, and are all released under the GPL, version 3 or # later. ## The runit debian postinst script expects to be run as the real ## superuser, and to be able to signal PID 1 to trigger a reread of ## /etc/inittab. ## ## Under debootstrap, that behavior is not desirable, because the the ## PID 1 that gets signalled is not actually reading the ## newly-modified etc/inittab inside the debootstrap. ## ## Under fakeroot, that signal is actually impossible, since PID 1 is ## owned by the real superuser. ## ## since debirf is a fakerooted debootstrapped environment, we have to ## jump through the hoops below, suggested by Gerrit Pape at: ## http://bugs.debian.org/306390#msg32 fix_and_retry_runit_installation() { echo "install-runit: attempting to repair runit installation." # get rid of the kill -s HUP 1 line in runit postinst local postinst="$DEBIRF_ROOT"/var/lib/dpkg/info/runit.postinst mv "$postinst" "$postinst".orig <"$postinst".orig sed 's/kill -s HUP 1/: kill -s HUP 1/' >"$postinst" rm "$postinst".orig # remove the busted extra lines from inittab: local inittab="$DEBIRF_ROOT"/etc/inittab mv "$inittab" "$inittab".orig <"$inittab".orig grep -v '^#-- runit' | grep -v '^SV:' >"$inittab" rm "$inittab".orig # complete the aborted configuration process debirf_exec dpkg --configure runit } debirf_exec apt-get --assume-yes install runit || \ fix_and_retry_runit_installation debirf/src/modules/install-manpages0000755000000000000000000000052311542214026014620 0ustar #!/bin/bash -e # debirf module: install-manpages # # The debirf scripts were written by # Jameson Rollins # and # Daniel Kahn Gillmor . # # They are Copyright 2007, and are all released under the GPL, # version 3 or later. debirf_exec apt-get --assume-yes install man-db manpages info debirf/src/modules/xkiosk0000755000000000000000000000661211542214026012676 0ustar #!/bin/bash -e # debirf module: xkiosk # create an graphical kiosk that starts x and a browser on boot. # # Depends: network-dhcp module, install-runit module # # The debirf scripts were written by # Jameson Rollins # and # Daniel Kahn Gillmor . # # They are Copyright 2007, and are all released under the GPL, # version 3 or later. ### download needed packages # could maybe pick and choose xorg packages if hardware known #debirf_exec apt-get install --assume-yes --no-install-recommends xserver-xorg xinit matchbox-window-manager xauth xfonts-base udev iceweasel debirf_exec apt-get install --assume-yes --no-install-recommends xserver-xorg xinit matchbox-window-manager xauth xfonts-base udev arora ### properly configure X # allow any user to start X (not just from command line): # ("debirf_exec dpkg-reconfigure x11-common") cat < "$DEBIRF_ROOT"/etc/X11/Xwrapper.config allowed_users=anybody nice_value=0 EOF ### add guest user if ! debirf_exec getent passwd guest >/dev/null 2>/dev/null ; then debirf_exec adduser --disabled-password --gecos "Kiosk User,,," guest fi ### configure runit service dir to start X session RUNIT_DIR=/srv/xkiosk RUNIT_DIR_DEBIRF="${DEBIRF_ROOT}/${RUNIT_DIR}" mkdir -p "$RUNIT_DIR_DEBIRF"/{env,log/main} debirf_exec chown guest:guest "$RUNIT_DIR"/log/main echo guest > "$RUNIT_DIR_DEBIRF"/env/UID echo guest > "$RUNIT_DIR_DEBIRF"/env/GID echo /home/guest > "$RUNIT_DIR_DEBIRF"/env/HOME # creat run script cat <<'EOF' > "$RUNIT_DIR_DEBIRF"/run #!/bin/sh exec 2>&1 # only allow 5 attempts at starting up X each minute. This gives # debirf admins a chance to fix from the console if there's repeated # failing invocations of the X server (see # http://cmrg.fifthhorseman.net/ticket/74) BUCKETDIR=./bucket mkdir -p "$BUCKETDIR" find "$BUCKETDIR" -type f '!' -cmin 1 -delete if [ $(find "$BUCKETDIR" -type f | wc -l ) -ge 5 ]; then echo "5 or more retries in the last minute. Waiting a minute..." sleep 60 fi touch "$BUCKETDIR"/$(date +%s) exec chpst -u guest:guest:audio:video -e env /usr/bin/startx EOF debirf_exec chmod a+x "$RUNIT_DIR"/run # create finish script cat <<'EOF' > "$RUNIT_DIR_DEBIRF"/finish #!/bin/sh rm -rf ~guest cp -r /etc/skel ~guest chown -R guest:guest ~guest EOF debirf_exec chmod a+x "$RUNIT_DIR"/finish # create log run script cat < "$RUNIT_DIR_DEBIRF"/log/run #!/bin/sh exec chpst -u guest svlogd -tt ./main EOF debirf_exec chmod a+x "$RUNIT_DIR"/log/run # link in service dir debirf_exec update-service --add "$RUNIT_DIR" ### make system xinitrc cat < "$DEBIRF_ROOT"/etc/X11/xinit/xinitrc #!/bin/sh matchbox-window-manager & TARG=file://$RUNIT_DIR/index.html if (grep -q 'browse=' "$RUNIT_DIR_DEBIRF"/index.html debirf - xkiosk

Welcome to debirf xkiosk.

To restart the session and purge all session history, just quit the browser by doing one of the following:

  • Select "Quit" from the "File" menu.
  • Close all open windows by clicking the x in the upper right corner.
EOF debirf/src/modules/bootlog0000755000000000000000000000060211542214026013024 0ustar #!/bin/sh -e # debirf module: bootlog # configure bootlog # # The debirf scripts were written by # Jameson Rollins # and # Daniel Kahn Gillmor . # # They are Copyright 2007, and are all released under the GPL, # version 3 or later. cat < "$DEBIRF_ROOT"/etc/default/bootlogd # Run bootlogd at startup ? BOOTLOGD_ENABLE=Yes EOF debirf/src/modules/z1_clean-root0000755000000000000000000000153311667234136014054 0ustar #!/bin/bash -e # debirf module: clean-root # clean up debirf root # # *** REQUIRED MODULE *** # WARNING: this module is necessary for proper functioning of debirf. # # The debirf scripts were written by # Jameson Rollins # and # Daniel Kahn Gillmor . # # They are Copyright 2007, and are all released under the GPL, # version 3 or later. # remove all cached apt information debirf_exec apt-get --assume-yes --purge autoremove debirf_exec apt-get clean rm -f "$DEBIRF_ROOT/var/cache/apt/"*.bin rm -rf "$DEBIRF_ROOT/var/lib/apt/lists/"* mkdir "$DEBIRF_ROOT/var/lib/apt/lists/partial" # remake proc directory # (originally made as symlink by debootstrap with fakechroot) rm -rf "$DEBIRF_ROOT/proc" mkdir "$DEBIRF_ROOT/proc" # setup dynamically updated /etc/mtab ln -sf /proc/mounts "$DEBIRF_ROOT/etc/mtab" debirf/src/modules/z0_remove-locales0000755000000000000000000000060011542214026014703 0ustar #!/bin/sh -e # debirf module: remove-locales # # The debirf scripts were written by # Jameson Rollins # and # Daniel Kahn Gillmor . # # They are Copyright 2007, and are all released under the GPL, # version 3 or later. cd "$DEBIRF_ROOT" find usr/share/locale -maxdepth 1 -mindepth 1 -type d ! -iname 'en*' -execdir rm -rf '{}' \+ debirf/src/modules/root-bashrc0000755000000000000000000000135611542214026013611 0ustar #!/bin/sh -e # debirf module: root-bashrc # create default root .bashrc # # The debirf scripts were written by # Jameson Rollins # and # Daniel Kahn Gillmor . # # They are Copyright 2007, and are all released under the GPL, # version 3 or later. cat < "$DEBIRF_ROOT"/root/.bashrc # ~/.bashrc: executed by bash(1) for non-login shells. export PS1='\$? \h:\w\\$ ' umask 022 # You may uncomment the following lines if you want 'ls' to be colorized: export LS_OPTIONS='--color=auto' eval "\$(dircolors)" alias ls='ls \$LS_OPTIONS' alias ll='ls \$LS_OPTIONS -l' alias l='ls \$LS_OPTIONS -lA' # # Some more alias to avoid making mistakes: alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' EOF debirf/src/modules/a0_prep-root0000755000000000000000000000356512022435553013705 0ustar #!/bin/bash -e # debirf module: prep-root # prep the debirf root with various needed files and info # # *** REQUIRED MODULE *** # WARNING: this module is necessary for proper functioning of debirf. # # The debirf scripts were written by # Jameson Rollins # and # Daniel Kahn Gillmor . # # They are Copyright 2007-2011, and are all released under the GPL, # version 3 or later. # output info to the debirf.info file on the initramfs mkdir -p "${DEBIRF_ROOT}/etc/debirf" cat < "${DEBIRF_ROOT}/etc/debirf/debirf.info" # debirf.info # # $DEBIRF_LABEL # # debirf version: $(dpkg-query --show debirf | awk '{ print $2 }') # build host: $(hostname -f) # build arch: $(dpkg --print-architecture) # build date: $(date -R) # the following config variables were set during build: EOF for var in ${!DEBIRF_*}; do debirf_info_sh "${var}=${!var}" done # initialize /etc/fstab echo proc /proc proc defaults 0 0 > "${DEBIRF_ROOT}/etc/fstab" # write /etc/hostname echo "$DEBIRF_LABEL" > "${DEBIRF_ROOT}/etc/hostname" # write /etc/hosts cat < "${DEBIRF_ROOT}/etc/hosts" 127.0.0.1 localhost 127.0.1.1 $DEBIRF_LABEL # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts EOF # purge root password debirf_exec passwd -d root # set debconf to noninteractive debirf_exec debconf-set-selections < # and # Daniel Kahn Gillmor . # # This script is Copyright 2010 and is released under the GPL, # version 3 or later. mkdir -p "${DEBIRF_ROOT}/etc/apt/sources.list.d" case "${DEBIRF_DISTRO}" in debian) cat < "${DEBIRF_ROOT}/etc/apt/sources.list.d/extra_repos.list" deb ${DEBIRF_MIRROR} ${DEBIRF_SUITE} non-free contrib EOF ;; ubuntu) cat < "${DEBIRF_ROOT}/etc/apt/sources.list.d/extra_repos.list" deb ${DEBIRF_MIRROR} ${DEBIRF_SUITE} universe multiverse restricted EOF ;; esac ## nothing to do for other distros. debirf/src/modules/install-kernel0000755000000000000000000000467311667234136014333 0ustar #!/bin/bash -e # debirf module: install-kernel # install a kernel package, indicated by the expected environment # variables: # DEBIRF_PATH # DEBIRF_ROOT # DEBIRF_KERNEL_PACKAGE # DEBIRF_KERNEL_FLAVOR # # *** REQUIRED MODULE *** # WARNING: this module is necessary for proper functioning of debirf. # # The debirf scripts were written by # Jameson Rollins # and # Daniel Kahn Gillmor . # # They are Copyright 2007, and are all released under the GPL, # version 3 or later. # clear out old modules if they exist, to avoid confusion rm -rf "$DEBIRF_ROOT/lib/modules" # download/copy in kernel package if [ -z "$DEBIRF_KERNEL_PACKAGE" ] ; then # determine kernel to install. assume arch of build host. # determine kernel arch. need everything after the kernel version # and debian version KARCH=${DEBIRF_KERNEL_FLAVOR:-$(uname -r | cut -d- -f3-)} # determine the full kernel version from the dependency of the # generic linux-image-ARCH package in the debirf root (since it # may be different than what is installed on the build host) KNAME=$(debirf_exec apt-cache show linux-image-"$KARCH" | grep '^Depends: ' | sed 's/^Depends: //' | tr ',' '\n' | tr -d ' ' | grep ^linux-image | sort -r | head -n1) # download only the desired kernel package for later dpkg # extraction. this also downloads the kernel dependencies, but # they will not be installed, and the downloaded packages will all # be purged in the end by the clean-root module. it would be nice # to just use "apt-get download", but that's only supported since # wheezy. debirf_exec apt-get install -d -y "$KNAME" else # install kernel deb if given at command line cp "$DEBIRF_KERNEL_PACKAGE" "$DEBIRF_ROOT"/var/cache/apt/archives/ fi KPKG=$(basename "$DEBIRF_ROOT"/var/cache/apt/archives/linux-image-*) echo "extracting kernel package $KPKG..." debirf_exec dpkg --extract /var/cache/apt/archives/"$KPKG" / # install the module init tools, since they are needed for depmod debirf_exec apt-get --assume-yes install module-init-tools # depmod to create module list KVERS=$(ls -1 -t "$DEBIRF_ROOT/lib/modules" | head -n1) echo "generating modules.dep..." debirf_exec depmod -a "$KVERS" # extract kernel and debian stock initrd from the build root: mv "$DEBIRF_ROOT"/boot/vmlinu* "$DEBIRF_BUILDD" # remove kernel symlinks if [ -L "$DEBIRF_ROOT"/vmlinuz ] ; then rm "$DEBIRF_BUILDD"/vmlinuz fi debirf/src/debirf0000755000000000000000000004462412022440651011155 0ustar #!/bin/bash -e # debirf: script to build debirf system. # # The debirf scripts were written by # Jameson Graef Rollins # and # Daniel Kahn Gillmor . # # They are Copyright 2007-2011, and are all released under the GPL, # version 3 or later. ############################################################### ### VARIABLES CMD=$(basename $0) DEBIRF_COMMON=${DEBIRF_COMMON:-/usr/share/debirf/common} source "$DEBIRF_COMMON" # default label DEBIRF_LABEL=${DEBIRF_LABEL:-debirf} # default debirf boot method DEBIRF_METHOD=${DEBIRF_METHOD:-nested} # default build type export ROOT_BUILD=false # stages to run by default STAGE_ROOT=${STAGE_ROOT:-true} STAGE_MODULES=${STAGE_MODULES:-true} STAGE_INITRD=${STAGE_INITRD:-true} # warn if running as root ROOT_WARNING=true # location of devices.tar.gz file export DEVICE_ARCHIVE=${DEVICE_ARCHIVE:-/usr/share/debirf/devices.tar.gz} # list of packages to include in debootstrap export INCLUDE=\ busybox-static,\ gpgv,\ less # list of packages to exclude from debootstrap export EXCLUDE=\ apt-utils,\ bsdmainutils,\ cron,\ ed,\ info,\ logrotate,\ man-db,\ manpages,\ tasksel,\ tasksel-data,\ tcpd,\ traceroute ############################################################### ### FUNCTIONS usage() { cat < [options] [args] Debirf system tool. subcommands: make [options] PROFILE build debirf kernel and initramfs -c|--check-vars check variables before make -n|--new create new root, even if old one exists -o|--overwrite debootstrap on top of old root if it exists -s|--skip skip debootstrap step if old root exists -r|--root-build use real chroot to build instead of fakechroot (requires superuser privileges or CAP_SYS_CHROOT) -w|--no-warning skip superuser warning when using -r -d|--no-initrd do not make initramfs -i|--initrd-only just remake initramfs from existing root -k|--kernel=KERNEL install KERNEL .deb, instead of default kernel enter PROFILE [CMDS] enter shell in debirf root (or execute CMDS) makeiso PROFILE create a bootable ISO using the given profile help this help EOF } usage_profile() { cat < "$1" } export -f pack_rootfs # initrd method: stupid simple # takes path to initrd as first input create_initrd_stupid_simple() { fakeroot_if_needed ln -sf /sbin/init "$DEBIRF_ROOT/init" pack_rootfs "$1" } # initrd method: nested cpio archives # takes path to initrd as first input create_initrd_nested() { local util lib local INITRD="$1" local NEST_ROOT="$DEBIRF_BUILDD"/nest # make the nested root rm -rf "$NEST_ROOT" mkdir -p "$NEST_ROOT"/{bin,lib} # copy in busybox-static from root, and link executables cp -f "$DEBIRF_ROOT"/bin/busybox "$NEST_ROOT"/bin/ for util in awk cpio free grep gunzip ls mkdir mount rm sh umount ; do ln "$NEST_ROOT"/bin/busybox "$NEST_ROOT"/bin/"$util" done # copy in run-init and needed libraries cp -f /usr/lib/klibc/bin/run-init "$NEST_ROOT"/bin/ cp -f /lib/klibc-* "$NEST_ROOT"/lib/ # symlink /lib64 if that is done on host # FIXME: is this necessary? if [ -L /lib64 ] && [ $(readlink /lib64) = /lib ] ; then ln -s /lib "$NEST_ROOT"/lib64 fi # create nest init cat > "$NEST_ROOT"/init < ./dev/console EOF chmod a+x "$NEST_ROOT"/init msg "creating rootfs.cgz..." fakeroot_if_needed ln -sf /sbin/init "$DEBIRF_ROOT/init" pack_rootfs "$NEST_ROOT"/rootfs.cgz msg "creating wrapper cgz..." fakeroot_if_needed sh -c "cd $NEST_ROOT && find * | cpio --create -H newc" | gzip -9 > "$INITRD" } # determine what the host system distro is, and set debirf build defaults # accordingly set_distro() { local distro local suite if type lsb_release &>/dev/null ; then distro=$(lsb_release --id --short) suite=$(lsb_release --codename --short) else distro="debian" suite="sid" fi distro=${distro,,} suite=${suite,,} DEBIRF_DISTRO=${DEBIRF_DISTRO:-$distro} DEBIRF_SUITE=${DEBIRF_SUITE:-$suite} DEBIRF_MIRROR=${DEBIRF_MIRROR:-"http://mirrors.kernel.org/${DEBIRF_DISTRO}"} DEBIRF_KEYRING=${DEBIRF_KEYRING:-"/usr/share/keyrings/${DEBIRF_DISTRO}-archive-keyring.gpg"} if ! [ -f "$DEBIRF_KEYRING" -a -r "$DEBIRF_KEYRING" ] ; then failure "Cannot read keyring '$DEBIRF_KEYRING' for debootstrap verification." fi } # setup profile environment setup_environment() { # get the debirf profile path # FIXME: should we canonicalize DEBIRF_PROFILE to an absolute # path? DEBIRF_PROFILE=${1%%/} DEBIRF_PROFILE_NAME=$(cd "$DEBIRF_PROFILE" && basename $(pwd)) # check profile if [ -d "$DEBIRF_PROFILE" ] ; then msg "loading profile '$DEBIRF_PROFILE_NAME'..." DEBIRF_CONF="$DEBIRF_PROFILE/debirf.conf" DEBIRF_MODULES="$DEBIRF_PROFILE/modules" else failure "Profile '$DEBIRF_PROFILE' not found." fi # source profile debirf.conf if [ -f "$DEBIRF_CONF" ] ; then source "$DEBIRF_CONF" else echo "Configuration file '$DEBIRF_CONF' not found." usage_profile exit 1 fi # check modules directory if [ ! -d "$DEBIRF_MODULES" ] || [ -z "$(ls "$DEBIRF_MODULES")" ] ; then echo "Modules directory '$DEBIRF_MODULES' does not exist or is empty." usage_profile exit 1 fi for MODULE in $(find "$DEBIRF_MODULES") ; do if [ ! -s "$MODULE" ] ; then failure "Module '$MODULE' is a broken link or empty file." fi done # set/check buildd DEBIRF_BUILDD=${DEBIRF_BUILDD:-"$DEBIRF_PROFILE"} if [ ! -d "$DEBIRF_BUILDD" ] ; then failure "Could not find build directory '$DEBIRF_BUILDD'." fi # "absolutize" the buildd path # This is needed because of trouble with fakechroot (see # http://bugs.debian.org/548691) DEBIRF_BUILDD=$(cd "$DEBIRF_BUILDD" && pwd) # set root directory DEBIRF_ROOT="$DEBIRF_BUILDD/root" # set fakechroot save file DEBIRF_FAKEROOT_STATE="$DEBIRF_BUILDD/.fakeroot-state.${DEBIRF_LABEL}" # set the debirf distro variables based on host distro set_distro # export all the DEBIRF_* environment variables: for var in ${!DEBIRF_*}; do if [ $var ] ; then export $var else failure "Variable '$var' not properly set." fi done # check variables if [ "$CHECK_VARS" ] ; then msg "debirf variables:" env | /bin/grep "^DEBIRF_" read -p "enter to continue: " OK fi } # make profile make() { # option parsing TEMP=$(getopt --options -hcnosrwdik: --longoptions help,check-vars,new,overwrite,skip,root-build,no-warning,no-initrd,initrd-only,kernel: -n "$CMD" -- "$@") if [ $? != 0 ] ; then echo "Invalid options." >&2 usage exit 1 fi # Note the quotes around `$TEMP': they are essential! eval set -- "$TEMP" while true ; do case "$1" in -c|--check-vars) CHECK_VARS=true shift 1 ;; -n|--new) WRITE_MODE=rewrite shift 1 ;; -o|--overwrite) WRITE_MODE=overwrite shift 1 ;; -s|--skip) WRITE_MODE=skip shift 1 ;; -r|--root-build) ROOT_BUILD=true shift 1 ;; -w|--no-warning) ROOT_WARNING=false shift 1 ;; -d|--no-initrd) STAGE_INITRD=false shift 1 ;; -i|--initrd-only) STAGE_ROOT=false STAGE_MODULES=false shift 1 ;; -k|--kernel) DEBIRF_KERNEL_PACKAGE="$2" shift 2 ;; --) shift ;; *) if (( $# < 1 )) ; then echo "Improper number of input arguments." usage exit 1 fi break ;; esac done if [ $(id -u) = '0' ] ; then cat < "$DEBIRF_FAKEROOT_STATE" create_debootstrap ;; 'rewrite') msg "clearing old debirf root..." rm -rf "$DEBIRF_ROOT" msg "creating debirf root..." > "$DEBIRF_FAKEROOT_STATE" create_debootstrap ;; 'overwrite') msg "overwriting old debirf root..." create_debootstrap ;; 'skip') msg "skipping debootstrap..." ;; *) failure "aborting." ;; esac # fix the dev tree if running as non-priv user (fakechroot debootstrap) fix_dev else msg "not building root" fi ### END BUILD ROOT ### RUN MODULES if [ "$STAGE_MODULES" = 'true' ] ; then msg "executing modules..." run_modules msg "modules complete" else msg "not running modules" fi ### END RUN MODULES ### BUILD INITRD if [ "$STAGE_INITRD" = 'true' ] ; then if [ ! -d "$DEBIRF_ROOT" ] ; then failure "Debirf root '$DEBIRF_ROOT' not found." fi # determine initramfs name local KERNEL_VERS=$(ls -1 "${DEBIRF_ROOT}/lib/modules" | head -n1) local INITRD="${DEBIRF_LABEL}_${DEBIRF_SUITE}_${KERNEL_VERS}.cgz" msg "creating debirf initrd ('$DEBIRF_METHOD')..." create_initrd_${DEBIRF_METHOD} "${DEBIRF_BUILDD}/${INITRD}" # final output local KERNEL=$(ls "$DEBIRF_BUILDD" | grep "vmlinu" | grep "$KERNEL_VERS$") msg "debirf initrd created." if [ "${DEBIRF_BUILDD}/${KERNEL}" ] ; then msg "kernel: ${DEBIRF_BUILDD}/${KERNEL}" fi msg "initrd: ${DEBIRF_BUILDD}/${INITRD}" else msg "not creating initramfs." fi ### END BUILD INITRD } # enter profile root enter() { setup_environment "$1" shift if [ "$1" ] ; then fakeroot_if_needed bash -c ". $DEBIRF_COMMON && debirf_exec $@" else fakeroot_if_needed bash -c ". $DEBIRF_COMMON && debirf_exec bash -i" fi } # create an ISO from the given kernel and initramfs (requires GRUB, # see: # http://www.gnu.org/software/grub/manual/html_node/Making-a-GRUB-bootable-CD-ROM.html) makeiso() { setup_environment "$1" shift [ -d "$DEBIRF_PROFILE" ] || failure "'$DEBIRF_PROFILE' does not seem to be a directory" # find kernel case $(cd "${DEBIRF_BUILDD}" && ls -1 | grep -c '^vmlinu.*$') in 0) failure "Failed to find a kernel. Maybe you need to run 'debirf make $DEBIRF_PROFILE' first?" ;; 1) msg "kernel found." local KERNEL=${KERNEL:-$(cd "${DEBIRF_BUILDD}" && ls -1 vmlinu*)} ;; *) failure "Multiple kernels found. Please clear out all but the desired kernel." ;; esac # find initramfs case $(cd "${DEBIRF_BUILDD}" && ls -1 | grep -c "^${DEBIRF_LABEL}"'_.*\.cgz$') in 0) failure "Failed to find a single initramfs. Maybe you need to run 'debirf make $DEBIRF_PROFILE' first?" ;; 1) msg "initramfs found." local INITRAMFS=${INITRAMFS:-$(cd "${DEBIRF_BUILDD}" && ls -1 "${DEBIRF_LABEL}"_*.cgz)} ;; *) failure "Multiple initramfs found. Please clear out all but the desired initramfs." ;; esac # determine which eltorito boot loader we're using if [ -z "$DEBIRF_ISO_BOOTLOADER" ] ; then if which grub-mkrescue >/dev/null ; then local DEBIRF_ISO_BOOTLOADER=grub elif [ -f /usr/lib/syslinux/isolinux.bin ] ; then local DEBIRF_ISO_BOOTLOADER=isolinux else failure "Suitable El Torito boot loader not found. Please install syslinux-common or grub-pc." fi fi msg "creating debirf iso..." # determine the iso name from the initramfs local ISO=$(basename "$INITRAMFS" .cgz).iso # create clean iso directory local ISODIR="${DEBIRF_BUILDD}/iso" rm -rf "$ISODIR" mkdir -p "$ISODIR" case "$DEBIRF_ISO_BOOTLOADER" in grub) msg "using GRUB as bootloader..." # use hard links to avoid massive copying time (we're almost certainly on the same filesystem) ln "${DEBIRF_BUILDD}/${KERNEL}" "${ISODIR}/" || failure "Failed to link kernel into iso" ln "${DEBIRF_BUILDD}/${INITRAMFS}" "${ISODIR}/" || failure "Failed to link initramfs into iso" # make grub.cfg mkdir -p "$ISODIR"/boot/grub/ cat >"$ISODIR"/boot/grub/grub.cfg < /dev/null) || failure "xorriso is not in your path. Maybe you need to install it?" # use hard links to avoid massive copying time (we're almost certainly on the same filesystem): ln "${DEBIRF_BUILDD}/${KERNEL}" "${ISODIR}/vmlinuz" || failure "Failed to link kernel into iso" ln "${DEBIRF_BUILDD}/${INITRAMFS}" "${ISODIR}/debirf.cfg" || failure "Failed to link initramfs into iso" # insert isolinux eltorito image mkdir -p "$ISODIR"/boot/isolinux cp /usr/lib/syslinux/isolinux.bin "$ISODIR"/boot/isolinux # make isolinux menu cat >"$ISODIR"/isolinux.cfg <"$ISODIR"/menu <