pax_global_header00006660000000000000000000000064134432053270014515gustar00rootroot0000000000000052 comment=39b789951173d834654b774a9b2df2609465cc4d oz-0.17.0/000077500000000000000000000000001344320532700122325ustar00rootroot00000000000000oz-0.17.0/.gitignore000066400000000000000000000001061344320532700142170ustar00rootroot00000000000000*.gz *.pyc *.sw[po] *~ *.egg *.egg-info tests/.venv tests/results.xml oz-0.17.0/.travis.yml000066400000000000000000000020321344320532700143400ustar00rootroot00000000000000language: python python: # - "3.3" # - "3.2" - "2.7" before_install: - sudo add-apt-repository -y ppa:pdffs/precise-virt - sudo apt-get update - sudo apt-get install -qq genisoimage libvirt-dev mtools openssh-client python-dev python-guestfs swig libssl1.0.0 python-m2crypto python-libvirt # Travis uses an isolated virtualenv (see http://about.travis-ci.org/docs/user/languages/python/#Travis-CI-Uses-Isolated-virtualenvs) # Install the system python packages to get their deps and then install the pip version to have them locally install: - pip install -r requirements.txt - sudo cp /usr/lib/python2.7/dist-packages/*guestfs* $VIRTUAL_ENV/lib/python$TRAVIS_PYTHON_VERSION/site-packages/ - python setup.py install - pip install coverage - pip install coveralls - py.test --genscript=runtests.py env: - TESTFOLDER=tdl - TESTFOLDER=guest - TESTFOLDER=ozutil - TESTFOLDER=factory script: - coverage run -p --source=oz runtests.py --verbose --tb=short tests/$TESTFOLDER after_success: - coveralls oz-0.17.0/COPYING000066400000000000000000000635641344320532700133030ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, 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 this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), 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 distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser 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 Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "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 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY 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 LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey 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 library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; version 2.1 of the License. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! oz-0.17.0/MANIFEST.in000066400000000000000000000002531344320532700137700ustar00rootroot00000000000000include README COPYING examples/*.tdl man/*.1 oz.cfg docs/*.rng oz/*.rng Makefile include man/examples/*.example man/examples/header man/examples/footer include oz/auto/* oz-0.17.0/Makefile000066400000000000000000000036201344320532700136730ustar00rootroot00000000000000VERSION = $(shell egrep "^VERSION" setup.py | awk '{print $$3}') VENV_DIR = tests/.venv sdist: oz.spec.in python setup.py sdist oz.spec: sdist signed-tarball: sdist gpg --detach-sign --armor -o dist/oz-$(VERSION).tar.gz.sign dist/oz-$(VERSION).tar.gz signed-rpm: oz.spec rpmbuild -ba oz.spec --sign --define "_sourcedir `pwd`/dist" rpm: oz.spec rpmbuild -ba oz.spec --define "_sourcedir `pwd`/dist" srpm: oz.spec rpmbuild -bs oz.spec --define "_sourcedir `pwd`/dist" deb: debuild -i -uc -us -b release: signed-rpm signed-tarball deb man2html: @for file in oz-install oz-customize oz-generate-icicle oz-cleanup-cache oz-examples; do \ echo "Generating $$file HTML page from man" ; \ groff -mandoc -mwww man/$$file.1 -T html > man/$$file.html ; \ done $(VENV_DIR): @virtualenv --system-site-packages $(VENV_DIR) @pip-python -E $(VENV_DIR) install pytest @[[ "$$PWD" =~ \ |\' ]] && ( \ echo "Resolving potential problems where '$$PWD' contains spaces" ; \ for MATCH in $$(grep '^#!"/' $(VENV_DIR)/bin/* -l) ; do \ sed -i '1s|^#!".*/\([^/]*\)"|#!/usr/bin/env \1|' "$$MATCH" ; \ done ) || true virtualenv: $(VENV_DIR) unittests: @[ -f $(VENV_DIR)/bin/activate ] && source $(VENV_DIR)/bin/activate ; python3 setup.py test @(type deactivate 2>/dev/null | grep -q 'function') && deactivate || true tests: unittests test-coverage: python-coverage run --source oz /usr/bin/py.test --verbose tests python-coverage html xdg-open htmlcov/index.html pylint: pylint-3 --rcfile=pylint.conf oz oz-install oz-customize oz-cleanup-cache oz-generate-icicle flake8: flake8-3 --ignore=E501 oz clean: rm -rf MANIFEST build dist usr *~ oz.spec *.pyc oz/*~ oz/*.pyc examples/*~ oz/auto/*~ man/*~ docs/*~ man/*.html $(VENV_DIR) tests/tdl/*~ tests/factory/*~ tests/results.xml htmlcov .PHONY: sdist oz.spec signed-tarball signed-rpm rpm srpm deb release man2html virtualenv unittests tests test-coverage pylint clean oz-0.17.0/README000066400000000000000000000010501344320532700131060ustar00rootroot00000000000000Oz is a set of programs and classes to do automated installations of operating systems. It is useful for creating virtual machine disk images containing an operating systems and, optionally, programs. The best way to install it is to make an RPM out of it by running "make rpm" or "make srpm", and then installing the resulting RPM on the target machine. Once you have the RPM installed, you will need to build up TDL files to feed as input into the building process. Please see the examples directory to get an idea of what a TDL file looks like. oz-0.17.0/TODO000066400000000000000000000153141344320532700127260ustar00rootroot000000000000001. More OS support: - Debian Etch, Lenny, Squeeze - SUSE Linux 10.0, 10.1 - openSUSE 10.2 - OpenBSD (http://people.cs.uchicago.edu/~brendan/howtos/openbsd_install/) - NetBSD (anita) - FreeBSD - Dragonfly BSD - Windows Vista, 98, 95, ME - RHL 5.2, 6.0, 6.1, 6.2 (only nfs installs work) 2. Add partition support to the TDL. 3. Add improved error logging to guest installation. That is, if the guest installation fails, we want to get detailed error information out of the installer to find out why. Fedora/RHEL support doing remote syslog via network or virtio-serial, and I also believe anaconda will dump data to syslog during installation, so that is one avenue to pursue. NOTE: anaconda virtio-serial support does not exist until F-14. See http://fedoraproject.org/wiki/Anaconda/Logging 4. Before attempting an install, check the output_dir to make sure it will approximately have enough space for the output disk image. 5. With windows from MSDN (at least 2000, maybe other versions too), the top-level doesn't really contain the bits you care about. What happens is that there are 3 boot options on the CD: installer for Professional, Server, and Advanced Server. The directory structure on the CD is something like: english win2000 adv_server pro server and underneath each of (adv_server, pro, server) are the bits you care about. To automate this you really need to figure out which one the user cares about, then copy just that subdirectory. You'll also need to extract the appropriate parts of eltorito so it boots automatically, and then you'll also need to set i386/txtsetup.sif [SetupData]: SetupSourcePath = "\". See http://old.bink.nu/bootcd/ 6. Take a screen shot if some customization or generate-icicle steps time out. 7. Try to do automatic detection of distro/version/architecture from the ISO that are provided to us. That will make it so that a minimal TDL will only include the path to the ISO, and we can figure out the rest of the information. 8. Add support for additional drivers during install (needed for Windows virtio support). 9. Make "python setup.py bdist_rpm" work. The problem is that bdist_rpm generates its own SPEC file based on the information in setup.py. When it does this, it somehow messes up the %description (minor, probably a change to the setup macro), fails to create the /var/lib/oz subdirectories (which could be moved into setup.py as well), and also fails to find the gzipped man page files (which is what eventually causes the build to fail). 10. RHL 6.2 does not work via HTTP because of a bug in the installer; when parsing a URL passed in via "method", it fails to put a / at the beginning of the URL. What this means is that when the installer goes to fetch the install images via "GET path/to/netstg2.img HTTP/0.9", the web server then returns an error. To do a fully automated install, we need to use an ISO, NFS or FTP install method; I could not get FTP to work, but I did not try that hard. 11. RHL 6.1 fails because there is no netstg2.img available in the distribution I have. Unfortunately, I have not been able to find the netstg2.img, nor an ISO of 6.1 to do an alternate install. NFS may still work here. 12. RHL 6.0 fails because the kernel panics on boot: VFS: Cannot open root device 08:21 Kernel panic: VFS: Unable to mount root fs on 08:21 13. Enable SELinux in enforcing mode inside of Fedora/RHEL guests. The current problem with this is that prior to launching the customize step, we upload files like ssh keys via libguestfs. In the default mode libguestfs uploads them with no SELinux context, which means reads are denied. Jim Meyering suggests that we add a script to the end of /etc/rc.d/rc.local that does a "restorecon" on the files we care about. Then we don't need to worry about knowing the context in Oz; we just make it do the right thing. There are two problems with this: 1) if we upload /etc/rc.d/rc.local, that will have the wrong context that we have to deal with, and 2) there is a race condition between icicle-nc checking in and this restorecon script finishing. Neither problem is insurmountable, but we should make the effort to get this working. 14. Do preflight checks on detected bridges. That is, if we detected the bridge (i.e. it was not specified by the user), then we should do some basic checks to make sure that we think it will work. We should check the state of at least: /proc/sys/vm/net/ipv4/ip_forward /proc/sys/net/bridge/bridge-nf-call-arptables /proc/sys/net/bridge/bridge-nf-call-ip6tables /proc/sys/net/bridge/bridge-nf-call-iptables iptables -t filter -L -v iptables -t nat -L -v 15. We should add a mode where we assume the responsibility for uploading RPMs into the guest (via ssh) and then doing a yum localinstall on those RPMs. 16. We should add additional commands section. In particular, we should have "pre" package installation and "post" package installation command sections. 17. Support hashes for the root password support. 18. Add a mode where we use a reverse ssh tunnel with a SOCKS proxy to download the packages. This means that the packages need to be visible to the imagefactory machine, but not necessarily to the instance. 19. During customization/icicle generation, we should check to make sure that the bridge listed in the libvirt XML matches up with what we detected (if anything). This isn't really an issue when doing oz-install -g -u, but if you use the short-circuit oz-customize or oz-generate-icicle, the user could have fed us bad data. 20. Currently we use libguestfs to extract the installation ISO, make changes to it, and then rebundle the ISO using mkisofs. This is time consuming, partially because we are doing two copies of the ISO (once from the ISO to the filesystem, and once from the filesystem to the new ISO), and partially because we are only modifying a very small portion of the ISO. We can improve this situation and get rid of one whole copy by mounting the ISO with fuseiso/guestmount, symlinking most of the contents to a temporary directory, and only modifying the small bits we need to. Then we can pack the whole thing back up using mkisofs. This gets rid of the first copy, so it should cut our initial time in half (plus or minus the page cache). 21. Change setup.py to make the directories /var/lib/oz/*. Since that is repeated in both of the RPM and deb building stuff, it would be better to just do it on python setup.py install instead. oz-0.17.0/debian/000077500000000000000000000000001344320532700134545ustar00rootroot00000000000000oz-0.17.0/debian/.gitignore000066400000000000000000000001371344320532700154450ustar00rootroot00000000000000*.debhelper *.debhelper.log *.substvars files oz/ python-module-stampdir/ source/ stamp-* tmp/ oz-0.17.0/debian/README000066400000000000000000000002331344320532700143320ustar00rootroot00000000000000The Debian Package oz ---------------------------- Comments regarding the Package -- Richard Jones Thu, 22 Sep 2011 16:17:34 +0100 oz-0.17.0/debian/README.Debian000066400000000000000000000003631344320532700155170ustar00rootroot00000000000000oz for Debian ------------- This is an experimental Oz package for Debian. Please open bug reports on the github issue tracker: http://github.com/clalancette/oz/issues -- Richard Jones Thu, 22 Sep 2011 16:17:34 +0100 oz-0.17.0/debian/README.source000066400000000000000000000002631344320532700156340ustar00rootroot00000000000000oz for Debian ------------- oz-0.17.0/debian/changelog000066400000000000000000000027731344320532700153370ustar00rootroot00000000000000oz (0.17.0-1) unstable; urgency=low * Update to Oz 0.17.0 -- Chris Lalancette Sat, 16 Mar 2019 14:37:00 -0500 oz (0.16.0-1) unstable; urgency=low * Update to Oz 0.16.0 -- Chris Lalancette Tue, 08 Aug 2017 14:37:00 -0500 oz (0.15.0-1) unstable; urgency=low * Update to Oz 0.15.0 -- Chris Lalancette Sun, 28 Feb 2016 14:37:00 -0500 oz (0.14.0-1) unstable; urgency=low * Update to Oz 0.14.0 -- Chris Lalancette Fri, 26 Jun 2015 14:37:00 -0500 oz (0.13.0-1) unstable; urgency=low * Update to Oz 0.13.0 -- Chris Lalancette Sat, 07 Mar 2015 17:46:00 -0500 oz (0.12.0-1) unstable; urgency=low * Update to Oz 0.12.0 -- Chris Lalancette Wed, 01 Jan 2014 17:46:00 -0500 oz (0.11.0-1) unstable; urgency=low * Update to Oz 0.11.0 -- Chris Lalancette Sun, 28 Jul 2013 15:48:00 -0500 oz (0.10.0-1) unstable; urgency=low * Update to Oz 0.10.0 -- Chris Lalancette Sat, 09 Mar 2013 08:37:00 -0500 oz (0.9.0-1) unstable; urgency=low * Update to Oz 0.9.0 -- Guilhem Lettron Tue, 21 Aug 2012 12:21:53 +0200 oz (0.8.0-1) unstable; urgency=low * Update to Oz 0.8.0 -- Chris Lalancette Thu, 21 May 2012 09:36:00 -0500 oz (0.7.0-5) unstable; urgency=low * Initial Release. -- Richard Jones Thu, 22 Sep 2011 16:17:34 +0100 oz-0.17.0/debian/compat000066400000000000000000000000021344320532700146520ustar00rootroot000000000000008 oz-0.17.0/debian/control000066400000000000000000000013421344320532700150570ustar00rootroot00000000000000Source: oz Maintainer: Richard Jones Section: python Priority: optional Build-Depends: debhelper (>= 8.0.0), python-all (>= 2.6.6-3) Standards-Version: 3.9.4 Homepage: http://github.com/clalancette/oz/wiki Vcs-Git: git://github.com/clalancette/oz.git X-Python-Version: >= 2.6 Package: oz Architecture: all Depends: ${misc:Depends}, ${python:Depends}, python (>= 2.5), genisoimage, libvirt-dev (>= 0.9.7), mtools, openssh-client, python-guestfs, python-lxml, python-libvirt (>= 0.9.7), python-requests, python-m2crypto, python-monotonic, Description: installing guest OSs with only minimal input the user Oz is a tool for automatically installing guest OSs with only minimal up-front input from the user. oz-0.17.0/debian/copyright000066400000000000000000000024471344320532700154160ustar00rootroot00000000000000This work was packaged for Debian by: Richard Jones on Thu, 22 Sep 2011 16:17:34 +0100 It was downloaded from: http://aeolusproject.org/oz.html Upstream Author: Chris Lalancette Copyright: Copyright (C) 2010-2011 Chris Lalancette License: This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; version 2.1 of the License. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA On Debian systems, the complete text of the GNU General Public License version 2 can be found in "/usr/share/common-licenses/LGPL-2.1". The Debian packaging is: Copyright (C) 2011 Richard Jones and is licensed under the LGPL version 2.1 or later, see above. oz-0.17.0/debian/dirs000066400000000000000000000002511344320532700143360ustar00rootroot00000000000000etc/oz var/lib/oz/isocontent var/lib/oz/isos var/lib/oz/floppycontent var/lib/oz/floppies var/lib/oz/icicletmp var/lib/oz/jeos var/lib/oz/kernels var/lib/oz/screenshots oz-0.17.0/debian/docs000066400000000000000000000000251344320532700143240ustar00rootroot00000000000000README TODO examples oz-0.17.0/debian/install000066400000000000000000000000171344320532700150430ustar00rootroot00000000000000/oz.cfg etc/oz oz-0.17.0/debian/postinst000077500000000000000000000002131344320532700152610ustar00rootroot00000000000000#!/bin/sh - if [ ! -f /etc/oz/id_rsa-icicle-gen ]; then ssh-keygen -t rsa -b 2048 -N "" -f /etc/oz/id_rsa-icicle-gen >/dev/null 2>&1 fi oz-0.17.0/debian/postrm000066400000000000000000000006771344320532700147350ustar00rootroot00000000000000#!/bin/sh set -e FILE="/etc/oz/id_rsa-icicle-gen" case "$1" in purge) if [ -f $FILE ]; then rm $FILE $FILE.pub fi ;; remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 oz-0.17.0/debian/rules000077500000000000000000000001141344320532700145300ustar00rootroot00000000000000#!/usr/bin/make -f %: dh $@ --buildsystem=python_distutils --with=python2 oz-0.17.0/debian/watch000066400000000000000000000002061344320532700145030ustar00rootroot00000000000000# Compulsory line, this is a version 3 file version=3 https://github.com/clalancette/oz/tags \ /clalancette/oz/archive/v(.*).tar.gz oz-0.17.0/examples/000077500000000000000000000000001344320532700140505ustar00rootroot00000000000000oz-0.17.0/examples/f12i386.tdl000066400000000000000000000006401344320532700155570ustar00rootroot00000000000000 oz-0.17.0/examples/f12x86_64.tdl000066400000000000000000000006461344320532700160320ustar00rootroot00000000000000 oz-0.17.0/examples/f13i386.tdl000066400000000000000000000012631344320532700155620ustar00rootroot00000000000000 oz-0.17.0/examples/f14i386local.tdl000066400000000000000000000006061344320532700165760ustar00rootroot00000000000000 oz-0.17.0/examples/f18disksize.tdl000066400000000000000000000010711344320532700167200ustar00rootroot00000000000000 oz-0.17.0/examples/f18file.tdl000066400000000000000000000015131344320532700160130ustar00rootroot00000000000000 oz-0.17.0/examples/f18isoextradir.tdl000066400000000000000000000013131344320532700174270ustar00rootroot00000000000000 oz-0.17.0/examples/f18isoextrafile.tdl000066400000000000000000000013211344320532700175670ustar00rootroot00000000000000 oz-0.17.0/examples/freebsd10.tdl000066400000000000000000000010231344320532700163240ustar00rootroot00000000000000 oz-0.17.0/examples/opensuse11.3i386.tdl000066400000000000000000000006641344320532700173410ustar00rootroot00000000000000 oz-0.17.0/examples/ubuntu9.10i386.tdl000066400000000000000000000006551344320532700170270ustar00rootroot00000000000000 oz-0.17.0/examples/win2k.tdl000066400000000000000000000007561344320532700156170ustar00rootroot00000000000000 oz-0.17.0/man/000077500000000000000000000000001344320532700130055ustar00rootroot00000000000000oz-0.17.0/man/oz-cleanup-cache.1000066400000000000000000000112371344320532700162110ustar00rootroot00000000000000.TH OZ-CLEANUP-CACHE 1 "Feb 2011" "oz-cleanup-cache" .SH NAME oz-cleanup-cache - tool to remove cached oz data .SH SYNOPSIS .B oz-cleanup-cache [OPTIONS] .SH DESCRIPTION This is a tool to remove all of the data that Oz has cached. Because the data that Oz caches can grow fairly large, it may be worthwhile to periodically clean it up. This is a simple script to do so. Note that if you do cleanup the Oz cache, subsequent operating system installs will be slower since Oz will have to re-download the installation media. .SH OPTIONS .TP .B "\-c " Get the configuration from config file \fBconfig\fR, instead of the default /etc/oz/oz.cfg. If neither one exists, Oz will use sensible defaults. The config file is in standard ini format; for an explanation of the sections and keys, see the .B CONFIGURATION FILE section. .TP .B "\-d " Turn on debugging output to level \fBloglevel\fR. The log levels are: .RS 7 .IP "0 - errors only (this is the default)" .IP "1 - errors and warnings" .IP "2 - errors, warnings, and information" .IP "3 - all messages" .IP "4 - all messages, prepended with the level and classname" .RE .TP .B "\-h" Print a short help message. .SH CONFIGURATION FILE The Oz configuration file is in standard INI format with several sections. If any section or configuration key is missing, Oz will use a sensible default. For true/false configuration keys, the values of "true", "True", "yes", or "Yes" can be used to turn the option on, and "false", "False", "no", or "No" can be used to turn the behavior off. The configuration file should have the following form: .sp .in +4n .nf [paths] output_dir = /var/lib/libvirt/images data_dir = /var/lib/oz screenshot_dir = . sshprivkey = /etc/oz/id_rsa-icicle-gen [libvirt] uri = qemu:///system type = kvm bridge_name = virbr0 cpus = 1 memory = 1024 image_type = raw [cache] original_media = yes modified_media = no jeos = no [icicle] safe_generation = no .fi .in The \fBpaths\fR section defines the paths that Oz will use for storing data. The \fBoutput_dir\fR key describes where to store the images after they are built, and the \fBdata_dir\fR key describes where to cache install media and use temporary storage. Both locations must have a decent amount of free disk space in order for Oz to work properly. The \fBscreenshot_dir\fR key describes where to store screenshots of failed installs. The \fBsshprivkey\fR key describes where the ssh keys are stored, which are required by Oz to do customization of the image. The \fBlibvirt\fR section allows some manipulation of how Oz uses libvirt. The \fBuri\fR key describes the libvirt URI to use to do the guest installation. The \fBtype\fR key defines what type of virtualization to use. The \fBbridge_name\fR key defines which bridge Oz should place the guests that it launches on. The \fBcpus\fR key defines how many cpus should be used inside the virtual machine. The \fBmemory\fR key defines how much memory (in megabytes) should be used inside the virtual machine. The \fBimage_type\fR key defines which output disk type should be used; this can be any value that libvirt supports. The \fBcache\fR section allows some manipulation of how Oz caches data. The caching of data in Oz is a tradeoff between installation time and storage space. The \fBoriginal_media\fR key tells Oz to cache the original installation media so that it does not have to download it the next time an install for the same operating system is requested. The \fBmodified_media\fR key tells Oz to cache the oz-modified installation media so that it does not have to download and modify it the next time an install for the same operating system is requested. The \fBjeos\fR key tells Oz to cache the installed operating system after installation. This can significantly speed up subsequent installation of the same operating system, with the additional downside of the operating system getting out-of-date with respect to security updates. Use with care. The \fBicicle\fR section allows some manipulation of how Oz generates ICICLE output. ICICLE is a package manifest that can optionally be generated at the end of installs. The \fBsafe_generation\fR key controls whether Oz uses a throwaway overlay file while generating the ICICLE. If it is set to "no" (the default), then Oz will boot up the guest at the end of the install and run the appropriate commands to generate the ICICLE. If it is set to "yes", then Oz will use a throwaway overlay file while generating the ICICLE. After the ICICLE is generated, Oz will delete the backing file, leaving the original disk image pristine. .SH SEE ALSO oz-generate-icicle(1), oz-install(1), oz-customize(1), oz-examples(1) .SH AUTHOR Chris Lalancette oz-0.17.0/man/oz-customize.1000066400000000000000000000114261344320532700155430ustar00rootroot00000000000000.TH OZ-CUSTOMIZE 1 "Dec 2010" "oz-customize" .SH NAME oz-customize - tool to automatically modify installed operating system files .SH SYNOPSIS .B oz-customize [OPTIONS] .SH DESCRIPTION This is a tool to modify already installed operating systems. Modifications typically involve installing additional packages. This program can be used as a counterpart to oz-install, though it does not have to be used in conjunction. Note that oz-customize does the actual customization using a combination of KVM and libvirt, so both of these must be available (and working) for oz-customize to have a chance to succeed. .SH OPTIONS .TP .B "\-c " Get the configuration from config file \fBconfig\fR, instead of the default /etc/oz/oz.cfg. If neither one exists, Oz will use sensible defaults. The config file is in standard ini format; for an explanation of the sections and keys, see the .B CONFIGURATION FILE section. .TP .B "\-d " Turn on debugging output to level \fBloglevel\fR. The log levels are: .RS 7 .IP "0 - errors only (this is the default)" .IP "1 - errors and warnings" .IP "2 - errors, warnings, and information" .IP "3 - all messages" .IP "4 - all messages, prepended with the level and classname" .RE .TP .B "\-h" Print a short help message. .SH CONFIGURATION FILE The Oz configuration file is in standard INI format with several sections. If any section or configuration key is missing, Oz will use a sensible default. For true/false configuration keys, the values of "true", "True", "yes", or "Yes" can be used to turn the option on, and "false", "False", "no", or "No" can be used to turn the behavior off. The configuration file should have the following form: .sp .in +4n .nf [paths] output_dir = /var/lib/libvirt/images data_dir = /var/lib/oz screenshot_dir = . sshprivkey = /etc/oz/id_rsa-icicle-gen [libvirt] uri = qemu:///system type = kvm bridge_name = virbr0 cpus = 1 memory = 1024 image_type = raw [cache] original_media = yes modified_media = no jeos = no [icicle] safe_generation = no .fi .in The \fBpaths\fR section defines the paths that Oz will use for storing data. The \fBoutput_dir\fR key describes where to store the images after they are built, and the \fBdata_dir\fR key describes where to cache install media and use temporary storage. Both locations must have a decent amount of free disk space in order for Oz to work properly. The \fBscreenshot_dir\fR key describes where to store screenshots of failed installs. The \fBsshprivkey\fR key describes where the ssh keys are stored, which are required by Oz to do customization of the image. The \fBlibvirt\fR section allows some manipulation of how Oz uses libvirt. The \fBuri\fR key describes the libvirt URI to use to do the guest installation. The \fBtype\fR key defines what type of virtualization to use. The \fBbridge_name\fR key defines which bridge Oz should place the guests that it launches on. The \fBcpus\fR key defines how many cpus should be used inside the virtual machine. The \fBmemory\fR key defines how much memory (in megabytes) should be used inside the virtual machine. The \fBimage_type\fR key defines which output disk type should be used; this can be any value that libvirt supports. The \fBcache\fR section allows some manipulation of how Oz caches data. The caching of data in Oz is a tradeoff between installation time and storage space. The \fBoriginal_media\fR key tells Oz to cache the original installation media so that it does not have to download it the next time an install for the same operating system is requested. The \fBmodified_media\fR key tells Oz to cache the oz-modified installation media so that it does not have to download and modify it the next time an install for the same operating system is requested. The \fBjeos\fR key tells Oz to cache the installed operating system after installation. This can significantly speed up subsequent installation of the same operating system, with the additional downside of the operating system getting out-of-date with respect to security updates. Use with care. The \fBicicle\fR section allows some manipulation of how Oz generates ICICLE output. ICICLE is a package manifest that can optionally be generated at the end of installs. The \fBsafe_generation\fR key controls whether Oz uses a throwaway overlay file while generating the ICICLE. If it is set to "no" (the default), then Oz will boot up the guest at the end of the install and run the appropriate commands to generate the ICICLE. If it is set to "yes", then Oz will use a throwaway overlay file while generating the ICICLE. After the ICICLE is generated, Oz will delete the backing file, leaving the original disk image pristine. .SH SEE ALSO oz-generate-icicle(1), oz-install(1), oz-cleanup-cache(1), oz-examples(1) .SH AUTHOR Chris Lalancette oz-0.17.0/man/oz-examples.1000066400000000000000000000334251344320532700153420ustar00rootroot00000000000000.TH OZ-EXAMPLES 1 "July 2013" "oz-examples" .SH NAME oz-examples - example TDL files for Oz. .SH DESCRIPTION The .I oz-install(1) , .I oz-customize(1) , and .I oz-generate-icicle(1) man pages explain the command-line usage of the Oz commands. One of the required input parameters to all of the above commands is a TDL (Template Description Language) file, which describes the OS the user wants to install, where to get the media from, and any additional packages or actions the user wants to take on the operating system. This man page describes a number of TDL examples and what happens when they are used. Since the TDL is XML, standard XPath notation is used to describe various elements of the XML. .SH EXAMPLE 1 - Minimal guest Assume we want to install a minimal Fedora 13 x86_64 operating system from a Fedora 13 DVD ISO located at http://example.org/fedora-13-x86_64.iso To do this install we first build a TDL XML file, then feed it to oz-install. The TDL file would look like: .in +4n .in /template/name is a user-defined name. This can be anything the user wants, but must be unique among all TDLs the user wants to build. /template/os/name is the name of the operating system we want to install, /template/os/version is the version we want, and /template/os/arch is the architecture we want. A full list of supported operating systems can be obtained by running: .RS # oz-install -h .RE /template/os/install tells Oz where to get the installation media from. In this example, we set type to 'iso' which means that we need an element in the XML pointing to the ISO install media (install methods other than ISO are supported, and described in other examples). /template/description is an optional, human-readable description of the template. This can be anything the user wants, and is ignored by Oz. That's all of the input that Oz needs. To actually do the installation, save the above to a file (say fedora13.tdl), and then run oz-install: .RS # oz-install /path/to/fedora13.tdl .RE Running this command will download and prepare the installation media, then run an automated install in a KVM guest. Assuming the install succeeds, the minimal operating system will be installed on a file in /var/lib/libvirt/images/fedora13_x86_64.dsk (by default, the output location can be overridden in the configuration file). .SH EXAMPLE 2 - Guest with additional packages Assume we want to install a Fedora 14 x86_64 operating system from a Fedora 14 DVD ISO located at http://example.org/fedora-14-x86_64.iso Additionally assume we want to install the postgresql-server package on the operating system. To do this install, we first need to build a TDL XML file and then feed that to oz-install. The TDL file would look like: .in +4n .in Notice that this is very similar to Example 1, except we specified an additional package to be installed in the /packages/package portion of the TDL. Multiple packages can be specified here, and they will all be installed on the operating system. In this example, all packages are downloaded and installed from the default operating system package repositories. Running the installation is done the same way as in Example 1, except we have to add a command-line parameter to actually do the customization: .RS # oz-install -u /path/to/fedora14.tdl .RE Running this command will download and prepare the installation media, then run an automated install in a KVM guest. Assuming the initial install succeeds, Oz will then boot the operating system and run native commands to install the additional packages. For more information about why this approach is used, please see the Oz Architecture document at http://github.com/clalancette/oz/wiki/Oz-architecture. Assuming this final step succeeds, the operating system with the additional packages will be installed on a file in /var/lib/libvirt/images/fedora14_postgres.dsk (by default, the output location can be overridden in the configuration file). .SH EXAMPLE 3 - Generate a package manifest (ICICLE) after installation Assume we want to install a RHEL-5 x86_64 operating system from a RHEL-5 DVD ISO located at http://example.org/rhel-5-x86_64.iso Additionally assume we want to get a package manifest out of the operating system after the install is done. To do this install, we first need to build a TDL XML file and then feed that to oz-install. The TDL file would look like: .in +4n .in This is essentially the same as Example 1, except we want to install RHEL-5 instead of Fedora-13. Running the installation is done the same was as in Example 1, except we have to add a command-line parameter to generate the manifest at the end: .RS # oz-install -g /path/to/rhel5.tdl .RE Running this command will download and prepare the installation media, then run an automated install in a KVM guest. Assuming the initial install succeeds, Oz will then boot the operating system and run native commands to query all of the packages in the system. It will then output an XML document (called an ICICLE) describing the entire manifest. Assuming this step succeeds, the minimal operating system will be install on a file in /var/lib/libvirt/images/rhel5_x86_64.dsk (by default, the output location can be overridden in the configuration file). .SH EXAMPLE 4 - Install a package from an alternate repository Assume we want to install a RHEL-6 x86_64 operating system from a RHEL-6 DVD ISO located at http://example.org/rhel-6-x86_64.iso Additionally assume that we want to install the ccache package from the EPEL-6 repositories on the operating system. To do this install, we first need to build a TDL XML file and then feed that to oz-install. The TDL file would look like: .in +4n .in Notice that this is very similar to Example 2, except we have specified an additional repository from which to download packages. The /repositories/repository section of the TDL specified the URL to the package repository along with whether the packages in the repository are signed. Running the installation is done the same way as in Example 2: .RS # oz-install -u /path/to/rhel6_ccache.tdl .RE Running this command will download and prepare the installation media, then run an automated install in a KVM guest. Assuming the initial install succeeds, Oz will then boot the operating system and run native commands to setup the additional repositories and install the additional packages. For more information about why this approach is used, please see the Oz Architecture document at http://github.com/clalancette/oz/wiki/Oz-architecture. Assuming this final step succeeds, the operating system with the additional packages will be installed on a file in /var/lib/libvirt/images/rhel6_ccache.dsk (by default, the output location can be overridden in the configuration file). .SH EXAMPLE 5 - Install a custom file from information in the TDL Assume we want to install a RHEL-6 x86_64 operating system from a RHEL-6 DVD ISO located at http://example.org/rhel-6-x86_64.iso Additionally assume that we want to write some data to the file /etc/test.out inside the guest. To do this install, we first need to build a TDL XML file and then feed that to oz-install. The TDL file would look like: .in +4n .in Multiple files can be specified here, and they will all be installed on the operating system in the specified locations. Files can be specified inline in raw text in the TDL, as base64 encoded data in the TDL, or as URLs. We need to run the installation with customization for this to work: .RS # oz-install -u /path/to/rhel6_testout.tdl .RE Running this command will download and prepare the installation media, then run an automated install in a KVM guest. Assuming the initial install succeeds, Oz will then boot the operating system and run native commands to upload the files specified in the TDL. For more information about why this approach is used, please see the Oz Architecture document at http://github.com/clalancette/oz/wiki/Oz-architecture. Assuming this final step succeeds, the operating system with the additional files will be installed on a file in /var/lib/libvirt/images/rhel6_testout.dsk (by default, the output location can be overridden in the configuration file). .SH EXAMPLE 6 - Install a custom file from base64-encoded information in the TDL Assume we want to install a RHEL-6 x86_64 operating system from a RHEL-6 DVD ISO located at http://example.org/rhel-6-x86_64.iso Additionally assume that we want to write some data to the file /etc/test.out inside the guest. Since this data may be binary, we want to base64 encode it first. To do this install, we first need to build a TDL XML file and then feed that to oz-install. The TDL file would look like: .in +4n .in Multiple files can be specified here, and they will all be installed on the operating system in the specified locations. Files can be specified inline in raw text in the TDL, as base64 encoded data in the TDL, or as URLs. We need to run the installation with customization for this to work: .RS # oz-install -u /path/to/rhel6_testout.tdl .RE Running this command will download and prepare the installation media, then run an automated install in a KVM guest. Assuming the initial install succeeds, Oz will then boot the operating system and run native commands to upload the files specified in the TDL. For more information about why this approach is used, please see the Oz Architecture document at http://github.com/clalancette/oz/wiki/Oz-architecture. Assuming this final step succeeds, the operating system with the additional files will be installed on a file in /var/lib/libvirt/images/rhel6_testout.dsk (by default, the output location can be overridden in the configuration file). .SH EXAMPLE 7 - Install a custom file from a URL Assume we want to install a RHEL-6 x86_64 operating system from a RHEL-6 DVD ISO located at http://example.org/rhel-6-x86_64.iso Additionally assume that we want to write some data to the file /etc/test.out inside the guest. We want to fetch this data from a URL and upload into the guest. To do this install, we first need to build a TDL XML file and then feed that to oz-install. The TDL file would look like: .in +4n .in Multiple files can be specified here, and they will all be installed on the operating system in the specified locations. Files can be specified inline in raw text in the TDL, as base64 encoded data in the TDL, or as URLs. We need to run the installation with customization for this to work: .RS # oz-install -u /path/to/rhel6_testout.tdl .RE Running this command will download and prepare the installation media, then run an automated install in a KVM guest. Assuming the initial install succeeds, Oz will then boot the operating system and run native commands to upload the files specified in the TDL. For more information about why this approach is used, please see the Oz Architecture document at http://github.com/clalancette/oz/wiki/Oz-architecture. Assuming this final step succeeds, the operating system with the additional files will be installed on a file in /var/lib/libvirt/images/rhel6_testout.dsk (by default, the output location can be overridden in the configuration file). .SH SEE ALSO oz-install(1), oz-generate-icicle(1), oz-customize(1), oz-cleanup-cache(1) .SH AUTHOR Chris Lalancette oz-0.17.0/man/oz-generate-icicle.1000066400000000000000000000116531344320532700165430ustar00rootroot00000000000000.TH OZ-GENERATE-ICICLE 1 "Aug 2011" "oz-generate-icicle" .SH NAME oz-generate-icicle - tool to generate an ICICLE (package manifest) of a disk image .SH SYNOPSIS .B oz-generate-icicle [OPTIONS] .SH DESCRIPTION This is a tool to generate a package manifest (also called ICICLE) from a disk image. This program can be used as a counterpart to oz-install, though it does not have to be used in conjunction. Note that oz-generate-icicle does the actual work using a combination of KVM and libvirt, so both of these must be available (and working) for oz-generate-icicle to have a chance to succeed. .SH OPTIONS .TP .B "\-c " Get the configuration from config file \fBconfig\fR, instead of the default /etc/oz/oz.cfg. If neither one exists, Oz will use sensible defaults. The config file is in standard ini format; for an explanation of the sections and keys, see the .B CONFIGURATION FILE section. .TP .B "\-d " Turn on debugging output to level \fBloglevel\fR. The log levels are: .RS 7 .IP "0 - errors only (this is the default)" .IP "1 - errors and warnings" .IP "2 - errors, warnings, and information" .IP "3 - all messages" .IP "4 - all messages, prepended with the level and classname" .RE .TP .B "\-h" Print a short help message. .TP .B "\-i " oz-generate-icicle will normally write the ICICLE XML to stdout. To have oz-generate-icicle write the ICICLE to a file instead, use this option. .SH CONFIGURATION FILE The Oz configuration file is in standard INI format with several sections. If any section or configuration key is missing, Oz will use a sensible default. For true/false configuration keys, the values of "true", "True", "yes", or "Yes" can be used to turn the option on, and "false", "False", "no", or "No" can be used to turn the behavior off. The configuration file should have the following form: .sp .in +4n .nf [paths] output_dir = /var/lib/libvirt/images data_dir = /var/lib/oz screenshot_dir = . sshprivkey = /etc/oz/id_rsa-icicle-gen [libvirt] uri = qemu:///system type = kvm bridge_name = virbr0 cpus = 1 memory = 1024 image_type = raw [cache] original_media = yes modified_media = no jeos = no [icicle] safe_generation = no .fi .in The \fBpaths\fR section defines the paths that Oz will use for storing data. The \fBoutput_dir\fR key describes where to store the images after they are built, and the \fBdata_dir\fR key describes where to cache install media and use temporary storage. Both locations must have a decent amount of free disk space in order for Oz to work properly. The \fBscreenshot_dir\fR key describes where to store screenshots of failed installs. The \fBsshprivkey\fR key describes where the ssh keys are stored, which are required by Oz to do customization of the image. The \fBlibvirt\fR section allows some manipulation of how Oz uses libvirt. The \fBuri\fR key describes the libvirt URI to use to do the guest installation. The \fBtype\fR key defines what type of virtualization to use. The \fBbridge_name\fR key defines which bridge Oz should place the guests that it launches on. The \fBcpus\fR key defines how many cpus should be used inside the virtual machine. The \fBmemory\fR key defines how much memory (in megabytes) should be used inside the virtual machine. The \fBimage_type\fR key defines which output disk type should be used; this can be any value that libvirt supports. The \fBcache\fR section allows some manipulation of how Oz caches data. The caching of data in Oz is a tradeoff between installation time and storage space. The \fBoriginal_media\fR key tells Oz to cache the original installation media so that it does not have to download it the next time an install for the same operating system is requested. The \fBmodified_media\fR key tells Oz to cache the oz-modified installation media so that it does not have to download and modify it the next time an install for the same operating system is requested. The \fBjeos\fR key tells Oz to cache the installed operating system after installation. This can significantly speed up subsequent installation of the same operating system, with the additional downside of the operating system getting out-of-date with respect to security updates. Use with care. The \fBicicle\fR section allows some manipulation of how Oz generates ICICLE output. ICICLE is a package manifest that can optionally be generated at the end of installs. The \fBsafe_generation\fR key controls whether Oz uses a throwaway overlay file while generating the ICICLE. If it is set to "no" (the default), then Oz will boot up the guest at the end of the install and run the appropriate commands to generate the ICICLE. If it is set to "yes", then Oz will use a throwaway overlay file while generating the ICICLE. After the ICICLE is generated, Oz will delete the backing file, leaving the original disk image pristine. .SH SEE ALSO oz-install(1), oz-customize(1), oz-cleanup-cache(1), oz-examples(1) .SH AUTHOR Chris Lalancette oz-0.17.0/man/oz-install.1000066400000000000000000000202321344320532700151620ustar00rootroot00000000000000.TH OZ-INSTALL 1 "Aug 2011" "oz-install" .SH NAME oz-install - tool to automatically install operating systems into files .SH SYNOPSIS .B oz-install [OPTIONS] .SH DESCRIPTION This is a tool to automatically install operating system into files that represent disk images. The input is an XML file representing the operating system and packages to be installed. By default (and by design), the first stage of the install only installs a JEOS (Just Enough Operating System); customization, including the installation of additional packages can also be done, but requires additional flags. Note that oz-install does the actual installation using a combination of KVM and libvirt, so both of these must be available (and working) for oz-install to have a chance to succeed. .SH OPTIONS .TP .B "\-a " Use the user-provided auto installation file \fBauto\fR. By default, Oz will use a hard-coded auto-installation file (kickstart, preseed, sif, etc) to do a basic OS installation. Using this option, the user can provide an alternate auto-installation file to do the install. The caveat is that user-provided auto-installation files are more likely to cause installation errors, so this option should be used with caution. .TP .B "\-b " Use \fBdisk_bus\fR for the storage device while doing the install. By default, Oz has built-in knowledge of the appropriate disk bus to use while installing each guest operating system (ide or virtio). This option allows the user to override that default with their own choice. .TP .B "\-c " Get the configuration from config file \fBconfig\fR, instead of the default /etc/oz/oz.cfg. If neither one exists, Oz will use sensible defaults. The config file is in standard ini format; for an explanation of the sections and keys, see the .B CONFIGURATION FILE section. .TP .B "\-d " Turn on debugging output to level \fBloglevel\fR. The log levels are: .RS 7 .IP "0 - errors only (this is the default)" .IP "1 - errors and warnings" .IP "2 - errors, warnings, and information" .IP "3 - all messages" .IP "4 - all messages, prepended with the level and classname" .RE .TP .B "\-f" Force the generation of new installation media. By default, oz-install will always try to use a locally cached version of the oz-modified install media if it is available. Failing that, oz-install will try to use a locally cached version of the pristine install media if it is available. You can use this flag to force it to always download and regenerate the oz-modified install media, even if it has a local version available. .TP .B "\-g" Generate the ICICLE (a package manifest, with some additional metadata) after the installation is complete. .TP .B "\-h" Print a short help message. .TP .B "\-i " If oz-install has been instructed to generate an ICICLE (see the \-g option), then it will normally write the ICICLE XML to stdout. To have oz-install write the ICICLE to a file instead, use the \-i option. Note that it is an error to specify \-i without \-g. .TP .B "\-m " Use \fBmac_address\fR for the network device while doing the install. The default value is autogenerated by Oz. This option allows the user to override this behaviour. .TP .B "\-n " Use \fBnetwork_device\fR for the network device while doing the install. By default, Oz has built-in knowledge of the appropriate network device to use while installing each guest operating system (ne2k_pci, rtl8139, virtio). This option allows the user to override that default with their own choice. .TP .B "\-p" Cleanup old guests before installation. By default, if a guest with the same libvirt UUID, libvirt name, or diskimage exists prior to Oz starting installation, Oz will abort. If this option is used, then Oz will undefine the libvirt guest with the same name or UUID and delete the diskimage, so it should be used with caution. .TP .B "\-s " Write the disk image to \fBdisk\fR, rather than the default of the TDL name. .TP .B "\-t " Terminate the installation of the guest in \fBtimeout\fR seconds rather than the oz default. This value should be increased if running on slow storage or running multiple oz-install operations on the same machine. Please note that there is a separate termination action that occurs if 300 seconds elapses with no disk activity to the operating system. This timer value is not configurable. .TP .B "\-u" Customize the image after installation. This generally installs additional packages onto the disk image after installation. .TP .B "\-x " Oz will normally generate a libvirt XML file in the current working directory suffixed with the date and time. Specifying the \-x option allows the filename to be overridden. .SH CONFIGURATION FILE The Oz configuration file is in standard INI format with several sections. If any section or configuration key is missing, Oz will use a sensible default. For true/false configuration keys, the values of "true", "True", "yes", or "Yes" can be used to turn the option on, and "false", "False", "no", or "No" can be used to turn the behavior off. The configuration file should have the following form: .sp .in +4n .nf [paths] output_dir = /var/lib/libvirt/images data_dir = /var/lib/oz screenshot_dir = . sshprivkey = /etc/oz/id_rsa-icicle-gen [libvirt] uri = qemu:///system type = kvm bridge_name = virbr0 cpus = 1 memory = 1024 image_type = raw [cache] original_media = yes modified_media = no jeos = no [icicle] safe_generation = no .fi .in The \fBpaths\fR section defines the paths that Oz will use for storing data. The \fBoutput_dir\fR key describes where to store the images after they are built, and the \fBdata_dir\fR key describes where to cache install media and use temporary storage. Both locations must have a decent amount of free disk space in order for Oz to work properly. The \fBscreenshot_dir\fR key describes where to store screenshots of failed installs. The \fBsshprivkey\fR key describes where the ssh keys are stored, which are required by Oz to do customization of the image. The \fBlibvirt\fR section allows some manipulation of how Oz uses libvirt. The \fBuri\fR key describes the libvirt URI to use to do the guest installation. The \fBtype\fR key defines what type of virtualization to use. The \fBbridge_name\fR key defines which bridge Oz should place the guests that it launches on. The \fBcpus\fR key defines how many cpus should be used inside the virtual machine. The \fBmemory\fR key defines how much memory (in megabytes) should be used inside the virtual machine. The \fBimage_type\fR key defines which output disk type should be used; this can be any value that libvirt supports. The \fBcache\fR section allows some manipulation of how Oz caches data. The caching of data in Oz is a tradeoff between installation time and storage space. The \fBoriginal_media\fR key tells Oz to cache the original installation media so that it does not have to download it the next time an install for the same operating system is requested. The \fBmodified_media\fR key tells Oz to cache the oz-modified installation media so that it does not have to download and modify it the next time an install for the same operating system is requested. The \fBjeos\fR key tells Oz to cache the installed operating system after installation. This can significantly speed up subsequent installation of the same operating system, with the additional downside of the operating system getting out-of-date with respect to security updates. Use with care. The \fBicicle\fR section allows some manipulation of how Oz generates ICICLE output. ICICLE is a package manifest that can optionally be generated at the end of installs. The \fBsafe_generation\fR key controls whether Oz uses a throwaway overlay file while generating the ICICLE. If it is set to "no" (the default), then Oz will boot up the guest at the end of the install and run the appropriate commands to generate the ICICLE. If it is set to "yes", then Oz will use a throwaway overlay file while generating the ICICLE. After the ICICLE is generated, Oz will delete the backing file, leaving the original disk image pristine. .SH SEE ALSO oz-generate-icicle(1), oz-customize(1), oz-cleanup-cache(1), oz-examples(1) .SH AUTHOR Chris Lalancette oz-0.17.0/oz-cleanup-cache000077500000000000000000000101231344320532700152730ustar00rootroot00000000000000#!/usr/bin/env python3 # Copyright (C) 2011 Chris Lalancette # Copyright (C) 2012-2018 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA import sys import getopt import os import shutil import logging import oz.ozutil try: get_input = raw_input except NameError: get_input = input def usage(): print("Usage: oz-cleanup-cache [OPTIONS]") print(" -c \tGet config from (default is /etc/oz/oz.cfg)") print(" -d \tTurn up logging level. The levels are:") print("\t\t\t0 - errors only (this is the default)") print("\t\t\t1 - errors and warnings") print("\t\t\t2 - errors, warnings, and information") print("\t\t\t3 - all messages") print("\t\t\t4 - all messages, prepended with the level and classname") print(" -f\t\tDon't ask any questions and just blindly remove all oz data") print(" -h\t\tPrint this help message") sys.exit(1) def main(): try: opts, args = getopt.gnu_getopt(sys.argv[1:], 'c:d:fh', ['config', 'debug', 'force', 'help']) except getopt.GetoptError as err: print(str(err)) usage() force = False config_file = None loglevel = logging.ERROR for o, a in opts: if o in ("-c", "--config"): config_file = a elif o in ("-d", "--debug"): try: d_int = int(a) except ValueError: usage() if d_int == 0: loglevel = logging.ERROR elif d_int == 1: loglevel = logging.WARNING elif d_int == 2: loglevel = logging.INFO elif d_int == 3: loglevel = logging.DEBUG elif d_int >= 4: loglevel = logging.DEBUG elif o in ("-f", "--force"): force = True elif o in ("-h", "--help"): usage() else: assert False, "unhandled option" if args: usage() try: config = oz.ozutil.parse_config(config_file) data_dir = oz.ozutil.config_get_path(config, 'paths', 'data_dir', oz.ozutil.default_data_dir()) dirs = ["floppies", "floppycontent", "icicletmp", "isocontent", "isos", "jeos", "kernels", "screenshots"] caches = [] for path in dirs: caches.append(os.path.join(data_dir, path)) if not force: while True: response = get_input("Going to remove all content from %s; continue? (y/N) " % (', '.join(caches))) if not response or response.lower() == 'n': sys.exit(0) elif response.lower() == 'y': break else: print("Please enter 'y' or 'n'") for cache in caches: print("Removing cached content from %s" % (cache)) for root, dirs, files in os.walk(cache): for f in files: os.unlink(os.path.join(root, f)) for d in dirs: shutil.rmtree(os.path.join(root, d)) except Exception as exc: if loglevel > logging.DEBUG: print("") print("ERROR: %s" % (str(exc))) print("") print("(use -d3 to get the full backtrace)") print("") else: raise if __name__ == "__main__": main() oz-0.17.0/oz-customize000077500000000000000000000101311344320532700146240ustar00rootroot00000000000000#!/usr/bin/env python3 # Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2018 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA import sys import getopt import os import logging import stat import oz.TDL import oz.GuestFactory import oz.ozutil def usage(): print("Usage: oz-customize [OPTIONS] ") print(" OPTIONS:") print(" -c \tGet config from (default is /etc/oz/oz.cfg)") print(" -d \tTurn up logging level. The levels are:") print("\t\t\t0 - errors only (this is the default)") print("\t\t\t1 - errors and warnings") print("\t\t\t2 - errors, warnings, and information") print("\t\t\t3 - all messages") print("\t\t\t4 - all messages, prepended with the level and classname") print(" -h\t\tPrint this help message") print(" -m \tUse for the network interface instead of an autogenerated value") print(" Currently supported architectures are:") print(" i386, x86_64") print(" Currently supported operating systems are:") oz.GuestFactory.distrolist() sys.exit(1) def main(): try: opts, args = getopt.gnu_getopt(sys.argv[1:], 'c:d:hm:', ['config', 'debug', 'mac-address', 'help']) except getopt.GetoptError as err: print(str(err)) usage() loglevel = logging.ERROR logformat = "%(message)s" config_file = None macaddress = None for o, a in opts: if o in ("-c", "--config"): config_file = a elif o in ("-d", "--debug"): try: d_int = int(a) except ValueError: usage() if d_int == 0: loglevel = logging.ERROR elif d_int == 1: loglevel = logging.WARNING elif d_int == 2: loglevel = logging.INFO elif d_int == 3: loglevel = logging.DEBUG elif d_int >= 4: loglevel = logging.DEBUG logformat = logging.BASIC_FORMAT elif o in ("-h", "--help"): usage() elif o in ("-m", "--mac-address"): macaddress = a else: assert False, "unhandled option" if len(args) != 2: usage() try: config = oz.ozutil.parse_config(config_file) tdlfile = args[0] libvirt_xml_file = args[1] logging.basicConfig(level=loglevel, format=logformat) tdl = oz.TDL.TDL(open(tdlfile, 'r').read()) guest = oz.GuestFactory.guest_factory(tdl, config, None, macaddress=macaddress) fp = open(libvirt_xml_file, 'r') # Arbitrarily limit the size of the XML file that we will support to 5MB. # this should be plenty for a normal libvirt XML, and this should prevent # us from causing OOMs on bogus files if os.fstat(fp.fileno())[stat.ST_SIZE] > (5 * 1024 * 1024): raise Exception("libvirt XML file is too big!") guest.customize(fp.read()) fp.close() except Exception as exc: if loglevel > logging.DEBUG: print("") print("ERROR: %s" % (str(exc))) print("") print("(use -d3 to get the full backtrace)") print("") else: raise if __name__ == "__main__": main() oz-0.17.0/oz-generate-icicle000077500000000000000000000102331344320532700156250ustar00rootroot00000000000000#!/usr/bin/env python3 # Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2018 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA import sys import getopt import os import logging import stat import oz.TDL import oz.GuestFactory import oz.ozutil def usage(): print("Usage: oz-generate-icicle [OPTIONS] ") print(" OPTIONS:") print(" -c \tGet config from (default is /etc/oz/oz.cfg)") print(" -d \tTurn up logging level. The levels are:") print("\t\t\t0 - errors only (this is the default)") print("\t\t\t1 - errors and warnings") print("\t\t\t2 - errors, warnings, and information") print("\t\t\t3 - all messages") print("\t\t\t4 - all messages, prepended with the level and classname") print(" -h\t\tPrint this help message") print(" -i \tWrite the ICICLE to ") print(" Currently supported architectures are:") print(" i386, x86_64") print(" Currently supported operating systems are:") oz.GuestFactory.distrolist() sys.exit(1) def main(): try: opts, args = getopt.gnu_getopt(sys.argv[1:], 'c:d:hi:', ['config', 'debug', 'help', 'icicle']) except getopt.GetoptError as err: print(str(err)) usage() loglevel = logging.ERROR logformat = "%(message)s" config_file = None icicle_file = None for o, a in opts: if o in ("-c", "--config"): config_file = a elif o in ("-d", "--debug"): try: d_int = int(a) except ValueError: usage() if d_int == 0: loglevel = logging.ERROR elif d_int == 1: loglevel = logging.WARNING elif d_int == 2: loglevel = logging.INFO elif d_int == 3: loglevel = logging.DEBUG elif d_int >= 4: loglevel = logging.DEBUG logformat = logging.BASIC_FORMAT elif o in ("-h", "--help"): usage() elif o in ("-i", "--icicle"): icicle_file = a else: assert False, "unhandled option" if len(args) != 2: usage() try: config = oz.ozutil.parse_config(config_file) tdlfile = args[0] libvirt_xml_file = args[1] logging.basicConfig(level=loglevel, format=logformat) tdl = oz.TDL.TDL(open(tdlfile, 'r').read()) guest = oz.GuestFactory.guest_factory(tdl, config, None) fp = open(libvirt_xml_file, 'r') # Arbitrarily limit the size of the XML file that we will support to 5MB. # this should be plenty for a normal libvirt XML, and this should prevent # us from causing OOMs on bogus files if os.fstat(fp.fileno())[stat.ST_SIZE] > (5 * 1024 * 1024): raise Exception("libvirt XML file is too big!") icicle_xml = guest.generate_icicle(fp.read()) fp.close() if icicle_file is None: print(icicle_xml) else: open(icicle_file, 'w').write(icicle_xml) print("ICICLE XML was written to " + icicle_file) except Exception as exc: if loglevel > logging.DEBUG: print("") print("ERROR: %s" % (str(exc))) print("") print("(use -d3 to get the full backtrace)") print("") else: raise if __name__ == "__main__": main() oz-0.17.0/oz-install000077500000000000000000000163161344320532700142630ustar00rootroot00000000000000#!/usr/bin/env python3 # Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2018 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA import sys import getopt import logging import time import oz.TDL import oz.GuestFactory import oz.ozutil def usage(): print("Usage: oz-install [OPTIONS] ") print(" OPTIONS:") print(" -a \tUse the guest configuration tool from instead") print("\t\tof using the hard-coded one. This is useful if you want to pass") print("\t\ta custom kickstart/preseed/sif/etc for installation") print(" -b \tUse the for attaching guest storage instead of") print("\t\tthe built-in Oz default") print(" -c \tGet config from (default is /etc/oz/oz.cfg)") print(" -d \tTurn up logging level. The levels are:") print("\t\t\t0 - errors only (this is the default)") print("\t\t\t1 - errors and warnings") print("\t\t\t2 - errors, warnings, and information") print("\t\t\t3 - all messages") print("\t\t\t4 - all messages, prepended with the level and classname") print(" -f\t\tForce download of installation media even if already cached") print(" -g\t\tGenerate the ICICLE after installation") print(" -h\t\tPrint this help message") print(" -i \tWrite the ICICLE to (only valid with -g)") print(" -m \tUse for the network interface instead of an autogenerated value") print(" -n \tUse for the network instead of the built-in Oz default") print(" -p\t\tCleanup old guests with the same name before installation") print(" -s \tWrite the output to (default is the TDL name tag)") print(" -t \tWait seconds for installation, rather than the default") print(" -u\t\tAfter installation, do the customization") print(" -x \tWrite libvirt XML to ") print(" Currently supported architectures are:") print(" i386, x86_64") print(" Currently supported operating systems are:") oz.GuestFactory.distrolist() sys.exit(1) def main(): try: opts, args = getopt.gnu_getopt(sys.argv[1:], 'a:b:c:d:fghi:m:n:ps:t:ux:', ['auto', 'disk-bus', 'config', 'debug', 'force-download', 'generate-icicle', 'help', 'icicle', 'mac-address', 'network-device', 'cleanup', 'disk', 'timeout', 'customize', 'xmlfile']) except getopt.GetoptError as err: print(str(err)) usage() loglevel = logging.ERROR logformat = "%(message)s" force_download = False config_file = None generate_icicle = False filename = None customize = False cleanup = False auto = None timeout = None icicle_file = None output_disk = None diskbus = None netdev = None macaddress = None for o, a in opts: if o in ("-a", "--auto"): auto = a elif o in ("-b", "--disk-bus"): diskbus = a elif o in ("-c", "--config"): config_file = a elif o in ("-d", "--debug"): try: d_int = int(a) except ValueError: usage() if d_int == 0: loglevel = logging.ERROR elif d_int == 1: loglevel = logging.WARNING elif d_int == 2: loglevel = logging.INFO elif d_int == 3: loglevel = logging.DEBUG elif d_int >= 4: loglevel = logging.DEBUG logformat = logging.BASIC_FORMAT elif o in ("-f", "--force-download"): force_download = True elif o in ("-g", "--generate-icicle"): generate_icicle = True elif o in ("-h", "--help"): usage() elif o in ("-i", "--icicle"): icicle_file = a elif o in ("-n", "--network-device"): netdev = a elif o in ("-m", "--mac-address"): macaddress = a elif o in ("-p", "--cleanup"): cleanup = True elif o in ("-s", "--disk"): output_disk = a elif o in ("-t", "--timeout"): timeout = int(a) elif o in ("-u", "--customize"): customize = True elif o in ("-x", "--xmlfile"): filename = a else: assert False, "unhandled option" if len(args) != 1: usage() if not generate_icicle and icicle_file is not None: print("The -i option must be combined with the -g option") sys.exit(3) try: config = oz.ozutil.parse_config(config_file) logging.basicConfig(level=loglevel, format=logformat) tdl = oz.TDL.TDL(open(args[0], 'r').read()) guest = oz.GuestFactory.guest_factory(tdl, config, auto, output_disk, netdev, diskbus, macaddress) if cleanup: guest.cleanup_old_guest() else: guest.check_for_guest_conflict() try: guest.generate_install_media(force_download, customize or generate_icicle) try: guest.generate_diskimage(size=guest.disksize, force=force_download) libvirt_xml = guest.install(timeout, force_download) except: guest.cleanup_old_guest() raise finally: guest.cleanup_install() if customize and generate_icicle: print(guest.customize_and_generate_icicle(libvirt_xml)) elif customize: guest.customize(libvirt_xml) elif generate_icicle: icicle_xml = guest.generate_icicle(libvirt_xml) if icicle_file is None: print(icicle_xml) else: open(icicle_file, 'w').write(icicle_xml) print("ICICLE XML was written to " + icicle_file) if filename is None: filename = guest.name + time.strftime("%b_%d_%Y-%H:%M:%S") open(filename, 'w').write(libvirt_xml) print("Libvirt XML was written to " + filename) except Exception as exc: if loglevel > logging.DEBUG: print("") print("ERROR: %s" % (str(exc))) print("") print("(use -d3 to get the full backtrace)") print("") else: raise if __name__ == "__main__": main() oz-0.17.0/oz.cfg000066400000000000000000000006461344320532700133510ustar00rootroot00000000000000[paths] output_dir = /var/lib/libvirt/images data_dir = /var/lib/oz screenshot_dir = /var/lib/oz/screenshots # sshprivkey = /etc/oz/id_rsa-icicle-gen [libvirt] uri = qemu:///system image_type = raw # type = kvm # bridge_name = virbr0 # cpus = 1 # memory = 1024 [cache] original_media = yes modified_media = no jeos = no [icicle] safe_generation = no [timeouts] install = 1200 inactivity = 300 boot = 300 shutdown = 90 oz-0.17.0/oz.spec.in000066400000000000000000000112301344320532700141400ustar00rootroot00000000000000Summary: Library and utilities for automated guest OS installs Name: oz Version: @VERSION@ Release: @RELEASE@%{?dist} License: LGPLv2 Group: Development/Libraries URL: http://github.com/clalancette/oz Source0: http://github.com/clalancette/%{name}/archive/%{name}-%{version}.tar.gz BuildArch: noarch Requires: python3 Requires: python3-libguestfs >= 1.18 Requires: python3-lxml Requires: python3-libvirt # in theory, oz doesn't really require libvirtd to be local to operate # properly. However, because of the libguestfs manipulations, in practice # it really does. Make it depend on libvirt (so we get libvirtd) for now, # unless/until we are able to make it really be remote. %if 0%{?fedora} >= 17 Requires: libvirt-daemon-kvm Requires: libvirt-daemon-qemu Requires: libvirt-daemon-config-network %else Requires: libvirt >= 0.9.7 %endif Requires: python3-requests Requires: genisoimage Requires: mtools %if 0%{?fedora} < 26 Requires: python-uuid %endif Requires: openssh-clients Requires: python3-m2crypto Requires: python3-monotonic BuildRequires: python3 %description Oz is a set of libraries and utilities for doing automated guest OS installations, with minimal input from the user. %prep %setup -q %build %py3_build %install %py3_install mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/oz/ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/oz/isocontent/ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/oz/isos/ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/oz/floppycontent/ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/oz/floppies/ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/oz/icicletmp/ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/oz/jeos/ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/oz/kernels/ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/oz/screenshots/ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/oz cp oz.cfg $RPM_BUILD_ROOT%{_sysconfdir}/oz %post if [ ! -f %{_sysconfdir}/oz/id_rsa-icicle-gen ]; then ssh-keygen -t rsa -b 2048 -N "" -f %{_sysconfdir}/oz/id_rsa-icicle-gen >& /dev/null fi %files %doc README COPYING examples %dir %attr(0755, root, root) %{_sysconfdir}/oz/ %config(noreplace) %{_sysconfdir}/oz/oz.cfg %dir %attr(0755, root, root) %{_localstatedir}/lib/oz/ %dir %attr(0755, root, root) %{_localstatedir}/lib/oz/isocontent/ %dir %attr(0755, root, root) %{_localstatedir}/lib/oz/isos/ %dir %attr(0755, root, root) %{_localstatedir}/lib/oz/floppycontent/ %dir %attr(0755, root, root) %{_localstatedir}/lib/oz/floppies/ %dir %attr(0755, root, root) %{_localstatedir}/lib/oz/icicletmp/ %dir %attr(0755, root, root) %{_localstatedir}/lib/oz/jeos/ %dir %attr(0755, root, root) %{_localstatedir}/lib/oz/kernels/ %dir %attr(0755, root, root) %{_localstatedir}/lib/oz/screenshots/ %{python3_sitelib}/oz %{_bindir}/oz-install %{_bindir}/oz-generate-icicle %{_bindir}/oz-customize %{_bindir}/oz-cleanup-cache %{python3_sitelib}/%{name}-%{version}-py%{python3_version}.egg-info %{_mandir}/man1/* %changelog * Sat Mar 16 2019 Chris Lalancette - 0.17.0-1 - Release 0.17.0 * Tue Aug 08 2017 Chris Lalancette - 0.16.0-1 - Release 0.16.0 * Sun Feb 28 2016 Chris Lalancette - 0.15.0-1 - Release 0.15.0 * Fri Jun 26 2015 Chris Lalancette - 0.14.0-1 - Release 0.14.0 * Sat Mar 7 2015 Chris Lalancette - 0.13.0-1 - Release 0.13.0 * Wed Jan 1 2014 Chris Lalancette - 0.12.0-1 - Release 0.12.0 * Sun Jul 28 2013 Chris Lalancette - 0.11.0-1 - Release 0.11.0 * Sat Mar 09 2013 Chris Lalancette - 0.10.0-1 - Release 0.10.0 * Tue Jul 17 2012 Chris Lalancette - 0.9.0-1 - Release 0.9.0 * Wed Jan 11 2012 Chris Lalancette - 0.8.0-1 - Release 0.8.0 * Mon Sep 12 2011 Chris Lalancette - 0.7.0-1 - Release 0.7.0 * Wed Aug 17 2011 Chris Lalancette - 0.6.0-1 - Release 0.6.0 * Wed Jun 29 2011 Chris Lalancette - 0.5.0-1 - Release 0.5.0 * Mon Jun 20 2011 Pádraig Brady - 0.4.0-4 - Include examples/. * Wed Jun 15 2011 Pádraig Brady - 0.4.0-3 - Address rpmlint issues. * Fri Jun 10 2011 Pádraig Brady - 0.4.0-2 - Change to noarch. * Tue May 24 2011 Chris Lalancette - 0.4.0-1 - Release 0.4.0. * Wed Mar 30 2011 Chris Lalancette - 0.3.0-1 - Release 0.3.0. * Wed Mar 16 2011 Chris Lalancette - 0.2.0-1 - Release 0.2.0. * Thu Feb 3 2011 Chris Lalancette - 0.1.0-1 - Initial public release of Oz. * Wed Nov 3 2010 Chris Lalancette - 0.0.4-1 - Initial build. oz-0.17.0/oz/000077500000000000000000000000001344320532700126625ustar00rootroot00000000000000oz-0.17.0/oz/Debian.py000066400000000000000000000645771344320532700144410ustar00rootroot00000000000000# Copyright (C) 2011 Chris Lalancette # Copyright (C) 2012-2017 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Debian installation """ import gzip import os import re import shutil import textwrap import oz.GuestFSManager import oz.Linux import oz.OzException import oz.ozutil class DebianConfiguration(object): """ Configuration class for Debian installation. """ def __init__(self, need_auto_direct, need_auto_iso, default_netdev, default_diskbus): self._need_auto_direct = need_auto_direct self._need_auto_iso = need_auto_iso self._default_netdev = default_netdev self._default_diskbus = default_diskbus @property def need_auto_direct(self): """ Property method for whether this version of Debian needs 'auto' on the command-line for direct installs. """ return self._need_auto_direct @property def need_auto_iso(self): """ Property method for whether this version of Debian needs 'auto' on the command-line for ISO installs. """ return self._need_auto_iso @property def default_netdev(self): """ Property method for the default netdev for this version of Debian. """ return self._default_netdev @property def default_diskbus(self): """ Property method for the default diskbus for this version of Debian. """ return self._default_diskbus version_to_config = { '9': DebianConfiguration(need_auto_direct=False, need_auto_iso=True, default_netdev='virtio', default_diskbus='virtio'), '8': DebianConfiguration(need_auto_direct=False, need_auto_iso=True, default_netdev='virtio', default_diskbus='virtio'), '7': DebianConfiguration(need_auto_direct=True, need_auto_iso=True, default_netdev='virtio', default_diskbus='virtio'), '6': DebianConfiguration(need_auto_direct=False, need_auto_iso=False, default_netdev='virtio', default_diskbus='virtio'), '5': DebianConfiguration(need_auto_direct=False, need_auto_iso=False, default_netdev='virtio', default_diskbus='virtio'), } class DebianGuest(oz.Linux.LinuxCDGuest): """ Class for Debian 5, 6, 7, 8, and 9 installation. """ def __init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress): self.config = version_to_config[tdl.update] if netdev is None: netdev = self.config.default_netdev if diskbus is None: diskbus = self.config.default_diskbus oz.Linux.LinuxCDGuest.__init__(self, tdl, config, auto, output_disk, netdev, diskbus, True, True, macaddress) self.crond_was_active = False self.sshd_was_active = False self.sshd_config = textwrap.dedent( """\ SyslogFacility AUTHPRIV PasswordAuthentication yes ChallengeResponseAuthentication no GSSAPIAuthentication yes GSSAPICleanupCredentials yes UsePAM yes AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE AcceptEnv XMODIFIERS X11Forwarding yes Subsystem sftp /usr/libexec/openssh/sftp-server """ ) self.tunnels = {} self.ssh_startuplink = None self.cron_startuplink = None self.debarch = self.tdl.arch if self.debarch == "x86_64": self.debarch = "amd64" self.kernelfname = os.path.join(self.output_dir, self.tdl.name + "-kernel") self.initrdfname = os.path.join(self.output_dir, self.tdl.name + "-ramdisk") self.kernelcache = os.path.join(self.data_dir, "kernels", self.tdl.distro + self.tdl.update + self.tdl.arch + "-kernel") self.initrdcache = os.path.join(self.data_dir, "kernels", self.tdl.distro + self.tdl.update + self.tdl.arch + "-ramdisk") def _copy_preseed(self, outname): """ Method to copy and modify an Debian style preseed file. """ self.log.debug("Putting the preseed file in place") if self.default_auto_file(): def _preseed_sub(line): """ Method that is called back from oz.ozutil.copy_modify_file() to modify preseed files as appropriate for Debian. """ if re.match('d-i passwd/root-password password', line): return 'd-i passwd/root-password password ' + self.rootpw + '\n' elif re.match('d-i passwd/root-password-again password', line): return 'd-i passwd/root-password-again password ' + self.rootpw + '\n' return line oz.ozutil.copy_modify_file(self.auto, outname, _preseed_sub) else: shutil.copy(self.auto, outname) def _modify_iso(self): """ Method to make the boot ISO auto-boot with appropriate parameters. """ self.log.debug("Modifying ISO") self.log.debug("Copying preseed file") outname = os.path.join(self.iso_contents, "preseed", "customiso.seed") outdir = os.path.dirname(outname) oz.ozutil.mkdir_p(outdir) self._copy_preseed(outname) # arch == i386 installdir = "/install.386" if self.tdl.arch == "x86_64": installdir = "/install.amd" self.log.debug("Modifying isolinux.cfg") isolinuxcfg = os.path.join(self.iso_contents, "isolinux", "isolinux.cfg") extra = "" if self.config.need_auto_iso: extra = "auto=true " with open(isolinuxcfg, 'w') as f: f.write(textwrap.dedent( """\ default customiso timeout 1 prompt 0 label customiso menu label ^Customiso menu default kernel %s/vmlinuz append file=/cdrom/preseed/customiso.seed %sdebian-installer/\ locale=en_US console-setup/layoutcode=us netcfg/choose_interface=auto priority=\ critical initrd=%s/initrd.gz -- """ % (installdir, extra, installdir))) def get_auto_path(self): autoname = self.tdl.distro + self.tdl.update + ".auto" sp = self.tdl.update.split('.') if len(sp) == 3: autoname = self.tdl.distro + sp[0] + "." + sp[1] + ".auto" return oz.ozutil.generate_full_auto_path(autoname) def _generate_new_iso(self): """ Method to create a new ISO based on the modified CD/DVD. """ self.log.info("Generating new ISO") oz.ozutil.subprocess_check_output(["genisoimage", "-r", "-V", "Custom", "-J", "-l", "-no-emul-boot", "-b", "isolinux/isolinux.bin", "-c", "isolinux/boot.cat", "-boot-load-size", "4", "-cache-inodes", "-boot-info-table", "-v", "-o", self.output_iso, self.iso_contents], printfn=self.log.debug) def install(self, timeout=None, force=False): """ Method to run the operating system installation. """ extra = "" if self.config.need_auto_direct: extra = "auto=true " cmdline = "priority=critical " + extra + "locale=en_US" return self._do_install(timeout, force, 0, self.kernelfname, self.initrdfname, cmdline) def _get_service_runlevel_link(self, g_handle, service): """ Method to find the runlevel link(s) for a service based on the name and the (detected) default runlevel. """ runlevel = self.get_default_runlevel(g_handle) lines = g_handle.cat('/etc/init.d/' + service).split("\n") startlevel = "99" for line in lines: if re.match('# chkconfig:', line): try: startlevel = line.split(':')[1].split()[1] except Exception: pass break return "/etc/rc" + runlevel + ".d/S" + startlevel + service def _image_ssh_teardown_step_1(self, g_handle): """ First step to undo _image_ssh_setup (remove authorized keys). """ self.log.debug("Teardown step 1") # reset the authorized keys self.log.debug("Resetting authorized_keys") g_handle.path_restore('/root/.ssh') def _image_ssh_teardown_step_2(self, g_handle): """ Second step to undo _image_ssh_setup (reset sshd service). """ self.log.debug("Teardown step 2") # remove custom sshd_config self.log.debug("Resetting sshd_config") g_handle.path_restore('/etc/ssh/sshd_config') # reset the service link self.log.debug("Resetting sshd service") if self.ssh_startuplink: g_handle.path_restore(self.ssh_startuplink) def _image_ssh_teardown_step_3(self, g_handle): """ Fourth step to undo _image_ssh_setup (remove guest announcement). """ self.log.debug("Teardown step 3") # remove announce cronjob self.log.debug("Resetting announcement to host") g_handle.remove_if_exists('/etc/cron.d/announce') # remove reportip self.log.debug("Removing reportip") g_handle.remove_if_exists('/root/reportip') # reset the service link self.log.debug("Resetting cron service") if self.cron_startuplink: g_handle.path_restore(self.cron_startuplink) def _image_ssh_teardown_step_4(self, g_handle): """ Fourth step to undo changes by the operating system. For instance, during first boot openssh generates ssh host keys and stores them in /etc/ssh. Since this image might be cached later on, this method removes those keys. """ for f in ["/etc/ssh/ssh_host_dsa_key", "/etc/ssh/ssh_host_dsa_key.pub", "/etc/ssh/ssh_host_rsa_key", "/etc/ssh/ssh_host_rsa_key.pub", "/etc/ssh/ssh_host_ecdsa_key", "/etc/ssh/ssh_host_ecdsa_key.pub", "/etc/ssh/ssh_host_key", "/etc/ssh/ssh_host_key.pub"]: g_handle.remove_if_exists(f) def _image_ssh_setup_step_1(self, g_handle): """ First step for allowing remote access (generate and upload ssh keys). """ # part 1; upload the keys self.log.debug("Step 1: Uploading ssh keys") g_handle.path_backup('/root/.ssh') g_handle.mkdir('/root/.ssh') g_handle.path_backup('/root/.ssh/authorized_keys') self._generate_openssh_key(self.sshprivkey) g_handle.upload(self.sshprivkey + ".pub", '/root/.ssh/authorized_keys') def _image_ssh_setup_step_2(self, g_handle): """ Second step for allowing remote access (configure sshd). """ # part 2; check and setup sshd self.log.debug("Step 2: setup sshd") if not g_handle.exists('/usr/sbin/sshd'): raise oz.OzException.OzException("ssh not installed on the image, cannot continue") self.ssh_startuplink = self._get_service_runlevel_link(g_handle, 'ssh') g_handle.path_backup(self.ssh_startuplink) g_handle.ln_sf('/etc/init.d/ssh', self.ssh_startuplink) sshd_config_file = os.path.join(self.icicle_tmp, "sshd_config") f = open(sshd_config_file, 'w') f.write(self.sshd_config) f.close() try: g_handle.path_backup('/etc/ssh/sshd_config') g_handle.upload(sshd_config_file, '/etc/ssh/sshd_config') finally: os.unlink(sshd_config_file) def _image_ssh_setup_step_3(self, g_handle): """ Third step for allowing remote access (make the guest announce itself on bootup). """ # part 3; make sure the guest announces itself self.log.debug("Step 3: Guest announcement") if not g_handle.exists('/usr/sbin/cron'): raise oz.OzException.OzException("cron not installed on the image, cannot continue") scriptfile = os.path.join(self.icicle_tmp, "script") f = open(scriptfile, 'w') f.write("#!/bin/bash\n") f.write("/bin/sleep 20\n") f.write("DEV=$(/usr/bin/awk '{if ($2 == 0) print $1}' /proc/net/route) &&\n") f.write('[ -z "$DEV" ] && exit 0\n') f.write("ADDR=$(/sbin/ip -4 -o addr show dev $DEV | /usr/bin/awk '{print $4}' | /usr/bin/cut -d/ -f1) &&\n") f.write('[ -z "$ADDR" ] && exit 0\n') f.write('echo -n "!$ADDR,%s!" > /dev/ttyS1\n' % (self.uuid)) f.close() try: g_handle.upload(scriptfile, '/root/reportip') g_handle.chmod(0o755, '/root/reportip') finally: os.unlink(scriptfile) announcefile = os.path.join(self.icicle_tmp, "announce") f = open(announcefile, 'w') f.write('*/1 * * * * root /bin/bash -c "/root/reportip"\n') f.close() try: g_handle.upload(announcefile, '/etc/cron.d/announce') finally: os.unlink(announcefile) self.cron_startuplink = self._get_service_runlevel_link(g_handle, 'cron') g_handle.path_backup(self.cron_startuplink) g_handle.ln_sf('/etc/init.d/cron', self.cron_startuplink) def _collect_setup(self, libvirt_xml): """ Setup the guest for remote access. """ self.log.info("Collection Setup") g_handle = oz.GuestFSManager.GuestFSLibvirtFactory(libvirt_xml, self.libvirt_conn) g_handle.mount_partitions() # we have to do 3 things to make sure we can ssh into Debian # 1) Upload our ssh key # 2) Make sure sshd is running on boot # 3) Make the guest announce itself to the host try: try: self._image_ssh_setup_step_1(g_handle) try: self._image_ssh_setup_step_2(g_handle) try: self._image_ssh_setup_step_3(g_handle) except: self._image_ssh_teardown_step_3(g_handle) raise except: self._image_ssh_teardown_step_2(g_handle) raise except: self._image_ssh_teardown_step_1(g_handle) raise finally: g_handle.cleanup() def _collect_teardown(self, libvirt_xml): """ Method to reverse the changes done in _collect_setup. """ self.log.info("Collection Teardown") g_handle = oz.GuestFSManager.GuestFSLibvirtFactory(libvirt_xml, self.libvirt_conn) g_handle.mount_partitions() try: self._image_ssh_teardown_step_1(g_handle) self._image_ssh_teardown_step_2(g_handle) self._image_ssh_teardown_step_3(g_handle) self._image_ssh_teardown_step_4(g_handle) finally: g_handle.cleanup() shutil.rmtree(self.icicle_tmp) def _discover_repo_locality(self, repo_url, guestaddr, certdict): """ Internal method to discover whether a repository is reachable from the guest or not. It is used by customize_repos to decide which method to use to reach the repository. """ # FIXME: Make this work for signed repositories def _customize_repos(self, guestaddr): """ Method to generate and upload custom repository files based on the TDL. """ self.log.debug("Installing additional repository files") for repo in list(self.tdl.repositories.values()): self.guest_execute_command(guestaddr, "echo '%s' > /etc/apt/sources.list.d/%s" % (repo.url.strip('\'"'), repo.name + ".list")) self.guest_execute_command(guestaddr, "apt-get update") def _install_packages(self, guestaddr, packstr): self.guest_execute_command(guestaddr, 'apt-get install -y %s' % (packstr)) def do_icicle(self, guestaddr): """ Method to collect the package information and generate the ICICLE XML. """ self.log.debug("Generating ICICLE") stdout, stderr_unused, retcode_unused = self.guest_execute_command(guestaddr, 'dpkg --get-selections', timeout=30) # the data we get back from dpkg is in the form of: # # \t\t\tinstall # # so we have to strip out the tabs and the install before # passing it on to output_icicle_xml packages = [] for line in stdout.split("\n"): packages.append(line.split("\t")[0]) return self._output_icicle_xml(packages, self.tdl.description) def _get_kernel_from_txt_cfg(self, fetchurl): """ Internal method to download and parse the txt.cfg file from a URL. If the txt.cfg file does not exist, or it does not have the keys that we expect, this method raises an error. """ txtcfgurl = fetchurl + "/debian-installer/" + self.debarch + "/boot-screens/txt.cfg" # first we check if the txt.cfg exists; this throws an exception if # it is missing info = oz.ozutil.http_get_header(txtcfgurl) if info['HTTP-Code'] != 200: raise oz.OzException.OzException("Could not find %s" % (txtcfgurl)) txtcfg = os.path.join(self.icicle_tmp, "txt.cfg") self.log.debug("Going to write txt.cfg to %s", txtcfg) txtcfgfd = os.open(txtcfg, os.O_RDWR | os.O_CREAT | os.O_TRUNC) os.unlink(txtcfg) fp = os.fdopen(txtcfgfd) try: self.log.debug("Trying to get txt.cfg from " + txtcfgurl) oz.ozutil.http_download_file(txtcfgurl, txtcfgfd, False, self.log) # if we made it here, the txt.cfg existed. Parse it and # find out the location of the kernel and ramdisk self.log.debug("Got txt.cfg, parsing") os.lseek(txtcfgfd, 0, os.SEEK_SET) # FIXME: This pattern doesn't match for Debian grub_pattern = re.compile(r"^default\s*(?P\w+)$.*" r"^label\s*(?P=default_entry)$.*" r"^\s*kernel\s*(?P\S+)$.*" r"initrd=(?P\S+).*" r"^label", re.DOTALL | re.MULTILINE) config_text = fp.read() match = re.search(grub_pattern, config_text) kernel = match.group('kernel') initrd = match.group('initrd') finally: fp.close() if kernel is None or initrd is None: raise oz.OzException.OzException("Empty kernel or initrd") self.log.debug("Returning kernel %s and initrd %s", kernel, initrd) return (kernel, initrd) def _gzip_file(self, inputfile, outputmode): """ Internal method to gzip a file and write it to the initrd. """ f = open(inputfile, 'rb') gzf = gzip.GzipFile(self.initrdfname, mode=outputmode) try: gzf.writelines(f) gzf.close() f.close() except: # there is a bit of asymmetry here in that OSs that support cpio # archives have the initial initrdfname copied in the higher level # function, but we delete it here. OSs that don't support cpio, # though, get the initrd created right here. C'est la vie os.unlink(self.initrdfname) raise def _create_cpio_initrd(self, preseedpath): """ Internal method to create a modified CPIO initrd """ extrafname = os.path.join(self.icicle_tmp, "extra.cpio") self.log.debug("Writing cpio to %s", extrafname) cpiofiledict = {} cpiofiledict[preseedpath] = 'preseed.cfg' oz.ozutil.write_cpio(cpiofiledict, extrafname) try: shutil.copyfile(self.initrdcache, self.initrdfname) self._gzip_file(extrafname, 'ab') finally: os.unlink(extrafname) def _initrd_inject_preseed(self, fetchurl, force_download): """ Internal method to download and inject a preseed file into an initrd. """ # we first see if we can use direct kernel booting, as that is # faster than downloading the ISO kernel = None initrd = None try: (kernel, initrd) = self._get_kernel_from_txt_cfg(fetchurl) except Exception: pass if kernel is None: self.log.debug("Kernel was None, trying debian-installer/%s/linux", self.debarch) # we couldn't find the kernel in the txt.cfg, so try a # hard-coded path kernel = "debian-installer/%s/linux" % (self.debarch) if initrd is None: self.log.debug("Initrd was None, trying debian-installer/%s/initrd.gz", self.debarch) # we couldn't find the initrd in the txt.cfg, so try a # hard-coded path initrd = "debian-installer/%s/initrd.gz" % (self.debarch) (fd, outdir) = oz.ozutil.open_locked_file(self.kernelcache) try: self._get_original_media('/'.join([self.url.rstrip('/'), kernel.lstrip('/')]), fd, outdir, force_download) # if we made it here, then we can copy the kernel into place shutil.copyfile(self.kernelcache, self.kernelfname) finally: os.close(fd) (fd, outdir) = oz.ozutil.open_locked_file(self.initrdcache) try: try: self._get_original_media('/'.join([self.url.rstrip('/'), initrd.lstrip('/')]), fd, outdir, force_download) except: os.unlink(self.kernelfname) raise finally: os.close(fd) try: preseedpath = os.path.join(self.icicle_tmp, "preseed.cfg") self._copy_preseed(preseedpath) try: self._create_cpio_initrd(preseedpath) finally: os.unlink(preseedpath) except: os.unlink(self.kernelfname) raise def _remove_repos(self, guestaddr): # FIXME: until we switch over to doing repository add by hand (instead # of using add-apt-repository), we can't really reliably implement this pass def generate_install_media(self, force_download=False, customize_or_icicle=False): """ Method to generate the install media for Debian based operating systems. If force_download is False (the default), then the original media will only be fetched if it is not cached locally. If force_download is True, then the original media will be downloaded regardless of whether it is cached locally. """ fetchurl = self.url if self.tdl.installtype == 'url': # set the fetchurl up-front so that if the OS doesn't support # initrd injection, or the injection fails for some reason, we # fall back to the mini.iso fetchurl += "/mini.iso" self.log.debug("Installtype is URL, trying to do direct kernel boot") try: return self._initrd_inject_preseed(self.url, force_download) except Exception as err: # if any of the above failed, we couldn't use the direct # kernel/initrd build method. Fall back to trying to fetch # the mini.iso instead self.log.debug("Could not do direct boot, fetching mini.iso instead (the following error message is useful for bug reports, but can be ignored)") self.log.debug(err) return self._iso_generate_install_media(fetchurl, force_download, customize_or_icicle) def cleanup_install(self): """ Method to cleanup any transient install data. """ self.log.info("Cleaning up after install") for fname in [self.output_iso, self.initrdfname, self.kernelfname]: try: os.unlink(fname) except Exception: pass if not self.cache_original_media: for fname in [self.orig_iso, self.kernelcache, self.initrdcache]: try: os.unlink(fname) except Exception: pass def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for Debian installs. """ if tdl.update in version_to_config.keys(): return DebianGuest(tdl, config, auto, output_disk, netdev, diskbus, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "Debian: " + ", ".join(sorted(version_to_config.keys())) oz-0.17.0/oz/Fedora.py000066400000000000000000000370661344320532700144500ustar00rootroot00000000000000# Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2018 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Fedora installation """ import os import oz.OzException import oz.RedHat import oz.ozutil class FedoraConfiguration(object): """ The configuration class for Fedora. """ def __init__(self, has_virtio_channel, use_yum, use_dev_cdrom_device, createpart, directkernel, default_netdev, default_diskbus, brokenisomethod, haverepo): self._has_virtio_channel = has_virtio_channel self._use_yum = use_yum self._use_dev_cdrom_device = use_dev_cdrom_device self._createpart = createpart self._directkernel = directkernel self._default_netdev = default_netdev self._default_diskbus = default_diskbus self._brokenisomethod = brokenisomethod self._haverepo = haverepo @property def has_virtio_channel(self): """ Property method for whether this Fedora version has a virtio channel. """ return self._has_virtio_channel @property def use_yum(self): """ Property method for whether this Fedora version uses yum or dnf. """ return self._use_yum @property def use_dev_cdrom_device(self): """ Property method for whether this Fedora version uses /dev/cdrom on the kickstart command-line. """ return self._use_dev_cdrom_device @property def createpart(self): """ Property method for whether to create partitions before installation. """ return self._createpart @property def directkernel(self): """ Property method for whether this Fedora version supports direct kernel boot. """ return self._directkernel @property def default_netdev(self): """ Property method for the default netdev for this Fedora version. """ return self._default_netdev @property def default_diskbus(self): """ Property method for the default diskbus for this Fedora version. """ return self._default_diskbus @property def brokenisomethod(self): """ Property method for whether to add method to the anaconda install line. """ return self._brokenisomethod @property def haverepo(self): """ Property method for whether to use 'repo=' or 'method=' on the anaconda install line. """ return self._haverepo version_to_config = { '29': FedoraConfiguration(has_virtio_channel=True, use_yum=False, use_dev_cdrom_device=True, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=False, haverepo=True), '28': FedoraConfiguration(has_virtio_channel=True, use_yum=False, use_dev_cdrom_device=True, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=False, haverepo=True), '27': FedoraConfiguration(has_virtio_channel=True, use_yum=False, use_dev_cdrom_device=True, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=False, haverepo=True), '26': FedoraConfiguration(has_virtio_channel=True, use_yum=False, use_dev_cdrom_device=True, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=False, haverepo=True), '25': FedoraConfiguration(has_virtio_channel=True, use_yum=False, use_dev_cdrom_device=True, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=False, haverepo=True), '24': FedoraConfiguration(has_virtio_channel=True, use_yum=False, use_dev_cdrom_device=True, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=False, haverepo=True), '23': FedoraConfiguration(has_virtio_channel=True, use_yum=False, use_dev_cdrom_device=True, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=False, haverepo=True), '22': FedoraConfiguration(has_virtio_channel=True, use_yum=False, use_dev_cdrom_device=True, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=False, haverepo=True), '21': FedoraConfiguration(has_virtio_channel=True, use_yum=True, use_dev_cdrom_device=True, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=False, haverepo=True), '20': FedoraConfiguration(has_virtio_channel=True, use_yum=True, use_dev_cdrom_device=True, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=False, haverepo=True), '19': FedoraConfiguration(has_virtio_channel=True, use_yum=True, use_dev_cdrom_device=True, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=False, haverepo=True), '18': FedoraConfiguration(has_virtio_channel=True, use_yum=True, use_dev_cdrom_device=True, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=True, haverepo=True), '17': FedoraConfiguration(has_virtio_channel=True, use_yum=True, use_dev_cdrom_device=True, createpart=False, directkernel=None, default_netdev='virtio', default_diskbus='virtio', brokenisomethod=True, haverepo=True), '16': FedoraConfiguration(has_virtio_channel=True, use_yum=True, use_dev_cdrom_device=False, createpart=False, directkernel=None, default_netdev='virtio', default_diskbus='virtio', brokenisomethod=True, haverepo=True), '15': FedoraConfiguration(has_virtio_channel=True, use_yum=True, use_dev_cdrom_device=False, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=True, haverepo=True), '14': FedoraConfiguration(has_virtio_channel=True, use_yum=True, use_dev_cdrom_device=False, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=True, haverepo=True), '13': FedoraConfiguration(has_virtio_channel=False, use_yum=True, use_dev_cdrom_device=False, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=True, haverepo=True), '12': FedoraConfiguration(has_virtio_channel=False, use_yum=True, use_dev_cdrom_device=False, createpart=True, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=True, haverepo=True), '11': FedoraConfiguration(has_virtio_channel=False, use_yum=True, use_dev_cdrom_device=False, createpart=True, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=True, haverepo=True), '10': FedoraConfiguration(has_virtio_channel=False, use_yum=True, use_dev_cdrom_device=False, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=True, haverepo=True), '9': FedoraConfiguration(has_virtio_channel=False, use_yum=True, use_dev_cdrom_device=False, createpart=False, directkernel="cpio", default_netdev='virtio', default_diskbus='virtio', brokenisomethod=False, haverepo=True), '8': FedoraConfiguration(has_virtio_channel=False, use_yum=True, use_dev_cdrom_device=False, createpart=False, directkernel="cpio", default_netdev=None, default_diskbus=None, brokenisomethod=False, haverepo=False), '7': FedoraConfiguration(has_virtio_channel=False, use_yum=True, use_dev_cdrom_device=False, createpart=False, directkernel="cpio", default_netdev=None, default_diskbus=None, brokenisomethod=False, haverepo=False), } class FedoraGuest(oz.RedHat.RedHatLinuxCDYumGuest): """ Class for Fedora 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, and 29 installation. """ # Note that the 'brokenisomethod' and 'haverepo' parameters are completely # ignored now; we leave it in place for backwards API compatibility. def __init__(self, tdl, config, auto, nicmodel, haverepo, diskbus, # pylint: disable=unused-argument brokenisomethod, output_disk=None, macaddress=None, # pylint: disable=unused-argument assumed_update=None): self.config = version_to_config[tdl.update] if nicmodel is None: nicmodel = self.config.default_netdev if diskbus is None: diskbus = self.config.default_diskbus self.assumed_update = assumed_update # Prior to Fedora-22, we use yum; on F-22 and later, we use dnf. oz.RedHat.RedHatLinuxCDYumGuest.__init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, True, True, self.config.directkernel, macaddress, self.config.use_yum) if self.assumed_update is not None: self.log.warning("==== WARN: TDL contains Fedora update %s, which is newer than Oz knows about; pretending this is Fedora %s, but this may fail ====", tdl.update, assumed_update) if self.config.has_virtio_channel: self.virtio_channel_name = 'org.fedoraproject.anaconda.log.0' def _modify_iso(self): """ Method to modify the ISO for autoinstallation. """ self._copy_kickstart(os.path.join(self.iso_contents, "ks.cfg")) if self.config.use_dev_cdrom_device: initrdline = " append initrd=initrd.img ks=cdrom:/dev/cdrom:/ks.cfg" else: initrdline = " append initrd=initrd.img ks=cdrom:/ks.cfg" if self.tdl.installtype == "url": if self.config.haverepo: initrdline += " repo=" else: initrdline += " method=" initrdline += self.url else: # if the installtype is iso, then due to a bug in anaconda we leave # out the method completely if not self.config.brokenisomethod: initrdline += " method=cdrom:/dev/cdrom" self._modify_isolinux(initrdline) def generate_diskimage(self, size=10, force=False): """ Method to generate a diskimage. By default, a blank diskimage of 10GB will be created; the caller can override this with the size parameter, specified in GB. If force is False (the default), then a diskimage will not be created if a cached JEOS is found. If force is True, a diskimage will be created regardless of whether a cached JEOS exists. See the oz-install man page for more information about JEOS caching. """ # If given a blank diskimage, Fedora 11/12 stops very early in # install with a message about losing all of your data on the # drive (it differs between them). # # To avoid that message, just create a partition table that spans # the entire disk return self._internal_generate_diskimage(size, force, self.config.createpart) def get_auto_path(self): """ Method to create the correct path to the Fedora kickstart files. """ # If we are doing our best with an unknown Fedora update, use the # newest known auto file; otherwise, do the usual thing. if self.assumed_update is not None: return oz.ozutil.generate_full_auto_path(self.tdl.distro + self.assumed_update + ".auto") return oz.ozutil.generate_full_auto_path(self.tdl.distro + self.tdl.update + ".auto") def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for Fedora installs. """ newest = sorted(version_to_config.keys(), key=int)[-1] if tdl.update == 'rawhide' or int(tdl.update) > int(newest): return FedoraGuest(tdl, config, auto, netdev, True, diskbus, False, output_disk, macaddress, newest) if tdl.update in version_to_config.keys(): return FedoraGuest(tdl, config, auto, netdev, True, diskbus, False, output_disk, macaddress, None) def get_supported_string(): """ Return supported versions as a string. """ return "Fedora: " + ", ".join(sorted(version_to_config.keys(), key=int)) oz-0.17.0/oz/FedoraCore.py000066400000000000000000000067151344320532700152560ustar00rootroot00000000000000# Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2018 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Fedora Core installation """ import os import oz.OzException import oz.RedHat import oz.ozutil class FedoraCoreConfiguration(object): """ Configuration class for Fedora Core installation. """ def __init__(self, initrdtype): self._initrdtype = initrdtype @property def initrdtype(self): """ Property method for the type of initrd this version of Fedora uses ('cpio' or 'ext2'). """ return self._initrdtype version_to_config = { '6': FedoraCoreConfiguration(initrdtype='cpio'), '5': FedoraCoreConfiguration(initrdtype='cpio'), '4': FedoraCoreConfiguration(initrdtype='cpio'), '3': FedoraCoreConfiguration(initrdtype='ext2'), '2': FedoraCoreConfiguration(initrdtype='ext2'), '1': FedoraCoreConfiguration(initrdtype='ext2'), } class FedoraCoreGuest(oz.RedHat.RedHatLinuxCDGuest): """ Class for Fedora Core 1, 2, 3, 4, 5, and 6 installation. """ def __init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress): self.config = version_to_config[tdl.update] oz.RedHat.RedHatLinuxCDGuest.__init__(self, tdl, config, auto, output_disk, netdev, diskbus, True, True, self.config.initrdtype, macaddress) # FIXME: if doing an ISO install, we have to check that the ISO passed # in is the DVD, not the CD (since we can't change disks midway) def _modify_iso(self): """ Method to modify the ISO for autoinstallation. """ self._copy_kickstart(os.path.join(self.iso_contents, "ks.cfg")) initrdline = " append initrd=initrd.img ks=cdrom:/ks.cfg method=" if self.tdl.installtype == "url": initrdline += self.url else: initrdline += "cdrom:/dev/cdrom" self._modify_isolinux(initrdline) def get_auto_path(self): """ Method to create the correct path to the Fedora Core kickstart files. """ return oz.ozutil.generate_full_auto_path("FedoraCore" + self.tdl.update + ".auto") def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for Fedora Core installs. """ if tdl.update in version_to_config.keys(): return FedoraCoreGuest(tdl, config, auto, output_disk, netdev, diskbus, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "Fedora Core: " + ", ".join(sorted(version_to_config.keys())) oz-0.17.0/oz/FreeBSD.py000066400000000000000000000122471344320532700144540ustar00rootroot00000000000000# Copyright (C) 2013 harmw # Copyright (C) 2013-2017 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ FreeBSD installation """ import os import oz.Guest import oz.OzException import oz.ozutil class FreeBSDConfiguration(object): """ Configuration class for FreeBSD. """ def __init__(self, default_netdev, default_diskbus): self._default_netdev = default_netdev self._default_diskbus = default_diskbus @property def default_netdev(self): """ Property method for the default netdev for this FreeBSD version. """ return self._default_netdev @property def default_diskbus(self): """ Property method for the default diskbus for this FreeBSD version. """ return self._default_diskbus version_to_config = { "11.0": FreeBSDConfiguration(default_netdev='virtio', default_diskbus='virtio'), "10.3": FreeBSDConfiguration(default_netdev='virtio', default_diskbus='virtio'), "10.2": FreeBSDConfiguration(default_netdev='virtio', default_diskbus='virtio'), "10.1": FreeBSDConfiguration(default_netdev='virtio', default_diskbus='virtio'), "10.0": FreeBSDConfiguration(default_netdev='virtio', default_diskbus='virtio'), } class FreeBSD(oz.Guest.CDGuest): """ Class for FreeBSD 10.0, 10.1, 10.2, 10.3 and 11.0 installation. """ def __init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress): self.config = version_to_config[tdl.update] if netdev is None: netdev = self.config.default_netdev if diskbus is None: diskbus = self.config.default_diskbus oz.Guest.CDGuest.__init__(self, tdl, config, auto, output_disk, netdev, "localtime", "usb", diskbus, True, False, macaddress) def _generate_new_iso(self): """ Method to create a new ISO based on the modified CD/DVD. """ self.log.debug("Generating new ISO") oz.ozutil.subprocess_check_output(["genisoimage", "-R", "-no-emul-boot", "-b", "boot/cdboot", "-v", "-o", self.output_iso, self.iso_contents], printfn=self.log.debug) def _modify_iso(self): """ Method to make the boot ISO auto-boot with appropriate parameters. """ self.log.debug("Modifying ISO") def _replace(line): """ Method that is called back from copy_modify_file to replace the rootpassword in the installerconfig file """ keys = { '#ROOTPW#': self.rootpw, } for key in keys: line = line.replace(key, keys[key]) return line # Copy the installconfig file to /etc/ on the iso image so bsdinstall(8) # can use that to do an unattended installation. This rules file # contains both setup rules and a post script. This stage also prepends # the post script with additional commands so it's possible to install # extra packages specified in the .tdl file. outname = os.path.join(self.iso_contents, "etc", "installerconfig") oz.ozutil.copy_modify_file(self.auto, outname, _replace) # Make sure the iso can be mounted at boot, otherwise this error shows # up after booting the kernel: # mountroot: waiting for device /dev/iso9660/FREEBSD_INSTALL ... # Mounting from cd9660:/dev/iso9660/FREEBSD_INSTALL failed with error 19. loaderconf = os.path.join(self.iso_contents, "boot", "loader.conf") with open(loaderconf, 'w') as conf: conf.write('autoboot_delay="0"\n') conf.write('vfs.root.mountfrom="cd9660:/dev/cd0"\n') conf.write('console="vidconsole comconsole"\n') conf.write('kern.panic_reboot_wait_time="-1"\n') def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for FreeBSD installs. """ if tdl.update in version_to_config.keys(): return FreeBSD(tdl, config, auto, output_disk, netdev, diskbus, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "FreeBSD: " + ", ".join(sorted(version_to_config.keys())) oz-0.17.0/oz/Guest.py000066400000000000000000002416071344320532700143350ustar00rootroot00000000000000# Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2018 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Main class for guest installation """ import base64 import errno import hashlib import logging import os import re import shutil import socket import stat import struct import subprocess import tempfile import time try: import urllib.parse as urlparse except ImportError: import urlparse import uuid import M2Crypto import guestfs import libvirt import lxml.etree import oz.GuestFSManager import oz.OzException import oz.ozutil class Guest(object): """ Main class for guest installation. """ def _discover_libvirt_type(self): """ Internal method to discover the libvirt type (qemu, kvm, etc) that we should use, if not specified by the user. """ if self.libvirt_type is None: doc = lxml.etree.fromstring(self.libvirt_conn.getCapabilities()) # Libvirt calls the old intel 32-bit architecture i686, while we # refer to it as i386. Do the mapping here, since we need to look # up the libvirt name. libvirtarch = self.tdl.arch if libvirtarch == 'i386': libvirtarch = 'i686' if len(doc.xpath("/capabilities/guest/arch[@name='%s']/domain[@type='kvm']" % (libvirtarch))) > 0: self.libvirt_type = 'kvm' elif len(doc.xpath("/capabilities/guest/arch[@name='%s']/domain[@type='qemu']" % (libvirtarch))) > 0: self.libvirt_type = 'qemu' else: raise oz.OzException.OzException("This host does not support virtualization type kvm or qemu for TDL arch (%s)" % (libvirtarch)) self.log.debug("Libvirt type is %s", self.libvirt_type) def _discover_libvirt_bridge(self): """ Internal method to discover a libvirt bridge (if necessary). """ if self.bridge_name is None: # otherwise, try to detect a private libvirt bridge for netname in self.libvirt_conn.listNetworks(): network = self.libvirt_conn.networkLookupByName(netname) xml = network.XMLDesc(0) doc = lxml.etree.fromstring(xml) forward = doc.xpath('/network/forward') if len(forward) != 1: self.log.warning("Libvirt network without a forward element, skipping") continue if forward[0].get('mode') == 'nat': ips = doc.xpath('/network/ip') if not ips: self.log.warning("Libvirt network without an IP, skipping") continue for ip in ips: family = ip.get("family") if family is None or family == "ipv4": self.bridge_name = network.bridgeName() break if self.bridge_name is None: raise oz.OzException.OzException("Could not find a libvirt bridge. Please run 'virsh net-start default' to start the default libvirt network, or see http://github.com/clalancette/oz/wiki/Oz-Network-Configuration for more information") self.log.debug("libvirt bridge name is %s", self.bridge_name) def connect_to_libvirt(self): """ Method to connect to libvirt and detect various things about the environment. """ def _libvirt_error_handler(ctxt, err): """ Error callback to suppress libvirt printing to stderr by default. """ pass libvirt.registerErrorHandler(_libvirt_error_handler, 'context') self.libvirt_conn = libvirt.open(self.libvirt_uri) self._discover_libvirt_bridge() self._discover_libvirt_type() def __init__(self, tdl, config, auto, output_disk, nicmodel, clockoffset, mousetype, diskbus, iso_allowed, url_allowed, macaddress): self.tdl = tdl # for backwards compatibility self.name = self.tdl.name if self.tdl.arch not in ["i386", "x86_64", "ppc64", "ppc64le", "aarch64", "armv7l", "s390x"]: raise oz.OzException.OzException("Unsupported guest arch " + self.tdl.arch) if os.uname()[4] in ["i386", "i586", "i686"] and self.tdl.arch == "x86_64": raise oz.OzException.OzException("Host machine is i386, but trying to install x86_64 guest; this cannot work") self.log = logging.getLogger('%s.%s' % (__name__, self.__class__.__name__)) self.uuid = uuid.uuid4() self.macaddr = macaddress if macaddress is None: self.macaddr = oz.ozutil.generate_macaddress() # configuration from 'paths' section self.output_dir = oz.ozutil.config_get_path(config, 'paths', 'output_dir', oz.ozutil.default_output_dir()) oz.ozutil.mkdir_p(self.output_dir) self.data_dir = oz.ozutil.config_get_path(config, 'paths', 'data_dir', oz.ozutil.default_data_dir()) self.screenshot_dir = oz.ozutil.config_get_path(config, 'paths', 'screenshot_dir', oz.ozutil.default_screenshot_dir()) self.sshprivkey = oz.ozutil.config_get_path(config, 'paths', 'sshprivkey', oz.ozutil.default_sshprivkey()) # configuration from 'libvirt' section self.libvirt_uri = oz.ozutil.config_get_key(config, 'libvirt', 'uri', 'qemu:///system') self.libvirt_type = oz.ozutil.config_get_key(config, 'libvirt', 'type', None) self.bridge_name = oz.ozutil.config_get_key(config, 'libvirt', 'bridge_name', None) self.install_cpus = oz.ozutil.config_get_key(config, 'libvirt', 'cpus', 1) # the memory in the configuration file is specified in megabytes, but # libvirt expects kilobytes, so multiply by 1024 if self.tdl.arch in ["ppc64", "ppc64le"]: # ppc64 needs at least 2Gb RAM self.install_memory = int(oz.ozutil.config_get_key(config, 'libvirt', 'memory', 2048)) * 1024 else: self.install_memory = int(oz.ozutil.config_get_key(config, 'libvirt', 'memory', 1024)) * 1024 self.image_type = oz.ozutil.config_get_key(config, 'libvirt', 'image_type', 'raw') # configuration from 'cache' section self.cache_original_media = oz.ozutil.config_get_boolean_key(config, 'cache', 'original_media', True) self.cache_modified_media = oz.ozutil.config_get_boolean_key(config, 'cache', 'modified_media', False) self.cache_jeos = oz.ozutil.config_get_boolean_key(config, 'cache', 'jeos', False) self.jeos_cache_dir = os.path.join(self.data_dir, "jeos") # configuration of "safe" ICICLE generation option self.safe_icicle_gen = oz.ozutil.config_get_boolean_key(config, 'icicle', 'safe_generation', False) # configuration of 'timeouts' section self.default_install_timeout = int(oz.ozutil.config_get_key(config, 'timeouts', 'install', 1200)) self.inactivity_timeout = int(oz.ozutil.config_get_key(config, 'timeouts', 'inactivity', 300)) self.boot_timeout = int(oz.ozutil.config_get_key(config, 'timeouts', 'boot', 300)) self.shutdown_timeout = int(oz.ozutil.config_get_key(config, 'timeouts', 'shutdown', 90)) # only pull a cached JEOS if it was built with the correct image type jeos_extension = self.image_type if self.image_type == 'raw': # backwards compatible jeos_extension = 'dsk' self.jeos_filename = os.path.join(self.jeos_cache_dir, self.tdl.distro + self.tdl.update + self.tdl.arch + '.' + jeos_extension) self.diskimage = output_disk if self.diskimage is None: ext = "." + self.image_type # compatibility with older versions of Oz if self.image_type == 'raw': ext = '.dsk' self.diskimage = os.path.join(self.output_dir, self.tdl.name + ext) if not os.path.isabs(self.diskimage): raise oz.OzException.OzException("Output disk image must be an absolute path") self.icicle_tmp = os.path.join(self.data_dir, "icicletmp", self.tdl.name) self.listen_port = oz.ozutil.get_free_port() self.console_listen_port = oz.ozutil.get_free_port() self.connect_to_libvirt() self.nicmodel = nicmodel if self.nicmodel is None: self.nicmodel = "rtl8139" self.clockoffset = clockoffset if self.clockoffset is None: self.clockoffset = "utc" self.mousetype = mousetype if self.mousetype is None: self.mousetype = "ps2" if diskbus is None or diskbus == "ide": self.disk_bus = "ide" self.disk_dev = "hda" elif diskbus == "virtio": self.disk_bus = "virtio" self.disk_dev = "vda" else: raise oz.OzException.OzException("Unknown diskbus type " + diskbus) self.rootpw = self.tdl.rootpw if self.rootpw is None: self.rootpw = "ozrootpw" try: # PPC64 directory structure differs from x86; disabling ISO boots if self.tdl.arch not in ["ppc64", "ppc64le"]: self.url = self._check_url(iso=iso_allowed, url=url_allowed) else: self.url = self._check_url(iso=False, url=url_allowed) except: self.log.debug("Install URL validation failed:", exc_info=True) raise oz.ozutil.mkdir_p(self.icicle_tmp) self.disksize = 10 if self.tdl.disksize is not None: self.disksize = int(self.tdl.disksize) self.auto = auto if self.auto is None: self.auto = self.get_auto_path() self.log.debug("Name: %s, UUID: %s", self.tdl.name, self.uuid) self.log.debug("MAC: %s, distro: %s", self.macaddr, self.tdl.distro) self.log.debug("update: %s, arch: %s, diskimage: %s", self.tdl.update, self.tdl.arch, self.diskimage) self.log.debug("nicmodel: %s, clockoffset: %s", self.nicmodel, self.clockoffset) self.log.debug("mousetype: %s, disk_bus: %s, disk_dev: %s", self.mousetype, self.disk_bus, self.disk_dev) self.log.debug("icicletmp: %s, listen_port: %d", self.icicle_tmp, self.listen_port) self.log.debug("console_listen_port: %s", self.console_listen_port) def image_name(self): """ Name of the image being built. """ return self.name def output_image_path(self): """ Path to the created image file. """ return self.diskimage def get_auto_path(self): """ Base method used to generate the path to the automatic installation file (kickstart, preseed, winnt.sif, etc). Some subclasses override override this method to provide support for additional aliases. """ return oz.ozutil.generate_full_auto_path(self.tdl.distro + self.tdl.update + ".auto") def default_auto_file(self): """ Method to determine if the auto file is the default one or user-provided. """ return self.auto == self.get_auto_path() def cleanup_old_guest(self): """ Method to completely clean up an old guest, including deleting the disk file. Use with caution! """ self.log.info("Cleaning up guest named %s", self.tdl.name) try: dom = self.libvirt_conn.lookupByName(self.tdl.name) try: dom.destroy() except libvirt.libvirtError: pass dom.undefine() except libvirt.libvirtError: pass try: os.unlink(self.diskimage) except OSError as err: if err.errno != errno.ENOENT: raise def check_for_guest_conflict(self): """ Method to check if any of our future actions will conflict with an already existing guest. In particular, if a guest with the same name, UUID, or diskimage already exists, this throws an exception. """ self.log.info("Checking for guest conflicts with %s", self.tdl.name) try: self.libvirt_conn.lookupByName(self.tdl.name) raise oz.OzException.OzException("Domain with name %s already exists" % (self.tdl.name)) except libvirt.libvirtError: pass try: self.libvirt_conn.lookupByUUID(str(self.uuid)) raise oz.OzException.OzException("Domain with UUID %s already exists" % (self.uuid)) except libvirt.libvirtError: pass if os.access(self.diskimage, os.F_OK): raise oz.OzException.OzException("Diskimage %s already exists" % (self.diskimage)) # the next 4 methods are intended to be overridden by the individual # OS backends; raise an error if they are called but not implemented def generate_install_media(self, force_download=False, customize_or_icicle=False): """ Base method for generating the install media for operating system installation. This is expected to be overridden by all subclasses. """ raise oz.OzException.OzException("Install media for %s%s is not implemented, install cannot continue" % (self.tdl.distro, self.tdl.update)) def customize(self, libvirt_xml): """ Base method for customizing the operating system. This is expected to be overridden by subclasses that support customization. """ raise oz.OzException.OzException("Customization for %s%s is not implemented" % (self.tdl.distro, self.tdl.update)) def generate_icicle(self, libvirt_xml): """ Base method for generating the ICICLE manifest from the operating system. This is expect to be overridden by subclasses that support ICICLE generation. """ raise oz.OzException.OzException("ICICLE generation for %s%s is not implemented" % (self.tdl.distro, self.tdl.update)) # this method is intended to be an optimization if the user wants to do # both customize and generate_icicle def customize_and_generate_icicle(self, libvirt_xml): """ Base method for doing operating system customization and ICICLE generation. This is an optimization over doing the two steps separately for those classes that support customization and ICICLE generation. """ raise oz.OzException.OzException("Customization and ICICLE generate for %s%s is not implemented" % (self.tdl.distro, self.tdl.update)) class _InstallDev(object): """ Class to hold information about an installation device. """ def __init__(self, devicetype, path, bus): self.devicetype = devicetype self.path = path self.bus = bus def _generate_serial_xml(self, devices): """ Method to generate the serial portion of the libvirt XML. """ serial = oz.ozutil.lxml_subelement(devices, "serial", None, {'type': 'tcp'}) oz.ozutil.lxml_subelement(serial, "source", None, {'mode': 'bind', 'host': '127.0.0.1', 'service': str(self.listen_port)}) oz.ozutil.lxml_subelement(serial, "protocol", None, {'type': 'raw'}) target = oz.ozutil.lxml_subelement(serial, "target", None, {'port': '1'}) if self.tdl.arch == 's390x': # use a different console, as sclp can be used as most once target.set('type', 'sclp-serial') oz.ozutil.lxml_subelement(target, "model", None, {'name': 'sclplmconsole'}) def _generate_virtio_channel(self, devices, name): """ Method to generate libvirt XML for a virtio channel. """ virtio = oz.ozutil.lxml_subelement(devices, "channel", None, {'type': 'tcp'}) oz.ozutil.lxml_subelement(virtio, "source", None, {'mode': 'bind', 'host': '127.0.0.1', 'service': str(self.console_listen_port)}) oz.ozutil.lxml_subelement(virtio, "target", None, {"type": "virtio", "name": name}) def _generate_xml(self, bootdev, installdev, kernel=None, initrd=None, cmdline=None, virtio_channel_name=None): """ Method to generate libvirt XML useful for installation. """ self.log.info("Generate XML for guest %s with bootdev %s", self.tdl.name, bootdev) # top-level domain element domain = lxml.etree.Element("domain", type=self.libvirt_type) # name element oz.ozutil.lxml_subelement(domain, "name", self.tdl.name) # memory elements oz.ozutil.lxml_subelement(domain, "memory", str(self.install_memory)) oz.ozutil.lxml_subelement(domain, "currentMemory", str(self.install_memory)) # uuid oz.ozutil.lxml_subelement(domain, "uuid", str(self.uuid)) # clock offset oz.ozutil.lxml_subelement(domain, "clock", None, {'offset': self.clockoffset}) # vcpu oz.ozutil.lxml_subelement(domain, "vcpu", str(self.install_cpus)) # features features = oz.ozutil.lxml_subelement(domain, "features") oz.ozutil.lxml_subelement(features, "acpi") oz.ozutil.lxml_subelement(features, "apic") oz.ozutil.lxml_subelement(features, "pae") # CPU if self.tdl.arch in ["aarch64", "armv7l"] and self.libvirt_type == "kvm": # Possibly related to BZ 1171501 - need host passthrough for aarch64 and arm with kvm cpu = oz.ozutil.lxml_subelement(domain, "cpu", None, {'mode': 'custom', 'match': 'exact'}) oz.ozutil.lxml_subelement(cpu, "model", "host", {'fallback': 'allow'}) # os osNode = oz.ozutil.lxml_subelement(domain, "os") mods = None if self.tdl.arch in ["aarch64", "armv7l"]: mods = {'arch': self.tdl.arch, 'machine': 'virt'} oz.ozutil.lxml_subelement(osNode, "type", "hvm", mods) if bootdev: oz.ozutil.lxml_subelement(osNode, "boot", None, {'dev': bootdev}) if kernel: oz.ozutil.lxml_subelement(osNode, "kernel", kernel) if initrd: oz.ozutil.lxml_subelement(osNode, "initrd", initrd) if cmdline: if self.tdl.arch == "armv7l": cmdline += " console=ttyAMA0" oz.ozutil.lxml_subelement(osNode, "cmdline", cmdline) if self.tdl.arch == "aarch64": loader, nvram = oz.ozutil.find_uefi_firmware(self.tdl.arch) oz.ozutil.lxml_subelement(osNode, "loader", loader, {'readonly': 'yes', 'type': 'pflash'}) oz.ozutil.lxml_subelement(osNode, "nvram", None, {'template': nvram}) # poweroff, reboot, crash oz.ozutil.lxml_subelement(domain, "on_poweroff", "destroy") oz.ozutil.lxml_subelement(domain, "on_reboot", "destroy") oz.ozutil.lxml_subelement(domain, "on_crash", "destroy") # devices devices = oz.ozutil.lxml_subelement(domain, "devices") # graphics if self.tdl.arch not in ["aarch64", "armv7l", "s390x"]: # qemu for arm/aarch64/s390x does not support a graphical console - amazingly oz.ozutil.lxml_subelement(devices, "graphics", None, {'port': '-1', 'type': 'vnc'}) # network interface = oz.ozutil.lxml_subelement(devices, "interface", None, {'type': 'bridge'}) oz.ozutil.lxml_subelement(interface, "source", None, {'bridge': self.bridge_name}) oz.ozutil.lxml_subelement(interface, "mac", None, {'address': self.macaddr}) oz.ozutil.lxml_subelement(interface, "model", None, {'type': self.nicmodel}) # input mousedict = {'bus': self.mousetype} if self.mousetype == "ps2": mousedict['type'] = 'mouse' elif self.mousetype == "usb": mousedict['type'] = 'tablet' oz.ozutil.lxml_subelement(devices, "input", None, mousedict) # serial console pseudo TTY console = oz.ozutil.lxml_subelement(devices, "serial", None, {'type': 'pty'}) oz.ozutil.lxml_subelement(console, "target", None, {'port': '0'}) # serial self._generate_serial_xml(devices) # virtio if virtio_channel_name is not None: self._generate_virtio_channel(devices, virtio_channel_name) self.has_consolelog = True else: self.has_consolelog = False # virtio-rng virtioRNG = oz.ozutil.lxml_subelement(devices, "rng", None, {'model': 'virtio'}) oz.ozutil.lxml_subelement(virtioRNG, "rate", None, {'bytes': '1024', 'period': '1000'}) oz.ozutil.lxml_subelement(virtioRNG, "backend", "/dev/random", {'model': 'random'}) # boot disk bootDisk = oz.ozutil.lxml_subelement(devices, "disk", None, {'device': 'disk', 'type': 'file'}) oz.ozutil.lxml_subelement(bootDisk, "target", None, {'dev': self.disk_dev, 'bus': self.disk_bus}) oz.ozutil.lxml_subelement(bootDisk, "source", None, {'file': self.diskimage}) oz.ozutil.lxml_subelement(bootDisk, "driver", None, {'name': 'qemu', 'type': self.image_type}) # install disk (if any) if not installdev: installdev_list = [] elif not isinstance(installdev, list): installdev_list = [installdev] else: installdev_list = installdev for idev in installdev_list: install = oz.ozutil.lxml_subelement(devices, "disk", None, {'type': 'file', 'device': idev.devicetype}) oz.ozutil.lxml_subelement(install, "source", None, {'file': idev.path}) oz.ozutil.lxml_subelement(install, "target", None, {'dev': idev.bus}) xml = lxml.etree.tostring(domain, pretty_print=True, encoding="unicode") self.log.debug("Generated XML:\n%s", xml) return xml def _internal_generate_diskimage(self, size=10, force=False, create_partition=False, image_filename=None, backing_filename=None): """ Internal method to generate a diskimage. Set image_filename to override the default selection of self.diskimage Set backing_filename to force diskimage to be a writeable qcow2 snapshot backed by "backing_filename" which can be either a raw image or a qcow2 image. """ if not force and os.access(self.jeos_filename, os.F_OK): # if we found a cached JEOS, we don't need to do anything here; # we'll copy the JEOS itself later on return self.log.info("Generating %dGB diskimage for %s", size, self.tdl.name) diskimage = self.diskimage if image_filename: diskimage = image_filename directory = os.path.dirname(diskimage) filename = os.path.basename(diskimage) # create the pool XML pool = lxml.etree.Element("pool", type="dir") oz.ozutil.lxml_subelement(pool, "name", "oztempdir" + str(uuid.uuid4())) target = oz.ozutil.lxml_subelement(pool, "target") oz.ozutil.lxml_subelement(target, "path", directory) pool_xml = lxml.etree.tostring(pool, pretty_print=True, encoding="unicode") # create the volume XML vol = lxml.etree.Element("volume", type="file") oz.ozutil.lxml_subelement(vol, "name", filename) oz.ozutil.lxml_subelement(vol, "allocation", "0") target = oz.ozutil.lxml_subelement(vol, "target") imgtype = self.image_type if backing_filename: # Only qcow2 supports image creation using a backing file imgtype = "qcow2" oz.ozutil.lxml_subelement(target, "format", None, {"type": imgtype}) # FIXME: this makes the permissions insecure, but is needed since # libvirt launches guests as qemu:qemu permissions = oz.ozutil.lxml_subelement(target, "permissions") oz.ozutil.lxml_subelement(permissions, "mode", "0666") capacity = size if backing_filename: # FIXME: Revisit as BZ 958510 evolves # At the moment libvirt forces us to specify a size rather than # assuming we want to inherit the size of our backing file. # It may be possible to avoid this inspection step if libvirt # allows creation without an explicit capacity element. qcow_size = oz.ozutil.check_qcow_size(backing_filename) if qcow_size: capacity = qcow_size / 1024 / 1024 / 1024 backing_format = 'qcow2' else: capacity = os.path.getsize(backing_filename) / 1024 / 1024 / 1024 backing_format = 'raw' backing = oz.ozutil.lxml_subelement(vol, "backingStore") oz.ozutil.lxml_subelement(backing, "path", backing_filename) oz.ozutil.lxml_subelement(backing, "format", None, {"type": backing_format}) oz.ozutil.lxml_subelement(vol, "capacity", str(capacity), {'unit': 'G'}) vol_xml = lxml.etree.tostring(vol, pretty_print=True, encoding="unicode") # sigh. Yes, this is racy; if a pool is defined during this loop, we # might miss it. I'm not quite sure how to do it better, and in any # case we don't expect that to happen often started = False found = False for poolname in self.libvirt_conn.listDefinedStoragePools() + self.libvirt_conn.listStoragePools(): pool = self.libvirt_conn.storagePoolLookupByName(poolname) doc = lxml.etree.fromstring(pool.XMLDesc(0)) res = doc.xpath('/pool/target/path') if len(res) != 1: continue if res[0].text == directory: # OK, this pool manages that directory; make sure it is running found = True if not pool.isActive(): pool.create(0) started = True break if not found: pool = self.libvirt_conn.storagePoolCreateXML(pool_xml, 0) started = True def _vol_create_cb(args): """ The callback used for waiting on volume creation to complete. """ pool = args[0] vol_xml = args[1] try: pool.refresh(0) except libvirt.libvirtError as e: if e.get_error_code() == libvirt.VIR_ERR_INTERNAL_ERROR: # libvirt returns a VIR_ERR_INTERNAL_ERROR when the # refresh fails. return False raise # this is a bit complicated, because of the cases that can # happen. The cases are: # # 1. The volume did not exist. In this case, storageVolLookupByName() # throws an exception, which we just ignore. We then go on to # create the volume # 2. The volume did exist. In this case, storageVolLookupByName() # returns a valid volume object, and then we delete the volume try: vol = pool.storageVolLookupByName(filename) vol.delete(0) except libvirt.libvirtError as e: if e.get_error_code() != libvirt.VIR_ERR_NO_STORAGE_VOL: raise pool.createXML(vol_xml, 0) return True try: # libvirt will not allow us to do certain operations (like a refresh) # while other operations are happening on a pool (like creating a new # volume). Since we don't exactly know which other processes might be # running on the system, we retry for a while until our refresh and # volume creation succeed. In most cases these operations will be fast. oz.ozutil.timed_loop(90, _vol_create_cb, "Waiting for volume to be created", (pool, vol_xml)) finally: if started: pool.destroy() if create_partition: if backing_filename: self.log.warning("Asked to create partition against a copy-on-write snapshot - ignoring") else: g_handle = oz.GuestFSManager.GuestFS(self.diskimage, self.image_type) g_handle.create_msdos_partition_table() g_handle.cleanup() def generate_diskimage(self, size=10, force=False): """ Method to generate a diskimage. By default, a blank diskimage of 10GB will be created; the caller can override this with the size parameter, specified in GB. If force is False (the default), then a diskimage will not be created if a cached JEOS is found. If force is True, a diskimage will be created regardless of whether a cached JEOS exists. See the oz-install man page for more information about JEOS caching. """ return self._internal_generate_diskimage(size, force, False) def _get_disks_and_interfaces(self, libvirt_xml): """ Method to figure out the disks and interfaces attached to a domain. The method returns two lists: the first is a list of disk devices (like hda, hdb, etc), and the second is a list of network devices (like vnet0, vnet1, etc). """ doc = lxml.etree.fromstring(libvirt_xml) disktargets = doc.xpath("/domain/devices/disk/target") if len(disktargets) < 1: raise oz.OzException.OzException("Could not find disk target") disks = [] for target in disktargets: dev = target.get('dev') if dev: disks.append(dev) if not disks: raise oz.OzException.OzException("Could not find disk target device") inttargets = doc.xpath("/domain/devices/interface/target") if len(inttargets) < 1: raise oz.OzException.OzException("Could not find interface target") interfaces = [] for target in inttargets: dev = target.get('dev') if dev: interfaces.append(dev) if not interfaces: raise oz.OzException.OzException("Could not find interface target device") return disks, interfaces def _get_disk_and_net_activity(self, libvirt_dom, disks, interfaces): """ Method to collect the disk and network activity by the domain. The method returns two numbers: the first is the sum of all disk activity from all disks, and the second is the sum of all network traffic from all network devices. """ total_disk_req = 0 for dev in disks: rd_req, rd_bytes, wr_req, wr_bytes, errs = libvirt_dom.blockStats(dev) total_disk_req += rd_req + wr_req total_net_bytes = 0 for dev in interfaces: rx_bytes, rx_packets, rx_errs, rx_drop, tx_bytes, tx_packets, tx_errs, tx_drop = libvirt_dom.interfaceStats(dev) total_net_bytes += rx_bytes + tx_bytes return total_disk_req, total_net_bytes def _wait_for_install_finish(self, xml, max_time): """ Method to wait for an installation to finish. This will wait around until either the VM has gone away (at which point it is assumed the install was successful), or until the timeout is reached (at which point it is assumed the install failed and raise an exception). """ libvirt_dom = self.libvirt_conn.createXML(xml, 0) disks, interfaces = self._get_disks_and_interfaces(libvirt_dom.XMLDesc(0)) self.last_disk_activity = 0 self.last_network_activity = 0 self.inactivity_countdown = self.inactivity_timeout self.saved_exception = None if self.has_consolelog: self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.settimeout(1) self.sock.connect(('127.0.0.1', self.console_listen_port)) def _finish_cb(self): ''' A callback for _looper to deal with waiting for a guest to finish installing. ''' if self.inactivity_countdown <= 0: return True try: total_disk_req, total_net_bytes = self._get_disk_and_net_activity(libvirt_dom, disks, interfaces) except libvirt.libvirtError as e: # we save the exception here because we want to raise it later # if this was a "real" exception self.saved_exception = e return True # rd_req and wr_req are the *total* number of disk read requests and # write requests ever made for this domain. Similarly rd_bytes and # wr_bytes are the total number of network bytes read or written # for this domain # we define activity as having done a read or write request on the # install disk, or having done at least 4KB of network transfers in # the last second. The thinking is that if the installer is putting # bits on disk, there will be disk activity, so we should keep # waiting. On the other hand, the installer might be downloading # bits to eventually install on disk, so we look for network # activity as well. We say that transfers of at least 4KB must be # made, however, to try to reduce false positives from things like # ARP requests if (total_disk_req == self.last_disk_activity) and (total_net_bytes < (self.last_network_activity + 4096)): # if we saw no read or write requests since the last iteration, # decrement our activity timer self.inactivity_countdown -= 1 else: # if we did see some activity, then we can reset the timer self.inactivity_countdown = self.inactivity_timeout self.last_disk_activity = total_disk_req self.last_network_activity = total_net_bytes if self.has_consolelog: try: # note that we have to build the data up here, since there # is no guarantee that we will get the whole write in one go data = self.sock.recv(65536) if data: self.log.debug(data.decode('utf-8')) except socket.timeout: # the socket times out after 1 second. We can just fall # through to the below code because it is a noop. pass return False finished = oz.ozutil.timed_loop(max_time, _finish_cb, "Waiting for %s to finish installing" % (self.tdl.name), self) # We get here because of a libvirt exception, an absolute timeout, or # an I/O timeout; we sort this out below if not finished: # if we timed out, then let's make sure to take a screenshot. screenshot_text = self._capture_screenshot(libvirt_dom) raise oz.OzException.OzException("Timed out waiting for install to finish. %s" % (screenshot_text)) elif self.inactivity_countdown <= 0: # if we saw no disk or network activity in the countdown window, # we presume the install has hung. Fail here screenshot_text = self._capture_screenshot(libvirt_dom) raise oz.OzException.OzException("No disk activity in %d seconds, failing. %s" % (self.inactivity_timeout, screenshot_text)) # We get here only if we got a libvirt exception if not self._wait_for_guest_shutdown(libvirt_dom): if self.saved_exception is not None: self.log.debug("Libvirt Domain Info Failed:") self.log.debug(" code is %d", self.saved_exception.get_error_code()) self.log.debug(" domain is %d", self.saved_exception.get_error_domain()) self.log.debug(" message is %s", self.saved_exception.get_error_message()) self.log.debug(" level is %d", self.saved_exception.get_error_level()) self.log.debug(" str1 is %s", self.saved_exception.get_str1()) self.log.debug(" str2 is %s", self.saved_exception.get_str2()) self.log.debug(" str3 is %s", self.saved_exception.get_str3()) self.log.debug(" int1 is %d", self.saved_exception.get_int1()) self.log.debug(" int2 is %d", self.saved_exception.get_int2()) raise self.saved_exception else: # the passed in exception was None, just raise a generic error raise oz.OzException.OzException("Unknown libvirt error") self.log.info("Install of %s succeeded", self.tdl.name) def _wait_for_guest_shutdown(self, libvirt_dom): """ Method to wait around for orderly shutdown of a running guest. Returns True if the guest shutdown in the specified time, False otherwise. """ def _shutdown_cb(self): ''' The _looper callback to wait for the guest to shutdown. ''' try: libvirt_dom.info() except libvirt.libvirtError as e: if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN: # Here, the guest really, truly went away cleanly. Thus, we know this # loop has successfully completed, and we can return True. return True # In all other cases, we got some kind of exception we didn't understand. # Fall through to the False return, and if we don't eventually see the # VIR_ERR_NO_DOMAIN, we'll return False to the caller. return False return oz.ozutil.timed_loop(self.shutdown_timeout, _shutdown_cb, "Waiting for %s to finish shutdown" % (self.tdl.name), self) def _get_csums(self, original_url, outdir, outputfd): """ Internal method to fetch the checksum file and compute the checksum on the downloaded data. """ if self.tdl.iso_md5_url: url = self.tdl.iso_md5_url hashname = 'md5' elif self.tdl.iso_sha1_url: url = self.tdl.iso_sha1_url hashname = 'sha1' elif self.tdl.iso_sha256_url: url = self.tdl.iso_sha256_url hashname = 'sha256' else: return True originalname = os.path.basename(urlparse.urlparse(original_url)[2]) csumname = os.path.join(outdir, self.tdl.distro + self.tdl.update + self.tdl.arch + "-CHECKSUM") (csumfd, outdir) = oz.ozutil.open_locked_file(csumname) os.ftruncate(csumfd, 0) try: self.log.debug("Checksum requested, fetching %s file", hashname) oz.ozutil.http_download_file(url, csumfd, False, self.log) finally: os.close(csumfd) upstream_sum = getattr(oz.ozutil, 'get_' + hashname + 'sum_from_file')(csumname, originalname) os.unlink(csumname) if not upstream_sum: raise oz.OzException.OzException("Could not find checksum for original file " + originalname) self.log.debug("Calculating checksum of downloaded file") os.lseek(outputfd, 0, os.SEEK_SET) local_sum = getattr(hashlib, hashname)() buf = oz.ozutil.read_bytes_from_fd(outputfd, 4096) while buf != '': local_sum.update(buf) buf = oz.ozutil.read_bytes_from_fd(outputfd, 4096) return local_sum.hexdigest() == upstream_sum def _get_original_media(self, url, fd, outdir, force_download): """ Method to fetch the original media from url. If the media is already cached locally, the cached copy will be used instead. """ self.log.info("Fetching the original media") info = oz.ozutil.http_get_header(url) if 'HTTP-Code' not in info or int(info['HTTP-Code']) >= 400 or 'Content-Length' not in info or int(info['Content-Length']) < 0: raise oz.OzException.OzException("Could not reach %s to fetch boot media: %r" % (url, info)) content_length = int(info['Content-Length']) if content_length == 0: raise oz.OzException.OzException("Install media of 0 size detected, something is wrong") if not force_download: if content_length == os.fstat(fd)[stat.ST_SIZE]: if self._get_csums(url, outdir, fd): self.log.info("Original install media available, using cached version") return self.log.info("Original available, but checksum mis-match; re-downloading") # before fetching everything, make sure that we have enough # space on the filesystem to store the data we are about to download devdata = os.statvfs(outdir) if (devdata.f_bsize * devdata.f_bavail) < content_length: raise oz.OzException.OzException("Not enough room on %s for install media" % (outdir)) # at this point we know we are going to download something. Make # sure to truncate the file so no stale data is left on the end os.ftruncate(fd, 0) self.log.info("Fetching the original install media from %s", url) oz.ozutil.http_download_file(url, fd, True, self.log) filesize = os.fstat(fd)[stat.ST_SIZE] if filesize != content_length: # if the length we downloaded is not the same as what we # originally saw from the headers, something went wrong raise oz.OzException.OzException("Expected to download %d bytes, downloaded %d" % (content_length, filesize)) if not self._get_csums(url, outdir, fd): raise oz.OzException.OzException("Checksum for downloaded file does not match!") def _capture_screenshot(self, libvirt_dom): """ Method to capture a screenshot of the VM. """ # First check to ensure that we've got a graphics device that would even let # us take a screenshot. domxml = libvirt_dom.XMLDesc(0) doc = lxml.etree.fromstring(domxml) graphics = doc.xpath("/domain/devices/graphics") if not graphics: return "No graphics device found, screenshot skipped" oz.ozutil.mkdir_p(self.screenshot_dir) # create a new stream st = libvirt_dom.connect().newStream(0) # start the screenshot mimetype = libvirt_dom.screenshot(st, 0, 0) if mimetype == "image/x-portable-pixmap": ext = ".ppm" elif mimetype == "image/png": ext = ".png" else: return "Unknown screenshot type, failed to take screenshot" try: screenshot = os.path.realpath(os.path.join(self.screenshot_dir, self.tdl.name + "-" + str(time.time()) + ext)) def sink(stream, buf, opaque): # pylint: disable=unused-argument """ Function that is called back from the libvirt stream. """ # opaque is the open file object return oz.ozutil.write_bytes_to_fd(opaque, buf) fd = os.open(screenshot, os.O_RDWR | os.O_CREAT) try: st.recvAll(sink, fd) finally: os.close(fd) st.finish() text = "Check screenshot at %s for more detail" % (screenshot) except Exception: text = "Failed to take screenshot" return text def _modify_libvirt_xml_for_serial(self, libvirt_xml): """ Internal method to take input libvirt XML (which may have been provided by the user) and add an appropriate serial section so that guest announcement works properly. """ input_doc = lxml.etree.fromstring(libvirt_xml) serialNode = input_doc.xpath("/domain/devices/serial") # we first go looking through the existing elements (if any); # if any exist on port 1, we delete it from the working XML and re-add # it below for serial in serialNode: target = serial.xpath('target') if len(target) != 1: raise oz.OzException.OzException("libvirt XML has a serial port with %d target(s), it is invalid" % (len(target))) if target[0].get('port') == "1": serial.getparent().remove(serial) break # at this point, the XML should be clean of any serial port=1 entries # and we can add the one we want devices = input_doc.xpath("/domain/devices") devlen = len(devices) if devlen == 0: raise oz.OzException.OzException("No devices section specified, something is wrong with the libvirt XML") elif devlen > 1: raise oz.OzException.OzException("%d devices sections specified, something is wrong with the libvirt XML" % (devlen)) self._generate_serial_xml(devices[0]) xml = lxml.etree.tostring(input_doc, pretty_print=True, encoding="unicode") self.log.debug("Generated XML:\n%s", xml) return xml def _modify_libvirt_xml_diskimage(self, libvirt_xml, new_diskimage, image_type): """ Internal method to take input libvirt XML and replace the existing disk image details with a new disk image file and, potentially, disk image type. Used in safe ICICLE generation to replace the "real" disk image file with a temporary writeable snapshot. """ self.log.debug("Modifying libvirt XML to use disk image (%s) of type (%s)", new_diskimage, image_type) input_doc = lxml.etree.fromstring(libvirt_xml) disks = input_doc.xpath("/domain/devices/disk") if len(disks) != 1: self.log.warning("Oz given a libvirt domain with more than 1 disk; using the first one parsed") source = disks[0].xpath('source') if len(source) != 1: raise oz.OzException.OzException("invalid entry without a source") source[0].set('file', new_diskimage) driver = disks[0].xpath('driver') # at the time this function was added, all boot disk device stanzas # have a driver section - even raw images if len(driver) == 1: driver[0].set('type', image_type) else: raise oz.OzException.OzException("Found a disk with an unexpected number of driver sections") xml = lxml.etree.tostring(input_doc, pretty_print=True, encoding="unicode") self.log.debug("Generated XML:\n%s", xml) return xml def _wait_for_guest_boot(self, libvirt_dom): """ Method to wait around for a guest to boot. Orderly guests will boot up and announce their presence via a TCP message; if that happens within the timeout, this method returns the IP address of the guest. If that doesn't happen an exception is raised. """ self.log.info("Waiting for guest %s to boot", self.tdl.name) self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: self.sock.settimeout(1) self.sock.connect(('127.0.0.1', self.listen_port)) self.addr = None self.data = b'' def _boot_cb(self): ''' The _looper callback to look for the guest to boot. ''' try: # note that we have to build the data up here, since there # is no guarantee that we will get the whole write in one go self.data += self.sock.recv(8192) except socket.timeout: # the socket times out after 1 second. We can just fall # through to the below code because it is a noop. pass # OK, we got data back from the socket. Check to see if it is # is what we expect; essentially, some up-front garbage, # followed by a !,! # Exclude ! from the wildcard to avoid errors when receiving two # announce messages in the same string match = re.search(b"!([^!]*?,[^!]*?)!$", self.data) if match is not None: if len(match.groups()) != 1: raise oz.OzException.OzException("Guest checked in with no data") split = match.group(1).split(b',') if len(split) != 2: raise oz.OzException.OzException("Guest checked in with bogus data") self.addr = split[0] uuidstr = split[1] try: # use socket.inet_aton() to validate the IP address socket.inet_aton(self.addr.decode('utf-8')) except socket.error: raise oz.OzException.OzException("Guest checked in with invalid IP address") if uuidstr.decode('utf-8') != str(self.uuid): raise oz.OzException.OzException("Guest checked in with unknown UUID") return True # if the data we got didn't match, we need to continue waiting. # before going to sleep, make sure that the domain is still # around libvirt_dom.info() return False oz.ozutil.timed_loop(self.boot_timeout, _boot_cb, "Waiting for %s to finish boot" % (self.tdl.name), self) finally: self.sock.close() if self.addr is None: raise oz.OzException.OzException("Timed out waiting for guest to boot") self.addr = self.addr.decode('utf-8') self.log.debug("IP address of guest is %s", self.addr) return self.addr def _output_icicle_xml(self, lines, description, extra=None): """ Generate ICICLE XML based on the data supplied. The parameter 'lines' is expected to be an list of strings, with one package per list item. The parameter 'description' is a description of the guest. The parameter 'extra' is an optional one that describes any additional information the user wanted in the ICICLE output. """ icicle = lxml.etree.Element("icicle") if description is not None: oz.ozutil.lxml_subelement(icicle, "description", description) packages = oz.ozutil.lxml_subelement(icicle, "packages") for index, line in enumerate(lines): if line == "": continue package = oz.ozutil.lxml_subelement(packages, "package", None, {'name': line}) if extra is not None: oz.ozutil.lxml_subelement(package, "extra", extra[index]) return lxml.etree.tostring(icicle, pretty_print=True, encoding="unicode") def _check_url(self, iso=True, url=True): """ Method to check that a TDL URL meets the requirements for a particular operating system. """ # this method is *slightly* odd in that it references ISOs from the # generic Guest class. However, the installtype comes from the user # TDL, which means that they could have specified an ISO installtype for # a floppy guest (for instance). Since we internally always set # iso=False for floppy guests, this will raise an appropriate error if iso and self.tdl.installtype == 'iso': url = self.tdl.iso elif url and self.tdl.installtype == 'url': url = self.tdl.url # when doing URL installs, we can't allow localhost URLs (the URL # will be embedded into the installer, so the install is guaranteed # to fail with localhost URLs). Disallow them here if urlparse.urlparse(url)[1] in ["localhost", "127.0.0.1", "localhost.localdomain"]: raise oz.OzException.OzException("Can not use localhost for an URL based install") else: if iso and url: raise oz.OzException.OzException("%s installs must be done via url or iso" % (self.tdl.distro)) elif iso: raise oz.OzException.OzException("%s installs must be done via iso" % (self.tdl.distro)) elif url: raise oz.OzException.OzException("%s installs for %s must be done via url" % (self.tdl.distro, self.tdl.arch)) else: raise oz.OzException.OzException("Unknown error occurred while determining install URL") return url def _generate_openssh_key(self, privname): """ Method to generate an OpenSSH compatible public/private keypair. """ self.log.info("Generating new openssh key") pubname = privname + ".pub" if os.access(privname, os.F_OK) and not os.access(pubname, os.F_OK): # hm, private key exists but not public? We have to regenerate os.unlink(privname) if not os.access(privname, os.F_OK) and os.access(pubname, os.F_OK): # hm, public key exists but not private? We have to regenerate os.unlink(pubname) # when we get here, either both the private and public key exist, or # neither exist. If they don't exist, generate them if not os.access(privname, os.F_OK) and not os.access(pubname, os.F_OK): def _null_callback(p, n, out): # pylint: disable=unused-argument """ Method to silence the default M2Crypto.RSA.gen_key output. """ pass pubname = privname + '.pub' key = M2Crypto.RSA.gen_key(2048, 65537, _null_callback) # this is the binary public key, in ssh "BN" (BigNumber) MPI format. # The ssh BN MPI format consists of 4 bytes that describe the length # of the following data, followed by the data itself in big-endian # format. The start of the string is 0x0007, which represent the 7 # bytes following that make up 'ssh-rsa'. The key exponent and # modulus as fetched out of M2Crypto are already in MPI format, so # we can just use them as-is. We then have to base64 encode the # result, add a little header information, and then we have a # full public key. pubkey = b'\x00\x00\x00\x07' + b'ssh-rsa' + key.e + key.n username = os.getlogin() hostname = os.uname()[1] keystring = 'ssh-rsa %s %s@%s\n' % (base64.b64encode(pubkey).decode('utf-8'), username, hostname) oz.ozutil.mkdir_p(os.path.dirname(privname)) key.save_key(privname, cipher=None) os.chmod(privname, 0o600) with open(pubname, 'w') as f: f.write(keystring) os.chmod(pubname, 0o644) class CDGuest(Guest): """ Class for guest installation via ISO. """ class _PrimaryVolumeDescriptor(object): """ Class to hold information about a CD's Primary Volume Descriptor. """ def __init__(self, version, sysid, volid, space_size, set_size, seqnum): self.version = version self.system_identifier = sysid self.volume_identifier = volid self.space_size = space_size self.set_size = set_size self.seqnum = seqnum def __init__(self, tdl, config, auto, output_disk, nicmodel, clockoffset, mousetype, diskbus, iso_allowed, url_allowed, macaddress): Guest.__init__(self, tdl, config, auto, output_disk, nicmodel, clockoffset, mousetype, diskbus, iso_allowed, url_allowed, macaddress) self.orig_iso = os.path.join(self.data_dir, "isos", self.tdl.distro + self.tdl.update + self.tdl.arch + "-" + self.tdl.installtype + ".iso") self.modified_iso_cache = os.path.join(self.data_dir, "isos", self.tdl.distro + self.tdl.update + self.tdl.arch + "-" + self.tdl.installtype + "-oz.iso") self.output_iso = os.path.join(self.output_dir, self.tdl.name + "-" + self.tdl.installtype + "-oz.iso") self.iso_contents = os.path.join(self.data_dir, "isocontent", self.tdl.name + "-" + self.tdl.installtype) # An optional floppy disk to be used for installation self.output_floppy = os.path.join(self.output_dir, self.tdl.name + "-" + self.tdl.installtype + "-oz.img") self.log.debug("Original ISO path: %s", self.orig_iso) self.log.debug("Modified ISO cache: %s", self.modified_iso_cache) self.log.debug("Output ISO path: %s", self.output_iso) self.log.debug("ISO content path: %s", self.iso_contents) def _get_original_iso(self, isourl, fd, outdir, force_download): """ Method to fetch the original ISO for an operating system. """ self._get_original_media(isourl, fd, outdir, force_download) def _copy_iso(self): """ Method to copy the data out of an ISO onto the local filesystem. """ self.log.info("Copying ISO contents for modification") try: shutil.rmtree(self.iso_contents) except OSError as err: if err.errno != errno.ENOENT: raise os.makedirs(self.iso_contents) self.log.info("Setting up guestfs handle for %s", self.tdl.name) gfs = guestfs.GuestFS() self.log.debug("Adding ISO image %s", self.orig_iso) gfs.add_drive_opts(self.orig_iso, readonly=1, format='raw') self.log.debug("Launching guestfs") gfs.launch() try: self.log.debug("Mounting ISO") gfs.mount_options('ro', "/dev/sda", "/") self.log.debug("Checking if there is enough space on the filesystem") isostat = gfs.statvfs("/") outputstat = os.statvfs(self.iso_contents) if (outputstat.f_bsize * outputstat.f_bavail) < (isostat['blocks'] * isostat['bsize']): raise oz.OzException.OzException("Not enough room on %s to extract install media" % (self.iso_contents)) self.log.debug("Extracting ISO contents") current = os.getcwd() os.chdir(self.iso_contents) try: rd, wr = os.pipe() try: # NOTE: it is very, very important that we use temporary # files for collecting stdout and stderr here. There is a # nasty bug in python subprocess; if your process produces # more than 64k of data on an fd that is using # subprocess.PIPE, the whole thing will hang. To avoid # this, we use temporary fds to capture the data stdouttmp = tempfile.TemporaryFile() stderrtmp = tempfile.TemporaryFile() try: tar = subprocess.Popen(["tar", "-x", "-v"], stdin=rd, stdout=stdouttmp, stderr=stderrtmp) try: gfs.tar_out("/", "/dev/fd/%d" % wr) except: # we need this here if gfs.tar_out throws an # exception. In that case, we need to manually # kill off the tar process and re-raise the # exception, otherwise we hang forever tar.kill() raise # Make sure tar is fully done with the archive before # we can continue. tar.wait() if tar.returncode: self.log.debug('tar stdout: %s', stdouttmp.read()) self.log.debug('tar stderr: %s', stderrtmp.read()) raise oz.OzException.OzException("Tar exited with an error") finally: stdouttmp.close() stderrtmp.close() finally: os.close(rd) os.close(wr) # since we extracted from an ISO, there are no write bits on # any of the directories. Fix that here. oz.ozutil.recursively_add_write_bit(self.iso_contents) finally: os.chdir(current) finally: gfs.sync() gfs.umount_all() gfs.kill_subprocess() def _get_primary_volume_descriptor(self, cdfd): """ Method to extract the primary volume descriptor from a CD. """ # check out the primary volume descriptor to make sure it is sane cdfd.seek(16 * 2048) fmt = b"=B5sBB32s32sQLL32sHHHH" (desc_type, identifier, version, unused1, system_identifier, volume_identifier, unused2, space_size_le, space_size_be_unused, unused3, set_size_le, set_size_be, seqnum_le, seqnum_be) = struct.unpack(fmt, cdfd.read(struct.calcsize(fmt))) if desc_type != 0x1: raise oz.OzException.OzException("Invalid primary volume descriptor") if identifier != "CD001": raise oz.OzException.OzException("invalid CD isoIdentification") if unused1 != 0x0: raise oz.OzException.OzException("data in unused field") if unused2 != 0x0: raise oz.OzException.OzException("data in 2nd unused field") return self._PrimaryVolumeDescriptor(version, system_identifier, volume_identifier, space_size_le, set_size_le, seqnum_le) def _geteltorito(self, cdfile, outfile): """ Method to extract the El-Torito boot sector off of a CD and write it to a file. """ if cdfile is None: raise oz.OzException.OzException("input iso is None") if outfile is None: raise oz.OzException.OzException("output file is None") with open(cdfile, 'rb') as cdfd: self._get_primary_volume_descriptor(cdfd) # the 17th sector contains the boot specification and the offset of the # boot sector cdfd.seek(17 * 2048) # NOTE: With "native" alignment (the default for struct), there is # some padding that happens that causes the unpacking to fail. # Instead we force "standard" alignment, which has no padding fmt = "=B5sB23s41sI" (boot, isoIdent, version, toritoSpec, unused, bootP) = struct.unpack(fmt, cdfd.read(struct.calcsize(fmt))) if boot != 0x0: raise oz.OzException.OzException("invalid CD boot sector") if isoIdent != "CD001": raise oz.OzException.OzException("invalid CD isoIdentification") if version != 0x1: raise oz.OzException.OzException("invalid CD version") if toritoSpec != "EL TORITO SPECIFICATION": raise oz.OzException.OzException("invalid CD torito specification") # OK, this looks like a bootable CD. Seek to the boot sector, and # look for the header, 0x55, and 0xaa in the first 32 bytes cdfd.seek(bootP * 2048) fmt = "=BBH24sHBB" bootdata = cdfd.read(struct.calcsize(fmt)) (header, platform, unused, manu_unused, unused2, five, aa) = struct.unpack(fmt, bootdata) if header != 0x1: raise oz.OzException.OzException("invalid CD boot sector header") if platform != 0x0 and platform != 0x1 and platform != 0x2: raise oz.OzException.OzException("invalid CD boot sector platform") if unused != 0x0: raise oz.OzException.OzException("invalid CD unused boot sector field") if five != 0x55 or aa != 0xaa: raise oz.OzException.OzException("invalid CD boot sector footer") def _checksum(data): """ Method to compute the checksum on the ISO. Note that this is *not* a 1's complement checksum; when an addition overflows, the carry bit is discarded, not added to the end. """ s = 0 for i in range(0, len(data), 2): w = ord(data[i]) + (ord(data[i + 1]) << 8) s = (s + w) & 0xffff return s csum = _checksum(bootdata) if csum != 0: raise oz.OzException.OzException("invalid CD checksum: expected 0, saw %d" % (csum)) # OK, everything so far has checked out. Read the default/initial # boot entry cdfd.seek(bootP * 2048 + 32) fmt = "=BBHBBHIB" (boot, media, loadsegment_unused, systemtype_unused, unused, scount, imgstart, unused2) = struct.unpack(fmt, cdfd.read(struct.calcsize(fmt))) if boot != 0x88: raise oz.OzException.OzException("invalid CD initial boot indicator") if unused != 0x0 or unused2 != 0x0: raise oz.OzException.OzException("invalid CD initial boot unused field") if media == 0 or media == 4: count = scount elif media == 1: # 1.2MB floppy in sectors count = 1200 * 1024 / 512 elif media == 2: # 1.44MB floppy in sectors count = 1440 * 1024 / 512 elif media == 3: # 2.88MB floppy in sectors count = 2880 * 1024 / 512 else: raise oz.OzException.OzException("invalid CD media type") # finally, seek to "imgstart", and read "count" sectors, which # contains the boot image cdfd.seek(imgstart * 2048) # The eltorito specification section 2.5 says: # # Sector Count. This is the number of virtual/emulated sectors the # system will store at Load Segment during the initial boot # procedure. # # and then Section 1.5 says: # # Virtual Disk - A series of sectors on the CD which INT 13 presents # to the system as a drive with 200 byte virtual sectors. There # are 4 virtual sectors found in each sector on a CD. # # (note that the bytes above are in hex). So we read count*512 eltoritodata = cdfd.read(count * 512) with open(outfile, "w") as f: f.write(eltoritodata) def _do_install(self, timeout=None, force=False, reboots=0, kernelfname=None, ramdiskfname=None, cmdline=None, extrainstalldevs=None, virtio_channel_name=None): """ Internal method to actually run the installation. """ if not force and os.access(self.jeos_filename, os.F_OK): self.log.info("Found cached JEOS (%s), using it", self.jeos_filename) oz.ozutil.copyfile_sparse(self.jeos_filename, self.diskimage) return self._generate_xml("hd", None) self.log.info("Running install for %s", self.tdl.name) if timeout is None: timeout = self.default_install_timeout cddev = self._InstallDev("cdrom", self.output_iso, "hdc") if extrainstalldevs is not None: extrainstalldevs.append(cddev) cddev = extrainstalldevs reboots_to_go = reboots while reboots_to_go >= 0: # if reboots_to_go is the same as reboots, it means that this is # the first time through and we should generate the "initial" xml if reboots_to_go == reboots: if kernelfname and os.access(kernelfname, os.F_OK) and ramdiskfname and os.access(ramdiskfname, os.F_OK) and cmdline: xml = self._generate_xml(None, None, kernelfname, ramdiskfname, cmdline, virtio_channel_name) else: xml = self._generate_xml("cdrom", cddev, None, None, None, virtio_channel_name) else: xml = self._generate_xml("hd", cddev, None, None, None, virtio_channel_name) self._wait_for_install_finish(xml, timeout) reboots_to_go -= 1 if self.cache_jeos: self.log.info("Caching JEOS") oz.ozutil.mkdir_p(self.jeos_cache_dir) oz.ozutil.copyfile_sparse(self.diskimage, self.jeos_filename) return self._generate_xml("hd", None) def install(self, timeout=None, force=False): """ Method to run the operating system installation. """ return self._do_install(timeout, force, 0) def _check_pvd(self): """ Base method to check the Primary Volume Descriptor on the ISO. In the common case, do nothing; subclasses that need to check the media will override this. """ pass def _check_iso_tree(self, customize_or_icicle): """ Base method to check the exploded ISO tree. In the common case, do nothing; subclasses that need to check the tree will override this. """ pass def _add_iso_extras(self): """ Method to modify the ISO based on the directories specified in the TDL file. This modification is done before the final OS and is not expected to be override by subclasses """ for isoextra in self.tdl.isoextras: targetabspath = os.path.join(self.iso_contents, isoextra.destination) oz.ozutil.mkdir_p(os.path.dirname(targetabspath)) parsedurl = urlparse.urlparse(isoextra.source) if parsedurl.scheme == 'file': if isoextra.element_type == "file": oz.ozutil.copyfile_sparse(parsedurl.path, targetabspath) else: oz.ozutil.copytree_merge(parsedurl.path, targetabspath) elif parsedurl.scheme == "ftp": if isoextra.element_type == "file": fd = os.open(targetabspath, os.O_CREAT | os.O_TRUNC | os.O_WRONLY) try: oz.ozutil.http_download_file(isoextra.source, fd, True, self.log) finally: os.close(fd) else: oz.ozutil.ftp_download_directory(parsedurl.hostname, parsedurl.username, parsedurl.password, parsedurl.path, targetabspath, parsedurl.port) elif parsedurl.scheme == "http": if isoextra.element_type == "directory": raise oz.OzException.OzException("ISO extra directories cannot be fetched over HTTP") else: fd = os.open(targetabspath, os.O_CREAT | os.O_TRUNC | os.O_WRONLY) try: oz.ozutil.http_download_file(isoextra.source, fd, True, self.log) finally: os.close(fd) else: raise oz.OzException.OzException("The protocol '%s' is not supported for fetching remote files or directories" % parsedurl.scheme) def _modify_iso(self): """ Base method to modify the ISO. Subclasses are expected to override this. """ raise oz.OzException.OzException("Internal error, subclass didn't override modify_iso") def _generate_new_iso(self): """ Base method to generate the new ISO. Subclasses are expected to override this. """ raise oz.OzException.OzException("Internal error, subclass didn't override generate_new_iso") def _iso_generate_install_media(self, url, force_download, customize_or_icicle): """ Method to generate the modified media necessary for unattended installs. """ self.log.info("Generating install media") if not force_download: if os.access(self.jeos_filename, os.F_OK): # if we found a cached JEOS, we don't need to do anything here; # we'll copy the JEOS itself later on return elif os.access(self.modified_iso_cache, os.F_OK): self.log.info("Using cached modified media") shutil.copyfile(self.modified_iso_cache, self.output_iso) return (fd, outdir) = oz.ozutil.open_locked_file(self.orig_iso) try: self._get_original_iso(url, fd, outdir, force_download) self._check_pvd() self._copy_iso() # from here on out, we have to make sure to cleanup the exploded ISO try: self._check_iso_tree(customize_or_icicle) self._add_iso_extras() self._modify_iso() self._generate_new_iso() if self.cache_modified_media: self.log.info("Caching modified media for future use") shutil.copyfile(self.output_iso, self.modified_iso_cache) finally: self._cleanup_iso() finally: os.close(fd) def generate_install_media(self, force_download=False, customize_or_icicle=False): """ Method to generate the install media for the operating system. If force_download is False (the default), then the original media will only be fetched if it is not cached locally. If force_download is True, then the original media will be downloaded regardless of whether it is cached locally. """ return self._iso_generate_install_media(self.url, force_download, customize_or_icicle) def _cleanup_iso(self): """ Method to cleanup the local ISO contents. """ self.log.info("Cleaning up old ISO data") # if we are running as non-root, then there might be some files left # around that are not writable, which means that the rmtree below would # fail. Recurse into the iso_contents tree, doing a chmod +w on # every file and directory to make sure the rmtree succeeds oz.ozutil.recursively_add_write_bit(self.iso_contents) oz.ozutil.rmtree_and_sync(self.iso_contents) def cleanup_install(self): """ Method to cleanup any transient install data. """ self.log.info("Cleaning up after install") try: os.unlink(self.output_iso) except: pass try: os.unlink(self.output_floppy) except: pass if not self.cache_original_media: try: os.unlink(self.orig_iso) except: pass class FDGuest(Guest): """ Class for guest installation via floppy disk. """ def __init__(self, tdl, config, auto, output_disk, nicmodel, clockoffset, mousetype, diskbus, macaddress): Guest.__init__(self, tdl, config, auto, output_disk, nicmodel, clockoffset, mousetype, diskbus, False, True, macaddress) self.orig_floppy = os.path.join(self.data_dir, "floppies", self.tdl.distro + self.tdl.update + self.tdl.arch + ".img") self.modified_floppy_cache = os.path.join(self.data_dir, "floppies", self.tdl.distro + self.tdl.update + self.tdl.arch + "-oz.img") self.output_floppy = os.path.join(self.output_dir, self.tdl.name + "-oz.img") self.floppy_contents = os.path.join(self.data_dir, "floppycontent", self.tdl.name) self.log.debug("Original floppy path: %s", self.orig_floppy) self.log.debug("Modified floppy cache: %s", self.modified_floppy_cache) self.log.debug("Output floppy path: %s", self.output_floppy) self.log.debug("Floppy content path: %s", self.floppy_contents) def _get_original_floppy(self, floppyurl, fd, outdir, force_download): """ Method to download the original floppy if necessary. """ self._get_original_media(floppyurl, fd, outdir, force_download) def _copy_floppy(self): """ Method to copy the floppy contents for modification. """ self.log.info("Copying floppy contents for modification") shutil.copyfile(self.orig_floppy, self.output_floppy) def install(self, timeout=None, force=False): """ Method to run the operating system installation. """ if not force and os.access(self.jeos_filename, os.F_OK): self.log.info("Found cached JEOS, using it") oz.ozutil.copyfile_sparse(self.jeos_filename, self.diskimage) return self._generate_xml("hd", None) self.log.info("Running install for %s", self.tdl.name) fddev = self._InstallDev("floppy", self.output_floppy, "fda") if timeout is None: timeout = 1200 self._wait_for_install_finish(self._generate_xml("fd", fddev), timeout) if self.cache_jeos: self.log.info("Caching JEOS") oz.ozutil.mkdir_p(self.jeos_cache_dir) oz.ozutil.copyfile_sparse(self.diskimage, self.jeos_filename) return self._generate_xml("hd", None) def _cleanup_floppy(self): """ Method to cleanup the temporary floppy data. """ self.log.info("Cleaning up floppy data") oz.ozutil.rmtree_and_sync(self.floppy_contents) def cleanup_install(self): """ Method to cleanup the installation floppies. """ self.log.info("Cleaning up after install") try: os.unlink(self.output_floppy) except: pass if not self.cache_original_media: try: os.unlink(self.orig_floppy) except Exception: pass oz-0.17.0/oz/GuestFSManager.py000066400000000000000000000233301344320532700160500ustar00rootroot00000000000000# Copyright (C) 2017 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Helper class for managing a GuestFS connection """ import functools import logging import guestfs import lxml.etree import oz.OzException class GuestFS(object): ''' A wrapper class over guestfs to make some common operations easier. ''' def __init__(self, input_disk, input_disk_type): self.log = logging.getLogger(__name__) self.g_handle = guestfs.GuestFS(python_return_dict=True) self.log.debug("Adding disk image %s", input_disk) # NOTE: we use "add_drive_opts" here so we can specify the type # of the diskimage. Otherwise it might be possible for an attacker # to fool libguestfs with a specially-crafted diskimage that looks # like a qcow2 disk (thanks to rjones for the tip) self.g_handle.add_drive_opts(input_disk, format=input_disk_type) self.log.debug("Launching guestfs") self.g_handle.launch() def create_msdos_partition_table(self): ''' A method to create a new msdos partition table on a disk. ''' devices = self.g_handle.list_devices() self.g_handle.part_init(devices[0], "msdos") self.g_handle.part_add(devices[0], 'p', 1, 2) def mount_partitions(self): ''' A method to mount existing partitions on a disk inside of guestfs. ''' self.log.debug("Inspecting guest OS") roots = self.g_handle.inspect_os() if not roots: raise oz.OzException.OzException("No operating systems found on the disk") self.log.debug("Getting mountpoints") already_mounted = {} for root in roots: self.log.debug("Root device: %s", root) # the problem here is that the list of mountpoints returned by # inspect_get_mountpoints is in no particular order. So if the # diskimage contains /usr and /usr/local on different devices, # but /usr/local happened to come first in the listing, the # devices would get mapped improperly. The clever solution here is # to sort the mount paths by length; this will ensure that they # are mounted in the right order. Thanks to rjones for the hint, # and the example code that comes from the libguestfs.org python # example page. mps = self.g_handle.inspect_get_mountpoints(root) for device in sorted(mps.keys(), key=len): try: # Here we check to see if the device was already mounted. # If it was, we skip over this mountpoint and go to the # next one. This can happen, for instance, on btrfs volumes # with snapshots. In that case, we'll always take the # "original" backing filesystem, and not the snapshots, # which seems to work in practice. if already_mounted[device] == mps[device]: continue except KeyError: # If we got a KeyError exception, we know that we haven't # yet mounted this filesystem, so continue on. pass try: self.g_handle.mount_options('', mps[device], device) already_mounted[device] = mps[device] except Exception: if device == '/': # If we cannot mount root, we may as well give up raise else: # some custom guests may have fstab content with # "nofail" as a mount option. For example, images # built for EC2 with ephemeral mappings. These # fail at this point. Allow things to continue. # Profound failures will trigger later on during # the process. self.log.warning("Unable to mount (%s) on (%s) - trying to continue", mps[device], device) def remove_if_exists(self, path): """ Method to remove a file if it exists in the disk image. """ if self.g_handle.exists(path): self.g_handle.rm_rf(path) def move_if_exists(self, orig_path, replace_path): """ Method to move a file if it exists in the disk image. """ if self.g_handle.exists(orig_path): self.g_handle.mv(orig_path, replace_path) def path_backup(self, orig): """ Method to backup a file in the disk image. """ self.move_if_exists(orig, orig + ".ozbackup") def path_restore(self, orig): """ Method to restore a backup file in the disk image. """ backup = orig + ".ozbackup" self.remove_if_exists(orig) self.move_if_exists(backup, orig) def exists(self, filename): ''' A passthrough method for the guestfs functionality of "exists". ''' return self.g_handle.exists(filename) def rm(self, filename): ''' A passthrough method for the guestfs functionality of "rm". ''' return self.g_handle.rm(filename) def glob_expand(self, glob): ''' A passthrough method for the guestfs functionality of "glob_expand". ''' return self.g_handle.glob_expand(glob) def mkdir(self, directory): ''' A passthrough method for the guestfs functionality of "mkdir". ''' return self.g_handle.mkdir(directory) def ln_sf(self, src, dst): ''' A passthrough method for the guestfs functionality of "ln_sf". ''' return self.g_handle.ln_sf(src, dst) def chmod(self, mode, fname): ''' A passthrough method for the guestfs functionality of "chmod". ''' return self.g_handle.chmod(mode, fname) def cat(self, fname): ''' A passthrough method for the guestfs functionality of "cat". ''' return self.g_handle.cat(fname) def upload(self, src, dest): ''' A passthrough method for the guestfs functionalityh of "upload". ''' return self.g_handle.upload(src, dest) def cleanup(self): ''' A method to cleanup after finishing with a guestfs handle. ''' self.log.info("Cleaning up guestfs handle") self.log.debug("Syncing") self.g_handle.sync() self.log.debug("Unmounting all") self.g_handle.umount_all() self.g_handle.kill_subprocess() self.g_handle.close() def GuestFSLibvirtFactory(libvirt_xml, libvirt_conn): ''' A factory function for getting a GuestFS object from a libvirt XML and a connection. ''' log = logging.getLogger(__name__) input_doc = lxml.etree.fromstring(libvirt_xml) namenode = input_doc.xpath('/domain/name') if len(namenode) != 1: raise oz.OzException.OzException("invalid libvirt XML with no name") input_name = namenode[0].text disks = input_doc.xpath('/domain/devices/disk') if len(disks) != 1: log.warning("Oz given a libvirt domain with more than 1 disk; using the first one parsed") source = disks[0].xpath('source') if len(source) != 1: raise oz.OzException.OzException("invalid entry without a source") input_disk = source[0].get('file') driver = disks[0].xpath('driver') if not driver: input_disk_type = 'raw' elif len(driver) == 1: input_disk_type = driver[0].get('type') else: raise oz.OzException.OzException("invalid entry without a driver") for domid in libvirt_conn.listDomainsID(): try: doc = lxml.etree.fromstring(libvirt_conn.lookupByID(domid).XMLDesc(0)) except Exception: log.debug("Could not get XML for domain ID (%s) - it may have disappeared (continuing)", domid) continue namenode = doc.xpath('/domain/name') if len(namenode) != 1: # hm, odd, a domain without a name? raise oz.OzException.OzException("Saw a domain without a name, something weird is going on") if input_name == namenode[0].text: raise oz.OzException.OzException("Cannot setup ICICLE generation on a running guest") disks = doc.xpath('/domain/devices/disk') if len(disks) < 1: # odd, a domain without a disk, but don't worry about it continue for guestdisk in disks: for source in guestdisk.xpath("source"): # FIXME: this will only work for files; we can make it work # for other things by following something like: # http://git.annexia.org/?p=libguestfs.git;a=blob;f=src/virt.c;h=2c6be3c6a2392ab8242d1f4cee9c0d1445844385;hb=HEAD#l169 filename = str(source.get('file')) if filename == input_disk: raise oz.OzException.OzException("Cannot setup ICICLE generation on a running disk") return GuestFS(input_disk, input_disk_type) oz-0.17.0/oz/GuestFactory.py000066400000000000000000000105451344320532700156600ustar00rootroot00000000000000# Copyright (C) 2011 Chris Lalancette # Copyright (C) 2012-2017 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Factory functions. """ import oz.OzException os_dict = { 'Fedora': 'Fedora', 'FedoraCore': 'FedoraCore', 'FC': 'FedoraCore', 'RedHatEnterpriseLinux-2.1': 'RHEL_2_1', 'RHEL-2.1': 'RHEL_2_1', 'RedHatEnterpriseLinux-3': 'RHEL_3', 'RHEL-3': 'RHEL_3', 'CentOS-3': 'RHEL_3', 'RedHatEnterpriseLinux-4': 'RHEL_4', 'RHEL-4': 'RHEL_4', 'CentOS-4': 'RHEL_4', 'ScientificLinux-4': 'RHEL_4', 'SL-4': 'RHEL_4', 'RedHatEnterpriseLinux-5': 'RHEL_5', 'RHEL-5': 'RHEL_5', 'CentOS-5': 'RHEL_5', 'OL-5': 'RHEL_5', 'ScientificLinux-5': 'RHEL_5', 'SL-5': 'RHEL_5', 'ScientificLinuxCern-5': 'RHEL_5', 'SLC-5': 'RHEL_5', 'RedHatEnterpriseLinux-6': 'RHEL_6', 'RHEL-6': 'RHEL_6', 'CentOS-6': 'RHEL_6', 'ScientificLinux-6': 'RHEL_6', 'SL-6': 'RHEL_6', 'ScientificLinuxCern-6': 'RHEL_6', 'SLC-6': 'RHEL_6', 'OracleEnterpriseLinux-6': 'RHEL_6', 'OEL-6': 'RHEL_6', 'OL-6': 'RHEL_6', 'RHEL-7': 'RHEL_7', 'CentOS-7': 'RHEL_7', 'Ubuntu': 'Ubuntu', 'Windows': 'Windows', 'RedHatLinux': 'RHL', 'RHL': 'RHL', 'OpenSUSE': 'OpenSUSE', 'Debian': 'Debian', 'Mandrake': 'Mandrake', 'Mandriva': 'Mandriva', 'Mageia': 'Mageia', 'FreeBSD': 'FreeBSD', } def guest_factory(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory function return an appropriate Guest object based on the TDL. The arguments are: tdl - The TDL object to be used. The return object will be determined based on the distro and version from the TDL. config - A ConfigParser object that contains configuration. If None is passed for the config, Oz defaults will be used. auto - An unattended installation file to be used for the installation. If None is passed for auto, then Oz will use a known-working unattended installation file. output_disk - An optional string argument specifying the path to the disk to be written to. netdev - An optional string argument specifying the type of network device to be used during installation. If specified, this will override the default that Oz uses. diskbus - An optional string argument specifying the type of disk device to be used during installation. If specified, this will override the default that Oz uses. macaddress - An optional string argument specifying the MAC address to use for the guest. """ klass = None for name, importname in os_dict.items(): if tdl.distro == name: # we found the matching module; import and call the get_class method module = __import__('oz.' + importname) klass = getattr(module, importname).get_class(tdl, config, auto, output_disk, netdev, diskbus, macaddress) break if klass is None: raise oz.OzException.OzException("Unsupported " + tdl.distro + " update " + tdl.update) return klass def distrolist(): """ Function to print out a list of supported distributions. """ strings = [] for importname in os_dict.values(): module = __import__('oz.' + importname) support = getattr(module, importname).get_supported_string() tmp = ' ' + support if tmp not in strings: strings.append(tmp) strings.sort() print('\n'.join(strings)) oz-0.17.0/oz/Linux.py000066400000000000000000000377431344320532700143510ustar00rootroot00000000000000# Copyright (C) 2013-2017 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Linux installation """ import os import re import time import libvirt import oz.Guest import oz.OzException class LinuxCDGuest(oz.Guest.CDGuest): """ Class for Linux installation. """ def __init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, iso_allowed, url_allowed, macaddress): oz.Guest.CDGuest.__init__(self, tdl, config, auto, output_disk, nicmodel, None, None, diskbus, iso_allowed, url_allowed, macaddress) def _test_ssh_connection(self, guestaddr): """ Internal method to test out the ssh connection before we try to use it. Under systemd, the IP address of a guest can come up and reportip can run before the ssh key is generated and sshd starts up. This check makes sure that we allow an additional 30 seconds (1 second per ssh attempt) for sshd to finish initializing. """ count = 30 success = False while count > 0: try: self.log.debug("Testing ssh connection, try %d", count) start = time.time() self.guest_execute_command(guestaddr, 'ls', timeout=1) self.log.debug("Succeeded") success = True break except oz.ozutil.SubprocessException: # ensure that we spent at least one second before trying again end = time.time() if (end - start) < 1: time.sleep(1 - (end - start)) count -= 1 if not success: self.log.debug("Failed to connect to ssh on running guest") raise oz.OzException.OzException("Failed to connect to ssh on running guest") def get_default_runlevel(self, g_handle): """ Function to determine the default runlevel based on the /etc/inittab. """ runlevel = "3" if g_handle.exists('/etc/inittab'): lines = g_handle.cat('/etc/inittab').split("\n") for line in lines: if re.match('id:', line): runlevel = line.split(':')[1] break return runlevel def guest_execute_command(self, guestaddr, command, timeout=10): """ Method to execute a command on the guest and return the output. """ # ServerAliveInterval protects against NAT firewall timeouts # on long-running commands with no output # # PasswordAuthentication=no prevents us from falling back to # keyboard-interactive password prompting # # -F /dev/null makes sure that we don't use the global or per-user # configuration files return oz.ozutil.subprocess_check_output(["ssh", "-i", self.sshprivkey, "-F", "/dev/null", "-o", "ServerAliveInterval=30", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=" + str(timeout), "-o", "UserKnownHostsFile=/dev/null", "-o", "PasswordAuthentication=no", "-o", "IdentitiesOnly yes", "root@" + guestaddr, command], printfn=self.log.debug) def guest_live_upload(self, guestaddr, file_to_upload, destination, timeout=10): """ Method to copy a file to the live guest. """ self.guest_execute_command(guestaddr, "mkdir -p " + os.path.dirname(destination), timeout) # ServerAliveInterval protects against NAT firewall timeouts # on long-running commands with no output # # PasswordAuthentication=no prevents us from falling back to # keyboard-interactive password prompting # # -F /dev/null makes sure that we don't use the global or per-user # configuration files return oz.ozutil.subprocess_check_output(["scp", "-i", self.sshprivkey, "-F", "/dev/null", "-o", "ServerAliveInterval=30", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=" + str(timeout), "-o", "UserKnownHostsFile=/dev/null", "-o", "PasswordAuthentication=no", "-o", "IdentitiesOnly yes", file_to_upload, "root@" + guestaddr + ":" + destination], printfn=self.log.debug) def _customize_files(self, guestaddr): """ Method to upload the custom files specified in the TDL to the guest. """ self.log.info("Uploading custom files") for name, fp in list(self.tdl.files.items()): # all of the self.tdl.files are named temporary files; we just need # to fetch the name out and have scp upload it self.guest_live_upload(guestaddr, fp.name, name) def _shutdown_guest(self, guestaddr, libvirt_dom): """ Method to shutdown the guest (gracefully at first, then with prejudice). """ if guestaddr is not None: # sometimes the ssh process gets disconnected before it can return # cleanly (particularly when the guest is running systemd). If that # happens, ssh returns 255, guest_execute_command throws an # exception, and the guest is forcibly destroyed. While this # isn't the end of the world, it isn't desirable. To avoid # this, we catch any exception thrown by ssh during the shutdown # command and throw them away. In the (rare) worst case, the # shutdown will not have made it to the guest and we'll have to wait # 90 seconds for wait_for_guest_shutdown to timeout and forcibly # kill the guest. try: self.guest_execute_command(guestaddr, 'shutdown -h now') except Exception: pass try: if not self._wait_for_guest_shutdown(libvirt_dom): self.log.warning("Guest did not shutdown in time, going to kill") else: libvirt_dom = None except Exception: self.log.warning("Failed shutting down guest, forcibly killing") if libvirt_dom is not None: try: libvirt_dom.destroy() except libvirt.libvirtError: # the destroy failed for some reason. This can happen if # _wait_for_guest_shutdown times out, but the domain shuts # down before we get to destroy. Check to make sure that the # domain is gone from the list of running domains; if so, just # continue on; if not, re-raise the error. for domid in self.libvirt_conn.listDomainsID(): if domid == libvirt_dom.ID(): raise def _collect_setup(self, libvirt_xml): # pylint: disable=unused-argument """ Default method to set the guest up for remote access. """ raise oz.OzException.OzException("ICICLE generation and customization is not implemented for guest %s" % (self.tdl.distro)) def _collect_teardown(self, libvirt_xml): # pylint: disable=unused-argument """ Method to reverse the changes done in _collect_setup. """ raise oz.OzException.OzException("ICICLE generation and customization is not implemented for guest %s" % (self.tdl.distro)) def _install_packages(self, guestaddr, packstr): # pylint: disable=unused-argument """ Internal method to install packages; expected to be overriden by child classes. """ raise oz.OzException.OzException("Customization is not implemented for guest %s" % (self.tdl.distro)) def _customize_repos(self, guestaddr): # pylint: disable=unused-argument """ Internal method to customize repositories; expected to be overriden by child classes. """ raise oz.OzException.OzException("Customization is not implemented for guest %s" % (self.tdl.distro)) def _remove_repos(self, guestaddr): # pylint: disable=unused-argument """ Internal method to remove repositories; expected to be overriden by child classes. """ raise oz.OzException.OzException("Repository removal not implemented for guest %s" % (self.tdl.distro)) def do_customize(self, guestaddr): """ Method to customize by installing additional packages and files. """ if not self.tdl.packages and not self.tdl.files and not self.tdl.commands: # no work to do, just return return self._customize_repos(guestaddr) for cmd in self.tdl.precommands: self.guest_execute_command(guestaddr, cmd.read()) self.log.debug("Installing custom packages") packstr = '' for package in self.tdl.packages: packstr += '"' + package.name + '" ' if packstr != '': self._install_packages(guestaddr, packstr) self._customize_files(guestaddr) self.log.debug("Running custom commands") for cmd in self.tdl.commands: self.guest_execute_command(guestaddr, cmd.read()) self.log.debug("Removing non-persisted repos") self._remove_repos(guestaddr) self.log.debug("Syncing") self.guest_execute_command(guestaddr, 'sync') def do_icicle(self, guestaddr): """ Default method to collect the package information and generate the ICICLE XML. """ raise oz.OzException.OzException("ICICLE generation is not implemented for this guest type") def _internal_customize(self, libvirt_xml, action): """ Internal method to customize and optionally generate an ICICLE for the operating system after initial installation. """ # the "action" input is actually a tri-state: # action = "gen_and_mod" means to generate the icicle and to # potentially make modifications # action = "gen_only" means to generate the icicle only, and not # look at any modifications # action = "mod_only" means to not generate the icicle, but still # potentially make modifications self.log.info("Customizing image") if not self.tdl.packages and not self.tdl.files and not self.tdl.commands: if action == "mod_only": self.log.info("No additional packages, files, or commands to install, and icicle generation not requested, skipping customization") return elif action == "gen_and_mod": # It is actually possible to get here with a "gen_and_mod" # action but a TDL that contains no real customizations. # In the "safe ICICLE" code below it is important to know # when we are truly in a "gen_only" state so we modify # the action here if we detect that ICICLE generation is the # only task to be done. self.log.debug("Asked to gen_and_mod but no mods are present - changing action to gen_only") action = "gen_only" # when doing an oz-install with -g, this isn't necessary as it will # just replace the port with the same port. However, it is very # necessary when doing an oz-customize since the serial port might # not match what is specified in the libvirt XML modified_xml = self._modify_libvirt_xml_for_serial(libvirt_xml) if action == "gen_only" and self.safe_icicle_gen: # We are only generating ICICLE and the user has asked us to do # this without modifying the completed image by booting it. # Create a copy on write snapshot to use for ICICLE # generation - discard when finished cow_diskimage = self.diskimage + "-icicle-snap.qcow2" self._internal_generate_diskimage(force=True, backing_filename=self.diskimage, image_filename=cow_diskimage) modified_xml = self._modify_libvirt_xml_diskimage(modified_xml, cow_diskimage, 'qcow2') self._collect_setup(modified_xml) icicle = None try: libvirt_dom = self.libvirt_conn.createXML(modified_xml, 0) try: guestaddr = None guestaddr = self._wait_for_guest_boot(libvirt_dom) self._test_ssh_connection(guestaddr) if action == "gen_and_mod": self.do_customize(guestaddr) icicle = self.do_icicle(guestaddr) elif action == "gen_only": icicle = self.do_icicle(guestaddr) elif action == "mod_only": self.do_customize(guestaddr) else: raise oz.OzException.OzException("Invalid customize action %s; this is a programming error" % (action)) finally: if action == "gen_only" and self.safe_icicle_gen: # if this is a gen_only and safe_icicle_gen, there is no # reason to wait around for the guest to shutdown; we'll # be removing the overlay file anyway. Just destroy it libvirt_dom.destroy() else: self._shutdown_guest(guestaddr, libvirt_dom) finally: if action == "gen_only" and self.safe_icicle_gen: # no need to teardown because we simply discard the file # containing those changes os.unlink(cow_diskimage) else: self._collect_teardown(modified_xml) return icicle def customize(self, libvirt_xml): """ Method to customize the operating system after installation. """ return self._internal_customize(libvirt_xml, "mod_only") def customize_and_generate_icicle(self, libvirt_xml): """ Method to customize and generate the ICICLE for an operating system after installation. This is equivalent to calling customize() and generate_icicle() back-to-back, but is faster. """ return self._internal_customize(libvirt_xml, "gen_and_mod") def generate_icicle(self, libvirt_xml): """ Method to generate the ICICLE from an operating system after installation. The ICICLE contains information about packages and other configuration on the diskimage. """ return self._internal_customize(libvirt_xml, "gen_only") oz-0.17.0/oz/Mageia.py000066400000000000000000000566771344320532700144440ustar00rootroot00000000000000# Copyright (C) 2013-2018 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Mageia installation """ import os import re import shutil try: import urllib.parse as urlparse except ImportError: import urlparse import oz.GuestFSManager import oz.Linux import oz.OzException import oz.ozutil class MageiaConfiguration(object): """ Configuration class for Mageia installation. """ def __init__(self, isolinux_style, default_netdev, default_diskbus): self._isolinux_style = isolinux_style self._default_netdev = default_netdev self._default_diskbus = default_diskbus @property def isolinux_style(self): """ Property method for the 'old' or 'new' isolinux style. """ return self._isolinux_style @property def default_netdev(self): """ Property method for the default netdev for this version of Mageia. """ return self._default_netdev @property def default_diskbus(self): """ Property method for the default diskbus for this version of Mageia. """ return self._default_diskbus version_to_config = { '5': MageiaConfiguration(isolinux_style="new", default_netdev='virtio', default_diskbus='virtio'), '4.1': MageiaConfiguration(isolinux_style="new", default_netdev='virtio', default_diskbus='virtio'), '4': MageiaConfiguration(isolinux_style="new", default_netdev='virtio', default_diskbus='virtio'), '3': MageiaConfiguration(isolinux_style="old", default_netdev='virtio', default_diskbus='virtio'), '2': MageiaConfiguration(isolinux_style="old", default_netdev='virtio', default_diskbus='virtio'), } class MageiaGuest(oz.Linux.LinuxCDGuest): """ Class for Mageia 2, 3, 4, 4.1, and 5 installation. """ def __init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress): self.config = version_to_config[tdl.update] if netdev is None: netdev = self.config.default_netdev if diskbus is None: diskbus = self.config.default_diskbus oz.Linux.LinuxCDGuest.__init__(self, tdl, config, auto, output_disk, netdev, diskbus, True, True, macaddress) self.sshd_was_active = False self.crond_was_active = False def _modify_iso(self): """ Method to make the boot ISO auto-boot with appropriate parameters. """ self.log.debug("Modifying ISO") self.log.debug("Copying cfg file to floppy image") outname = os.path.join(self.iso_contents, "auto_inst.cfg") if self.default_auto_file(): def _cfg_sub(line): """ Method that is called back from oz.ozutil.copy_modify_file() to modify preseed files as appropriate for Mageia. """ if re.search("'password' =>", line): return " 'password' => '" + self.rootpw + "',\n" return line oz.ozutil.copy_modify_file(self.auto, outname, _cfg_sub) else: shutil.copy(self.auto, outname) oz.ozutil.subprocess_check_output(["/sbin/mkfs.msdos", "-C", self.output_floppy, "1440"]) oz.ozutil.subprocess_check_output(["mcopy", "-n", "-o", "-i", self.output_floppy, outname, "::AUTO_INST.CFG"]) self.log.debug("Modifying isolinux.cfg") if self.config.isolinux_style == "old": # Mageia 2 dual - isolinux/32.cfg # isolinux/64.cfg # isolinux/alt0/32/vmlinuz # isolinux/alt0/32/all.rdz # isolinux/alt0/64/vmlinuz # isolinux/alt0/64/all.rdz # Mageia 2 x86_64 - x86_64/isolinux/isolinux.cfg # x86_64/isolinux/alt0/vmlinuz # x86_64/isolinux/alt0/all.rdz # Mageia 2 i586 - i586/isolinux/isolinux.cfg # i586/isolinux/vmlinuz # i586/isolinux/all.rdz # Mageia 3 dual - syslinux/32.cfg # syslinux/64.cfg # syslinux/alt0/32/vmlinuz # syslinux/alt0/32/all.rdz # syslinux/alt0/64/vmlinuz # syslinux/alt0/64/all.rdz # Mageia 3 x86_64 - x86_64/isolinux/isolinux.cfg # x86_64/isolinux/alt0/vmlinuz # x86_64/isolinux/alt0/all.rdz # Mageia 3 i586 - i586/isolinux/isolinux.cfg # i586/isolinux/alt0/vmlinuz # i586/isolinux/alt0/all.rdz isolinuxstr = None if os.path.exists(os.path.join(self.iso_contents, 'isolinux')): isolinuxstr = "isolinux" elif os.path.exists(os.path.join(self.iso_contents, 'syslinux')): isolinuxstr = "syslinux" if isolinuxstr is not None: if self.tdl.arch == "i386": mageia_arch = "32" else: mageia_arch = "64" # This looks like a dual CD, so let's set things up that way. isolinuxcfg = os.path.join(self.iso_contents, isolinuxstr, mageia_arch + ".cfg") self.isolinuxbin = os.path.join(isolinuxstr, mageia_arch + ".bin") kernel = "alt0/" + mageia_arch + "/vmlinuz" initrd = "alt0/" + mageia_arch + "/all.rdz" else: # This looks like an i586 or x86_64 ISO, so set things up that way. mageia_arch = self.tdl.arch if self.tdl.arch == "i386": mageia_arch = "i586" isolinuxcfg = os.path.join(self.iso_contents, mageia_arch, 'isolinux', 'isolinux.cfg') self.isolinuxbin = os.path.join(mageia_arch, 'isolinux', 'isolinux.bin') kernel = "alt0/vmlinuz" initrd = "alt0/all.rdz" flags = "ramdisk_size=128000 root=/dev/ram3 acpi=ht vga=788 automatic=method:cdrom" else: # Mageia 4 dual - isolinux/i586.cfg # isolinux/x86_64.cfg # isolinux/i586/vmlinuz # isolinux/i586/all.rdz # isolinux/x86_64/vmlinuz # isolinux/x86_64/all.rdz # Mageia 4 x86_64 - isolinux/isolinux.cfg # isolinux/x86_64/vmlinuz # isolinux/x86_64/all.rdz # Mageia 4 i586 - isolinux/isolinux.cfg # isolinux/i586/vmlinuz # isolinuz/i586/all.rdz # Mageia 4.1 dual - isolinux/i586.cfg # isolinux/x86_64.cfg # isolinux/i586/vmlinuz # isolinux/i586/all.rdz # isolinux/x86_64/vmlinuz # isolinux/x86_64/all.rdz # Mageia 4.1 x86_64 - isolinux/isolinux.cfg # isolinux/x86_64/vmlinuz # isolinux/x86_64/all.rdz # Mageia 4.1 i586 - isolinux/isolinux.cfg # isolinux/i586/vmlinuz # isolinux/i586/all.rdz # Mageia 5 dual - isolinux/i586.cfg # isolinux/x86_64.cfg # isolinux/i586/vmlinuz # isolinux/i586/all.rdz # isolinux/x86_64/vmlinuz # isolinux/x86_64/all.rdz # Mageia 5 x86_64 - isolinux/isolinux.cfg # isolinux/x86_64/vmlinuz # isolinux/x86_64/all.rdz # Mageia 5 i586 - isolinux/isolinux.cfg # isolinux/i586/vmlinuz # isolinux/i586/all.rdz # Starting with Mageia 4, things are a lot more regular. The # directory always starts with isolinux. If it is a dual ISO, then # there is an i586.cfg and x86_64.cfg describing how to boot each # of them. Otherwise, there is just an isolinux.cfg. The kernel # and initrd are always in the same place. mageia_arch = self.tdl.arch if self.tdl.arch == "i386": mageia_arch = "i586" if os.path.exists(os.path.join(self.iso_contents, 'isolinux', 'i586.cfg')): # A dual, so use the correct cfg isolinuxcfg = os.path.join(self.iso_contents, 'isolinux', mageia_arch + ".cfg") self.isolinuxbin = os.path.join('isolinux', mageia_arch + ".bin") else: isolinuxcfg = os.path.join(self.iso_contents, 'isolinux', 'isolinux.cfg') self.isolinuxbin = os.path.join('isolinux', 'isolinux.bin') kernel = mageia_arch + "/vmlinuz" initrd = mageia_arch + "/all.rdz" if self.tdl.installtype == "url": url = urlparse.urlparse(self.tdl.url) flags = "automatic=method:%s,ser:%s,dir:%s,int:eth0,netw:dhcp" % (url.scheme, url.hostname, url.path) else: flags = "automatic=method:cdrom" with open(isolinuxcfg, 'w') as f: f.write("""\ default customiso timeout 1 prompt 0 label customiso kernel %s append initrd=%s kickstart=floppy %s """ % (kernel, initrd, flags)) def _generate_new_iso(self): """ Method to create a new ISO based on the modified CD/DVD. """ self.log.info("Generating new ISO") oz.ozutil.subprocess_check_output(["genisoimage", "-r", "-V", "Custom", "-J", "-l", "-no-emul-boot", "-b", self.isolinuxbin, "-c", "boot.catalog", "-boot-load-size", "4", "-cache-inodes", "-boot-info-table", "-v", "-o", self.output_iso, self.iso_contents], printfn=self.log.debug) def _get_service_runlevel_link(self, g_handle, service): """ Method to find the runlevel link(s) for a service based on the name and the (detected) default runlevel. """ runlevel = self.get_default_runlevel(g_handle) lines = g_handle.cat('/etc/init.d/' + service).split("\n") startlevel = "99" for line in lines: if re.match('# chkconfig:', line): try: startlevel = line.split(':')[1].split()[1] except Exception: pass break return "/etc/rc" + runlevel + ".d/S" + startlevel + service def _image_ssh_teardown_step_1(self, g_handle): """ First step to undo _image_ssh_setup (remove authorized keys). """ self.log.debug("Teardown step 1") # reset the authorized keys self.log.debug("Resetting authorized_keys") g_handle.path_restore('/root/.ssh/authorized_keys') def _image_ssh_teardown_step_2(self, g_handle): """ Second step to undo _image_ssh_setup (remove custom sshd_config). """ self.log.debug("Teardown step 2") # remove custom sshd_config self.log.debug("Resetting sshd_config") g_handle.path_restore('/etc/ssh/sshd_config') # reset the service link self.log.debug("Resetting sshd service") if g_handle.exists('/usr/lib/systemd/system/sshd.service'): if not self.sshd_was_active: g_handle.rm('/etc/systemd/system/multi-user.target.wants/sshd.service') else: startuplink = self._get_service_runlevel_link(g_handle, 'sshd') g_handle.path_restore(startuplink) def _image_ssh_teardown_step_3(self, g_handle): """ Third step to undo _image_ssh_setup (remove guest announcement). """ self.log.debug("Teardown step 3") # remove announce cronjob self.log.debug("Resetting announcement to host") g_handle.remove_if_exists('/etc/cron.d/announce') # remove reportip self.log.debug("Removing reportip") g_handle.remove_if_exists('/root/reportip') # reset the service link self.log.debug("Resetting cron service") if g_handle.exists('/usr/lib/systemd/system/cron.service'): if not self.crond_was_active: g_handle.rm('/etc/systemd/system/multi-user.target.wants/cron.service') else: runlevel = self.get_default_runlevel(g_handle) startuplink = '/etc/rc.d/rc' + runlevel + ".d/S06cron" g_handle.path_restore(startuplink) def _image_ssh_teardown_step_4(self, g_handle): """ Fourth step to undo changes by the operating system. For instance, during first boot openssh generates ssh host keys and stores them in /etc/ssh. Since this image might be cached later on, this method removes those keys. """ for f in ["/etc/ssh/ssh_host_dsa_key", "/etc/ssh/ssh_host_dsa_key.pub", "/etc/ssh/ssh_host_rsa_key", "/etc/ssh/ssh_host_rsa_key.pub", "/etc/ssh/ssh_host_ecdsa_key", "/etc/ssh/ssh_host_ecdsa_key.pub", "/etc/ssh/ssh_host_key", "/etc/ssh/ssh_host_key.pub"]: g_handle.remove_if_exists(f) # Remove any lease files; this is so that subsequent boots don't try # to connect to a DHCP server that is on a totally different network for lease in g_handle.glob_expand("/var/lib/dhcp/*.leases"): g_handle.rm(lease) for lease in g_handle.glob_expand("/var/lib/dhcp6/*.leases"): g_handle.rm(lease) for lease in g_handle.glob_expand("/var/lib/dhcp6/*.lease"): g_handle.rm(lease) def _collect_teardown(self, libvirt_xml): """ Method to reverse the changes done in _collect_setup. """ self.log.info("Collection Teardown") g_handle = oz.GuestFSManager.GuestFSLibvirtFactory(libvirt_xml, self.libvirt_conn) g_handle.mount_partitions() try: self._image_ssh_teardown_step_1(g_handle) self._image_ssh_teardown_step_2(g_handle) self._image_ssh_teardown_step_3(g_handle) self._image_ssh_teardown_step_4(g_handle) finally: g_handle.cleanup() shutil.rmtree(self.icicle_tmp) def _image_ssh_setup_step_1(self, g_handle): """ First step for allowing remote access (generate and upload ssh keys). """ # part 1; upload the keys self.log.debug("Step 1: Uploading ssh keys") if not g_handle.exists('/root/.ssh'): g_handle.mkdir('/root/.ssh') g_handle.path_backup('/root/.ssh/authorized_keys') self._generate_openssh_key(self.sshprivkey) g_handle.upload(self.sshprivkey + ".pub", '/root/.ssh/authorized_keys') def _image_ssh_setup_step_2(self, g_handle): """ Second step for allowing remote access (ensure sshd is running). """ # part 2; check and setup sshd self.log.debug("Step 2: setup sshd") if not g_handle.exists('/usr/sbin/sshd'): raise oz.OzException.OzException("ssh not installed on the image, cannot continue") if g_handle.exists('/usr/lib/systemd/system/sshd.service'): if g_handle.exists('/etc/systemd/system/multi-user.target.wants/sshd.service'): self.sshd_was_active = True else: g_handle.ln_sf('/usr/lib/systemd/system/sshd.service', '/etc/systemd/system/multi-user.target.wants/sshd.service') else: startuplink = self._get_service_runlevel_link(g_handle, 'sshd') g_handle.path_backup(startuplink) g_handle.ln_sf('/etc/init.d/sshd', startuplink) sshd_config_file = self.icicle_tmp + "/sshd_config" with open(sshd_config_file, 'w') as f: f.write("""PasswordAuthentication no UsePAM yes X11Forwarding yes Subsystem sftp /usr/lib64/ssh/sftp-server AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL """) try: g_handle.path_backup("/etc/ssh/sshd_config") g_handle.upload(sshd_config_file, '/etc/ssh/sshd_config') finally: os.unlink(sshd_config_file) def _image_ssh_setup_step_3(self, g_handle): """ Third step for allowing remote access (make the guest announce itself on bootup). """ # part 3; make sure the guest announces itself self.log.debug("Step 3: Guest announcement") scriptfile = os.path.join(self.icicle_tmp, "script") if not g_handle.exists('/usr/sbin/crond'): raise oz.OzException.OzException("cron not installed on the image, cannot continue") with open(scriptfile, 'w') as f: f.write("""\ #!/bin/bash DEV=$(/bin/awk '{if ($2 == 0) print $1}' /proc/net/route) && [ -z "$DEV" ] && exit 0 ADDR=$(/sbin/ip -4 -o addr show dev $DEV | /bin/awk '{print $4}' | /usr/bin/cut -d/ -f1) && [ -z "$ADDR" ] && exit 0 echo -n "!$ADDR,%s!" > /dev/ttyS1 """ % (self.uuid)) try: g_handle.upload(scriptfile, '/root/reportip') g_handle.chmod(0o755, '/root/reportip') finally: os.unlink(scriptfile) announcefile = os.path.join(self.icicle_tmp, "announce") with open(announcefile, 'w') as f: f.write('*/1 * * * * root /bin/bash -c "/root/reportip"\n') try: g_handle.upload(announcefile, '/etc/cron.d/announce') finally: os.unlink(announcefile) if g_handle.exists('/usr/lib/systemd/system/cron.service'): if g_handle.exists('/etc/systemd/system/multi-user.target.wants/cron.service'): self.crond_was_active = True else: g_handle.ln_sf('/lib/systemd/system/cron.service', '/etc/systemd/system/multi-user.target.wants/cron.service') else: runlevel = self.get_default_runlevel(g_handle) startuplink = '/etc/rc.d/rc' + runlevel + ".d/S06cron" g_handle.path_backup(startuplink) g_handle.ln_sf('/etc/init.d/cron', startuplink) def _collect_setup(self, libvirt_xml): """ Setup the guest for remote access. """ self.log.info("Collection Setup") g_handle = oz.GuestFSManager.GuestFSLibvirtFactory(libvirt_xml, self.libvirt_conn) g_handle.mount_partitions() # we have to do 3 things to make sure we can ssh into OpenSUSE: # 1) Upload our ssh key # 2) Make sure sshd is running on boot # 3) Make the guest announce itself to the host try: try: self._image_ssh_setup_step_1(g_handle) try: self._image_ssh_setup_step_2(g_handle) try: self._image_ssh_setup_step_3(g_handle) except: self._image_ssh_teardown_step_3(g_handle) raise except: self._image_ssh_teardown_step_2(g_handle) raise except: self._image_ssh_teardown_step_1(g_handle) raise finally: g_handle.cleanup() def do_icicle(self, guestaddr): """ Method to collect the package information and generate the ICICLE XML. """ self.log.debug("Generating ICICLE") stdout, stderr_unused, retcode_unused = self.guest_execute_command(guestaddr, 'rpm -qa', timeout=30) package_split = stdout.split("\n") extrasplit = None if self.tdl.icicle_extra_cmd: extrastdout, stderr_unused, retcode_unused = self.guest_execute_command(guestaddr, self.tdl.icicle_extra_cmd, timeout=30) extrasplit = extrastdout.split("\n") if len(package_split) != len(extrasplit): raise oz.OzException.OzException("Invalid extra package command; it must return the same set of packages as 'rpm -qa'") return self._output_icicle_xml(package_split, self.tdl.description, extrasplit) def generate_install_media(self, force_download=False, customize_or_icicle=False): """ Method to generate the install media for Mageia based operating systems. If force_download is False (the default), then the original media will only be fetched if it is not cached locally. If force_download is True, then the original media will be downloaded regardless of whether it is cached locally. """ fetchurl = self.url if self.tdl.installtype == 'url': fetchurl += "/install/images/boot.iso" return self._iso_generate_install_media(fetchurl, force_download, customize_or_icicle) def install(self, timeout=None, force=False): fddev = self._InstallDev("floppy", self.output_floppy, "fda") return self._do_install(timeout, force, 0, None, None, None, [fddev]) def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for Mageia installs. """ if tdl.update in version_to_config.keys(): return MageiaGuest(tdl, config, auto, output_disk, netdev, diskbus, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "Mageia: " + ", ".join(sorted(version_to_config.keys())) oz-0.17.0/oz/Mandrake.py000066400000000000000000000152711344320532700147640ustar00rootroot00000000000000# Copyright (C) 2011 Chris Lalancette # Copyright (C) 2012-2018 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Mandrake installation """ import os import re import shutil import oz.Guest import oz.OzException import oz.ozutil class MandrakeConfiguration(object): """ Configuration class for Mandrake installation. """ def __init__(self, old_isolinux, need_longer_timeout): self._old_isolinux = old_isolinux self._need_longer_timeout = need_longer_timeout @property def old_isolinux(self): """ Property method for whether this version of Mandrake uses an old isolinux. """ return self._old_isolinux @property def need_longer_timeout(self): """ Property method for whether this version of Mandrake needs a longer timeout. """ return self._need_longer_timeout version_to_config = { '10.1': MandrakeConfiguration(old_isolinux=False, need_longer_timeout=False), '10.0': MandrakeConfiguration(old_isolinux=False, need_longer_timeout=False), '9.2': MandrakeConfiguration(old_isolinux=False, need_longer_timeout=False), '9.1': MandrakeConfiguration(old_isolinux=False, need_longer_timeout=False), '9.0': MandrakeConfiguration(old_isolinux=False, need_longer_timeout=True), '8.2': MandrakeConfiguration(old_isolinux=True, need_longer_timeout=True), } class MandrakeGuest(oz.Guest.CDGuest): """ Class for Mandrake 8.2, 9.1, 9.2, 10.0, and 10.1 installation. """ def __init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress): oz.Guest.CDGuest.__init__(self, tdl, config, auto, output_disk, netdev, None, None, diskbus, True, False, macaddress) if self.tdl.arch != "i386": raise oz.OzException.OzException("Mandrake only supports i386 architecture") self.config = version_to_config[tdl.update] def _modify_iso(self): """ Method to make the boot ISO auto-boot with appropriate parameters. """ self.log.debug("Modifying ISO") self.log.debug("Copying cfg file") outname = os.path.join(self.iso_contents, "auto_inst.cfg") if self.default_auto_file(): def _cfg_sub(line): """ Method that is called back from oz.ozutil.copy_modify_file() to modify preseed files as appropriate for Mandrake. """ if re.search("'password' =>", line): return " 'password' => '" + self.rootpw + "',\n" return line oz.ozutil.copy_modify_file(self.auto, outname, _cfg_sub) else: shutil.copy(self.auto, outname) self.log.debug("Modifying isolinux.cfg") if self.config.old_isolinux: syslinux = os.path.join(self.icicle_tmp, 'syslinux.cfg') with open(syslinux, 'w') as f: f.write("""\ default customiso timeout 1 prompt 0 label customiso kernel vmlinuz append initrd=cdrom.rdz ramdisk_size=32000 root=/dev/ram3 automatic=method:cdrom vga=788 auto_install=auto_inst.cfg """) cdromimg = os.path.join(self.iso_contents, "Boot", "cdrom.img") oz.ozutil.subprocess_check_output(["mcopy", "-n", "-o", "-i", cdromimg, syslinux, "::SYSLINUX.CFG"], printfn=self.log.debug) else: isolinuxcfg = os.path.join(self.iso_contents, "isolinux", "isolinux.cfg") with open(isolinuxcfg, 'w') as f: f.write("""\ default customiso timeout 1 prompt 0 label customiso kernel alt0/vmlinuz append initrd=alt0/all.rdz ramdisk_size=128000 root=/dev/ram3 acpi=ht vga=788 automatic=method:cdrom kickstart=auto_inst.cfg """) def _generate_new_iso(self): """ Method to create a new ISO based on the modified CD/DVD. """ self.log.info("Generating new ISO") if self.config.old_isolinux: oz.ozutil.subprocess_check_output(["genisoimage", "-r", "-V", "Custom", "-J", "-cache-inodes", "-b", "Boot/cdrom.img", "-c", "Boot/boot.cat", "-v", "-o", self.output_iso, self.iso_contents], printfn=self.log.debug) else: oz.ozutil.subprocess_check_output(["genisoimage", "-r", "-V", "Custom", "-J", "-l", "-no-emul-boot", "-b", "isolinux/isolinux.bin", "-c", "isolinux/boot.cat", "-boot-load-size", "4", "-cache-inodes", "-boot-info-table", "-v", "-o", self.output_iso, self.iso_contents], printfn=self.log.debug) def install(self, timeout=None, force=False): internal_timeout = timeout if internal_timeout is None and self.config.need_longer_timeout: internal_timeout = 2500 return self._do_install(internal_timeout, force, 0) def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for Mandrake installs. """ if tdl.update in version_to_config.keys(): return MandrakeGuest(tdl, config, auto, output_disk, netdev, diskbus, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "Mandrake: " + ", ".join(sorted(version_to_config.keys(), key=float)) oz-0.17.0/oz/Mandriva.py000066400000000000000000000115201344320532700147740ustar00rootroot00000000000000# Copyright (C) 2011 Chris Lalancette # Copyright (C) 2012-2017 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Mandriva installation """ import os import re import shutil import oz.Guest import oz.OzException import oz.ozutil class MandrivaConfiguration(object): """ Configuration class for Mandriva. """ def __init__(self, old_path): self._old_path = old_path @property def old_path(self): """ Property method for whether this uses the old style paths. """ return self._old_path version_to_config = { "2008.0": MandrivaConfiguration(old_path=False), "2007.0": MandrivaConfiguration(old_path=False), "2006.0": MandrivaConfiguration(old_path=True), "2005": MandrivaConfiguration(old_path=True), } class MandrivaGuest(oz.Guest.CDGuest): """ Class for Mandriva 2005, 2006.0, 2007.0, and 2008.0 installation. """ def __init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress): oz.Guest.CDGuest.__init__(self, tdl, config, auto, output_disk, netdev, None, None, diskbus, True, False, macaddress) self.mandriva_arch = self.tdl.arch if self.mandriva_arch == "i386": self.mandriva_arch = "i586" self.config = version_to_config[tdl.update] def _modify_iso(self): """ Method to make the boot ISO auto-boot with appropriate parameters. """ self.log.debug("Modifying ISO") self.log.debug("Copying cfg file") pathdir = self.iso_contents if not self.config.old_path: pathdir = os.path.join(self.iso_contents, self.mandriva_arch) outname = os.path.join(pathdir, "auto_inst.cfg") if self.default_auto_file(): def _cfg_sub(line): """ Method that is called back from oz.ozutil.copy_modify_file() to modify preseed files as appropriate for Mandriva. """ if re.search("'password' =>", line): return " 'password' => '" + self.rootpw + "',\n" return line oz.ozutil.copy_modify_file(self.auto, outname, _cfg_sub) else: shutil.copy(self.auto, outname) self.log.debug("Modifying isolinux.cfg") isolinuxcfg = os.path.join(pathdir, "isolinux", "isolinux.cfg") with open(isolinuxcfg, 'w') as f: f.write("""\ default customiso timeout 1 prompt 0 label customiso kernel alt0/vmlinuz append initrd=alt0/all.rdz ramdisk_size=128000 root=/dev/ram3 acpi=ht vga=788 automatic=method:cdrom kickstart=auto_inst.cfg """) def _generate_new_iso(self): """ Method to create a new ISO based on the modified CD/DVD. """ self.log.info("Generating new ISO") isolinuxdir = "" if not self.config.old_path: isolinuxdir = self.mandriva_arch isolinuxbin = os.path.join(isolinuxdir, "isolinux/isolinux.bin") isolinuxboot = os.path.join(isolinuxdir, "isolinux/boot.cat") oz.ozutil.subprocess_check_output(["genisoimage", "-r", "-V", "Custom", "-J", "-l", "-no-emul-boot", "-b", isolinuxbin, "-c", isolinuxboot, "-boot-load-size", "4", "-cache-inodes", "-boot-info-table", "-v", "-o", self.output_iso, self.iso_contents], printfn=self.log.debug) def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for Mandriva installs. """ if tdl.update in version_to_config.keys(): return MandrivaGuest(tdl, config, auto, output_disk, netdev, diskbus, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "Mandriva: " + ", ".join(sorted(version_to_config.keys())) oz-0.17.0/oz/OpenSUSE.py000066400000000000000000000535651344320532700146530ustar00rootroot00000000000000# Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2018 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ OpenSUSE installation """ import os import re import shutil import lxml.etree import oz.GuestFSManager import oz.Linux import oz.OzException import oz.ozutil class OpenSUSEConfiguration(object): """ Configuration class for OpenSUSE. """ def __init__(self, reboots, use_floppy_autoyast, extended_zypper_list, default_netdev, default_diskbus): self._reboots = reboots self._use_floppy_autoyast = use_floppy_autoyast self._extended_zypper_list = extended_zypper_list self._default_netdev = default_netdev self._default_diskbus = default_diskbus @property def reboots(self): """ Property method for the number of reboots for installation of this version of OpenSUSE. """ return self._reboots @property def use_floppy_autoyast(self): """ Property method to determine whether the autoyast should go on a floppy or on the ISO. """ return self._use_floppy_autoyast @property def extended_zypper_list(self): """ Property method for where the URI is stored in the output of 'zypper list' in this version of OpenSUSE. """ return self._extended_zypper_list @property def default_netdev(self): """ Property method for the default netdev for this version of OpenSUSE. """ return self._default_netdev @property def default_diskbus(self): """ Property method for the default diskbus for this version of OpenSUSE. """ return self._default_diskbus version_to_config = { "42.2": OpenSUSEConfiguration(reboots=1, use_floppy_autoyast=False, extended_zypper_list=True, default_netdev='virtio', default_diskbus='virtio'), "42.1": OpenSUSEConfiguration(reboots=1, use_floppy_autoyast=False, extended_zypper_list=True, default_netdev='virtio', default_diskbus='virtio'), "13.2": OpenSUSEConfiguration(reboots=1, use_floppy_autoyast=True, extended_zypper_list=False, default_netdev='virtio', default_diskbus='virtio'), "13.1": OpenSUSEConfiguration(reboots=1, use_floppy_autoyast=False, extended_zypper_list=False, default_netdev='virtio', default_diskbus='virtio'), "12.3": OpenSUSEConfiguration(reboots=1, use_floppy_autoyast=False, extended_zypper_list=False, default_netdev='virtio', default_diskbus='virtio'), "12.2": OpenSUSEConfiguration(reboots=1, use_floppy_autoyast=False, extended_zypper_list=False, default_netdev='virtio', default_diskbus='virtio'), "12.1": OpenSUSEConfiguration(reboots=1, use_floppy_autoyast=False, extended_zypper_list=False, default_netdev='virtio', default_diskbus='virtio'), "11.4": OpenSUSEConfiguration(reboots=1, use_floppy_autoyast=False, extended_zypper_list=False, default_netdev='virtio', default_diskbus='virtio'), "11.3": OpenSUSEConfiguration(reboots=1, use_floppy_autoyast=False, extended_zypper_list=False, default_netdev='virtio', default_diskbus='virtio'), "11.2": OpenSUSEConfiguration(reboots=1, use_floppy_autoyast=False, extended_zypper_list=False, default_netdev='virtio', default_diskbus='virtio'), "11.1": OpenSUSEConfiguration(reboots=1, use_floppy_autoyast=False, extended_zypper_list=False, default_netdev='virtio', default_diskbus='virtio'), "11.0": OpenSUSEConfiguration(reboots=1, use_floppy_autoyast=False, extended_zypper_list=False, default_netdev='virtio', default_diskbus='virtio'), "10.3": OpenSUSEConfiguration(reboots=0, use_floppy_autoyast=False, extended_zypper_list=False, default_netdev=None, default_diskbus=None), } class OpenSUSEGuest(oz.Linux.LinuxCDGuest): """ Class for OpenSUSE installation. """ def __init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, macaddress): self.config = version_to_config[tdl.update] if nicmodel is None: nicmodel = self.config.default_netdev if diskbus is None: diskbus = self.config.default_diskbus oz.Linux.LinuxCDGuest.__init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, True, False, macaddress) self.crond_was_active = False self.sshd_was_active = False def _modify_iso(self): """ Method to make the boot ISO auto-boot with appropriate parameters. """ self.log.debug("Putting the autoyast in place") outname = os.path.join(self.iso_contents, "autoinst.xml") if self.default_auto_file(): doc = lxml.etree.parse(self.auto) pw = doc.xpath('/suse:profile/suse:users/suse:user/suse:user_password', namespaces={'suse': 'http://www.suse.com/1.0/yast2ns'}) if len(pw) != 1: raise oz.OzException.OzException("Invalid SUSE autoyast file; expected single user_password, saw %d" % (len(pw))) pw[0].text = self.rootpw with open(outname, 'w') as f: f.write(lxml.etree.tostring(doc, pretty_print=True, encoding="unicode")) else: shutil.copy(self.auto, outname) if self.config.use_floppy_autoyast: oz.ozutil.subprocess_check_output(["/sbin/mkfs.msdos", "-C", self.output_floppy, "1440"]) oz.ozutil.subprocess_check_output(["mcopy", "-n", "-o", "-i", self.output_floppy, outname, "::autoinst.xml"]) self.log.debug("Modifying the boot options") isolinux_cfg = os.path.join(self.iso_contents, "boot", self.tdl.arch, "loader", "isolinux.cfg") f = open(isolinux_cfg, "r") lines = f.readlines() f.close() for index, line in enumerate(lines): if re.match("timeout", line): lines[index] = "timeout 1\n" elif re.match("default", line): lines[index] = "default customiso\n" lines.append("label customiso\n") lines.append(" kernel linux\n") if self.config.use_floppy_autoyast: # OpenSUSE 13.2 has an utterly broken autoyast that can't figure out # how to read the autoinst.xml from the CD. Use a floppy instead. lines.append(" append initrd=initrd splash=silent autoyast=floppy:///autoinst.xml") else: lines.append(" append initrd=initrd splash=silent instmode=cd autoyast=default") with open(isolinux_cfg, 'w') as f: f.writelines(lines) def _generate_new_iso(self): """ Method to create a new ISO based on the modified CD/DVD. """ self.log.info("Generating new ISO") oz.ozutil.subprocess_check_output(["genisoimage", "-r", "-V", "Custom", "-J", "-no-emul-boot", "-b", "boot/" + self.tdl.arch + "/loader/isolinux.bin", "-c", "boot/" + self.tdl.arch + "/loader/boot.cat", "-boot-load-size", "4", "-boot-info-table", "-graft-points", "-iso-level", "4", "-pad", "-allow-leading-dots", "-l", "-v", "-o", self.output_iso, self.iso_contents], printfn=self.log.debug) def install(self, timeout=None, force=False): """ Method to run the operating system installation. """ extrainstalldevs = None if self.config.use_floppy_autoyast: extrainstalldevs = [self._InstallDev("floppy", self.output_floppy, "fda")] return self._do_install(timeout, force, self.config.reboots, None, None, None, extrainstalldevs) def _image_ssh_teardown_step_1(self, g_handle): """ First step to undo _image_ssh_setup (remove authorized keys). """ self.log.debug("Teardown step 1") # reset the authorized keys self.log.debug("Resetting authorized_keys") g_handle.path_restore('/root/.ssh/authorized_keys') def _image_ssh_teardown_step_2(self, g_handle): """ Second step to undo _image_ssh_setup (remove custom sshd_config). """ self.log.debug("Teardown step 2") # remove custom sshd_config self.log.debug("Resetting sshd_config") g_handle.path_restore('/etc/ssh/sshd_config') # reset the service link self.log.debug("Resetting sshd service") if g_handle.exists('/usr/lib/systemd/system/sshd.service'): if not self.sshd_was_active: g_handle.remove_if_exists('/etc/systemd/system/multi-user.target.wants/sshd.service') else: g_handle.path_restore('/etc/init.d/after.local') def _image_ssh_teardown_step_3(self, g_handle): """ Third step to undo _image_ssh_setup (remove guest announcement). """ self.log.debug("Teardown step 3") # remove announce cronjob self.log.debug("Resetting announcement to host") g_handle.remove_if_exists('/etc/NetworkManager/dispatcher.d/99-reportip') g_handle.remove_if_exists('/etc/cron.d/announce') # remove reportip self.log.debug("Removing reportip") g_handle.remove_if_exists('/root/reportip') # reset the service link self.log.debug("Resetting cron service") if g_handle.exists('/usr/lib/systemd/system/cron.service'): if not self.crond_was_active: g_handle.rm('/etc/systemd/system/multi-user.target.wants/cron.service') else: runlevel = self.get_default_runlevel(g_handle) startuplink = '/etc/rc.d/rc' + runlevel + ".d/S06cron" g_handle.path_restore(startuplink) def _image_ssh_teardown_step_4(self, g_handle): """ Fourth step to undo changes by the operating system. For instance, during first boot openssh generates ssh host keys and stores them in /etc/ssh. Since this image might be cached later on, this method removes those keys. """ for f in ["/etc/ssh/ssh_host_dsa_key", "/etc/ssh/ssh_host_dsa_key.pub", "/etc/ssh/ssh_host_rsa_key", "/etc/ssh/ssh_host_rsa_key.pub", "/etc/ssh/ssh_host_ecdsa_key", "/etc/ssh/ssh_host_ecdsa_key.pub", "/etc/ssh/ssh_host_key", "/etc/ssh/ssh_host_key.pub"]: g_handle.remove_if_exists(f) # Remove any lease files; this is so that subsequent boots don't try # to connect to a DHCP server that is on a totally different network for lease in g_handle.glob_expand("/var/lib/dhcp/*.leases"): g_handle.rm(lease) for lease in g_handle.glob_expand("/var/lib/dhcp6/*.leases"): g_handle.rm(lease) for lease in g_handle.glob_expand("/var/lib/dhcp6/*.lease"): g_handle.rm(lease) def _collect_teardown(self, libvirt_xml): """ Method to reverse the changes done in _collect_setup. """ self.log.info("Collection Teardown") g_handle = oz.GuestFSManager.GuestFSLibvirtFactory(libvirt_xml, self.libvirt_conn) g_handle.mount_partitions() try: self._image_ssh_teardown_step_1(g_handle) self._image_ssh_teardown_step_2(g_handle) self._image_ssh_teardown_step_3(g_handle) self._image_ssh_teardown_step_4(g_handle) finally: g_handle.cleanup() shutil.rmtree(self.icicle_tmp) def do_icicle(self, guestaddr): """ Method to collect the package information and generate the ICICLE XML. """ self.log.debug("Generating ICICLE") stdout, stderr_unused, retcode_unused = self.guest_execute_command(guestaddr, 'rpm -qa', timeout=30) return self._output_icicle_xml(stdout.split("\n"), self.tdl.description) def _image_ssh_setup_step_1(self, g_handle): """ First step for allowing remote access (generate and upload ssh keys). """ # part 1; upload the keys self.log.debug("Step 1: Uploading ssh keys") if not g_handle.exists('/root/.ssh'): g_handle.mkdir('/root/.ssh') g_handle.path_backup('/root/.ssh/authorized_keys') self._generate_openssh_key(self.sshprivkey) g_handle.upload(self.sshprivkey + ".pub", '/root/.ssh/authorized_keys') def _image_ssh_setup_step_2(self, g_handle): """ Second step for allowing remote access (ensure sshd is running). """ # part 2; check and setup sshd self.log.debug("Step 2: setup sshd") if not g_handle.exists('/usr/sbin/sshd'): raise oz.OzException.OzException("ssh not installed on the image, cannot continue") if g_handle.exists('/usr/lib/systemd/system/sshd.service'): if g_handle.exists('/etc/systemd/system/multi-user.target.wants/sshd.service'): self.sshd_was_active = True else: g_handle.ln_sf('/usr/lib/systemd/system/sshd.service', '/etc/systemd/system/multi-user.target.wants/sshd.service') else: g_handle.path_backup("/etc/init.d/after.local") local = os.path.join(self.icicle_tmp, "after.local") with open(local, "w") as f: f.write("/sbin/service sshd start\n") try: g_handle.upload(local, "/etc/init.d/after.local") finally: os.unlink(local) sshd_config_file = self.icicle_tmp + "/sshd_config" with open(sshd_config_file, 'w') as f: f.write("""PasswordAuthentication no UsePAM yes X11Forwarding yes Subsystem sftp /usr/lib64/ssh/sftp-server AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL """) try: g_handle.path_backup("/etc/ssh/sshd_config") g_handle.upload(sshd_config_file, '/etc/ssh/sshd_config') finally: os.unlink(sshd_config_file) def _image_ssh_setup_step_3(self, g_handle): """ Third step for allowing remote access (make the guest announce itself on bootup). """ # part 3; make sure the guest announces itself self.log.debug("Step 3: Guest announcement") scriptfile = os.path.join(self.icicle_tmp, "script") if g_handle.exists("/etc/NetworkManager/dispatcher.d"): with open(scriptfile, 'w') as f: f.write("""\ #!/bin/bash if [ "$1" = "eth0" -a "$2" = "up" ]; then echo -n "!$DHCP4_IP_ADDRESS,%s!" > /dev/ttyS1 fi """ % (self.uuid)) try: g_handle.upload(scriptfile, '/etc/NetworkManager/dispatcher.d/99-reportip') g_handle.chmod(0o755, '/etc/NetworkManager/dispatcher.d/99-reportip') finally: os.unlink(scriptfile) if not g_handle.exists('/usr/sbin/cron'): raise oz.OzException.OzException("cron not installed on the image, cannot continue") with open(scriptfile, 'w') as f: f.write("""\ #!/bin/bash DEV=$(/bin/awk '{if ($2 == 0) print $1}' /proc/net/route) && [ -z "$DEV" ] && exit 0 ADDR=$(/sbin/ip -4 -o addr show dev $DEV | /bin/awk '{print $4}' | /usr/bin/cut -d/ -f1) && [ -z "$ADDR" ] && exit 0 echo -n "!$ADDR,%s!" > /dev/ttyS1 """ % (self.uuid)) try: g_handle.upload(scriptfile, '/root/reportip') g_handle.chmod(0o755, '/root/reportip') finally: os.unlink(scriptfile) announcefile = os.path.join(self.icicle_tmp, "announce") with open(announcefile, 'w') as f: f.write('*/1 * * * * root /bin/bash -c "/root/reportip"\n') try: g_handle.upload(announcefile, '/etc/cron.d/announce') finally: os.unlink(announcefile) if g_handle.exists('/usr/lib/systemd/system/cron.service'): if g_handle.exists('/etc/systemd/system/multi-user.target.wants/cron.service'): self.crond_was_active = True else: g_handle.ln_sf('/lib/systemd/system/cron.service', '/etc/systemd/system/multi-user.target.wants/cron.service') else: runlevel = self.get_default_runlevel(g_handle) startuplink = '/etc/rc.d/rc' + runlevel + ".d/S06cron" g_handle.path_backup(startuplink) g_handle.ln_sf('/etc/init.d/cron', startuplink) def _collect_setup(self, libvirt_xml): """ Setup the guest for remote access. """ self.log.info("Collection Setup") g_handle = oz.GuestFSManager.GuestFSLibvirtFactory(libvirt_xml, self.libvirt_conn) g_handle.mount_partitions() # we have to do 3 things to make sure we can ssh into OpenSUSE: # 1) Upload our ssh key # 2) Make sure sshd is running on boot # 3) Make the guest announce itself to the host try: try: self._image_ssh_setup_step_1(g_handle) try: self._image_ssh_setup_step_2(g_handle) try: self._image_ssh_setup_step_3(g_handle) except: self._image_ssh_teardown_step_3(g_handle) raise except: self._image_ssh_teardown_step_2(g_handle) raise except: self._image_ssh_teardown_step_1(g_handle) raise finally: g_handle.cleanup() def _customize_repos(self, guestaddr): """ Method to add user-provided repositories to the guest. """ self.log.debug("Installing additional repository files") for repo in list(self.tdl.repositories.values()): self.guest_execute_command(guestaddr, "zypper addrepo %s %s" % (repo.url, repo.name)) def _install_packages(self, guestaddr, packstr): # due to a bug in OpenSUSE 11.1, we want to remove the default # CD repo first stdout, stderr_unused, retcode_unused = self.guest_execute_command(guestaddr, 'zypper repos -d') removerepos = [] for line in stdout.split('\n'): if re.match("^[0-9]+", line): split = line.split('|') column = 7 if self.config.extended_zypper_list: # OpenSUSE Leap has the URI in the 8th column column = 8 if re.match("^cd://", split[column].strip()): removerepos.append(split[0].strip()) for repo in removerepos: self.guest_execute_command(guestaddr, 'zypper removerepo %s' % (repo)) self.guest_execute_command(guestaddr, 'zypper -n install %s' % (packstr)) def _remove_repos(self, guestaddr): for repo in list(self.tdl.repositories.values()): if not repo.persisted: self.guest_execute_command(guestaddr, "zypper removerepo %s" % (repo.name)) def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for OpenSUSE installs. """ if tdl.update in version_to_config.keys(): return OpenSUSEGuest(tdl, config, auto, output_disk, netdev, diskbus, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "OpenSUSE: " + ", ".join(sorted(version_to_config.keys())) oz-0.17.0/oz/OzException.py000066400000000000000000000017401344320532700155050ustar00rootroot00000000000000# Copyright (C) 2011 Chris Lalancette # Copyright (C) 2012-2017 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Exception class for Oz. """ class OzException(Exception): """ Class for Oz Exceptions. """ def __init__(self, msg): Exception.__init__(self, msg) oz-0.17.0/oz/RHEL_2_1.py000066400000000000000000000037401344320532700144330ustar00rootroot00000000000000# Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2017 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ RHEL-2.1 installation """ import oz.OzException import oz.RedHat versions = ["GOLD", "U2", "U3", "U4", "U5", "U6"] class RHEL21Guest(oz.RedHat.RedHatFDGuest): """ Class for RHEL-2.1 GOLD, U2, U3, U4, U5, and U6 installation. """ def __init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress): oz.RedHat.RedHatFDGuest.__init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress) def get_auto_path(self): """ Method to create the correct path to the RHEL 2.1 kickstart file. """ return oz.ozutil.generate_full_auto_path("RHEL2.1.auto") def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for RHEL-2.1 installs. """ if tdl.update in versions: if netdev is None: netdev = 'pcnet' return RHEL21Guest(tdl, config, auto, output_disk, netdev, diskbus, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "RHEL 2.1: " + ", ".join(versions) oz-0.17.0/oz/RHEL_3.py000066400000000000000000000110751344320532700142140ustar00rootroot00000000000000# Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2017 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ RHEL-3 installation """ import os import re import oz.OzException import oz.RedHat import oz.ozutil versions = ["GOLD", "U1", "U2", "U3", "U4", "U5", "U6", "U7", "U8", "U9"] class RHEL3Guest(oz.RedHat.RedHatLinuxCDGuest): """ Class for RHEL-3 GOLD, U1, U2, U3, U4, U5, U6, U7, U8, and U9 installation. """ def __init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress): iso_support = True if tdl.distro == "RHEL-3": iso_support = False # although we could use ext2 for the initrdtype here (and hence get # fast initial installs), it isn't super reliable on RHEL-3. Just # disable it and fall back to the boot.iso method which is more reliable oz.RedHat.RedHatLinuxCDGuest.__init__(self, tdl, config, auto, output_disk, netdev, diskbus, iso_support, True, None, macaddress) # override the sshd_config value set in RedHatLinuxCDGuest.__init__ self.sshd_config = """\ SyslogFacility AUTHPRIV PasswordAuthentication yes ChallengeResponseAuthentication no X11Forwarding yes Subsystem sftp /usr/libexec/openssh/sftp-server """ def _modify_iso(self): """ Method to make the boot ISO auto-boot with appropriate parameters. """ self._copy_kickstart(os.path.join(self.iso_contents, "ks.cfg")) initrdline = " append initrd=initrd.img ks=cdrom:/ks.cfg method=" if self.tdl.installtype == "url": initrdline += self.url else: initrdline += "cdrom:/dev/cdrom" self._modify_isolinux(initrdline) def _check_pvd(self): """ Method to ensure the the boot ISO for an ISO install is a DVD """ cdfd = open(self.orig_iso, "r") pvd = self._get_primary_volume_descriptor(cdfd) cdfd.close() if pvd.system_identifier != "LINUX ": raise oz.OzException.OzException("Invalid system identifier on ISO for " + self.tdl.distro + " install") if self.tdl.distro == "RHEL-3": if self.tdl.installtype == "iso": raise oz.OzException.OzException("BUG: shouldn't be able to reach RHEL-3 with ISO checking") # The boot ISOs for RHEL-3 don't have a whole lot of identifying # information. We just pass through here, doing nothing else: if self.tdl.installtype == "iso": centos_disk_1 = re.match(r"CentOS-3(\.[0-9])? Disk 1", pvd.volume_identifier) centos_server = re.match(r"CentOS-3(\.[0-9])? server", pvd.volume_identifier) centos_dvd = re.match(r"CentOS-3(\.[0-9])? " + self.tdl.arch + " DVD", pvd.volume_identifier) if not centos_disk_1 and not centos_server and not centos_dvd: raise oz.OzException.OzException("Only DVDs are supported for CentOS-3 ISO installs") # The boot ISOs for CentOS-3 don't have a whole lot of identifying # information. We just pass through here, doing nothing def get_auto_path(self): """ Method to create the correct path to the RHEL 3 kickstart files. """ return oz.ozutil.generate_full_auto_path("RHEL3.auto") def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for RHEL-3 installs. """ if tdl.update in versions: return RHEL3Guest(tdl, config, auto, output_disk, netdev, diskbus, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "RHEL/CentOS 3: " + ", ".join(versions) oz-0.17.0/oz/RHEL_4.py000066400000000000000000000135641344320532700142220ustar00rootroot00000000000000# Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2017 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ RHEL-4 installation """ import os import re import oz.OzException import oz.RedHat import oz.ozutil class RHEL4Configuration(object): def __init__(self, default_netdev, default_diskbus): self._default_netdev = default_netdev self._default_diskbus = default_diskbus @property def default_netdev(self): return self._default_netdev @property def default_diskbus(self): return self._default_diskbus version_to_config = { "U9": RHEL4Configuration(default_netdev='virtio', default_diskbus='virtio'), "U8": RHEL4Configuration(default_netdev='virtio', default_diskbus='virtio'), "U7": RHEL4Configuration(default_netdev=None, default_diskbus=None), "U6": RHEL4Configuration(default_netdev=None, default_diskbus=None), "U5": RHEL4Configuration(default_netdev=None, default_diskbus=None), "U4": RHEL4Configuration(default_netdev=None, default_diskbus=None), "U3": RHEL4Configuration(default_netdev=None, default_diskbus=None), "U2": RHEL4Configuration(default_netdev=None, default_diskbus=None), "U1": RHEL4Configuration(default_netdev=None, default_diskbus=None), "GOLD": RHEL4Configuration(default_netdev=None, default_diskbus=None), } class RHEL4Guest(oz.RedHat.RedHatLinuxCDGuest): """ Class for RHEL-4 GOLD, U1, U2, U3, U4, U5, U6, U7, U8, and U9 installation. """ def __init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, macaddress): self.config = version_to_config[tdl.update] if nicmodel is None: nicmodel = self.config.default_netdev if diskbus is None: diskbus = self.config.default_diskbus # we set initrdtype to None because RHEL-4 spews errors using direct # kernel/initrd booting. The odd part is that it actually works, but # it looks ugly so for now we will just always use the boot.iso method oz.RedHat.RedHatLinuxCDGuest.__init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, True, True, None, macaddress) def _modify_iso(self): """ Method to make the boot ISO auto-boot with appropriate parameters. """ self._copy_kickstart(os.path.join(self.iso_contents, "ks.cfg")) initrdline = " append initrd=initrd.img ks=cdrom:/ks.cfg method=" if self.tdl.installtype == "url": initrdline += self.url else: initrdline += "cdrom:/dev/cdrom" self._modify_isolinux(initrdline) def _check_pvd(self): """ Method to ensure that boot ISO is a DVD (we cannot use boot CDs to install RHEL-4/CentOS-4 since it requires a switch during install, which we cannot detect). """ with open(self.orig_iso, "r") as cdfd: pvd = self._get_primary_volume_descriptor(cdfd) # all of the below should have "LINUX" as their system_identifier, # so check it here if pvd.system_identifier != "LINUX ": raise oz.OzException.OzException("Invalid system identifier on ISO for " + self.tdl.distro + " install") if self.tdl.distro == "RHEL-4": if self.tdl.installtype == 'iso': # unfortunately RHEL-4 has the same volume identifier for both # DVDs and CDs. To tell them apart, we assume that if the # size is smaller than 1GB, this is a CD if not re.match("RHEL/4(-U[0-9])?", pvd.volume_identifier) or (pvd.space_size * 2048) < 1 * 1024 * 1024 * 1024: raise oz.OzException.OzException("Only DVDs are supported for RHEL-4 ISO installs") else: # url installs if not pvd.volume_identifier.startswith("Red Hat Enterprise Linux"): raise oz.OzException.OzException("Invalid boot.iso for RHEL-4 URL install") elif self.tdl.distro == "CentOS-4": if self.tdl.installtype == 'iso': if not re.match(r"CentOS 4(\.[0-9])?.*DVD", pvd.volume_identifier): raise oz.OzException.OzException("Only DVDs are supported for CentOS-4 ISO installs") else: # url installs if not re.match("CentOS *", pvd.volume_identifier): raise oz.OzException.OzException("Invalid boot.iso for CentOS-4 URL install") def get_auto_path(self): """ Method to create the correct path to the RHEL 4 kickstart file. """ return oz.ozutil.generate_full_auto_path("RHEL4.auto") def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for RHEL-4 installs. """ if tdl.update in version_to_config.keys(): return RHEL4Guest(tdl, config, auto, output_disk, netdev, diskbus, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "RHEL/CentOS/Scientific Linux 4: " + ", ".join(sorted(version_to_config.keys())) oz-0.17.0/oz/RHEL_5.py000066400000000000000000000154321344320532700142170ustar00rootroot00000000000000# Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2017 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ RHEL-5 installation """ import os import re import oz.OzException import oz.RedHat import oz.ozutil class RHEL5Configuration(object): """ Configuration class for RHEL-5 installation. """ def __init__(self, default_netdev, default_diskbus): self._default_netdev = default_netdev self._default_diskbus = default_diskbus @property def default_netdev(self): """ Property method for the default netdev for this version of RHEL-5. """ return self._default_netdev @property def default_diskbus(self): """ Property method for the default diskbus for this version of RHEL-5. """ return self._default_diskbus version_to_config = { "U11": RHEL5Configuration(default_netdev='virtio', default_diskbus='virtio'), "U10": RHEL5Configuration(default_netdev='virtio', default_diskbus='virtio'), "U9": RHEL5Configuration(default_netdev='virtio', default_diskbus='virtio'), "U8": RHEL5Configuration(default_netdev='virtio', default_diskbus='virtio'), "U7": RHEL5Configuration(default_netdev='virtio', default_diskbus='virtio'), "U6": RHEL5Configuration(default_netdev='virtio', default_diskbus='virtio'), "U5": RHEL5Configuration(default_netdev='virtio', default_diskbus='virtio'), "U4": RHEL5Configuration(default_netdev='virtio', default_diskbus='virtio'), "U3": RHEL5Configuration(default_netdev=None, default_diskbus=None), "U2": RHEL5Configuration(default_netdev=None, default_diskbus=None), "U1": RHEL5Configuration(default_netdev=None, default_diskbus=None), "GOLD": RHEL5Configuration(default_netdev=None, default_diskbus=None), } class RHEL5Guest(oz.RedHat.RedHatLinuxCDYumGuest): """ Class for RHEL-5 GOLD, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10 and U11 installation. """ def __init__(self, tdl, config, auto, nicmodel, diskbus, output_disk=None, macaddress=None): self.config = version_to_config[tdl.update] if nicmodel is None: nicmodel = self.config.default_netdev if diskbus is None: diskbus = self.config.default_diskbus oz.RedHat.RedHatLinuxCDYumGuest.__init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, True, True, "cpio", macaddress, True) def _modify_iso(self): """ Method to make the boot ISO auto-boot with appropriate parameters. """ self._copy_kickstart(os.path.join(self.iso_contents, "ks.cfg")) initrdline = " append initrd=initrd.img ks=cdrom:/ks.cfg method=" if self.tdl.installtype == "url": initrdline += self.url else: initrdline += "cdrom:/dev/cdrom" self._modify_isolinux(initrdline) def _check_pvd(self): """ Method to ensure that boot ISO is a DVD (we cannot use boot CDs to install RHEL-5/CentOS-5 since it requires a switch during install, which we cannot detect). """ with open(self.orig_iso, "r") as cdfd: pvd = self._get_primary_volume_descriptor(cdfd) # all of the below should have "LINUX" as their system_identifier, # so check it here if pvd.system_identifier != "LINUX ": raise oz.OzException.OzException("Invalid system identifier on ISO for " + self.tdl.distro + " install") if self.tdl.distro == "RHEL-5": if self.tdl.installtype == 'iso': if not re.match(r"RHEL/5(\.[0-9]{1,2})? " + self.tdl.arch + " DVD", pvd.volume_identifier): raise oz.OzException.OzException("Only DVDs are supported for RHEL-5 ISO installs") else: # url installs if not pvd.volume_identifier.startswith("Red Hat Enterprise Linux"): raise oz.OzException.OzException("Invalid boot.iso for RHEL-5 URL install") elif self.tdl.distro == "CentOS-5": # CentOS-5 if self.tdl.installtype == 'iso': # unfortunately CentOS-5 has the same volume identifier for both # DVDs and CDs. To tell them apart, we assume that if the # size is smaller than 1GB, this is a CD if not re.match(r"CentOS_5.[0-9]{1,2}_Final", pvd.volume_identifier) or (pvd.space_size * 2048) < 1 * 1024 * 1024 * 1024: raise oz.OzException.OzException("Only DVDs are supported for CentOS-5 ISO installs") else: # url installs if not re.match(r"CentOS *", pvd.volume_identifier): raise oz.OzException.OzException("Invalid boot.iso for CentOS-5 URL install") elif self.tdl.distro == "SLC-5": # SLC-5 if self.tdl.installtype == 'iso': if not re.match(r"Scientific Linux CERN 5.[0-9]{1,2}", pvd.volume_identifier): raise oz.OzException.OzException("Only DVDs are supported for SLC-5 ISO installs") else: # url installs if not re.match(r"CentOS *", pvd.volume_identifier): raise oz.OzException.OzException("Invalid boot.iso for SLC-5 URL install") def get_auto_path(self): """ Method to create the correct path to the RHEL 5 kickstart file. """ return oz.ozutil.generate_full_auto_path("RHEL5.auto") def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for RHEL-5 installs. """ if tdl.update in version_to_config.keys(): return RHEL5Guest(tdl, config, auto, netdev, diskbus, output_disk, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "RHEL/OL/CentOS/Scientific Linux{,CERN} 5: " + ", ".join(sorted(version_to_config.keys())) oz-0.17.0/oz/RHEL_6.py000066400000000000000000000050021344320532700142100ustar00rootroot00000000000000# Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2017 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ RHEL-6 installation """ import os import oz.OzException import oz.RedHat import oz.ozutil class RHEL6Guest(oz.RedHat.RedHatLinuxCDYumGuest): """ Class for RHEL-6 installation """ def __init__(self, tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): oz.RedHat.RedHatLinuxCDYumGuest.__init__(self, tdl, config, auto, output_disk, netdev, diskbus, True, True, "cpio", macaddress, True) def _modify_iso(self): """ Method to modify the ISO for autoinstallation. """ self._copy_kickstart(os.path.join(self.iso_contents, "ks.cfg")) initrdline = " append initrd=initrd.img ks=cdrom:/ks.cfg" if self.tdl.installtype == "url": initrdline += " repo=" + self.url self._modify_isolinux(initrdline) def get_auto_path(self): """ Method to create the correct path to the RHEL 6 kickstart files. """ return oz.ozutil.generate_full_auto_path("RHEL6.auto") def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for RHEL-6 installs. """ if tdl.update.isdigit(): if netdev is None: netdev = 'virtio' if diskbus is None: diskbus = 'virtio' return RHEL6Guest(tdl, config, auto, output_disk, netdev, diskbus, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "RHEL/OL/CentOS/Scientific Linux{,CERN} 6" oz-0.17.0/oz/RHEL_7.py000066400000000000000000000055011344320532700142150ustar00rootroot00000000000000# Copyright (C) 2013-2017 Chris Lalancette # Copyright (C) 2013 Ian McLeod # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ RHEL-7 installation """ import os import oz.OzException import oz.RedHat import oz.ozutil class RHEL7Guest(oz.RedHat.RedHatLinuxCDYumGuest): """ Class for RHEL-7 installation """ def __init__(self, tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): oz.RedHat.RedHatLinuxCDYumGuest.__init__(self, tdl, config, auto, output_disk, netdev, diskbus, True, True, "cpio", macaddress, True) self.virtio_channel_name = 'org.fedoraproject.anaconda.log.0' def _modify_iso(self): """ Method to modify the ISO for autoinstallation. """ self._copy_kickstart(os.path.join(self.iso_contents, "ks.cfg")) initrdline = " append initrd=initrd.img ks=cdrom:/dev/cdrom:/ks.cfg" if self.tdl.installtype == "url": initrdline += " repo=" + self.url else: # RHEL6 dropped this command line directive due to an Anaconda bug # that has since been fixed. Note that this used to be "method=" # but that has been deprecated for some time. initrdline += " repo=cdrom:/dev/cdrom" self._modify_isolinux(initrdline) def get_auto_path(self): """ Method to create the correct path to the RHEL 7 kickstart file. """ return oz.ozutil.generate_full_auto_path("RHEL7.auto") def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for RHEL-7 installs. """ if tdl.update.isdigit(): if netdev is None: netdev = 'virtio' if diskbus is None: diskbus = 'virtio' return RHEL7Guest(tdl, config, auto, output_disk, netdev, diskbus, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "RHEL 7" oz-0.17.0/oz/RHL.py000066400000000000000000000102171344320532700136620ustar00rootroot00000000000000# Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2017 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ RHL installation """ import os import re import shutil import oz.OzException import oz.RedHat import oz.ozutil class RHL9Guest(oz.RedHat.RedHatLinuxCDGuest): """ Class for RHL-9 installation. """ def __init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress): # RHL-9 doesn't support direct kernel/initrd booting; it hangs right # after unpacking the initrd oz.RedHat.RedHatLinuxCDGuest.__init__(self, tdl, config, auto, output_disk, netdev, diskbus, False, True, None, macaddress) if self.tdl.arch != "i386": raise oz.OzException.OzException("Invalid arch " + self.tdl.arch + "for RHL guest") def _modify_iso(self): """ Method to modify the ISO for autoinstallation. """ self.log.debug("Putting the kickstart in place") outname = os.path.join(self.iso_contents, "ks.cfg") if self.default_auto_file(): def _kssub(line): """ Method that is called back from oz.ozutil.copy_modify_file() to modify kickstart files as appropriate for RHL-9. """ # because we need to do this URL substitution here, we can't use # the generic "copy_kickstart()" method if re.match("^url", line): return "url --url " + self.url + "\n" elif re.match("^rootpw", line): return "rootpw " + self.rootpw + "\n" return line oz.ozutil.copy_modify_file(self.auto, outname, _kssub) else: shutil.copy(self.auto, outname) initrdline = " append initrd=initrd.img ks=cdrom:/ks.cfg method=" + self.url self._modify_isolinux(initrdline) def get_auto_path(self): """ Method to create the correct path to the RHL kickstart files. """ return oz.ozutil.generate_full_auto_path("RedHatLinux" + self.tdl.update + ".auto") class RHL7xand8Guest(oz.RedHat.RedHatFDGuest): """ Class for RHL 7.0, 7.1, 7.2, and 8 installation. """ def __init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, macaddress): oz.RedHat.RedHatFDGuest.__init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, macaddress) def get_auto_path(self): return oz.ozutil.generate_full_auto_path("RedHatLinux" + self.tdl.update + ".auto") def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for RHL installs. """ if tdl.update in ["9"]: return RHL9Guest(tdl, config, auto, output_disk, netdev, diskbus, macaddress) if tdl.update in ["7.2", "7.3", "8"]: return RHL7xand8Guest(tdl, config, auto, output_disk, netdev, diskbus, macaddress) if tdl.update in ["7.0", "7.1"]: if netdev is None: netdev = "ne2k_pci" return RHL7xand8Guest(tdl, config, auto, output_disk, netdev, diskbus, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "RHL: 7.0, 7.1, 7.2, 7.3, 8, 9" oz-0.17.0/oz/RedHat.py000066400000000000000000001113141344320532700144040ustar00rootroot00000000000000# Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2017 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Common methods for installing and configuring RedHat-based guests """ try: import configparser except ImportError: import ConfigParser as configparser import gzip import os import re import shutil import oz.Guest import oz.GuestFSManager import oz.Linux import oz.OzException import oz.ozutil class RedHatLinuxCDGuest(oz.Linux.LinuxCDGuest): """ Class for RedHat-based CD guests. """ def __init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, iso_allowed, url_allowed, initrdtype, macaddress): oz.Linux.LinuxCDGuest.__init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, iso_allowed, url_allowed, macaddress) self.crond_was_active = False self.sshd_was_active = False self.sshd_config = """\ SyslogFacility AUTHPRIV PasswordAuthentication yes ChallengeResponseAuthentication no GSSAPIAuthentication yes GSSAPICleanupCredentials yes UsePAM yes AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE AcceptEnv XMODIFIERS X11Forwarding yes Subsystem sftp /usr/libexec/openssh/sftp-server """ # initrdtype is actually a tri-state: # None - don't try to do direct kernel/initrd boot # "cpio" - Attempt to do direct kernel/initrd boot with a gzipped CPIO # archive # "ext2" - Attempt to do direct kernel/initrd boot with a gzipped ext2 # filesystem self.initrdtype = initrdtype self.kernelfname = os.path.join(self.output_dir, self.tdl.name + "-kernel") self.initrdfname = os.path.join(self.output_dir, self.tdl.name + "-ramdisk") self.kernelcache = os.path.join(self.data_dir, "kernels", self.tdl.distro + self.tdl.update + self.tdl.arch + "-kernel") self.initrdcache = os.path.join(self.data_dir, "kernels", self.tdl.distro + self.tdl.update + self.tdl.arch + "-ramdisk") self.cmdline = "method=" + self.url + " ks=file:/ks.cfg" if self.tdl.kernel_param: self.cmdline += " " + self.tdl.kernel_param self.virtio_channel_name = None def _generate_new_iso(self): """ Method to create a new ISO based on the modified CD/DVD. """ self.log.debug("Generating new ISO") oz.ozutil.subprocess_check_output(["genisoimage", "-r", "-T", "-J", "-V", "Custom", "-no-emul-boot", "-b", "isolinux/isolinux.bin", "-c", "isolinux/boot.cat", "-boot-load-size", "4", "-boot-info-table", "-v", "-o", self.output_iso, self.iso_contents], printfn=self.log.debug) def _check_iso_tree(self, customize_or_icicle): kernel = os.path.join(self.iso_contents, "isolinux", "vmlinuz") if not os.path.exists(kernel): raise oz.OzException.OzException("Fedora/Red Hat installs can only be done using a boot.iso (netinst) or DVD image (LiveCDs are not supported)") def _modify_isolinux(self, initrdline): """ Method to modify the isolinux.cfg file on a RedHat style CD. """ self.log.debug("Modifying isolinux.cfg") # append additional kernel params from the TDL to initrdline if self.tdl.kernel_param: initrdline += " " + self.tdl.kernel_param initrdline += '\n' isolinuxcfg = os.path.join(self.iso_contents, "isolinux", "isolinux.cfg") with open(isolinuxcfg, "w") as f: f.write("""\ default customiso timeout 1 prompt 0 label customiso kernel vmlinuz %s """ % (initrdline)) def _copy_kickstart(self, outname): """ Method to copy and modify a RedHat style kickstart file. """ self.log.debug("Putting the kickstart in place") if self.default_auto_file(): def _kssub(line): """ Method that is called back from oz.ozutil.copy_modify_file() to modify kickstart files as appropriate. """ if re.match("^rootpw", line): return "rootpw " + self.rootpw + '\n' return line oz.ozutil.copy_modify_file(self.auto, outname, _kssub) else: shutil.copy(self.auto, outname) def _get_service_runlevel_link(self, g_handle, service): """ Method to find the runlevel link(s) for a service based on the name and the (detected) default runlevel. """ runlevel = self.get_default_runlevel(g_handle) lines = g_handle.cat('/etc/init.d/' + service).split("\n") startlevel = "99" for line in lines: if re.match('# chkconfig:', line): try: startlevel = line.split(':')[1].split()[1] except Exception: pass break return "/etc/rc.d/rc" + runlevel + ".d/S" + startlevel + service def _image_ssh_teardown_step_1(self, g_handle): """ First step to undo _image_ssh_setup (remove authorized keys). """ self.log.debug("Teardown step 1") # reset the authorized keys self.log.debug("Resetting authorized_keys") g_handle.path_restore('/root/.ssh') def _image_ssh_teardown_step_2(self, g_handle): """ Second step to undo _image_ssh_setup (reset sshd service). """ self.log.debug("Teardown step 2") # remove custom sshd_config self.log.debug("Resetting sshd_config") g_handle.path_restore('/etc/ssh/sshd_config') # reset the service link self.log.debug("Resetting sshd service") if g_handle.exists('/lib/systemd/system/sshd.service'): if not self.sshd_was_active: g_handle.rm('/etc/systemd/system/multi-user.target.wants/sshd.service') else: startuplink = self._get_service_runlevel_link(g_handle, 'sshd') g_handle.path_restore(startuplink) def _image_ssh_teardown_step_3(self, g_handle): """ Third step to undo _image_ssh_setup (reset iptables). """ self.log.debug("Teardown step 3") # reset iptables self.log.debug("Resetting iptables rules") g_handle.path_restore('/etc/sysconfig/iptables') def _image_ssh_teardown_step_4(self, g_handle): """ Fourth step to undo _image_ssh_setup (remove guest announcement). """ self.log.debug("Teardown step 4") self.log.debug("Removing announcement to host") g_handle.remove_if_exists('/etc/NetworkManager/dispatcher.d/99-reportip') # remove announce cronjob self.log.debug("Resetting announcement to host") g_handle.remove_if_exists('/etc/cron.d/announce') # remove reportip self.log.debug("Removing reportip") g_handle.remove_if_exists('/root/reportip') # reset the service link self.log.debug("Resetting crond service") if g_handle.exists('/lib/systemd/system/crond.service'): if not self.crond_was_active: g_handle.rm('/etc/systemd/system/multi-user.target.wants/crond.service') else: startuplink = self._get_service_runlevel_link(g_handle, 'crond') g_handle.path_restore(startuplink) def _image_ssh_teardown_step_5(self, g_handle): """ Fifth step to undo _image_ssh_setup (reset SELinux). """ self.log.debug("Teardown step 5") g_handle.path_restore("/etc/selinux/config") def _image_ssh_teardown_step_6(self, g_handle): """ Sixth step to undo changes by the operating system. For instance, during first boot openssh generates ssh host keys and stores them in /etc/ssh. Since this image might be cached later on, this method removes those keys. """ for key in g_handle.glob_expand("/etc/ssh/*_key*"): g_handle.remove_if_exists(key) # Remove any lease files; this is so that subsequent boots don't try # to connect to a DHCP server that is on a totally different network for lease in g_handle.glob_expand("/var/lib/dhclient/*.leases"): g_handle.rm(lease) for lease in g_handle.glob_expand("/var/lib/NetworkManager/*.lease"): g_handle.rm(lease) def _collect_teardown(self, libvirt_xml): """ Method to reverse the changes done in _collect_setup. """ self.log.info("Collection Teardown") g_handle = oz.GuestFSManager.GuestFSLibvirtFactory(libvirt_xml, self.libvirt_conn) g_handle.mount_partitions() try: self._image_ssh_teardown_step_1(g_handle) self._image_ssh_teardown_step_2(g_handle) self._image_ssh_teardown_step_3(g_handle) self._image_ssh_teardown_step_4(g_handle) self._image_ssh_teardown_step_5(g_handle) self._image_ssh_teardown_step_6(g_handle) finally: g_handle.cleanup() shutil.rmtree(self.icicle_tmp) def _image_ssh_setup_step_1(self, g_handle): """ First step for allowing remote access (generate and upload ssh keys). """ # part 1; upload the keys self.log.debug("Step 1: Uploading ssh keys") g_handle.path_backup('/root/.ssh') g_handle.mkdir('/root/.ssh') g_handle.path_backup('/root/.ssh/authorized_keys') self._generate_openssh_key(self.sshprivkey) g_handle.upload(self.sshprivkey + ".pub", '/root/.ssh/authorized_keys') def _image_ssh_setup_step_2(self, g_handle): """ Second step for allowing remote access (configure sshd). """ # part 2; check and setup sshd self.log.debug("Step 2: setup sshd") if not g_handle.exists('/usr/sbin/sshd'): raise oz.OzException.OzException("ssh not installed on the image, cannot continue") if g_handle.exists('/lib/systemd/system/sshd.service'): if g_handle.exists('/etc/systemd/system/multi-user.target.wants/sshd.service'): self.sshd_was_active = True else: g_handle.ln_sf('/lib/systemd/system/sshd.service', '/etc/systemd/system/multi-user.target.wants/sshd.service') else: startuplink = self._get_service_runlevel_link(g_handle, 'sshd') g_handle.path_backup(startuplink) g_handle.ln_sf('/etc/init.d/sshd', startuplink) sshd_config_file = os.path.join(self.icicle_tmp, "sshd_config") with open(sshd_config_file, 'w') as f: f.write(self.sshd_config) try: g_handle.path_backup('/etc/ssh/sshd_config') g_handle.upload(sshd_config_file, '/etc/ssh/sshd_config') finally: os.unlink(sshd_config_file) def _image_ssh_setup_step_3(self, g_handle): """ Third step for allowing remote access (open up the firewall). """ # part 3; open up iptables self.log.debug("Step 3: Open up the firewall") g_handle.path_backup('/etc/sysconfig/iptables') def _image_ssh_setup_step_4(self, g_handle): """ Fourth step for allowing remote access (make the guest announce itself on bootup). """ # part 4; make sure the guest announces itself self.log.debug("Step 4: Guest announcement") if self.tdl.arch in ['ppc64', 'ppc64le']: announce_device = '/dev/hvc1' elif self.tdl.arch == 's390x': announce_device = '/dev/sclp_line0' else: announce_device = '/dev/ttyS1' scriptfile = os.path.join(self.icicle_tmp, "script") if g_handle.exists("/etc/NetworkManager/dispatcher.d"): with open(scriptfile, 'w') as f: f.write("""\ #!/bin/bash if [ "$1" != "lo" -a "$2" = "up" ]; then echo -n "!$DHCP4_IP_ADDRESS,%s!" > %s fi """ % (self.uuid, announce_device)) try: g_handle.upload(scriptfile, '/etc/NetworkManager/dispatcher.d/99-reportip') g_handle.chmod(0o755, '/etc/NetworkManager/dispatcher.d/99-reportip') finally: os.unlink(scriptfile) if not g_handle.exists('/usr/sbin/crond'): raise oz.OzException.OzException("cron not installed on the image, cannot continue") with open(scriptfile, 'w') as f: f.write("""\ #!/bin/bash DEV=$(/bin/awk '{if ($2 == 0) print $1}' /proc/net/route) && [ -z "$DEV" ] && exit 0 ADDR=$(/sbin/ip -4 -o addr show dev $DEV | /bin/awk '{print $4}' | /bin/cut -d/ -f1) && [ -z "$ADDR" ] && exit 0 echo -n "!$ADDR,%s!" > %s """ % (self.uuid, announce_device)) try: g_handle.upload(scriptfile, '/root/reportip') g_handle.chmod(0o755, '/root/reportip') finally: os.unlink(scriptfile) announcefile = os.path.join(self.icicle_tmp, "announce") with open(announcefile, 'w') as f: f.write('*/1 * * * * root /bin/bash -c "/root/reportip"\n') try: g_handle.upload(announcefile, '/etc/cron.d/announce') finally: os.unlink(announcefile) if g_handle.exists('/lib/systemd/system/crond.service'): if g_handle.exists('/etc/systemd/system/multi-user.target.wants/crond.service'): self.crond_was_active = True else: g_handle.ln_sf('/lib/systemd/system/crond.service', '/etc/systemd/system/multi-user.target.wants/crond.service') else: startuplink = self._get_service_runlevel_link(g_handle, 'crond') g_handle.path_backup(startuplink) g_handle.ln_sf('/etc/init.d/crond', startuplink) def _image_ssh_setup_step_5(self, g_handle): """ Fifth step for allowing remote access (set SELinux to permissive). """ # part 5; set SELinux to permissive mode so we don't have to deal with # incorrect contexts self.log.debug("Step 5: Set SELinux to permissive mode") g_handle.path_backup('/etc/selinux/config') selinuxfile = self.icicle_tmp + "/selinux" with open(selinuxfile, 'w') as f: f.write("SELINUX=permissive\n") f.write("SELINUXTYPE=targeted\n") try: g_handle.upload(selinuxfile, "/etc/selinux/config") finally: os.unlink(selinuxfile) def _collect_setup(self, libvirt_xml): """ Setup the guest for remote access. """ self.log.info("Collection Setup") g_handle = oz.GuestFSManager.GuestFSLibvirtFactory(libvirt_xml, self.libvirt_conn) g_handle.mount_partitions() # we have to do 5 things to make sure we can ssh into RHEL/Fedora: # 1) Upload our ssh key # 2) Make sure sshd is running on boot # 3) Make sure that port 22 is open in the firewall # 4) Make the guest announce itself to the host # 5) Set SELinux to permissive mode try: try: self._image_ssh_setup_step_1(g_handle) try: self._image_ssh_setup_step_2(g_handle) try: self._image_ssh_setup_step_3(g_handle) try: self._image_ssh_setup_step_4(g_handle) try: self._image_ssh_setup_step_5(g_handle) except: self._image_ssh_teardown_step_5(g_handle) raise except: self._image_ssh_teardown_step_4(g_handle) raise except: self._image_ssh_teardown_step_3(g_handle) raise except: self._image_ssh_teardown_step_2(g_handle) raise except: self._image_ssh_teardown_step_1(g_handle) raise finally: g_handle.cleanup() def do_icicle(self, guestaddr): """ Method to collect the package information and generate the ICICLE XML. """ self.log.debug("Generating ICICLE") stdout, stderr_unused, retcode_unused = self.guest_execute_command(guestaddr, 'rpm -qa', timeout=30) package_split = stdout.split("\n") extrasplit = None if self.tdl.icicle_extra_cmd: extrastdout, stderr_unused, retcode_unused = self.guest_execute_command(guestaddr, self.tdl.icicle_extra_cmd, timeout=30) extrasplit = extrastdout.split("\n") if len(package_split) != len(extrasplit): raise oz.OzException.OzException("Invalid extra package command; it must return the same set of packages as 'rpm -qa'") return self._output_icicle_xml(package_split, self.tdl.description, extrasplit) def _parse_treeinfo(self, fp): """ Internal method to parse the treeinfo file and get the kernel and initrd paths out of it. """ self.log.debug("Got treeinfo, parsing") config = configparser.SafeConfigParser() config.readfp(fp) section = "images-%s" % (self.tdl.arch) kernel = oz.ozutil.config_get_key(config, section, "kernel", None) initrd = oz.ozutil.config_get_key(config, section, "initrd", None) return (kernel, initrd) def _get_kernel_from_treeinfo(self, fetchurl): """ Internal method to download and parse the .treeinfo file from a URL. If the .treeinfo file does not exist, or it does not have the keys that we expect, this method raises an error. """ treeinfourl = fetchurl + "/.treeinfo" # first we check if the .treeinfo exists; this throws an exception if # it is missing info = oz.ozutil.http_get_header(treeinfourl) if info['HTTP-Code'] != 200: raise oz.OzException.OzException("Could not find %s" % (treeinfourl)) treeinfo = os.path.join(self.icicle_tmp, "treeinfo") self.log.debug("Going to write treeinfo to %s", treeinfo) treeinfofd = os.open(treeinfo, os.O_RDWR | os.O_CREAT | os.O_TRUNC) fp = os.fdopen(treeinfofd) try: os.unlink(treeinfo) self.log.debug("Trying to get treeinfo from " + treeinfourl) oz.ozutil.http_download_file(treeinfourl, treeinfofd, False, self.log) # if we made it here, the .treeinfo existed. Parse it and # find out the location of the vmlinuz and initrd fp.seek(0) (kernel, initrd) = self._parse_treeinfo(fp) finally: fp.close() if kernel is None or initrd is None: raise oz.OzException.OzException("Empty kernel or initrd") self.log.debug("Returning kernel %s and initrd %s", kernel, initrd) return (kernel, initrd) def _create_cpio_initrd(self, kspath): """ Internal method to create a modified CPIO initrd """ # if initrdtype is cpio, then we can just append a gzipped # archive onto the end of the initrd extrafname = os.path.join(self.icicle_tmp, "extra.cpio") self.log.debug("Writing cpio to %s", extrafname) cpiofiledict = {} cpiofiledict[kspath] = 'ks.cfg' oz.ozutil.write_cpio(cpiofiledict, extrafname) try: shutil.copyfile(self.initrdcache, self.initrdfname) oz.ozutil.gzip_append(extrafname, self.initrdfname) finally: os.unlink(extrafname) def _create_ext2_initrd(self, kspath): """ Internal method to create a modified ext2 initrd """ # in this case, the archive is not CPIO but is an ext2 # filesystem. use guestfs to mount it and add the kickstart self.log.debug("Creating temporary directory") tmpdir = os.path.join(self.icicle_tmp, "initrd") oz.ozutil.mkdir_p(tmpdir) ext2file = os.path.join(tmpdir, "initrd.ext2") self.log.debug("Uncompressing initrd %s to %s", self.initrdfname, ext2file) inf = gzip.open(self.initrdcache, 'rb') outf = open(ext2file, "w") try: outf.writelines(inf) inf.close() g_handle = oz.GuestFSManager.GuestFS(ext2file, 'raw') g_handle.mount_partitions() g_handle.upload(kspath, "/ks.cfg") g_handle.cleanup() # kickstart is added, lets recompress it oz.ozutil.gzip_create(ext2file, self.initrdfname) finally: os.unlink(ext2file) def _initrd_inject_ks(self, fetchurl, force_download): """ Internal method to download and inject a kickstart into an initrd. """ # we first see if we can use direct kernel booting, as that is # faster than downloading the ISO kernel = None initrd = None try: (kernel, initrd) = self._get_kernel_from_treeinfo(fetchurl) except Exception: pass if kernel is None: self.log.debug("Kernel was None, trying images/pxeboot/vmlinuz") # we couldn't find the kernel in the treeinfo, so try a # hard-coded path kernel = "images/pxeboot/vmlinuz" if initrd is None: self.log.debug("Initrd was None, trying images/pxeboot/initrd.img") # we couldn't find the initrd in the treeinfo, so try a # hard-coded path initrd = "images/pxeboot/initrd.img" (fd, outdir) = oz.ozutil.open_locked_file(self.kernelcache) try: self._get_original_media('/'.join([self.url.rstrip('/'), kernel.lstrip('/')]), fd, outdir, force_download) # if we made it here, then we can copy the kernel into place shutil.copyfile(self.kernelcache, self.kernelfname) finally: os.close(fd) (fd, outdir) = oz.ozutil.open_locked_file(self.initrdcache) try: try: self._get_original_media('/'.join([self.url.rstrip('/'), initrd.lstrip('/')]), fd, outdir, force_download) except: os.unlink(self.kernelfname) raise try: kspath = os.path.join(self.icicle_tmp, "ks.cfg") self._copy_kickstart(kspath) try: if self.initrdtype == "cpio": self._create_cpio_initrd(kspath) elif self.initrdtype == "ext2": self._create_ext2_initrd(kspath) else: raise oz.OzException.OzException("Invalid initrdtype, this is a programming error") finally: os.unlink(kspath) except: os.unlink(self.kernelfname) raise finally: os.close(fd) def generate_install_media(self, force_download=False, customize_or_icicle=False): """ Method to generate the install media for RedHat based operating systems. If force_download is False (the default), then the original media will only be fetched if it is not cached locally. If force_download is True, then the original media will be downloaded regardless of whether it is cached locally. """ fetchurl = self.url if self.tdl.installtype == 'url': # set the fetchurl up-front so that if the OS doesn't support # initrd injection, or the injection fails for some reason, we # fall back to the boot.iso fetchurl += "/images/boot.iso" if self.initrdtype is not None: self.log.debug("Installtype is URL, trying to do direct kernel boot") try: return self._initrd_inject_ks(self.url, force_download) except Exception as err: # if any of the above failed, we couldn't use the direct # kernel/initrd build method. Fall back to trying to fetch # the boot.iso instead self.log.debug("Could not do direct boot, fetching boot.iso instead (the following error message is useful for bug reports, but can be ignored)") self.log.debug(err) return self._iso_generate_install_media(fetchurl, force_download, customize_or_icicle) def cleanup_install(self): """ Method to cleanup any transient install data. """ self.log.info("Cleaning up after install") for fname in [self.output_iso, self.initrdfname, self.kernelfname]: try: os.unlink(fname) except Exception: pass if not self.cache_original_media: for fname in [self.orig_iso, self.kernelcache, self.initrdcache]: try: os.unlink(fname) except Exception: pass def install(self, timeout=None, force=False): """ Method to run the operating system installation. """ return self._do_install(timeout, force, 0, self.kernelfname, self.initrdfname, self.cmdline, None, self.virtio_channel_name) class RedHatLinuxCDYumGuest(RedHatLinuxCDGuest): """ Class for RedHat-based CD guests with yum support. """ def __init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, iso_allowed, url_allowed, initrdtype, macaddress, use_yum): oz.RedHat.RedHatLinuxCDGuest.__init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, iso_allowed, url_allowed, initrdtype, macaddress) self.use_yum = use_yum def _check_url(self, iso=True, url=True): """ Method to check if a URL specified by the user is one that will work with anaconda. """ url = RedHatLinuxCDGuest._check_url(self, iso, url) if self.tdl.installtype == 'url': # The HTTP/1.1 specification allows for servers that don't support # byte ranges; if the client requests it and the server doesn't # support it, it is supposed to return a header that looks like: # # Accept-Ranges: none # # You can see this in action by editing httpd.conf: # # ... # LoadModule headers_module # ... # Header set Accept-Ranges "none" # # and then trying to fetch a file with wget: # # wget --header="Range: bytes=5-10" http://path/to/my/file # # Unfortunately, anaconda does not honor this server header, and # blindly requests a byte range anyway. When this happens, the # server throws a "403 Forbidden", and the URL install fails. # # There is the additional problem of mirror lists. If we take # the original URL that was given to us, and it happens to be # a redirect, then what can happen is that each individual package # during the install can come from a different mirror (some of # which may not support the byte ranges). To avoid both of these # problems, resolve the (possible) redirect to a real mirror, and # check if we hit a server that doesn't support ranges. If we do # hit one of these, try up to 5 times to redirect to a different # mirror. If after this we still cannot find a server that # supports byte ranges, fail. count = 5 while count > 0: info = oz.ozutil.http_get_header(url, redirect=False) if 'Accept-Ranges' in info and info['Accept-Ranges'] == "none": if url == info['Redirect-URL']: # optimization; if the URL we resolved to is exactly # the same as what we started with, this is *not* # a redirect, and we should fail immediately count = 0 break count -= 1 continue if 'Redirect-URL' in info and info['Redirect-URL'] is not None: url = info['Redirect-URL'] break if count == 0: raise oz.OzException.OzException("%s URL installs cannot be done using servers that don't accept byte ranges. Please try another mirror" % (self.tdl.distro)) return url def _customize_repos(self, guestaddr): """ Method to generate and upload custom repository files based on the TDL. """ self.log.debug("Installing additional repository files") for repo in list(self.tdl.repositories.values()): filename = repo.name.replace(" ", "_") + ".repo" localname = os.path.join(self.icicle_tmp, filename) with open(localname, 'w') as f: f.write("[%s]\n" % repo.name.replace(" ", "_")) f.write("name=%s\n" % repo.name) f.write("baseurl=%s\n" % repo.url) f.write("skip_if_unavailable=1\n") f.write("enabled=1\n") if repo.sslverify: f.write("sslverify=1\n") else: f.write("sslverify=0\n") if repo.signed: f.write("gpgcheck=1\n") else: f.write("gpgcheck=0\n") try: remotename = os.path.join("/etc/yum.repos.d/", filename) self.guest_live_upload(guestaddr, localname, remotename) finally: os.unlink(localname) def _install_packages(self, guestaddr, packstr): if self.use_yum: self.guest_execute_command(guestaddr, 'yum -y install %s' % (packstr)) else: self.guest_execute_command(guestaddr, 'dnf -y install %s' % (packstr)) def _remove_repos(self, guestaddr): for repo in list(self.tdl.repositories.values()): if not repo.persisted: filename = os.path.join("/etc/yum.repos.d", repo.name.replace(" ", "_") + ".repo") self.guest_execute_command(guestaddr, "rm -f " + filename, timeout=30) class RedHatFDGuest(oz.Guest.FDGuest): """ Class for RedHat-based floppy guests. """ def __init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, macaddress): oz.Guest.FDGuest.__init__(self, tdl, config, auto, output_disk, nicmodel, None, None, diskbus, macaddress) if self.tdl.arch != "i386": raise oz.OzException.OzException("Invalid arch " + self.tdl.arch + "for " + self.tdl.distro + " guest") def _modify_floppy(self): """ Method to make the floppy auto-boot with appropriate parameters. """ oz.ozutil.mkdir_p(self.floppy_contents) self.log.debug("Putting the kickstart in place") output_ks = os.path.join(self.floppy_contents, "ks.cfg") if self.default_auto_file(): def _kssub(line): """ Method that is called back from oz.ozutil.copy_modify_file() to modify kickstart files as appropriate for RHL. """ if re.match("^url", line): return "url --url " + self.url + "\n" elif re.match("^rootpw", line): return "rootpw " + self.rootpw + "\n" return line oz.ozutil.copy_modify_file(self.auto, output_ks, _kssub) else: shutil.copy(self.auto, output_ks) oz.ozutil.subprocess_check_output(["mcopy", "-i", self.output_floppy, output_ks, "::KS.CFG"], printfn=self.log.debug) self.log.debug("Modifying the syslinux.cfg") syslinux = os.path.join(self.floppy_contents, "SYSLINUX.CFG") with open(syslinux, 'w') as outfile: outfile.write("""\ default customboot prompt 1 timeout 1 label customboot kernel vmlinuz append initrd=initrd.img lang= devfs=nomount ramdisk_size=9126 ks=floppy method=%s """ % (self.url)) # sometimes, syslinux.cfg on the floppy gets marked read-only. Avoid # problems with the subsequent mcopy by marking it read/write. oz.ozutil.subprocess_check_output(["mattrib", "-r", "-i", self.output_floppy, "::SYSLINUX.CFG"], printfn=self.log.debug) oz.ozutil.subprocess_check_output(["mcopy", "-n", "-o", "-i", self.output_floppy, syslinux, "::SYSLINUX.CFG"], printfn=self.log.debug) def generate_install_media(self, force_download=False, customize_or_icicle=False): """ Method to generate the install media for RedHat based operating systems that install from floppy. If force_download is False (the default), then the original media will only be fetched if it is not cached locally. If force_download is True, then the original media will be downloaded regardless of whether it is cached locally. """ self.log.info("Generating install media") if not force_download: if os.access(self.jeos_filename, os.F_OK): # if we found a cached JEOS, we don't need to do anything here; # we'll copy the JEOS itself later on return elif os.access(self.modified_floppy_cache, os.F_OK): self.log.info("Using cached modified media") shutil.copyfile(self.modified_floppy_cache, self.output_floppy) return # name of the output file (fd, outdir) = oz.ozutil.open_locked_file(self.orig_floppy) try: self._get_original_floppy(self.url + "/images/bootnet.img", fd, outdir, force_download) self._copy_floppy() try: self._modify_floppy() if self.cache_modified_media: self.log.info("Caching modified media for future use") shutil.copyfile(self.output_floppy, self.modified_floppy_cache) finally: self._cleanup_floppy() finally: os.close(fd) oz-0.17.0/oz/TDL.py000066400000000000000000000547661344320532700137010ustar00rootroot00000000000000# Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2018 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Template Description Language (TDL) """ import base64 import os import re import sys import tempfile try: import urllib.parse as urlparse except ImportError: import urlparse try: from StringIO import StringIO except ImportError: from io import StringIO import lxml.etree import oz.OzException import oz.ozutil def _xml_get_value(doc, xmlstring, component, optional=False): """ Function to get the contents from an XML node. It takes 4 arguments: doc - The lxml.etree document to get a value from. xmlstring - The XPath string to use. component - A string representing which TDL component is being looked for (used in error reporting). optional - A boolean describing whether this XML node is allowed to be absent or not. If optional is True and the node is absent, None is returned. If optional is False and the node is absent, an exception is raised. (default: False) Returns the content of the XML node if found, None if the node is not found and optional is True. """ res = doc.xpath(xmlstring) if len(res) == 1: return res[0].text elif not res: if optional: return None else: raise oz.OzException.OzException("Failed to find %s in TDL" % (component)) else: raise oz.OzException.OzException("Expected 0 or 1 %s in TDL, saw %d" % (component, len(res))) def data_from_type(name, contenttype, content): ''' A function to get data out of some content, possibly decoding it depending on the content type. This function understands three types of content: raw (where no decoding is necessary), base64 (where the data needs to be base64 decoded), and url (where the data needs to be downloaded). Because the data might be large, all data is sent to file handle, which is returned from the function. ''' out = tempfile.NamedTemporaryFile() if contenttype == 'raw': out.write(content.encode('utf-8')) elif contenttype == 'base64': if sys.version_info.major == 2: out.write(base64.decodestring(content)) else: out.write(base64.decodebytes(content.encode('utf-8'))) elif contenttype == 'url': url = urlparse.urlparse(content) if url.scheme == "file": with open(url.netloc + url.path) as f: outstr = "".join(f.readlines()) out.write(outstr.encode('utf-8')) else: oz.ozutil.http_download_file(content, out.fileno(), False, None) else: raise oz.OzException.OzException("Type for %s must be 'raw', 'url' or 'base64'" % (name)) # make sure the data is flushed to disk for uses of the file through # the name out.flush() out.seek(0) return out class Repository(object): """ Class that represents a single repository to be used for installing packages. Objects of this type contain 3 pieces of information: name - The name of this repository. url - The URL of this repository. signed - Whether this repository is signed persisted - Whether this repository should remain in the final image sslverify - Whether SSL certificates should be verified """ def __init__(self, name, url, signed, persisted, sslverify): self.name = name self.url = url self.signed = signed self.persisted = persisted self.sslverify = sslverify class Package(object): """ Class that represents a single package to be installed. Objects of this type contain 4 pieces of information: name - The name of the package. repo - The repository that this package comes from (optional). filename - The filename that contains this package (optional). args - Arguments necessary to install this package (optional). """ def __init__(self, name, repo, filename, args): self.name = name self.repo = repo self.filename = filename self.args = args class ISOExtra(object): """ Class that represents an extra element to add to an installation ISO. Objects of this type contain 3 pieces of information: element_type - "file" or "directory" source - A source URL for the element. destination - A relative destination for the element. """ def __init__(self, element_type, source, destination): self.element_type = element_type self.source = source self.destination = destination class TDL(object): """ Class that represents a parsed piece of TDL XML. Objects of this kind contain 10 pieces of information: name - The name assigned to this TDL. distro - The type of operating system this TDL represents. update - The version of the operating system this TDL represents. arch - The architecture of the operating system this TDL represents. Currently this must be one of "i386" or "x86_64". key - The installation key necessary to install this operating system (optional). description - A free-form description of this TDL (optional). installtype - The method to be used to install this operating system. Currently this must be one of "url" or "iso". packages - A list of Package objects describing the packages to be installed on the operating system. This list may be empty. repositories - A dictionary of Repository objects describing the repositories to be searched to find packages. The dictionary is indexed by repository name. This dictionary may be empty. files - A dictionary of file contents to be added to the operating system. The dictionary is indexed by filename. commands - A dictionary of commands to run inside the guest VM. The dictionary is indexed by commands. This dictionary may be empty. """ def __init__(self, xmlstring, rootpw_required=False): # open the XML document tree = lxml.etree.parse(StringIO(xmlstring)) tree.xinclude() self.doc = tree.getroot() # then validate the schema relaxng = lxml.etree.RelaxNG(file=os.path.join(os.path.dirname(__file__), 'tdl.rng')) valid = relaxng.validate(self.doc) if not valid: errstr = "\nXML schema validation failed:\n" for error in relaxng.error_log: errstr += "\tline %s: %s\n" % (error.line, error.message) raise oz.OzException.OzException(errstr) template = self.doc.xpath('/template') if len(template) != 1: raise oz.OzException.OzException("Expected 1 template section in TDL, saw %d" % (len(template))) self.version = template[0].get('version') if self.version: self._validate_tdl_version() self.name = _xml_get_value(self.doc, '/template/name', 'template name') self.distro = _xml_get_value(self.doc, '/template/os/name', 'OS name') self.update = _xml_get_value(self.doc, '/template/os/version', 'OS version') self.arch = _xml_get_value(self.doc, '/template/os/arch', 'OS architecture') if self.arch not in ["i386", "x86_64", "ppc64", "ppc64le", "aarch64", "armv7l", "s390x"]: raise oz.OzException.OzException("Architecture must be one of 'i386, x86_64, ppc64, ppc64le, armv7l, aarch64, or s390x'") self.key = _xml_get_value(self.doc, '/template/os/key', 'OS key', optional=True) # key is not required, so it is not fatal if it is None self.description = _xml_get_value(self.doc, '/template/description', 'description', optional=True) # description is not required, so it is not fatal if it is None install = self.doc.xpath('/template/os/install') if len(install) != 1: raise oz.OzException.OzException("Expected 1 OS install section in TDL, saw %d" % (len(install))) self.installtype = install[0].get('type') if self.installtype is None: raise oz.OzException.OzException("Failed to find OS install type in TDL") # we only support md5/sha1/sha256 sums for ISO install types. However, # we make sure the instance variables are set to None for both types # so code lower down in the stack doesn't have to care about the ISO # vs. URL install type distinction, and can just check whether or not # these URLs are None self.iso_md5_url = None self.iso_sha1_url = None self.iso_sha256_url = None if self.installtype == "url": self.url = _xml_get_value(self.doc, '/template/os/install/url', 'OS install URL') elif self.installtype == "iso": self.iso = _xml_get_value(self.doc, '/template/os/install/iso', 'OS install ISO') self.iso_md5_url = _xml_get_value(self.doc, '/template/os/install/md5sum', 'OS install ISO MD5SUM', optional=True) self.iso_sha1_url = _xml_get_value(self.doc, '/template/os/install/sha1sum', 'OS install ISO SHA1SUM', optional=True) self.iso_sha256_url = _xml_get_value(self.doc, '/template/os/install/sha256sum', 'OS install ISO SHA256SUM', optional=True) # only one of md5, sha1, or sha256 can be specified; raise an error # if multiple are if (self.iso_md5_url and self.iso_sha1_url) or (self.iso_md5_url and self.iso_sha256_url) or (self.iso_sha1_url and self.iso_sha256_url): raise oz.OzException.OzException("Only one of , , and can be specified") else: raise oz.OzException.OzException("Unknown install type " + self.installtype + " in TDL") self.rootpw = _xml_get_value(self.doc, '/template/os/rootpw', "root/Administrator password", optional=not rootpw_required) self.packages = [] self._add_packages(self.doc.xpath('/template/packages/package')) self.files = {} for afile in self.doc.xpath('/template/files/file'): name = afile.get('name') if name is None: raise oz.OzException.OzException("File without a name was given") contenttype = afile.get('type') if contenttype is None: contenttype = 'raw' content = afile.text if content: content = content.strip() else: content = '' self.files[name] = data_from_type(name, contenttype, content) self.isoextras = self._add_isoextras('/template/os/install/extras/directory', 'directory') self.isoextras += self._add_isoextras('/template/os/install/extras/file', 'file') self.repositories = {} self._add_repositories(self.doc.xpath('/template/repositories/repository')) self.commands = self._parse_commands('/template/commands') self.precommands = self._parse_commands('/template/precommands') self.disksize = self._parse_disksize() self.icicle_extra_cmd = _xml_get_value(self.doc, '/template/os/icicle/extra_command', "extra icicle command", optional=True) self.kernel_param = _xml_get_value(self.doc, '/template/os/kernelparam', 'custom kernel parameter', optional=True) def _parse_disksize(self): """ Internal method to parse the disk size out of the TDL. """ size = _xml_get_value(self.doc, '/template/disk/size', 'disk size', optional=True) if size is None: # if it wasn't specified, return None; the Guest object will assign # a sensible default return None match = re.match(r'([0-9]*) *([GT]?)$', size) if not match or len(match.groups()) != 2: raise oz.OzException.OzException("Invalid disk size; it must be specified as a size in gigabytes, optionally suffixed with 'G' or 'T'") number = match.group(1) suffix = match.group(2) if not suffix or suffix == 'G': # for backwards compatibility, we assume G when there is no suffix size = number elif suffix == 'T': size = str(int(number) * 1024) return size def _parse_commands(self, xpath): """ Internal method to parse the commands XML and put it into order. This order can either be via parse order (implicit) or by using the 'position' attribute in the commands XML (explicit). Note that the two cannot be mixed; if position is specified on one node, it must be specified on all of them. Conversely, if position is *not* specified on one node, it must *not* be specified on any of them. Also note that if explicit ordering is used, it must be strictly sequential, starting at 1, with no duplicate numbers. """ tmp = [] saw_position = False for command in self.doc.xpath(xpath + "/command"): name = command.get('name') if name is None: raise oz.OzException.OzException("Command without a name was given") contenttype = command.get('type') if contenttype is None: contenttype = 'raw' content = "" if command.text: content = command.text.strip() if not content: raise oz.OzException.OzException("Empty commands are not allowed") # since XML doesn't *guarantee* an order, the correct way to # specify a particular order of commands is to use the "position" # attribute. For backwards compatibility, if the order is not # specified, we just use the parse order. That being said, we do # not allow a mix of position attributes and implicit order. If # you use the position attribute on one command, you must use it # on all commands, and vice-versa. position = command.get('position') if position is not None: saw_position = True position = int(position) fp = data_from_type(name, contenttype, content) tmp.append((position, fp)) commands = [] if not saw_position: for pos, fp in tmp: commands.append(fp) else: tmp.sort(key=lambda x: x[0]) order = 1 for pos, fp in tmp: if pos is None: raise oz.OzException.OzException("All command elements must have a position (explicit order), or none of them may (implicit order)") elif pos != order: # this handles both the case where there are duplicates and # the case where there is a missing number raise oz.OzException.OzException("Cannot have duplicate or sparse command position order!") order += 1 commands.append(fp) return commands def merge_packages(self, packages): """ Method to merge additional packages into an existing TDL. The packages argument should be a properly structured string as explained in the TDL documentation. If a package with the same name is in the existing TDL and in packages, the value in packages overrides. """ packsdoc = lxml.etree.fromstring(packages) packslist = packsdoc.xpath('/packages/package') self._add_packages(packslist, True) def _add_packages(self, packslist, remove_duplicates=False): """ Internal method to add the list of lxml.etree nodes from packslist into the self.packages array. If remove_duplicates is False (the default), then a package that is listed both in packslist and in the initial TDL is listed twice. If it is set to True, then a package that is listed both in packslist and the initial TDL is listed only once, from the packslist. """ for package in packslist: # package name name = package.get('name') if name is None: raise oz.OzException.OzException("Package without a name was given") # repository that the package lives in (optional) repo = _xml_get_value(package, 'repository', "package repository section", optional=True) # filename of the package (optional) filename = _xml_get_value(package, 'file', "package filename", optional=True) # arguments to install package (optional) args = _xml_get_value(package, 'arguments', "package arguments", optional=True) if remove_duplicates: # delete any existing packages with this name for p in [package for package in self.packages if package.name == name]: self.packages.remove(p) # now add in our new package def self.packages.append(Package(name, repo, filename, args)) def merge_repositories(self, repos): """ Method to merge additional repositories into an existing TDL. The repos argument should be a properly structured string as explained in the TDL documentation. If a repository with the same name is in the existing TDL and in repos, the value in repos overrides. """ reposdoc = lxml.etree.fromstring(repos) reposlist = reposdoc.xpath('/repositories/repository') self._add_repositories(reposlist) def _add_repositories(self, reposlist): """ Internal method to add the list of lxml.etree nodes from reposlist into the self.repositories dictionary. """ def _get_optional_repo_bool(repo, name, default): """ Internal method to get an option boolean from a repo XML section. """ xmlstr = _xml_get_value(repo, name, name, optional=True) if xmlstr is None: xmlstr = default val = oz.ozutil.string_to_bool(xmlstr) if val is None: raise oz.OzException.OzException("Repository %s property must be 'true', 'yes', 'false', or 'no'" % (name)) return val for repo in reposlist: name = repo.get('name') if name is None: raise oz.OzException.OzException("Repository without a name was given") url = _xml_get_value(repo, 'url', 'repository url') if urlparse.urlparse(url)[1] in ["localhost", "127.0.0.1", "localhost.localdomain"]: raise oz.OzException.OzException("Repositories cannot be localhost, since they must be reachable from the guest operating system") signed = _get_optional_repo_bool(repo, 'signed', 'no') persist = _get_optional_repo_bool(repo, 'persisted', 'yes') sslverify = _get_optional_repo_bool(repo, 'sslverify', 'no') # no need to delete - if the name matches we just overwrite here self.repositories[name] = Repository(name, url, signed, persist, sslverify) def _add_isoextras(self, extraspath, element_type): """ Internal method to add the list of extra ISO elements from the specified XML path into the self.isoextras list. """ isoextras = [] extraslist = self.doc.xpath(extraspath) if self.installtype != 'iso' and extraslist: raise oz.OzException.OzException("Extra ISO data can only be used with iso install type") for extra in extraslist: source = extra.get('source') if source is None: raise oz.OzException.OzException("Extra ISO element without a source was given") destination = extra.get('destination') if destination is None: raise oz.OzException.OzException("Extra ISO element without a destination was given") isoextras.append(ISOExtra(element_type, source, destination)) return isoextras # I declare we will use a 2 element version string with a dot # This allows simple comparison by conversion to float schema_version = "1.0" def _validate_tdl_version(self): """ Internal method to validate that we support the TDL version. """ if float(self.version) > float(self.schema_version): raise oz.OzException.OzException("TDL version (%s) is higher than our known version (%s)" % (self.version, self.schema_version)) oz-0.17.0/oz/Ubuntu.py000066400000000000000000002125741344320532700145310ustar00rootroot00000000000000# Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2018 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Ubuntu installation """ import collections import gzip import os import re import shutil import oz.GuestFSManager import oz.Linux import oz.OzException import oz.ozutil class UbuntuConfiguration(object): """ Configuration class for Ubuntu installation. """ def __init__(self, reboots, can_customize, can_install_from_desktop, ancient_isolinux, efi_extension, old_kbd_chooser, extra_long_timeout, default_netdev, default_diskbus, initrdname): self._reboots = reboots self._can_customize = can_customize self._can_install_from_desktop = can_install_from_desktop self._ancient_isolinux = ancient_isolinux self._efi_extension = efi_extension self._old_kbd_chooser = old_kbd_chooser self._extra_long_timeout = extra_long_timeout self._default_netdev = default_netdev self._default_diskbus = default_diskbus self._initrdname = initrdname @property def reboots(self): """ Property method to control how many reboots this version of Ubuntu needs for an installation. """ return self._reboots @property def can_customize(self): """ Property method for whether this version of Ubuntu can be customized. """ return self._can_customize @property def can_install_from_desktop(self): """ Property method for whether this version of Ubuntu can be installed from the 'desktop' ISO. """ return self._can_install_from_desktop @property def ancient_isolinux(self): """ Property method for whether this version of Ubuntu has an ancient version of isolinux. """ return self._ancient_isolinux @property def efi_extension(self): """ Property method for whether this version of Ubuntu uses the EFI extensions. """ return self._efi_extension @property def old_kbd_chooser(self): """ Property method for whether this version of Ubuntu uses the old kbd chooser method. """ return self._old_kbd_chooser @property def extra_long_timeout(self): """ Property method for whether this version of Ubuntu uses an extra long timeout. """ return self._extra_long_timeout @property def default_netdev(self): """ Property method for the netdev for this version of Ubuntu. """ return self._default_netdev @property def default_diskbus(self): """ Property method for the diskbus for this version of Ubuntu. """ return self._default_diskbus @property def initrdname(self): """ Property method for the initrd name for this version of Ubuntu. """ return self._initrdname version_to_config = collections.OrderedDict() version_to_config["18.10"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["18.04.2"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["18.04.1"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["18.04"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["17.10"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["17.04"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["16.10"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["16.04.6"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["16.04.5"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["16.04.4"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["16.04.3"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["16.04.2"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["16.04.1"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["16.04"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["15.10"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["15.04"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["14.10"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["14.04.5"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["14.04.4"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["14.04.3"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["14.04.2"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["14.04.1"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["14.04"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["13.10"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=False, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["13.04"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["12.10"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["12.04.5"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["12.04.4"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["12.04.3"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["12.04.2"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=True, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["12.04.1"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["12.04"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["11.10"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["11.04"] = UbuntuConfiguration(reboots=0, can_customize=True, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["10.10"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["10.04.3"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["10.04.2"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["10.04.1"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["10.04"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["9.10"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.lz') version_to_config["9.04"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.gz') version_to_config["8.10"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.gz') version_to_config["8.04.4"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.gz') version_to_config["8.04.3"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.gz') version_to_config["8.04.2"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.gz') version_to_config["8.04.1"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.gz') version_to_config["8.04"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev='virtio', default_diskbus='virtio', initrdname='initrd.gz') version_to_config["7.10"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=True, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=False, default_netdev=None, default_diskbus=None, initrdname='initrd.gz') version_to_config["7.04"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=False, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=True, default_netdev=None, default_diskbus=None, initrdname='initrd.gz') version_to_config["6.10"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=False, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=True, default_netdev=None, default_diskbus=None, initrdname='initrd.gz') version_to_config["6.06.2"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=False, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=True, extra_long_timeout=True, default_netdev=None, default_diskbus=None, initrdname='initrd.gz') version_to_config["6.06.1"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=False, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=True, extra_long_timeout=True, default_netdev=None, default_diskbus=None, initrdname='initrd.gz') version_to_config["6.06"] = UbuntuConfiguration(reboots=0, can_customize=False, can_install_from_desktop=False, ancient_isolinux=False, efi_extension=False, old_kbd_chooser=True, extra_long_timeout=True, default_netdev=None, default_diskbus=None, initrdname='initrd.gz') version_to_config["5.10"] = UbuntuConfiguration(reboots=1, can_customize=False, can_install_from_desktop=True, ancient_isolinux=True, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=True, default_netdev=None, default_diskbus=None, initrdname='initrd.gz') version_to_config["5.04"] = UbuntuConfiguration(reboots=1, can_customize=False, can_install_from_desktop=True, ancient_isolinux=True, efi_extension=False, old_kbd_chooser=False, extra_long_timeout=True, default_netdev=None, default_diskbus=None, initrdname='initrd.gz') class UbuntuGuest(oz.Linux.LinuxCDGuest): """ Class for Ubuntu 5.04, 5.10, 6.06, 6.10, 7.04, 7.10, 8.04, 8.10, 9.04, 9.10, 10.04, 10.10, 11.04, 11.10, 12.04, 12.10, 13.04, 13.10, 14.04, 14.10, 15.04, 15.10, 16.04, 16.10, 17.04, 17.10, 18.04, and 18.10 installation. """ # Note that the 'initrd' parameter is completely ignored now; we leave # it in place for backwards API compatibility. def __init__(self, tdl, config, auto, output_disk, initrd, nicmodel, # pylint: disable=unused-argument diskbus, macaddress): self.config = version_to_config[tdl.update] if nicmodel is None: nicmodel = self.config.default_netdev if diskbus is None: diskbus = self.config.default_diskbus oz.Linux.LinuxCDGuest.__init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, True, True, macaddress) self.crond_was_active = False self.sshd_was_active = False self.sshd_config = """\ SyslogFacility AUTHPRIV PasswordAuthentication yes ChallengeResponseAuthentication no GSSAPIAuthentication yes GSSAPICleanupCredentials yes UsePAM yes AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE AcceptEnv XMODIFIERS X11Forwarding yes Subsystem sftp /usr/libexec/openssh/sftp-server """ self.ssh_startuplink = None self.cron_startuplink = None self.debarch = self.tdl.arch if self.debarch == "x86_64": self.debarch = "amd64" self.kernelfname = os.path.join(self.output_dir, self.tdl.name + "-kernel") self.initrdfname = os.path.join(self.output_dir, self.tdl.name + "-ramdisk") self.kernelcache = os.path.join(self.data_dir, "kernels", self.tdl.distro + self.tdl.update + self.tdl.arch + "-kernel") self.initrdcache = os.path.join(self.data_dir, "kernels", self.tdl.distro + self.tdl.update + self.tdl.arch + "-ramdisk") self.cmdline = "priority=critical locale=en_US" if self.tdl.kernel_param: self.cmdline += " " + self.tdl.kernel_param def _check_iso_tree(self, customize_or_icicle): # Anything prior to Ubuntu 11.04 can't have openssh installed, and # we thus can't customize if customize_or_icicle and not self.config.can_customize: raise oz.OzException.OzException("Customization can only be done on Ubuntu 11.04 or later") # ISOs that contain casper are desktop install CDs if os.path.isdir(os.path.join(self.iso_contents, "casper")): # as far as I can tell, the Ubuntu 13.10 Desktop installer always # crashes during preseeded installations, so raise an error for # a Desktop install if not self.config.can_install_from_desktop: raise oz.OzException.OzException("Ubuntu %s installs can only be done using the alternate or server CDs" % (self.tdl.update)) if customize_or_icicle: raise oz.OzException.OzException("Ubuntu customization or ICICLE generation can only be done using the alternate or server CDs") def _copy_preseed(self, outname): """ Method to copy and modify an Ubuntu style preseed file. """ self.log.debug("Putting the preseed file in place") if self.default_auto_file(): def _preseed_sub(line): """ Method that is called back from oz.ozutil.copy_modify_file() to modify preseed files as appropriate for Ubuntu. """ if re.match('d-i passwd/root-password password', line): return 'd-i passwd/root-password password ' + self.rootpw + '\n' elif re.match('d-i passwd/root-password-again password', line): return 'd-i passwd/root-password-again password ' + self.rootpw + '\n' return line oz.ozutil.copy_modify_file(self.auto, outname, _preseed_sub) else: shutil.copy(self.auto, outname) def _modify_iso(self): """ Method to make the boot ISO auto-boot with appropriate parameters. """ self.log.debug("Modifying ISO") self.log.debug("Copying preseed file") outname = os.path.join(self.iso_contents, "preseed", "customiso.seed") outdir = os.path.dirname(outname) oz.ozutil.mkdir_p(outdir) self._copy_preseed(outname) self.log.debug("Modifying isolinux.cfg") isolinuxcfg = os.path.join(self.iso_contents, "isolinux", "isolinux.cfg") isolinuxdir = os.path.dirname(isolinuxcfg) if not os.path.isdir(isolinuxdir): oz.ozutil.mkdir_p(isolinuxdir) shutil.copyfile(os.path.join(self.iso_contents, "isolinux.bin"), os.path.join(isolinuxdir, "isolinux.bin")) shutil.copyfile(os.path.join(self.iso_contents, "boot.cat"), os.path.join(isolinuxdir, "boot.cat")) with open(isolinuxcfg, 'w') as f: if self.config.ancient_isolinux: f.write("""\ DEFAULT /install/vmlinuz APPEND initrd=/install/initrd.gz ramdisk_size=16384 root=/dev/rd/0 rw preseed/file=/cdrom/preseed/customiso.seed debian-installer/locale=en_US kbd-chooser/method=us netcfg/choose_interface=auto keyboard-configuration/layoutcode=us debconf/priority=critical -- TIMEOUT 1 PROMPT 0 """) else: f.write("default customiso\n") f.write("timeout 1\n") f.write("prompt 0\n") f.write("label customiso\n") f.write(" menu label ^Customiso\n") f.write(" menu default\n") if os.path.isdir(os.path.join(self.iso_contents, "casper")): kernelname = "/casper/vmlinuz" if self.config.efi_extension and self.tdl.arch == "x86_64": kernelname += ".efi" f.write(" kernel " + kernelname + "\n") f.write(" append file=/cdrom/preseed/customiso.seed boot=casper automatic-ubiquity noprompt keyboard-configuration/layoutcode=us initrd=/casper/" + self.config.initrdname + "\n") else: keyboard = "console-setup/layoutcode=us" if self.config.old_kbd_chooser: keyboard = "kbd-chooser/method=us" f.write(" kernel /install/vmlinuz\n") f.write(" append preseed/file=/cdrom/preseed/customiso.seed debian-installer/locale=en_US " + keyboard + " netcfg/choose_interface=auto keyboard-configuration/layoutcode=us priority=critical initrd=/install/initrd.gz --\n") def get_auto_path(self): """ Method to create the correct path to the Ubuntu preseed files. """ autoname = self.tdl.distro + self.tdl.update + ".auto" sp = self.tdl.update.split('.') if len(sp) == 3: autoname = self.tdl.distro + sp[0] + "." + sp[1] + ".auto" return oz.ozutil.generate_full_auto_path(autoname) def _generate_new_iso(self): """ Method to create a new ISO based on the modified CD/DVD. """ self.log.info("Generating new ISO") oz.ozutil.subprocess_check_output(["genisoimage", "-r", "-V", "Custom", "-J", "-l", "-no-emul-boot", "-b", "isolinux/isolinux.bin", "-c", "isolinux/boot.cat", "-boot-load-size", "4", "-cache-inodes", "-boot-info-table", "-v", "-o", self.output_iso, self.iso_contents], printfn=self.log.debug) def install(self, timeout=None, force=False): """ Method to run the operating system installation. """ if self.config.extra_long_timeout and timeout is None: timeout = 3000 return self._do_install(timeout, force, self.config.reboots, self.kernelfname, self.initrdfname, self.cmdline) def _get_service_runlevel_link(self, g_handle, service): """ Method to find the runlevel link(s) for a service based on the name and the (detected) default runlevel. """ runlevel = self.get_default_runlevel(g_handle) lines = g_handle.cat('/etc/init.d/' + service).split("\n") startlevel = "99" for line in lines: if re.match('# chkconfig:', line): try: startlevel = line.split(':')[1].split()[1] except IndexError: pass break return "/etc/rc" + runlevel + ".d/S" + startlevel + service def _image_ssh_teardown_step_1(self, g_handle): """ First step to undo _image_ssh_setup (remove authorized keys). """ self.log.debug("Teardown step 1") # reset the authorized keys self.log.debug("Resetting authorized_keys") g_handle.path_restore('/root/.ssh') def _image_ssh_teardown_step_2(self, g_handle): """ Second step to undo _image_ssh_setup (reset sshd service). """ self.log.debug("Teardown step 2") # remove custom sshd_config self.log.debug("Resetting sshd_config") g_handle.path_restore('/etc/ssh/sshd_config') # reset the service link self.log.debug("Resetting sshd service") if self.ssh_startuplink: g_handle.path_restore(self.ssh_startuplink) def _image_ssh_teardown_step_3(self, g_handle): """ Fourth step to undo _image_ssh_setup (remove guest announcement). """ self.log.debug("Teardown step 3") # remove announce cronjob self.log.debug("Resetting announcement to host") g_handle.remove_if_exists('/etc/NetworkManager/dispatcher.d/99-reportip') g_handle.remove_if_exists('/etc/cron.d/announce') # remove reportip self.log.debug("Removing reportip") g_handle.remove_if_exists('/root/reportip') # reset the service link self.log.debug("Resetting cron service") if self.cron_startuplink: g_handle.path_restore(self.cron_startuplink) def _image_ssh_teardown_step_4(self, g_handle): """ Fourth step to undo changes by the operating system. For instance, during first boot openssh generates ssh host keys and stores them in /etc/ssh. Since this image might be cached later on, this method removes those keys. """ for f in ["/etc/ssh/ssh_host_dsa_key", "/etc/ssh/ssh_host_dsa_key.pub", "/etc/ssh/ssh_host_rsa_key", "/etc/ssh/ssh_host_rsa_key.pub", "/etc/ssh/ssh_host_ecdsa_key", "/etc/ssh/ssh_host_ecdsa_key.pub", "/etc/ssh/ssh_host_ed25519_key", "/etc/ssh/ssh_host_ed25519_key.pub", "/etc/ssh/ssh_host_key", "/etc/ssh/ssh_host_key.pub"]: g_handle.remove_if_exists(f) # Remove any lease files; this is so that subsequent boots don't try # to connect to a DHCP server that is on a totally different network for lease in g_handle.glob_expand("/var/lib/dhcp/*.leases"): g_handle.rm(lease) def _image_ssh_setup_step_1(self, g_handle): """ First step for allowing remote access (generate and upload ssh keys). """ # part 1; upload the keys self.log.debug("Step 1: Uploading ssh keys") g_handle.path_backup('/root/.ssh') g_handle.mkdir('/root/.ssh') g_handle.path_backup('/root/.ssh/authorized_keys') self._generate_openssh_key(self.sshprivkey) g_handle.upload(self.sshprivkey + ".pub", '/root/.ssh/authorized_keys') def _image_ssh_setup_step_2(self, g_handle): """ Second step for allowing remote access (configure sshd). """ # part 2; check and setup sshd self.log.debug("Step 2: setup sshd") if not g_handle.exists('/usr/sbin/sshd'): raise oz.OzException.OzException("ssh not installed on the image, cannot continue") self.ssh_startuplink = self._get_service_runlevel_link(g_handle, 'ssh') g_handle.path_backup(self.ssh_startuplink) g_handle.ln_sf('/etc/init.d/ssh', self.ssh_startuplink) sshd_config_file = os.path.join(self.icicle_tmp, "sshd_config") with open(sshd_config_file, 'w') as f: f.write(self.sshd_config) try: g_handle.path_backup('/etc/ssh/sshd_config') g_handle.upload(sshd_config_file, '/etc/ssh/sshd_config') finally: os.unlink(sshd_config_file) def _image_ssh_setup_step_3(self, g_handle): """ Fourth step for allowing remote access (make the guest announce itself on bootup). """ # part 3; make sure the guest announces itself self.log.debug("Step 3: Guest announcement") scriptfile = os.path.join(self.icicle_tmp, "script") if g_handle.exists("/etc/NetworkManager/dispatcher.d"): with open(scriptfile, 'w') as f: f.write("""\ #!/bin/bash if [ "$1" = "eth0" -a "$2" = "up" ]; then echo -n "!$DHCP4_IP_ADDRESS,%s!" > /dev/ttyS1 fi """ % (self.uuid)) try: g_handle.upload(scriptfile, '/etc/NetworkManager/dispatcher.d/99-reportip') g_handle.chmod(0o755, '/etc/NetworkManager/dispatcher.d/99-reportip') finally: os.unlink(scriptfile) if not g_handle.exists('/usr/sbin/cron'): raise oz.OzException.OzException("cron not installed on the image, cannot continue") with open(scriptfile, 'w') as f: f.write("""\ #!/bin/bash /bin/sleep 20 DEV=$(/usr/bin/awk '{if ($2 == 0) print $1}' /proc/net/route) && [ -z "$DEV" ] && exit 0 ADDR=$(/sbin/ip -4 -o addr show dev $DEV | /usr/bin/awk '{print $4}' | /usr/bin/cut -d/ -f1) && [ -z "$ADDR" ] && exit 0 echo -n "!$ADDR,%s!" > /dev/ttyS1 """ % (self.uuid)) try: g_handle.upload(scriptfile, '/root/reportip') g_handle.chmod(0o755, '/root/reportip') finally: os.unlink(scriptfile) announcefile = os.path.join(self.icicle_tmp, "announce") with open(announcefile, 'w') as f: f.write('*/1 * * * * root /bin/bash -c "/root/reportip"\n') try: g_handle.upload(announcefile, '/etc/cron.d/announce') finally: os.unlink(announcefile) self.cron_startuplink = self._get_service_runlevel_link(g_handle, 'cron') g_handle.path_backup(self.cron_startuplink) g_handle.ln_sf('/etc/init.d/cron', self.cron_startuplink) def _collect_setup(self, libvirt_xml): """ Setup the guest for remote access. """ self.log.info("Collection Setup") g_handle = oz.GuestFSManager.GuestFSLibvirtFactory(libvirt_xml, self.libvirt_conn) g_handle.mount_partitions() # we have to do 3 things to make sure we can ssh into Ubuntu # 1) Upload our ssh key # 2) Make sure sshd is running on boot # 3) Make the guest announce itself to the host try: try: self._image_ssh_setup_step_1(g_handle) try: self._image_ssh_setup_step_2(g_handle) try: self._image_ssh_setup_step_3(g_handle) except: self._image_ssh_teardown_step_3(g_handle) raise except: self._image_ssh_teardown_step_2(g_handle) raise except: self._image_ssh_teardown_step_1(g_handle) raise finally: g_handle.cleanup() def _collect_teardown(self, libvirt_xml): """ Method to reverse the changes done in _collect_setup. """ self.log.info("Collection Teardown") g_handle = oz.GuestFSManager.GuestFSLibvirtFactory(libvirt_xml, self.libvirt_conn) g_handle.mount_partitions() try: self._image_ssh_teardown_step_1(g_handle) self._image_ssh_teardown_step_2(g_handle) self._image_ssh_teardown_step_3(g_handle) self._image_ssh_teardown_step_4(g_handle) finally: g_handle.cleanup() shutil.rmtree(self.icicle_tmp) def _customize_repos(self, guestaddr): """ Method to generate and upload custom repository files based on the TDL. """ self.log.debug("Installing additional repository files") for repo in list(self.tdl.repositories.values()): self.guest_execute_command(guestaddr, "apt-add-repository --yes '%s'" % (repo.url.strip('\'"'))) self.guest_execute_command(guestaddr, "apt-get update") def _install_packages(self, guestaddr, packstr): self.guest_execute_command(guestaddr, 'apt-get install -y %s' % (packstr)) def do_icicle(self, guestaddr): """ Method to collect the package information and generate the ICICLE XML. """ self.log.debug("Generating ICICLE") stdout, stderr_unused, retcode_unused = self.guest_execute_command(guestaddr, 'dpkg --get-selections', timeout=30) # the data we get back from dpkg is in the form of: # # \t\t\tinstall # # so we have to strip out the tabs and the install before # passing it on to output_icicle_xml packages = [] for line in stdout.split("\n"): packages.append(line.split("\t")[0]) return self._output_icicle_xml(packages, self.tdl.description) def _get_kernel_from_txt_cfg(self, fetchurl): """ Internal method to download and parse the txt.cfg file from a URL. If the txt.cfg file does not exist, or it does not have the keys that we expect, this method raises an error. """ txtcfgurl = fetchurl + "/ubuntu-installer/" + self.debarch + "/boot-screens/txt.cfg" # first we check if the txt.cfg exists; this throws an exception if # it is missing info = oz.ozutil.http_get_header(txtcfgurl) if info['HTTP-Code'] != 200: raise oz.OzException.OzException("Could not find %s" % (txtcfgurl)) txtcfg = os.path.join(self.icicle_tmp, "txt.cfg") self.log.debug("Going to write txt.cfg to %s", txtcfg) txtcfgfd = os.open(txtcfg, os.O_RDWR | os.O_CREAT | os.O_TRUNC) os.unlink(txtcfg) fp = os.fdopen(txtcfgfd) try: self.log.debug("Trying to get txt.cfg from " + txtcfgurl) oz.ozutil.http_download_file(txtcfgurl, txtcfgfd, False, self.log) # if we made it here, the txt.cfg existed. Parse it and # find out the location of the kernel and ramdisk self.log.debug("Got txt.cfg, parsing") os.lseek(txtcfgfd, 0, os.SEEK_SET) grub_pattern = re.compile(r"^default\s*(?P\w+)$.*" r"^label\s*(?P=default_entry)$.*" r"^\s*kernel\s*(?P\S+)$.*" r"initrd=(?P\S+).*" r"^label", re.DOTALL | re.MULTILINE) config_text = fp.read() match = re.search(grub_pattern, config_text) kernel = match.group('kernel') initrd = match.group('initrd') finally: fp.close() if kernel is None or initrd is None: raise oz.OzException.OzException("Empty kernel or initrd") self.log.debug("Returning kernel %s and initrd %s", kernel, initrd) return (kernel, initrd) def _gzip_file(self, inputfile, outputmode): """ Internal method to gzip a file and write it to the initrd. """ with open(inputfile, 'rb') as f: gzf = gzip.GzipFile(self.initrdfname, mode=outputmode) try: gzf.writelines(f) gzf.close() except: # there is a bit of asymmetry here in that OSs that support cpio # archives have the initial initrdfname copied in the higher level # function, but we delete it here. OSs that don't support cpio, # though, get the initrd created right here. C'est la vie os.unlink(self.initrdfname) raise def _create_cpio_initrd(self, preseedpath): """ Internal method to create a modified CPIO initrd """ extrafname = os.path.join(self.icicle_tmp, "extra.cpio") self.log.debug("Writing cpio to %s", extrafname) cpiofiledict = {} cpiofiledict[preseedpath] = 'preseed.cfg' oz.ozutil.write_cpio(cpiofiledict, extrafname) try: shutil.copyfile(self.initrdcache, self.initrdfname) self._gzip_file(extrafname, 'ab') finally: os.unlink(extrafname) def _initrd_inject_preseed(self, fetchurl, force_download): """ Internal method to download and inject a preseed file into an initrd. """ # we first see if we can use direct kernel booting, as that is # faster than downloading the ISO kernel = None initrd = None try: (kernel, initrd) = self._get_kernel_from_txt_cfg(fetchurl) except Exception: pass if kernel is None: self.log.debug("Kernel was None, trying ubuntu-installer/%s/linux", self.debarch) # we couldn't find the kernel in the txt.cfg, so try a # hard-coded path kernel = "ubuntu-installer/%s/linux" % (self.debarch) if initrd is None: self.log.debug("Initrd was None, trying ubuntu-installer/%s/initrd.gz", self.debarch) # we couldn't find the initrd in the txt.cfg, so try a # hard-coded path initrd = "ubuntu-installer/%s/initrd.gz" % (self.debarch) (fd, outdir) = oz.ozutil.open_locked_file(self.kernelcache) try: self._get_original_media('/'.join([self.url.rstrip('/'), kernel.lstrip('/')]), fd, outdir, force_download) # if we made it here, then we can copy the kernel into place shutil.copyfile(self.kernelcache, self.kernelfname) finally: os.close(fd) (fd, outdir) = oz.ozutil.open_locked_file(self.initrdcache) try: try: self._get_original_media('/'.join([self.url.rstrip('/'), initrd.lstrip('/')]), fd, outdir, force_download) except: os.unlink(self.kernelfname) raise try: preseedpath = os.path.join(self.icicle_tmp, "preseed.cfg") self._copy_preseed(preseedpath) try: self._create_cpio_initrd(preseedpath) finally: os.unlink(preseedpath) except: os.unlink(self.kernelfname) raise finally: os.close(fd) def _remove_repos(self, guestaddr): # FIXME: until we switch over to doing repository add by hand (instead # of using add-apt-repository), we can't really reliably implement this pass def generate_install_media(self, force_download=False, customize_or_icicle=False): """ Method to generate the install media for Ubuntu based operating systems. If force_download is False (the default), then the original media will only be fetched if it is not cached locally. If force_download is True, then the original media will be downloaded regardless of whether it is cached locally. """ fetchurl = self.url if self.tdl.installtype == 'url': # set the fetchurl up-front so that if the OS doesn't support # initrd injection, or the injection fails for some reason, we # fall back to the mini.iso fetchurl += "/mini.iso" self.log.debug("Installtype is URL, trying to do direct kernel boot") try: return self._initrd_inject_preseed(self.url, force_download) except Exception as err: # if any of the above failed, we couldn't use the direct # kernel/initrd build method. Fall back to trying to fetch # the mini.iso instead self.log.debug("Could not do direct boot, fetching mini.iso instead (the following error message is useful for bug reports, but can be ignored)") self.log.debug(err) return self._iso_generate_install_media(fetchurl, force_download, customize_or_icicle) def cleanup_install(self): """ Method to cleanup any transient install data. """ self.log.info("Cleaning up after install") for fname in [self.output_iso, self.initrdfname, self.kernelfname]: try: os.unlink(fname) except Exception: pass if not self.cache_original_media: for fname in [self.orig_iso, self.kernelcache, self.initrdcache]: try: os.unlink(fname) except Exception: pass def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for Ubuntu installs. """ if tdl.update in version_to_config.keys(): return UbuntuGuest(tdl, config, auto, output_disk, "initrd.lz", netdev, diskbus, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "Ubuntu: " + ", ".join(reversed(version_to_config.keys())) oz-0.17.0/oz/Windows.py000066400000000000000000000353031344320532700146720ustar00rootroot00000000000000# Copyright (C) 2010,2011 Chris Lalancette # Copyright (C) 2012-2018 Chris Lalancette # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Windows installation """ import os import random import re import shutil import lxml.etree import oz.Guest import oz.OzException import oz.ozutil class Windows(oz.Guest.CDGuest): """ Shared Windows base class. """ def __init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress): oz.Guest.CDGuest.__init__(self, tdl, config, auto, output_disk, netdev, "localtime", "usb", diskbus, True, False, macaddress) if self.tdl.key is None: raise oz.OzException.OzException("A key is required when installing Windows") class Windows_v5(Windows): """ Class for Windows versions based on kernel 5.x (2000, XP, and 2003). """ def __init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress): Windows.__init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress) if self.tdl.update == "2000" and self.tdl.arch != "i386": raise oz.OzException.OzException("Windows 2000 only supports i386 architecture") self.winarch = self.tdl.arch if self.winarch == "x86_64": self.winarch = "amd64" def _generate_new_iso(self): """ Method to create a new ISO based on the modified CD/DVD. """ self.log.debug("Generating new ISO") oz.ozutil.subprocess_check_output(["genisoimage", "-b", "cdboot/boot.bin", "-no-emul-boot", "-boot-load-seg", "1984", "-boot-load-size", "4", "-iso-level", "2", "-J", "-l", "-D", "-N", "-joliet-long", "-relaxed-filenames", "-v", "-V", "Custom", "-o", self.output_iso, self.iso_contents], printfn=self.log.debug) def generate_diskimage(self, size=10, force=False): """ Method to generate a diskimage. By default, a blank diskimage of 10GB will be created; the caller can override this with the size parameter, specified in GB. If force is False (the default), then a diskimage will not be created if a cached JEOS is found. If force is True, a diskimage will be created regardless of whether a cached JEOS exists. See the oz-install man page for more information about JEOS caching. """ createpart = False if self.tdl.update == "2000": # If given a blank diskimage, windows 2000 stops very early in # install with a message: # # Setup has determined that your computer's startup hard disk is # new or has been erased... # # To avoid that message, create a partition table that spans # the entire disk createpart = True return self._internal_generate_diskimage(size, force, createpart) def _modify_iso(self): """ Method to make the boot ISO auto-boot with appropriate parameters. """ self.log.debug("Modifying ISO") os.mkdir(os.path.join(self.iso_contents, "cdboot")) self._geteltorito(self.orig_iso, os.path.join(self.iso_contents, "cdboot", "boot.bin")) outname = os.path.join(self.iso_contents, self.winarch, "winnt.sif") if self.default_auto_file(): # if this is the oz default siffile, we modify certain parameters # to make installation succeed computername = "OZ" + str(random.randrange(1, 900000)) def _sifsub(line): """ Method that is called back from oz.ozutil.copy_modify_file() to modify sif files as appropriate for Windows 2000/XP/2003. """ if re.match(" *ProductKey", line): return " ProductKey=" + self.tdl.key + "\n" elif re.match(" *ProductID", line): return " ProductID=" + self.tdl.key + "\n" elif re.match(" *ComputerName", line): return " ComputerName=" + computername + "\n" elif re.match(" *AdminPassword", line): return " AdminPassword=" + self.rootpw + "\n" return line oz.ozutil.copy_modify_file(self.auto, outname, _sifsub) else: # if the user provided their own siffile, do not override their # choices; the user gets to keep both pieces if something breaks shutil.copy(self.auto, outname) def install(self, timeout=None, force=False): """ Method to run the operating system installation. """ internal_timeout = timeout if internal_timeout is None: internal_timeout = 3600 return self._do_install(internal_timeout, force, 1) class Windows_v6(Windows): """ Class for Windows versions based on kernel 6.x (2008, 7, 2012, 8, and 8.1). """ def __init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress): Windows.__init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress) self.winarch = "x86" if self.tdl.arch == "x86_64": self.winarch = "amd64" def _generate_new_iso(self): """ Method to create a new ISO based on the modified CD/DVD. """ self.log.debug("Generating new ISO") # NOTE: Windows 2008 is very picky about which arguments to genisoimage # will generate a bootable CD, so modify these at your own risk oz.ozutil.subprocess_check_output(["genisoimage", "-b", "cdboot/boot.bin", "-no-emul-boot", "-c", "BOOT.CAT", "-iso-level", "2", "-J", "-l", "-D", "-N", "-joliet-long", "-relaxed-filenames", "-v", "-V", "Custom", "-udf", "-o", self.output_iso, self.iso_contents], printfn=self.log.debug) def _modify_iso(self): """ Method to make the boot ISO auto-boot with appropriate parameters. """ self.log.debug("Modifying ISO") os.mkdir(os.path.join(self.iso_contents, "cdboot")) self._geteltorito(self.orig_iso, os.path.join(self.iso_contents, "cdboot", "boot.bin")) outname = os.path.join(self.iso_contents, "autounattend.xml") if self.default_auto_file(): # if this is the oz default unattend file, we modify certain # parameters to make installation succeed doc = lxml.etree.parse(self.auto) for component in doc.xpath('/ms:unattend/ms:settings/ms:component', namespaces={'ms': 'urn:schemas-microsoft-com:unattend'}): component.set('processorArchitecture', self.winarch) keys = doc.xpath('/ms:unattend/ms:settings/ms:component/ms:ProductKey', namespaces={'ms': 'urn:schemas-microsoft-com:unattend'}) if len(keys) != 1: raise oz.OzException.OzException("Invalid autounattend file; expected 1 key, saw %d" % (len(keys))) keys[0].text = self.tdl.key adminpw = doc.xpath('/ms:unattend/ms:settings/ms:component/ms:UserAccounts/ms:AdministratorPassword/ms:Value', namespaces={'ms': 'urn:schemas-microsoft-com:unattend'}) if len(adminpw) != 1: raise oz.OzException.OzException("Invalid autounattend file; expected 1 admin password, saw %d" % (len(adminpw))) adminpw[0].text = self.rootpw autologinpw = doc.xpath('/ms:unattend/ms:settings/ms:component/ms:AutoLogon/ms:Password/ms:Value', namespaces={'ms': 'urn:schemas-microsoft-com:unattend'}) if len(autologinpw) != 1: raise oz.OzException.OzException("Invalid autounattend file; expected 1 auto logon password, saw %d" % (len(autologinpw))) autologinpw[0].text = self.rootpw with open(outname, 'w') as f: f.write(lxml.etree.tostring(doc, pretty_print=True, encoding="unicode")) else: # if the user provided their own unattend file, do not override # their choices; the user gets to keep both pieces if something # breaks shutil.copy(self.auto, outname) def install(self, timeout=None, force=False): internal_timeout = timeout if internal_timeout is None: internal_timeout = 8500 return self._do_install(internal_timeout, force, 2) class Windows_v10(Windows): """ Class for Windows versions based on kernel 10.x (2016 and 10). """ def __init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress): Windows.__init__(self, tdl, config, auto, output_disk, netdev, diskbus, macaddress) self.winarch = "x86" if self.tdl.arch == "x86_64": self.winarch = "amd64" def _generate_new_iso(self): """ Method to create a new ISO based on the modified CD/DVD. """ self.log.debug("Generating new ISO") oz.ozutil.subprocess_check_output(["genisoimage", "-b", "cdboot/boot.bin", "-no-emul-boot", "-c", "BOOT.CAT", "-iso-level", "2", "-J", "-l", "-D", "-N", "-joliet-long", "-allow-limited-size", "-relaxed-filenames", "-v", "-V", "Custom", "-udf", "-o", self.output_iso, self.iso_contents], printfn=self.log.debug) def _modify_iso(self): """ Method to make the boot ISO auto-boot with appropriate parameters. """ self.log.debug("Modifying ISO") os.mkdir(os.path.join(self.iso_contents, "cdboot")) self._geteltorito(self.orig_iso, os.path.join(self.iso_contents, "cdboot", "boot.bin")) outname = os.path.join(self.iso_contents, "autounattend.xml") if self.default_auto_file(): # if this is the oz default unattend file, we modify certain # parameters to make installation succeed doc = lxml.etree.parse(self.auto) for component in doc.xpath('/ms:unattend/ms:settings/ms:component', namespaces={'ms': 'urn:schemas-microsoft-com:unattend'}): component.set('processorArchitecture', self.winarch) keys = doc.xpath('/ms:unattend/ms:settings/ms:component/ms:ProductKey', namespaces={'ms': 'urn:schemas-microsoft-com:unattend'}) if len(keys) != 1: raise oz.OzException.OzException("Invalid autounattend file; expected 1 key, saw %d" % (len(keys))) keys[0].text = self.tdl.key adminpw = doc.xpath('/ms:unattend/ms:settings/ms:component/ms:UserAccounts/ms:AdministratorPassword/ms:Value', namespaces={'ms': 'urn:schemas-microsoft-com:unattend'}) if len(adminpw) != 1: raise oz.OzException.OzException("Invalid autounattend file; expected 1 admin password, saw %d" % (len(adminpw))) adminpw[0].text = self.rootpw autologinpw = doc.xpath('/ms:unattend/ms:settings/ms:component/ms:AutoLogon/ms:Password/ms:Value', namespaces={'ms': 'urn:schemas-microsoft-com:unattend'}) if len(autologinpw) != 1: raise oz.OzException.OzException("Invalid autounattend file; expected 1 auto logon password, saw %d" % (len(autologinpw))) autologinpw[0].text = self.rootpw with open(outname, 'w') as f: f.write(lxml.etree.tostring(doc, pretty_print=True, encoding="unicode")) else: # if the user provided their own unattend file, do not override # their choices; the user gets to keep both pieces if something # breaks shutil.copy(self.auto, outname) def install(self, timeout=None, force=False): internal_timeout = timeout if internal_timeout is None: internal_timeout = 8500 return self._do_install(internal_timeout, force, 2) def get_class(tdl, config, auto, output_disk=None, netdev=None, diskbus=None, macaddress=None): """ Factory method for Windows installs. """ if tdl.update in ["2000", "XP", "2003"]: return Windows_v5(tdl, config, auto, output_disk, netdev, diskbus, macaddress) if tdl.update in ["2008", "7", "2012", "8", "8.1"]: return Windows_v6(tdl, config, auto, output_disk, netdev, diskbus, macaddress) if tdl.update in ["2016", "10"]: return Windows_v10(tdl, config, auto, output_disk, netdev, diskbus, macaddress) def get_supported_string(): """ Return supported versions as a string. """ return "Windows: 2000, XP, 2003, 7, 2008, 2012, 8, 8.1, 2016, 10" oz-0.17.0/oz/__init__.py000066400000000000000000000021121344320532700147670ustar00rootroot00000000000000""" Class for automated operating system installation. Oz is a set of classes to do automated operating system installation. It has built-in knowledge of the proper things to do for each of the supported operating systems, so the data that the user must provide is very minimal. This data is supplied in the form of an XML document that describes what type of operating system is to be installed and where to get the installation media. Oz handles the rest. The simplest Oz program (without error handling or any advanced features) would look something like: import oz.TDL import oz.GuestFactory tdl_xml = \"\"\" \"\"\" tdl = oz.TDL.TDL(tdl_xml) guest = oz.GuestFactory.guest_factory(tdl, None, None) guest.generate_install_media() guest.generate_diskimage() guest.install() """ oz-0.17.0/oz/auto/000077500000000000000000000000001344320532700136325ustar00rootroot00000000000000oz-0.17.0/oz/auto/Debian5.auto000066400000000000000000000102031344320532700157670ustar00rootroot00000000000000d-i debian-installer/locale select en_US.UTF-8 d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string localhost d-i netcfg/get_domain string localdomain d-i netcfg/disable_dhcp boolean false d-i mirror/http/proxy string d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone select US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string d-i apt-setup/services-select multiselect d-i apt-setup/volatile_host string d-i apt-setup/security_host string d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub ; \ echo '#! /bin/sh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### BEGIN INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Provides: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Start: $local_fs $network' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Stop: $local_fs' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# X-Start-Before: sshd' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Start: 2 3 4 5' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Stop: 0 1 6' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Short-Description: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Description: regenerate ssh keys on first boot' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### END INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh ; \ in-target update-rc.d oz-generate-ssh enable ; \ sed -i -e 's/^deb cdrom/# deb cdrom/' /target/etc/apt/sources.list d-i finish-install/reboot_in_progress note oz-0.17.0/oz/auto/Debian6.auto000066400000000000000000000103371344320532700160000ustar00rootroot00000000000000d-i debian-installer/locale select en_US.UTF-8 d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string localhost d-i netcfg/get_domain string localdomain d-i netcfg/disable_dhcp boolean false d-i mirror/http/proxy string d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone select US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string d-i apt-setup/services-select multiselect d-i apt-setup/volatile_host string d-i apt-setup/security_host string d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub ; \ echo '#! /bin/sh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### BEGIN INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Provides: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Start: $local_fs $network' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Stop: $local_fs' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# X-Start-Before: sshd' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Start: 2 3 4 5' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Stop: 0 1 6' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Short-Description: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Description: regenerate ssh keys on first boot' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### END INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh ; \ in-target update-rc.d oz-generate-ssh enable ; \ sed -i -e 's/^deb cdrom/# deb cdrom/' /target/etc/apt/sources.list d-i finish-install/reboot_in_progress note oz-0.17.0/oz/auto/Debian7.auto000066400000000000000000000103371344320532700160010ustar00rootroot00000000000000d-i debian-installer/locale select en_US.UTF-8 d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string localhost d-i netcfg/get_domain string localdomain d-i netcfg/disable_dhcp boolean false d-i mirror/http/proxy string d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone select US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string d-i apt-setup/services-select multiselect d-i apt-setup/volatile_host string d-i apt-setup/security_host string d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub ; \ echo '#! /bin/sh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### BEGIN INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Provides: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Start: $local_fs $network' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Stop: $local_fs' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# X-Start-Before: sshd' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Start: 2 3 4 5' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Stop: 0 1 6' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Short-Description: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Description: regenerate ssh keys on first boot' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### END INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S01oz-generate-ssh ; \ in-target update-rc.d oz-generate-ssh enable ; \ sed -i -e 's/^deb cdrom/# deb cdrom/' /target/etc/apt/sources.list d-i finish-install/reboot_in_progress note oz-0.17.0/oz/auto/Debian8.auto000066400000000000000000000077331344320532700160100ustar00rootroot00000000000000d-i debian-installer/locale select en_US d-i keyboard-configuration/xkb-keymap select us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string localhost d-i netcfg/get_domain string localdomain d-i mirror/http/proxy string d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone select US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman-partitioning/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i grub-installer/bootdev string default d-i apt-setup/security_host string d-i apt-setup/services-select multiselect d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub ; \ echo '#! /bin/sh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### BEGIN INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Provides: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Start: $local_fs $network' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Stop: $local_fs' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Start: 2 3 4 5' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Stop: 0 1 6' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Short-Description: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Description: regenerate ssh keys on first boot' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### END INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh ; \ sed -i -e 's/^deb cdrom/# deb cdrom/' /target/etc/apt/sources.list d-i finish-install/reboot_in_progress note oz-0.17.0/oz/auto/Debian9.auto000066400000000000000000000077331344320532700160110ustar00rootroot00000000000000d-i debian-installer/locale select en_US d-i keyboard-configuration/xkb-keymap select us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string localhost d-i netcfg/get_domain string localdomain d-i mirror/http/proxy string d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone select US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman-partitioning/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i grub-installer/bootdev string default d-i apt-setup/security_host string d-i apt-setup/services-select multiselect d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub ; \ echo '#! /bin/sh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### BEGIN INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Provides: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Start: $local_fs $network' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Stop: $local_fs' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Start: 2 3 4 5' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Stop: 0 1 6' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Short-Description: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Description: regenerate ssh keys on first boot' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### END INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh ; \ sed -i -e 's/^deb cdrom/# deb cdrom/' /target/etc/apt/sources.list d-i finish-install/reboot_in_progress note oz-0.17.0/oz/auto/Fedora10.auto000066400000000000000000000012221344320532700160620ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=vda part /boot --fstype ext3 --size=200 --ondisk=vda part pv.2 --size=1 --grow --ondisk=vda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %post oz-0.17.0/oz/auto/Fedora11.auto000066400000000000000000000011651344320532700160710ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes part /boot --fstype ext3 --size=200 --ondisk=vda part pv.2 --size=1 --grow --ondisk=vda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %post oz-0.17.0/oz/auto/Fedora12.auto000066400000000000000000000012221344320532700160640ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=vda part /boot --fstype ext4 --size=200 --ondisk=vda part pv.2 --size=1 --grow --ondisk=vda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %post oz-0.17.0/oz/auto/Fedora13.auto000066400000000000000000000012221344320532700160650ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=vda part /boot --fstype ext4 --size=200 --ondisk=vda part pv.2 --size=1 --grow --ondisk=vda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %post oz-0.17.0/oz/auto/Fedora14.auto000066400000000000000000000012341344320532700160710ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" zerombr clearpart --all --drives=vda part /boot --fstype ext4 --size=200 --ondisk=vda part pv.2 --size=1 --grow --ondisk=vda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %end oz-0.17.0/oz/auto/Fedora15.auto000066400000000000000000000012151344320532700160710ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr clearpart --all --drives=vda part /boot --fstype ext4 --size=200 --ondisk=vda part pv.2 --size=1 --grow --ondisk=vda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %end oz-0.17.0/oz/auto/Fedora16.auto000066400000000000000000000012661344320532700161000ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr clearpart --all --drives=vda part biosboot --fstype=biosboot --size=1 part /boot --fstype ext4 --size=200 --ondisk=vda part pv.2 --size=1 --grow --ondisk=vda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %end oz-0.17.0/oz/auto/Fedora17.auto000066400000000000000000000012661344320532700161010ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr clearpart --all --drives=vda part biosboot --fstype=biosboot --size=1 part /boot --fstype ext4 --size=200 --ondisk=vda part pv.2 --size=1 --grow --ondisk=vda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %end oz-0.17.0/oz/auto/Fedora18.auto000066400000000000000000000012661344320532700161020ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr clearpart --all --drives=vda part biosboot --fstype=biosboot --size=1 part /boot --fstype ext4 --size=200 --ondisk=vda part pv.2 --size=1 --grow --ondisk=vda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @core %end oz-0.17.0/oz/auto/Fedora19.auto000066400000000000000000000012661344320532700161030ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr clearpart --all --drives=vda part biosboot --fstype=biosboot --size=1 part /boot --fstype ext4 --size=200 --ondisk=vda part pv.2 --size=1 --grow --ondisk=vda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @core %end oz-0.17.0/oz/auto/Fedora20.auto000066400000000000000000000012661344320532700160730ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr clearpart --all --drives=vda part biosboot --fstype=biosboot --size=1 part /boot --fstype ext4 --size=200 --ondisk=vda part pv.2 --size=1 --grow --ondisk=vda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @core %end oz-0.17.0/oz/auto/Fedora21.auto000066400000000000000000000005641344320532700160740ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr clearpart --all --initlabel autopart --type=lvm reboot %packages @core %end oz-0.17.0/oz/auto/Fedora22.auto000066400000000000000000000005641344320532700160750ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr clearpart --all --initlabel autopart --type=lvm reboot %packages @core %end oz-0.17.0/oz/auto/Fedora23.auto000066400000000000000000000005641344320532700160760ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device ens3 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr clearpart --all --initlabel autopart --type=lvm reboot %packages @core %end oz-0.17.0/oz/auto/Fedora24.auto000066400000000000000000000005641344320532700160770ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device ens3 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr clearpart --all --initlabel autopart --type=lvm reboot %packages @core %end oz-0.17.0/oz/auto/Fedora25.auto000066400000000000000000000005641344320532700161000ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device ens3 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr clearpart --all --initlabel autopart --type=lvm reboot %packages @core %end oz-0.17.0/oz/auto/Fedora26.auto000066400000000000000000000005641344320532700161010ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device ens3 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr clearpart --all --initlabel autopart --type=lvm reboot %packages @core %end oz-0.17.0/oz/auto/Fedora27.auto000066400000000000000000000005641344320532700161020ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device ens3 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr clearpart --all --initlabel autopart --type=lvm reboot %packages @core %end oz-0.17.0/oz/auto/Fedora28.auto000066400000000000000000000005641344320532700161030ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device ens3 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr clearpart --all --initlabel autopart --type=lvm reboot %packages @core %end oz-0.17.0/oz/auto/Fedora7.auto000066400000000000000000000012221344320532700160100ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=sda part /boot --fstype ext3 --size=200 --ondisk=sda part pv.2 --size=1 --grow --ondisk=sda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %post oz-0.17.0/oz/auto/Fedora8.auto000066400000000000000000000012221344320532700160110ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=sda part /boot --fstype ext3 --size=200 --ondisk=sda part pv.2 --size=1 --grow --ondisk=sda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %post oz-0.17.0/oz/auto/Fedora9.auto000066400000000000000000000012221344320532700160120ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=vda part /boot --fstype ext3 --size=200 --ondisk=vda part pv.2 --size=1 --grow --ondisk=vda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %post oz-0.17.0/oz/auto/FedoraCore1.auto000066400000000000000000000013161344320532700166170ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=hda part /boot --fstype ext3 --size=200 --ondisk=hda part pv.2 --size=1 --grow --ondisk=hda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %post oz-0.17.0/oz/auto/FedoraCore2.auto000066400000000000000000000013421344320532700166170ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=hda part /boot --fstype ext3 --size=200 --ondisk=hda part pv.2 --size=1 --grow --ondisk=hda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %post oz-0.17.0/oz/auto/FedoraCore3.auto000066400000000000000000000013421344320532700166200ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=hda part /boot --fstype ext3 --size=200 --ondisk=hda part pv.2 --size=1 --grow --ondisk=hda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %post oz-0.17.0/oz/auto/FedoraCore4.auto000066400000000000000000000013421344320532700166210ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=hda part /boot --fstype ext3 --size=200 --ondisk=hda part pv.2 --size=1 --grow --ondisk=hda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %post oz-0.17.0/oz/auto/FedoraCore5.auto000066400000000000000000000013421344320532700166220ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=hda part /boot --fstype ext3 --size=200 --ondisk=hda part pv.2 --size=1 --grow --ondisk=hda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %post oz-0.17.0/oz/auto/FedoraCore6.auto000066400000000000000000000013421344320532700166230ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=hda part /boot --fstype ext3 --size=200 --ondisk=hda part pv.2 --size=1 --grow --ondisk=hda volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %post oz-0.17.0/oz/auto/FreeBSD10.0.auto000066400000000000000000000020271344320532700162360ustar00rootroot00000000000000# Install rules. PARTITIONS="vtbd0 { auto freebsd-ufs / }" BSDINSTALL_DISTSITE="http://mirror.leaseweb.net/freebsd/releases/amd64/10.0-RELEASE/" DISTRIBUTIONS="kernel.txz base.txz" # Post script. #!/bin/sh hostname=$(openssl rand -hex 4) echo "ifconfig_vtnet0=DHCP" >> /etc/rc.conf echo "sshd_enable=YES" >> /etc/rc.conf echo "hostname=$hostname" >> /etc/rc.conf echo "#ROOTPW#" | pw mod user root -h 0 # Clean up any old dhclient stuff from the preparation stage. rm -f /var/db/dhclient.leases.* # The machine check fails pretty hard on a hypervisor running on top of AMD # processors, so just disable it. echo "hw.mca.enabled=0" >> /boot/loader.conf.local # Log kernel (boot) messages to console, so that they can be captured. echo 'console="vidconsole,comconsole"' >> /boot/loader.conf.local sed -i.bak -E "s/^(ttyu0.+)dialup(.+)off(.+)secure/\1 vt100 on secure/" /etc/ttys rm -f /etc/ttys.bak # The installer wants to reboot to the newly installed system, though at this # point we'd rather send the image to the cloud :) shutdown -p now oz-0.17.0/oz/auto/FreeBSD11.0.auto000066400000000000000000000020271344320532700162370ustar00rootroot00000000000000# Install rules. PARTITIONS="vtbd0 { auto freebsd-ufs / }" BSDINSTALL_DISTSITE="http://mirror.leaseweb.net/freebsd/releases/amd64/11.0-RELEASE/" DISTRIBUTIONS="kernel.txz base.txz" # Post script. #!/bin/sh hostname=$(openssl rand -hex 4) echo "ifconfig_vtnet0=DHCP" >> /etc/rc.conf echo "sshd_enable=YES" >> /etc/rc.conf echo "hostname=$hostname" >> /etc/rc.conf echo "#ROOTPW#" | pw mod user root -h 0 # Clean up any old dhclient stuff from the preparation stage. rm -f /var/db/dhclient.leases.* # The machine check fails pretty hard on a hypervisor running on top of AMD # processors, so just disable it. echo "hw.mca.enabled=0" >> /boot/loader.conf.local # Log kernel (boot) messages to console, so that they can be captured. echo 'console="vidconsole,comconsole"' >> /boot/loader.conf.local sed -i.bak -E "s/^(ttyu0.+)dialup(.+)off(.+)secure/\1 vt100 on secure/" /etc/ttys rm -f /etc/ttys.bak # The installer wants to reboot to the newly installed system, though at this # point we'd rather send the image to the cloud :) shutdown -p now oz-0.17.0/oz/auto/Mageia2.auto000066400000000000000000000064111344320532700157730ustar00rootroot00000000000000#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). $o = { 'autoExitInstall' => '1', 'interactiveSteps' => [], 'no_suggests' => 1, 'mkbootdisk' => 0, 'isUpgrade' => 0, 'excludedocs' => 1, 'minimal' => 1, 'miscellaneous' => { 'numlock' => 1, }, 'netc' => { 'ZEROCONF_HOSTNAME' => undef, 'NETWORKING' => 'yes', 'NET_DEVICE' => 'eth0', 'DHCP' => 'yes' }, 'locale' => { 'lang' => 'en_US', 'country' => 'US', 'utf8' => 1, 'langs' => { 'en_US' => 1 } }, 'mkbootdisk' => 0, 'partitions' => [ { 'size' => 12273597, 'mntpoint' => '/', 'type' => 1155, 'fs_type' => 'ext4' }, { 'size' => 1012032, 'mntpoint' => 'swap', 'type' => 130, 'fs_type' => 'swap' }, { 'size' => 1024, 'ratio' => 100, 'mntpoint' => '/home', 'type' => 1155, 'fs_type' => 'ext4' } ], 'printer' => { 'MANUALCUPSCONFIG' => undef, 'BROWSEPOLLPORT' => undef, 'BROWSEPOLLADDR' => undef, 'SPOOLER' => undef, 'configured' => {}, 'DEFAULT' => undef }, 'intf' => { 'eth0' => { 'BROADCAST' => '', 'ONBOOT' => 'yes', 'BOOTPROTO' => 'dhcp', 'DEVICE' => 'eth0', 'NETMASK' => '255.255.255.0', 'NETWORK' => '' } }, 'authentication' => { 'shadow' => 1, 'md5' => 1, 'local' => undef }, 'partitioning' => { 'auto_allocate' => '1', 'clearall' => '1', 'eraseBadPartitions' => 0 }, 'users' => [{ 'icon' => 'default', 'realname' => 'user', 'uid' => undef, 'groups' => [], 'name' => 'user', 'shell' => '/bin/bash', 'password' => %ROOTPW%, 'gid' => undef }], 'security' => 2, 'X' => { disabled => 1 }, 'skipped_packages' => [ 'xdm', 'shorewall', 'shorewall-core', 'mageia-gfxboot-theme'], 'default_packages' => [ 'basesystem-minimal', 'urpmi', 'sudo', 'openssh-client', 'openssh-server', 'vim-minimal' ], 'superuser' => { 'home' => '/root', 'shell' => '/bin/bash', 'realname' => 'root', 'password' => %ROOTPW%, 'uid' => '0', 'gid' => '0' }, 'manualFstab' => [], 'libsafe' => 0, 'useSupermount' => '0', 'timezone' => { 'UTC' => 1, 'ntp' => undef, 'timezone' => 'America/New_York' }, 'netcnx' => { 'lan' => {}, 'type' => 'lan' }, 'keyboard' => { 'unsafe' => 1, 'GRP_TOGGLE' => '', 'KEYBOARD' => 'us', 'KBCHARSET' => 'C' }, 'security_user' => '', 'mouse' => { 'MOUSETYPE' => 'ps/2', 'device' => 'psaux', 'name' => 'Standard', 'nbuttons' => 2, 'type' => 'PS/2', 'XMOUSETYPE' => 'PS/2', 'EMULATEWHEEL' => undef } }; oz-0.17.0/oz/auto/Mageia3.auto000066400000000000000000000064111344320532700157740ustar00rootroot00000000000000#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). $o = { 'autoExitInstall' => '1', 'interactiveSteps' => [], 'no_suggests' => 1, 'mkbootdisk' => 0, 'isUpgrade' => 0, 'excludedocs' => 1, 'minimal' => 1, 'miscellaneous' => { 'numlock' => 1, }, 'netc' => { 'ZEROCONF_HOSTNAME' => undef, 'NETWORKING' => 'yes', 'NET_DEVICE' => 'eth0', 'DHCP' => 'yes' }, 'locale' => { 'lang' => 'en_US', 'country' => 'US', 'utf8' => 1, 'langs' => { 'en_US' => 1 } }, 'mkbootdisk' => 0, 'partitions' => [ { 'size' => 12273597, 'mntpoint' => '/', 'type' => 1155, 'fs_type' => 'ext4' }, { 'size' => 1012032, 'mntpoint' => 'swap', 'type' => 130, 'fs_type' => 'swap' }, { 'size' => 1024, 'ratio' => 100, 'mntpoint' => '/home', 'type' => 1155, 'fs_type' => 'ext4' } ], 'printer' => { 'MANUALCUPSCONFIG' => undef, 'BROWSEPOLLPORT' => undef, 'BROWSEPOLLADDR' => undef, 'SPOOLER' => undef, 'configured' => {}, 'DEFAULT' => undef }, 'intf' => { 'eth0' => { 'BROADCAST' => '', 'ONBOOT' => 'yes', 'BOOTPROTO' => 'dhcp', 'DEVICE' => 'eth0', 'NETMASK' => '255.255.255.0', 'NETWORK' => '' } }, 'authentication' => { 'shadow' => 1, 'md5' => 1, 'local' => undef }, 'partitioning' => { 'auto_allocate' => '1', 'clearall' => '1', 'eraseBadPartitions' => 0 }, 'users' => [{ 'icon' => 'default', 'realname' => 'user', 'uid' => undef, 'groups' => [], 'name' => 'user', 'shell' => '/bin/bash', 'password' => %ROOTPW%, 'gid' => undef }], 'security' => 2, 'X' => { disabled => 1 }, 'skipped_packages' => [ 'xdm', 'shorewall', 'shorewall-core', 'mageia-gfxboot-theme'], 'default_packages' => [ 'basesystem-minimal', 'urpmi', 'sudo', 'openssh-client', 'openssh-server', 'vim-minimal' ], 'superuser' => { 'home' => '/root', 'shell' => '/bin/bash', 'realname' => 'root', 'password' => %ROOTPW%, 'uid' => '0', 'gid' => '0' }, 'manualFstab' => [], 'libsafe' => 0, 'useSupermount' => '0', 'timezone' => { 'UTC' => 1, 'ntp' => undef, 'timezone' => 'America/New_York' }, 'netcnx' => { 'lan' => {}, 'type' => 'lan' }, 'keyboard' => { 'unsafe' => 1, 'GRP_TOGGLE' => '', 'KEYBOARD' => 'us', 'KBCHARSET' => 'C' }, 'security_user' => '', 'mouse' => { 'MOUSETYPE' => 'ps/2', 'device' => 'psaux', 'name' => 'Standard', 'nbuttons' => 2, 'type' => 'PS/2', 'XMOUSETYPE' => 'PS/2', 'EMULATEWHEEL' => undef } }; oz-0.17.0/oz/auto/Mageia4.1.auto000066400000000000000000000064111344320532700161340ustar00rootroot00000000000000#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). $o = { 'autoExitInstall' => '1', 'interactiveSteps' => [], 'no_suggests' => 1, 'mkbootdisk' => 0, 'isUpgrade' => 0, 'excludedocs' => 1, 'minimal' => 1, 'miscellaneous' => { 'numlock' => 1, }, 'netc' => { 'ZEROCONF_HOSTNAME' => undef, 'NETWORKING' => 'yes', 'NET_DEVICE' => 'eth0', 'DHCP' => 'yes' }, 'locale' => { 'lang' => 'en_US', 'country' => 'US', 'utf8' => 1, 'langs' => { 'en_US' => 1 } }, 'mkbootdisk' => 0, 'partitions' => [ { 'size' => 12273597, 'mntpoint' => '/', 'type' => 1155, 'fs_type' => 'ext4' }, { 'size' => 1012032, 'mntpoint' => 'swap', 'type' => 130, 'fs_type' => 'swap' }, { 'size' => 1024, 'ratio' => 100, 'mntpoint' => '/home', 'type' => 1155, 'fs_type' => 'ext4' } ], 'printer' => { 'MANUALCUPSCONFIG' => undef, 'BROWSEPOLLPORT' => undef, 'BROWSEPOLLADDR' => undef, 'SPOOLER' => undef, 'configured' => {}, 'DEFAULT' => undef }, 'intf' => { 'eth0' => { 'BROADCAST' => '', 'ONBOOT' => 'yes', 'BOOTPROTO' => 'dhcp', 'DEVICE' => 'eth0', 'NETMASK' => '255.255.255.0', 'NETWORK' => '' } }, 'authentication' => { 'shadow' => 1, 'md5' => 1, 'local' => undef }, 'partitioning' => { 'auto_allocate' => '1', 'clearall' => '1', 'eraseBadPartitions' => 0 }, 'users' => [{ 'icon' => 'default', 'realname' => 'user', 'uid' => undef, 'groups' => [], 'name' => 'user', 'shell' => '/bin/bash', 'password' => %ROOTPW%, 'gid' => undef }], 'security' => 2, 'X' => { disabled => 1 }, 'skipped_packages' => [ 'xdm', 'shorewall', 'shorewall-core', 'mageia-gfxboot-theme'], 'default_packages' => [ 'basesystem-minimal', 'urpmi', 'sudo', 'openssh-client', 'openssh-server', 'vim-minimal' ], 'superuser' => { 'home' => '/root', 'shell' => '/bin/bash', 'realname' => 'root', 'password' => %ROOTPW%, 'uid' => '0', 'gid' => '0' }, 'manualFstab' => [], 'libsafe' => 0, 'useSupermount' => '0', 'timezone' => { 'UTC' => 1, 'ntp' => undef, 'timezone' => 'America/New_York' }, 'netcnx' => { 'lan' => {}, 'type' => 'lan' }, 'keyboard' => { 'unsafe' => 1, 'GRP_TOGGLE' => '', 'KEYBOARD' => 'us', 'KBCHARSET' => 'C' }, 'security_user' => '', 'mouse' => { 'MOUSETYPE' => 'ps/2', 'device' => 'psaux', 'name' => 'Standard', 'nbuttons' => 2, 'type' => 'PS/2', 'XMOUSETYPE' => 'PS/2', 'EMULATEWHEEL' => undef } }; oz-0.17.0/oz/auto/Mageia4.auto000066400000000000000000000064111344320532700157750ustar00rootroot00000000000000#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). $o = { 'autoExitInstall' => '1', 'interactiveSteps' => [], 'no_suggests' => 1, 'mkbootdisk' => 0, 'isUpgrade' => 0, 'excludedocs' => 1, 'minimal' => 1, 'miscellaneous' => { 'numlock' => 1, }, 'netc' => { 'ZEROCONF_HOSTNAME' => undef, 'NETWORKING' => 'yes', 'NET_DEVICE' => 'eth0', 'DHCP' => 'yes' }, 'locale' => { 'lang' => 'en_US', 'country' => 'US', 'utf8' => 1, 'langs' => { 'en_US' => 1 } }, 'mkbootdisk' => 0, 'partitions' => [ { 'size' => 12273597, 'mntpoint' => '/', 'type' => 1155, 'fs_type' => 'ext4' }, { 'size' => 1012032, 'mntpoint' => 'swap', 'type' => 130, 'fs_type' => 'swap' }, { 'size' => 1024, 'ratio' => 100, 'mntpoint' => '/home', 'type' => 1155, 'fs_type' => 'ext4' } ], 'printer' => { 'MANUALCUPSCONFIG' => undef, 'BROWSEPOLLPORT' => undef, 'BROWSEPOLLADDR' => undef, 'SPOOLER' => undef, 'configured' => {}, 'DEFAULT' => undef }, 'intf' => { 'eth0' => { 'BROADCAST' => '', 'ONBOOT' => 'yes', 'BOOTPROTO' => 'dhcp', 'DEVICE' => 'eth0', 'NETMASK' => '255.255.255.0', 'NETWORK' => '' } }, 'authentication' => { 'shadow' => 1, 'md5' => 1, 'local' => undef }, 'partitioning' => { 'auto_allocate' => '1', 'clearall' => '1', 'eraseBadPartitions' => 0 }, 'users' => [{ 'icon' => 'default', 'realname' => 'user', 'uid' => undef, 'groups' => [], 'name' => 'user', 'shell' => '/bin/bash', 'password' => %ROOTPW%, 'gid' => undef }], 'security' => 2, 'X' => { disabled => 1 }, 'skipped_packages' => [ 'xdm', 'shorewall', 'shorewall-core', 'mageia-gfxboot-theme'], 'default_packages' => [ 'basesystem-minimal', 'urpmi', 'sudo', 'openssh-client', 'openssh-server', 'vim-minimal' ], 'superuser' => { 'home' => '/root', 'shell' => '/bin/bash', 'realname' => 'root', 'password' => %ROOTPW%, 'uid' => '0', 'gid' => '0' }, 'manualFstab' => [], 'libsafe' => 0, 'useSupermount' => '0', 'timezone' => { 'UTC' => 1, 'ntp' => undef, 'timezone' => 'America/New_York' }, 'netcnx' => { 'lan' => {}, 'type' => 'lan' }, 'keyboard' => { 'unsafe' => 1, 'GRP_TOGGLE' => '', 'KEYBOARD' => 'us', 'KBCHARSET' => 'C' }, 'security_user' => '', 'mouse' => { 'MOUSETYPE' => 'ps/2', 'device' => 'psaux', 'name' => 'Standard', 'nbuttons' => 2, 'type' => 'PS/2', 'XMOUSETYPE' => 'PS/2', 'EMULATEWHEEL' => undef } }; oz-0.17.0/oz/auto/Mageia5.auto000066400000000000000000000064111344320532700157760ustar00rootroot00000000000000#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). $o = { 'autoExitInstall' => '1', 'interactiveSteps' => [], 'no_suggests' => 1, 'mkbootdisk' => 0, 'isUpgrade' => 0, 'excludedocs' => 1, 'minimal' => 1, 'miscellaneous' => { 'numlock' => 1, }, 'netc' => { 'ZEROCONF_HOSTNAME' => undef, 'NETWORKING' => 'yes', 'NET_DEVICE' => 'eth0', 'DHCP' => 'yes' }, 'locale' => { 'lang' => 'en_US', 'country' => 'US', 'utf8' => 1, 'langs' => { 'en_US' => 1 } }, 'mkbootdisk' => 0, 'partitions' => [ { 'size' => 12273597, 'mntpoint' => '/', 'type' => 1155, 'fs_type' => 'ext4' }, { 'size' => 1012032, 'mntpoint' => 'swap', 'type' => 130, 'fs_type' => 'swap' }, { 'size' => 1024, 'ratio' => 100, 'mntpoint' => '/home', 'type' => 1155, 'fs_type' => 'ext4' } ], 'printer' => { 'MANUALCUPSCONFIG' => undef, 'BROWSEPOLLPORT' => undef, 'BROWSEPOLLADDR' => undef, 'SPOOLER' => undef, 'configured' => {}, 'DEFAULT' => undef }, 'intf' => { 'eth0' => { 'BROADCAST' => '', 'ONBOOT' => 'yes', 'BOOTPROTO' => 'dhcp', 'DEVICE' => 'eth0', 'NETMASK' => '255.255.255.0', 'NETWORK' => '' } }, 'authentication' => { 'shadow' => 1, 'md5' => 1, 'local' => undef }, 'partitioning' => { 'auto_allocate' => '1', 'clearall' => '1', 'eraseBadPartitions' => 0 }, 'users' => [{ 'icon' => 'default', 'realname' => 'user', 'uid' => undef, 'groups' => [], 'name' => 'user', 'shell' => '/bin/bash', 'password' => %ROOTPW%, 'gid' => undef }], 'security' => 2, 'X' => { disabled => 1 }, 'skipped_packages' => [ 'xdm', 'shorewall', 'shorewall-core', 'mageia-gfxboot-theme'], 'default_packages' => [ 'basesystem-minimal', 'urpmi', 'sudo', 'openssh-client', 'openssh-server', 'vim-minimal' ], 'superuser' => { 'home' => '/root', 'shell' => '/bin/bash', 'realname' => 'root', 'password' => %ROOTPW%, 'uid' => '0', 'gid' => '0' }, 'manualFstab' => [], 'libsafe' => 0, 'useSupermount' => '0', 'timezone' => { 'UTC' => 1, 'ntp' => undef, 'timezone' => 'America/New_York' }, 'netcnx' => { 'lan' => {}, 'type' => 'lan' }, 'keyboard' => { 'unsafe' => 1, 'GRP_TOGGLE' => '', 'KEYBOARD' => 'us', 'KBCHARSET' => 'C' }, 'security_user' => '', 'mouse' => { 'MOUSETYPE' => 'ps/2', 'device' => 'psaux', 'name' => 'Standard', 'nbuttons' => 2, 'type' => 'PS/2', 'XMOUSETYPE' => 'PS/2', 'EMULATEWHEEL' => undef } }; oz-0.17.0/oz/auto/Mandrake10.0.auto000066400000000000000000000066471344320532700165620ustar00rootroot00000000000000#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). $o = { 'autoExitInstall' => '1', 'netc' => { 'ZEROCONF_HOSTNAME' => undef, 'NETWORKING' => 'yes', 'NET_DEVICE' => 'eth0', 'DHCP' => 'yes' }, 'locale' => { 'lang' => 'en_US', 'country' => 'US', 'utf8' => '', 'langs' => { 'en_US' => 1 } }, 'mkbootdisk' => 0, 'partitions' => [ { 'size' => 12273597, 'mntpoint' => '/', 'type' => 1155 }, { 'size' => 1012032, 'mntpoint' => 'swap', 'type' => 130 }, { 'size' => 28643832, 'mntpoint' => '/home', 'type' => 1155 } ], 'printer' => { 'MANUALCUPSCONFIG' => undef, 'BROWSEPOLLPORT' => undef, 'BROWSEPOLLADDR' => undef, 'SPOOLER' => undef, 'configured' => {}, 'DEFAULT' => undef }, 'intf' => { 'eth0' => { 'BROADCAST' => '', 'ONBOOT' => 'yes', 'BOOTPROTO' => 'dhcp', 'DEVICE' => 'eth0', 'NETMASK' => '255.255.255.0', 'NETWORK' => '' } }, 'authentication' => { 'shadow' => 1, 'md5' => 1, 'local' => undef }, 'partitioning' => { 'auto_allocate' => '1', 'clearall' => '1', 'eraseBadPartitions' => 0 }, 'users' => [], 'security' => 2, 'default_packages' => [ 'locales', 'locales-en', 'msec', 'devfsd', 'kernel-enterprise-2.4.22.10mdk', 'eject', 'gnupg', 'urpmi', 'hotplug', 'procmail', 'mtools', 'groff', 'at', 'coreutils-doc', 'dhcp-client', 'ftp-client-krb5', 'grub', 'harddrake', 'hdparm', 'hexedit', 'info', 'ldetect', 'man', 'mkxauth', 'numlock', 'open', 'openssh-server', 'rfbdrake', 'samba-server', 'slocate', 'strace', 'sudo', 'tmdns', 'tmpwatch', 'words', 'zcip', 'patch', 'recode', 'emacs-X11', 'man-pages', 'nfs-utils', 'rgrep', 'screen', 'symlinks', 'webmin', 'xterm' ], 'superuser' => { 'home' => '/root', 'shell' => '/bin/bash', 'realname' => 'root', 'password' => %ROOTPW%, 'uid' => '0', 'gid' => '0' }, 'manualFstab' => [], 'libsafe' => 0, 'useSupermount' => '1', 'timezone' => { 'UTC' => 1, 'ntp' => undef, 'timezone' => 'America/New_York' }, 'netcnx' => { 'lan' => {}, 'type' => 'lan' }, 'keyboard' => { 'unsafe' => 1, 'GRP_TOGGLE' => '', 'KEYBOARD' => 'us', 'KBCHARSET' => 'C' }, 'X' => {}, 'security_user' => '', 'mouse' => { 'MOUSETYPE' => 'ps/2', 'device' => 'psaux', 'name' => 'Standard', 'nbuttons' => 2, 'type' => 'PS/2', 'XMOUSETYPE' => 'PS/2', 'EMULATEWHEEL' => undef } }; oz-0.17.0/oz/auto/Mandrake10.1.auto000066400000000000000000000066471344320532700165630ustar00rootroot00000000000000#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). $o = { 'autoExitInstall' => '1', 'netc' => { 'ZEROCONF_HOSTNAME' => undef, 'NETWORKING' => 'yes', 'NET_DEVICE' => 'eth0', 'DHCP' => 'yes' }, 'locale' => { 'lang' => 'en_US', 'country' => 'US', 'utf8' => '', 'langs' => { 'en_US' => 1 } }, 'mkbootdisk' => 0, 'partitions' => [ { 'size' => 12273597, 'mntpoint' => '/', 'type' => 1155 }, { 'size' => 1012032, 'mntpoint' => 'swap', 'type' => 130 }, { 'size' => 28643832, 'mntpoint' => '/home', 'type' => 1155 } ], 'printer' => { 'MANUALCUPSCONFIG' => undef, 'BROWSEPOLLPORT' => undef, 'BROWSEPOLLADDR' => undef, 'SPOOLER' => undef, 'configured' => {}, 'DEFAULT' => undef }, 'intf' => { 'eth0' => { 'BROADCAST' => '', 'ONBOOT' => 'yes', 'BOOTPROTO' => 'dhcp', 'DEVICE' => 'eth0', 'NETMASK' => '255.255.255.0', 'NETWORK' => '' } }, 'authentication' => { 'shadow' => 1, 'md5' => 1, 'local' => undef }, 'partitioning' => { 'auto_allocate' => '1', 'clearall' => '1', 'eraseBadPartitions' => 0 }, 'users' => [], 'security' => 2, 'default_packages' => [ 'locales', 'locales-en', 'msec', 'devfsd', 'kernel-enterprise-2.4.22.10mdk', 'eject', 'gnupg', 'urpmi', 'hotplug', 'procmail', 'mtools', 'groff', 'at', 'coreutils-doc', 'dhcp-client', 'ftp-client-krb5', 'grub', 'harddrake', 'hdparm', 'hexedit', 'info', 'ldetect', 'man', 'mkxauth', 'numlock', 'open', 'openssh-server', 'rfbdrake', 'samba-server', 'slocate', 'strace', 'sudo', 'tmdns', 'tmpwatch', 'words', 'zcip', 'patch', 'recode', 'emacs-X11', 'man-pages', 'nfs-utils', 'rgrep', 'screen', 'symlinks', 'webmin', 'xterm' ], 'superuser' => { 'home' => '/root', 'shell' => '/bin/bash', 'realname' => 'root', 'password' => %ROOTPW%, 'uid' => '0', 'gid' => '0' }, 'manualFstab' => [], 'libsafe' => 0, 'useSupermount' => '1', 'timezone' => { 'UTC' => 1, 'ntp' => undef, 'timezone' => 'America/New_York' }, 'netcnx' => { 'lan' => {}, 'type' => 'lan' }, 'keyboard' => { 'unsafe' => 1, 'GRP_TOGGLE' => '', 'KEYBOARD' => 'us', 'KBCHARSET' => 'C' }, 'X' => {}, 'security_user' => '', 'mouse' => { 'MOUSETYPE' => 'ps/2', 'device' => 'psaux', 'name' => 'Standard', 'nbuttons' => 2, 'type' => 'PS/2', 'XMOUSETYPE' => 'PS/2', 'EMULATEWHEEL' => undef } }; oz-0.17.0/oz/auto/Mandrake8.2.auto000066400000000000000000000103101344320532700164710ustar00rootroot00000000000000#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). $o = { 'partitions' => [ { 'mntpoint' => '/', 'size' => 7164927, 'type' => 1155 }, { 'mntpoint' => 'swap', 'size' => 497952, 'type' => 130 }, { 'mntpoint' => '/home', 'size' => 13308452, 'type' => 1155 } ], 'superuser' => { 'shell' => '/bin/bash', 'gid' => '0', 'realname' => 'root', 'home' => '/root', 'password' => %ROOTPW%, 'uid' => '0' }, 'lang' => 'en_US', 'default_packages' => [ 'aspell-de', 'curl', 'wget', 'info', 'urpmi', 'gv', 'anacron', 'at', 'procmail', 'psutils', 'ldetect', 'faces', 'devfsd', 'texinfo', 'strace', 'sudo', 'lftp', 'dhcpcd', 'rsync', 'efax', 'enscript', 'kernel-enterprise-2.4.18.6mdk', 'man-pages', 'metamail', 'mirrordir', 'bind-utils', 'man', 'ftp-client-krb5', 'gaddr', 'numlock', 'locales-en', 'rdist', 'gpm', 'cpio', 'gftp', 'grub', 'MAKEDEV', 'hexedit', 'hotplug', 'msec', 'links' ], 'partitioning' => { 'clearall' => 0, 'eraseBadPartitions' => 0, 'auto_allocate' => 1 }, 'intf' => { 'eth0' => { 'WIRELESS_IWSPY' => undef, 'BROADCAST' => '', 'WIRELESS_MODE' => undef, 'WIRELESS_NWID' => undef, 'WIRELESS_ENC_KEY' => undef, 'WIRELESS_FRAG' => undef, 'WIRELESS_RATE' => undef, 'NETWORK' => '', 'ONBOOT' => 'yes', 'WIRELESS_RTS' => undef, 'WIRELESS_ESSID' => undef, 'WIRELESS_IWCONFIG' => undef, 'WIRELESS_IWPRIV' => undef, 'NETMASK' => '255.255.255.0', 'DEVICE' => 'eth0', 'WIRELESS_FREQ' => undef, 'IPADDR' => '', 'BOOTPROTO' => 'dhcp', 'WIRELESS_SENS' => undef } }, 'users' => [], 'useSupermount' => 1, 'netcnx' => { 'NET_DEVICE' => '', 'lan' => {}, 'NET_INTERFACE' => undef, 'type' => 'lan', 'PROFILE' => undef }, 'authentication' => { 'shadow' => 1, 'md5' => 1, 'NIS' => '', 'LDAP' => '' }, 'isUpgrade' => 0, 'security' => 2, 'timezone' => { 'UTC' => 0, 'ntp' => undef, 'timezone' => 'America/New_York' }, 'mouse' => { 'MOUSETYPE' => 'ps/2', 'device' => 'psaux', 'WHEEL' => undef, 'XEMU3' => undef, 'FULLNAME' => undef, 'XMOUSETYPE' => 'PS/2', 'type' => 'PS/2', 'name' => 'Standard', 'nbuttons' => 2 }, 'mkbootdisk' => 0, 'wacom' => [], 'manualFstab' => [], 'keyboard' => 'us', 'autoExitInstall' => 1, 'netc' => { 'internet_cnx' => { 'local network' => { '/etc/sysconfig/network-scripts/net_cnx_up' => ' /etc/rc.d/init.d/network restart ', 'type' => 'lan', '/etc/sysconfig/network-scripts/net_cnx_down' => ' /etc/rc.d/init.d/network stop /sbin/ifup lo ' } }, 'NETWORKING' => 'yes', 'internet_cnx_choice' => 'local network', 'autodetection' => 1, 'DHCP_HOSTNAME' => 'localhost.localdomain', 'minus_one' => 1, 'nb_cards' => 1, 'NET_DEVICE' => '', 'FORWARD_IPV4' => 'false', 'DOMAINNAME' => 'localdomain', 'autodetect' => { 'isdn' => { 'driver' => undef, 'card_type' => undef, 'description' => undef, 'id' => undef, 'vendor' => undef, 'type' => undef }, 'lan' => { 'eth0' => '8139too' } }, 'HOSTNAME' => 'localhost.localdomain' } }; oz-0.17.0/oz/auto/Mandrake9.0.auto000077500000000000000000000066471344320532700165150ustar00rootroot00000000000000#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). $o = { 'autoExitInstall' => '1', 'netc' => { 'ZEROCONF_HOSTNAME' => undef, 'NETWORKING' => 'yes', 'NET_DEVICE' => 'eth0', 'DHCP' => 'yes' }, 'locale' => { 'lang' => 'en_US', 'country' => 'US', 'utf8' => '', 'langs' => { 'en_US' => 1 } }, 'mkbootdisk' => 0, 'partitions' => [ { 'size' => 12273597, 'mntpoint' => '/', 'type' => 1155 }, { 'size' => 1012032, 'mntpoint' => 'swap', 'type' => 130 }, { 'size' => 28643832, 'mntpoint' => '/home', 'type' => 1155 } ], 'printer' => { 'MANUALCUPSCONFIG' => undef, 'BROWSEPOLLPORT' => undef, 'BROWSEPOLLADDR' => undef, 'SPOOLER' => undef, 'configured' => {}, 'DEFAULT' => undef }, 'intf' => { 'eth0' => { 'BROADCAST' => '', 'ONBOOT' => 'yes', 'BOOTPROTO' => 'dhcp', 'DEVICE' => 'eth0', 'NETMASK' => '255.255.255.0', 'NETWORK' => '' } }, 'authentication' => { 'shadow' => 1, 'md5' => 1, 'local' => undef }, 'partitioning' => { 'auto_allocate' => '1', 'clearall' => '1', 'eraseBadPartitions' => 0 }, 'users' => [], 'security' => 2, 'default_packages' => [ 'locales', 'locales-en', 'msec', 'devfsd', 'kernel-enterprise-2.4.22.10mdk', 'eject', 'gnupg', 'urpmi', 'hotplug', 'procmail', 'mtools', 'groff', 'at', 'coreutils-doc', 'dhcp-client', 'ftp-client-krb5', 'grub', 'harddrake', 'hdparm', 'hexedit', 'info', 'ldetect', 'man', 'mkxauth', 'numlock', 'open', 'openssh-server', 'rfbdrake', 'samba-server', 'slocate', 'strace', 'sudo', 'tmdns', 'tmpwatch', 'words', 'zcip', 'patch', 'recode', 'emacs-X11', 'man-pages', 'nfs-utils', 'rgrep', 'screen', 'symlinks', 'webmin', 'xterm' ], 'superuser' => { 'home' => '/root', 'shell' => '/bin/bash', 'realname' => 'root', 'password' => %ROOTPW%, 'uid' => '0', 'gid' => '0' }, 'manualFstab' => [], 'libsafe' => 0, 'useSupermount' => '1', 'timezone' => { 'UTC' => 1, 'ntp' => undef, 'timezone' => 'America/New_York' }, 'netcnx' => { 'lan' => {}, 'type' => 'lan' }, 'keyboard' => { 'unsafe' => 1, 'GRP_TOGGLE' => '', 'KEYBOARD' => 'us', 'KBCHARSET' => 'C' }, 'X' => {}, 'security_user' => '', 'mouse' => { 'MOUSETYPE' => 'ps/2', 'device' => 'psaux', 'name' => 'Standard', 'nbuttons' => 2, 'type' => 'PS/2', 'XMOUSETYPE' => 'PS/2', 'EMULATEWHEEL' => undef } }; oz-0.17.0/oz/auto/Mandrake9.1.auto000066400000000000000000000066471344320532700165130ustar00rootroot00000000000000#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). $o = { 'autoExitInstall' => '1', 'netc' => { 'ZEROCONF_HOSTNAME' => undef, 'NETWORKING' => 'yes', 'NET_DEVICE' => 'eth0', 'DHCP' => 'yes' }, 'locale' => { 'lang' => 'en_US', 'country' => 'US', 'utf8' => '', 'langs' => { 'en_US' => 1 } }, 'mkbootdisk' => 0, 'partitions' => [ { 'size' => 12273597, 'mntpoint' => '/', 'type' => 1155 }, { 'size' => 1012032, 'mntpoint' => 'swap', 'type' => 130 }, { 'size' => 28643832, 'mntpoint' => '/home', 'type' => 1155 } ], 'printer' => { 'MANUALCUPSCONFIG' => undef, 'BROWSEPOLLPORT' => undef, 'BROWSEPOLLADDR' => undef, 'SPOOLER' => undef, 'configured' => {}, 'DEFAULT' => undef }, 'intf' => { 'eth0' => { 'BROADCAST' => '', 'ONBOOT' => 'yes', 'BOOTPROTO' => 'dhcp', 'DEVICE' => 'eth0', 'NETMASK' => '255.255.255.0', 'NETWORK' => '' } }, 'authentication' => { 'shadow' => 1, 'md5' => 1, 'local' => undef }, 'partitioning' => { 'auto_allocate' => '1', 'clearall' => '1', 'eraseBadPartitions' => 0 }, 'users' => [], 'security' => 2, 'default_packages' => [ 'locales', 'locales-en', 'msec', 'devfsd', 'kernel-enterprise-2.4.22.10mdk', 'eject', 'gnupg', 'urpmi', 'hotplug', 'procmail', 'mtools', 'groff', 'at', 'coreutils-doc', 'dhcp-client', 'ftp-client-krb5', 'grub', 'harddrake', 'hdparm', 'hexedit', 'info', 'ldetect', 'man', 'mkxauth', 'numlock', 'open', 'openssh-server', 'rfbdrake', 'samba-server', 'slocate', 'strace', 'sudo', 'tmdns', 'tmpwatch', 'words', 'zcip', 'patch', 'recode', 'emacs-X11', 'man-pages', 'nfs-utils', 'rgrep', 'screen', 'symlinks', 'webmin', 'xterm' ], 'superuser' => { 'home' => '/root', 'shell' => '/bin/bash', 'realname' => 'root', 'password' => %ROOTPW%, 'uid' => '0', 'gid' => '0' }, 'manualFstab' => [], 'libsafe' => 0, 'useSupermount' => '1', 'timezone' => { 'UTC' => 1, 'ntp' => undef, 'timezone' => 'America/New_York' }, 'netcnx' => { 'lan' => {}, 'type' => 'lan' }, 'keyboard' => { 'unsafe' => 1, 'GRP_TOGGLE' => '', 'KEYBOARD' => 'us', 'KBCHARSET' => 'C' }, 'X' => {}, 'security_user' => '', 'mouse' => { 'MOUSETYPE' => 'ps/2', 'device' => 'psaux', 'name' => 'Standard', 'nbuttons' => 2, 'type' => 'PS/2', 'XMOUSETYPE' => 'PS/2', 'EMULATEWHEEL' => undef } }; oz-0.17.0/oz/auto/Mandrake9.2.auto000066400000000000000000000066471344320532700165140ustar00rootroot00000000000000#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). $o = { 'autoExitInstall' => '1', 'netc' => { 'ZEROCONF_HOSTNAME' => undef, 'NETWORKING' => 'yes', 'NET_DEVICE' => 'eth0', 'DHCP' => 'yes' }, 'locale' => { 'lang' => 'en_US', 'country' => 'US', 'utf8' => '', 'langs' => { 'en_US' => 1 } }, 'mkbootdisk' => 0, 'partitions' => [ { 'size' => 12273597, 'mntpoint' => '/', 'type' => 1155 }, { 'size' => 1012032, 'mntpoint' => 'swap', 'type' => 130 }, { 'size' => 28643832, 'mntpoint' => '/home', 'type' => 1155 } ], 'printer' => { 'MANUALCUPSCONFIG' => undef, 'BROWSEPOLLPORT' => undef, 'BROWSEPOLLADDR' => undef, 'SPOOLER' => undef, 'configured' => {}, 'DEFAULT' => undef }, 'intf' => { 'eth0' => { 'BROADCAST' => '', 'ONBOOT' => 'yes', 'BOOTPROTO' => 'dhcp', 'DEVICE' => 'eth0', 'NETMASK' => '255.255.255.0', 'NETWORK' => '' } }, 'authentication' => { 'shadow' => 1, 'md5' => 1, 'local' => undef }, 'partitioning' => { 'auto_allocate' => '1', 'clearall' => '1', 'eraseBadPartitions' => 0 }, 'users' => [], 'security' => 2, 'default_packages' => [ 'locales', 'locales-en', 'msec', 'devfsd', 'kernel-enterprise-2.4.22.10mdk', 'eject', 'gnupg', 'urpmi', 'hotplug', 'procmail', 'mtools', 'groff', 'at', 'coreutils-doc', 'dhcp-client', 'ftp-client-krb5', 'grub', 'harddrake', 'hdparm', 'hexedit', 'info', 'ldetect', 'man', 'mkxauth', 'numlock', 'open', 'openssh-server', 'rfbdrake', 'samba-server', 'slocate', 'strace', 'sudo', 'tmdns', 'tmpwatch', 'words', 'zcip', 'patch', 'recode', 'emacs-X11', 'man-pages', 'nfs-utils', 'rgrep', 'screen', 'symlinks', 'webmin', 'xterm' ], 'superuser' => { 'home' => '/root', 'shell' => '/bin/bash', 'realname' => 'root', 'password' => %ROOTPW%, 'uid' => '0', 'gid' => '0' }, 'manualFstab' => [], 'libsafe' => 0, 'useSupermount' => '1', 'timezone' => { 'UTC' => 1, 'ntp' => undef, 'timezone' => 'America/New_York' }, 'netcnx' => { 'lan' => {}, 'type' => 'lan' }, 'keyboard' => { 'unsafe' => 1, 'GRP_TOGGLE' => '', 'KEYBOARD' => 'us', 'KBCHARSET' => 'C' }, 'X' => {}, 'security_user' => '', 'mouse' => { 'MOUSETYPE' => 'ps/2', 'device' => 'psaux', 'name' => 'Standard', 'nbuttons' => 2, 'type' => 'PS/2', 'XMOUSETYPE' => 'PS/2', 'EMULATEWHEEL' => undef } }; oz-0.17.0/oz/auto/Mandriva2005.auto000066400000000000000000000066471344320532700166110ustar00rootroot00000000000000#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). $o = { 'autoExitInstall' => '1', 'netc' => { 'ZEROCONF_HOSTNAME' => undef, 'NETWORKING' => 'yes', 'NET_DEVICE' => 'eth0', 'DHCP' => 'yes' }, 'locale' => { 'lang' => 'en_US', 'country' => 'US', 'utf8' => '', 'langs' => { 'en_US' => 1 } }, 'mkbootdisk' => 0, 'partitions' => [ { 'size' => 12273597, 'mntpoint' => '/', 'type' => 1155 }, { 'size' => 1012032, 'mntpoint' => 'swap', 'type' => 130 }, { 'size' => 28643832, 'mntpoint' => '/home', 'type' => 1155 } ], 'printer' => { 'MANUALCUPSCONFIG' => undef, 'BROWSEPOLLPORT' => undef, 'BROWSEPOLLADDR' => undef, 'SPOOLER' => undef, 'configured' => {}, 'DEFAULT' => undef }, 'intf' => { 'eth0' => { 'BROADCAST' => '', 'ONBOOT' => 'yes', 'BOOTPROTO' => 'dhcp', 'DEVICE' => 'eth0', 'NETMASK' => '255.255.255.0', 'NETWORK' => '' } }, 'authentication' => { 'shadow' => 1, 'md5' => 1, 'local' => undef }, 'partitioning' => { 'auto_allocate' => '1', 'clearall' => '1', 'eraseBadPartitions' => 0 }, 'users' => [], 'security' => 2, 'default_packages' => [ 'locales', 'locales-en', 'msec', 'devfsd', 'kernel-enterprise-2.4.22.10mdk', 'eject', 'gnupg', 'urpmi', 'hotplug', 'procmail', 'mtools', 'groff', 'at', 'coreutils-doc', 'dhcp-client', 'ftp-client-krb5', 'grub', 'harddrake', 'hdparm', 'hexedit', 'info', 'ldetect', 'man', 'mkxauth', 'numlock', 'open', 'openssh-server', 'rfbdrake', 'samba-server', 'slocate', 'strace', 'sudo', 'tmdns', 'tmpwatch', 'words', 'zcip', 'patch', 'recode', 'emacs-X11', 'man-pages', 'nfs-utils', 'rgrep', 'screen', 'symlinks', 'webmin', 'xterm' ], 'superuser' => { 'home' => '/root', 'shell' => '/bin/bash', 'realname' => 'root', 'password' => %ROOTPW%, 'uid' => '0', 'gid' => '0' }, 'manualFstab' => [], 'libsafe' => 0, 'useSupermount' => '1', 'timezone' => { 'UTC' => 1, 'ntp' => undef, 'timezone' => 'America/New_York' }, 'netcnx' => { 'lan' => {}, 'type' => 'lan' }, 'keyboard' => { 'unsafe' => 1, 'GRP_TOGGLE' => '', 'KEYBOARD' => 'us', 'KBCHARSET' => 'C' }, 'X' => {}, 'security_user' => '', 'mouse' => { 'MOUSETYPE' => 'ps/2', 'device' => 'psaux', 'name' => 'Standard', 'nbuttons' => 2, 'type' => 'PS/2', 'XMOUSETYPE' => 'PS/2', 'EMULATEWHEEL' => undef } }; oz-0.17.0/oz/auto/Mandriva2006.0.auto000066400000000000000000000066471344320532700167500ustar00rootroot00000000000000#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). $o = { 'autoExitInstall' => '1', 'netc' => { 'ZEROCONF_HOSTNAME' => undef, 'NETWORKING' => 'yes', 'NET_DEVICE' => 'eth0', 'DHCP' => 'yes' }, 'locale' => { 'lang' => 'en_US', 'country' => 'US', 'utf8' => '', 'langs' => { 'en_US' => 1 } }, 'mkbootdisk' => 0, 'partitions' => [ { 'size' => 12273597, 'mntpoint' => '/', 'type' => 1155 }, { 'size' => 1012032, 'mntpoint' => 'swap', 'type' => 130 }, { 'size' => 28643832, 'mntpoint' => '/home', 'type' => 1155 } ], 'printer' => { 'MANUALCUPSCONFIG' => undef, 'BROWSEPOLLPORT' => undef, 'BROWSEPOLLADDR' => undef, 'SPOOLER' => undef, 'configured' => {}, 'DEFAULT' => undef }, 'intf' => { 'eth0' => { 'BROADCAST' => '', 'ONBOOT' => 'yes', 'BOOTPROTO' => 'dhcp', 'DEVICE' => 'eth0', 'NETMASK' => '255.255.255.0', 'NETWORK' => '' } }, 'authentication' => { 'shadow' => 1, 'md5' => 1, 'local' => undef }, 'partitioning' => { 'auto_allocate' => '1', 'clearall' => '1', 'eraseBadPartitions' => 0 }, 'users' => [], 'security' => 2, 'default_packages' => [ 'locales', 'locales-en', 'msec', 'devfsd', 'kernel-enterprise-2.4.22.10mdk', 'eject', 'gnupg', 'urpmi', 'hotplug', 'procmail', 'mtools', 'groff', 'at', 'coreutils-doc', 'dhcp-client', 'ftp-client-krb5', 'grub', 'harddrake', 'hdparm', 'hexedit', 'info', 'ldetect', 'man', 'mkxauth', 'numlock', 'open', 'openssh-server', 'rfbdrake', 'samba-server', 'slocate', 'strace', 'sudo', 'tmdns', 'tmpwatch', 'words', 'zcip', 'patch', 'recode', 'emacs-X11', 'man-pages', 'nfs-utils', 'rgrep', 'screen', 'symlinks', 'webmin', 'xterm' ], 'superuser' => { 'home' => '/root', 'shell' => '/bin/bash', 'realname' => 'root', 'password' => %ROOTPW%, 'uid' => '0', 'gid' => '0' }, 'manualFstab' => [], 'libsafe' => 0, 'useSupermount' => '1', 'timezone' => { 'UTC' => 1, 'ntp' => undef, 'timezone' => 'America/New_York' }, 'netcnx' => { 'lan' => {}, 'type' => 'lan' }, 'keyboard' => { 'unsafe' => 1, 'GRP_TOGGLE' => '', 'KEYBOARD' => 'us', 'KBCHARSET' => 'C' }, 'X' => {}, 'security_user' => '', 'mouse' => { 'MOUSETYPE' => 'ps/2', 'device' => 'psaux', 'name' => 'Standard', 'nbuttons' => 2, 'type' => 'PS/2', 'XMOUSETYPE' => 'PS/2', 'EMULATEWHEEL' => undef } }; oz-0.17.0/oz/auto/Mandriva2007.0.auto000066400000000000000000000066471344320532700167510ustar00rootroot00000000000000#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). $o = { 'autoExitInstall' => '1', 'netc' => { 'ZEROCONF_HOSTNAME' => undef, 'NETWORKING' => 'yes', 'NET_DEVICE' => 'eth0', 'DHCP' => 'yes' }, 'locale' => { 'lang' => 'en_US', 'country' => 'US', 'utf8' => '', 'langs' => { 'en_US' => 1 } }, 'mkbootdisk' => 0, 'partitions' => [ { 'size' => 12273597, 'mntpoint' => '/', 'type' => 1155 }, { 'size' => 1012032, 'mntpoint' => 'swap', 'type' => 130 }, { 'size' => 28643832, 'mntpoint' => '/home', 'type' => 1155 } ], 'printer' => { 'MANUALCUPSCONFIG' => undef, 'BROWSEPOLLPORT' => undef, 'BROWSEPOLLADDR' => undef, 'SPOOLER' => undef, 'configured' => {}, 'DEFAULT' => undef }, 'intf' => { 'eth0' => { 'BROADCAST' => '', 'ONBOOT' => 'yes', 'BOOTPROTO' => 'dhcp', 'DEVICE' => 'eth0', 'NETMASK' => '255.255.255.0', 'NETWORK' => '' } }, 'authentication' => { 'shadow' => 1, 'md5' => 1, 'local' => undef }, 'partitioning' => { 'auto_allocate' => '1', 'clearall' => '1', 'eraseBadPartitions' => 0 }, 'users' => [], 'security' => 2, 'default_packages' => [ 'locales', 'locales-en', 'msec', 'devfsd', 'kernel-enterprise-2.4.22.10mdk', 'eject', 'gnupg', 'urpmi', 'hotplug', 'procmail', 'mtools', 'groff', 'at', 'coreutils-doc', 'dhcp-client', 'ftp-client-krb5', 'grub', 'harddrake', 'hdparm', 'hexedit', 'info', 'ldetect', 'man', 'mkxauth', 'numlock', 'open', 'openssh-server', 'rfbdrake', 'samba-server', 'slocate', 'strace', 'sudo', 'tmdns', 'tmpwatch', 'words', 'zcip', 'patch', 'recode', 'emacs-X11', 'man-pages', 'nfs-utils', 'rgrep', 'screen', 'symlinks', 'webmin', 'xterm' ], 'superuser' => { 'home' => '/root', 'shell' => '/bin/bash', 'realname' => 'root', 'password' => %ROOTPW%, 'uid' => '0', 'gid' => '0' }, 'manualFstab' => [], 'libsafe' => 0, 'useSupermount' => '1', 'timezone' => { 'UTC' => 1, 'ntp' => undef, 'timezone' => 'America/New_York' }, 'netcnx' => { 'lan' => {}, 'type' => 'lan' }, 'keyboard' => { 'unsafe' => 1, 'GRP_TOGGLE' => '', 'KEYBOARD' => 'us', 'KBCHARSET' => 'C' }, 'X' => {}, 'security_user' => '', 'mouse' => { 'MOUSETYPE' => 'ps/2', 'device' => 'psaux', 'name' => 'Standard', 'nbuttons' => 2, 'type' => 'PS/2', 'XMOUSETYPE' => 'PS/2', 'EMULATEWHEEL' => undef } }; oz-0.17.0/oz/auto/Mandriva2008.0.auto000066400000000000000000000067701344320532700167470ustar00rootroot00000000000000#!/usr/bin/perl -cw # # You should check the syntax of this file before using it in an auto-install. # You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file # (note the '#!/usr/bin/perl -cw' on the first line). $o = { 'autoExitInstall' => '1', 'netc' => { 'ZEROCONF_HOSTNAME' => undef, 'NETWORKING' => 'yes', 'NET_DEVICE' => 'eth0', 'DHCP' => 'yes' }, 'locale' => { 'lang' => 'en_US', 'country' => 'US', 'utf8' => '', 'langs' => { 'en_US' => 1 } }, 'mkbootdisk' => 0, 'partitions' => [ { 'size' => 12273597, 'mntpoint' => '/', 'type' => 1155, 'fs_type' => 'ext3' }, { 'size' => 1012032, 'mntpoint' => 'swap', 'type' => 130, 'fs_type' => 'swap' }, { 'size' => 28643832, 'mntpoint' => '/home', 'type' => 1155, 'fs_type' => 'ext3' } ], 'printer' => { 'MANUALCUPSCONFIG' => undef, 'BROWSEPOLLPORT' => undef, 'BROWSEPOLLADDR' => undef, 'SPOOLER' => undef, 'configured' => {}, 'DEFAULT' => undef }, 'intf' => { 'eth0' => { 'BROADCAST' => '', 'ONBOOT' => 'yes', 'BOOTPROTO' => 'dhcp', 'DEVICE' => 'eth0', 'NETMASK' => '255.255.255.0', 'NETWORK' => '' } }, 'authentication' => { 'shadow' => 1, 'md5' => 1, 'local' => undef }, 'partitioning' => { 'auto_allocate' => '1', 'clearall' => '1', 'eraseBadPartitions' => 0 }, 'users' => [], 'security' => 2, 'default_packages' => [ 'locales', 'locales-en', 'msec', 'devfsd', 'kernel-enterprise-2.4.22.10mdk', 'eject', 'gnupg', 'urpmi', 'hotplug', 'procmail', 'mtools', 'groff', 'at', 'coreutils-doc', 'dhcp-client', 'ftp-client-krb5', 'grub', 'harddrake', 'hdparm', 'hexedit', 'info', 'ldetect', 'man', 'mkxauth', 'numlock', 'open', 'openssh-server', 'rfbdrake', 'samba-server', 'slocate', 'strace', 'sudo', 'tmdns', 'tmpwatch', 'words', 'zcip', 'patch', 'recode', 'emacs-X11', 'man-pages', 'nfs-utils', 'rgrep', 'screen', 'symlinks', 'webmin', 'xterm' ], 'superuser' => { 'home' => '/root', 'shell' => '/bin/bash', 'realname' => 'root', 'password' => %ROOTPW%, 'uid' => '0', 'gid' => '0' }, 'manualFstab' => [], 'libsafe' => 0, 'useSupermount' => '1', 'timezone' => { 'UTC' => 1, 'ntp' => undef, 'timezone' => 'America/New_York' }, 'netcnx' => { 'lan' => {}, 'type' => 'lan' }, 'keyboard' => { 'unsafe' => 1, 'GRP_TOGGLE' => '', 'KEYBOARD' => 'us', 'KBCHARSET' => 'C' }, 'X' => {}, 'security_user' => '', 'mouse' => { 'MOUSETYPE' => 'ps/2', 'device' => 'psaux', 'name' => 'Standard', 'nbuttons' => 2, 'type' => 'PS/2', 'XMOUSETYPE' => 'PS/2', 'EMULATEWHEEL' => undef } }; oz-0.17.0/oz/auto/OpenSUSE10.3.auto000066400000000000000000000136571344320532700164430ustar00rootroot00000000000000 false false false false true false true true none false false false false false false AUTO true auto dhcp eth0 auto no false false false true true true false ext2 131 true false /boot device 131 1 false 128M true false swap 130 true false swap device 130 2 false auto true false ext3 131 true false / device 131 3 false max CT_DISK all false localhost 3 autoyast2-installation autoyast2-installation apparmor base yast2_install_wf default sw_management apparmor_opt 25 video,dialout /home -1 /bin/bash /etc/skel false root 0 /root 99999 0 7 /bin/bash 0 %ROOTPW% root oz-0.17.0/oz/auto/OpenSUSE11.0.auto000066400000000000000000000136571344320532700164410ustar00rootroot00000000000000 false false false false true false true true none false false false false false false AUTO true auto dhcp eth0 auto no false false false true true true false ext2 131 true false /boot device 131 1 false 128M true false swap 130 true false swap device 130 2 false auto true false ext3 131 true false / device 131 3 false max CT_DISK all false localhost 3 autoyast2-installation autoyast2-installation apparmor base yast2_install_wf default sw_management apparmor_opt 25 video,dialout /home -1 /bin/bash /etc/skel false root 0 /root 99999 0 7 /bin/bash 0 %ROOTPW% root oz-0.17.0/oz/auto/OpenSUSE11.1.auto000066400000000000000000000136571344320532700164420ustar00rootroot00000000000000 false false false false true false true true none false false false false false false AUTO true auto dhcp eth0 auto no false false false true true true false ext2 131 true false /boot device 131 1 false 128M true false swap 130 true false swap device 130 2 false auto true false ext3 131 true false / device 131 3 false max CT_DISK all false localhost 3 autoyast2-installation autoyast2-installation apparmor base yast2_install_wf default sw_management apparmor_opt 25 video,dialout /home -1 /bin/bash /etc/skel false root 0 /root 99999 0 7 /bin/bash 0 %ROOTPW% root oz-0.17.0/oz/auto/OpenSUSE11.2.auto000066400000000000000000000136571344320532700164430ustar00rootroot00000000000000 false false false false true false true true none false false false false false false AUTO true auto dhcp eth0 auto no false false false true true true false ext2 131 true false /boot device 131 1 false 128M true false swap 130 true false swap device 130 2 false auto true false ext3 131 true false / device 131 3 false max CT_DISK all false localhost 3 autoyast2-installation autoyast2-installation apparmor base yast2_install_wf default sw_management apparmor_opt 25 video,dialout /home -1 /bin/bash /etc/skel false root 0 /root 99999 0 7 /bin/bash 0 %ROOTPW% root oz-0.17.0/oz/auto/OpenSUSE11.3.auto000066400000000000000000000136571344320532700164440ustar00rootroot00000000000000 false false false false true false true true none false false false false false false AUTO true auto dhcp eth0 auto no false false false true true true false ext2 131 true false /boot device 131 1 false 128M true false swap 130 true false swap device 130 2 false auto true false ext3 131 true false / device 131 3 false max CT_DISK all false localhost 3 autoyast2-installation autoyast2-installation apparmor base yast2_install_wf default sw_management apparmor_opt 25 video,dialout /home -1 /bin/bash /etc/skel false root 0 /root 99999 0 7 /bin/bash 0 %ROOTPW% root oz-0.17.0/oz/auto/OpenSUSE11.4.auto000066400000000000000000000136571344320532700164450ustar00rootroot00000000000000 false false false false true false true true none false false false false false false AUTO true auto dhcp eth0 auto no false false false true true true false ext2 131 true false /boot device 131 1 false 128M true false swap 130 true false swap device 130 2 false auto true false ext3 131 true false / device 131 3 false max CT_DISK all false localhost 3 autoyast2-installation autoyast2-installation apparmor base yast2_install_wf default sw_management apparmor_opt 25 video,dialout /home -1 /bin/bash /etc/skel false root 0 /root 99999 0 7 /bin/bash 0 %ROOTPW% root oz-0.17.0/oz/auto/OpenSUSE12.1.auto000066400000000000000000000163471344320532700164420ustar00rootroot00000000000000 hd0 /dev/vda true false false false true false false /boot/message false 2 8 processor thermal ata_piix virtio_pci fan jbd ext3 virtio_blk edd console=tty0 console=ttyS0,115200 grub false false false true true none true true true true false true 33 x video linux 16 x dialout linux bios tty1 tty2 tty3 tty4 tty5 tty6 english-us AUTO true true dhcp eth0 auto no false false /dev/vda CT_DISK all true true 0 true true 0 true true 0 true true 0 autoyast2-installation dhcp-client dhcp-tools autoyast2-installation autoyast2-installation autoyast2-installation apparmor apparmor_opt base console devel_basis enhanced_base enhanced_base_opt sw_management yast2_basis yast2_install_wf 100 video,dialout /home -1 /bin/bash /etc/skel false root 0 /root 99999 0 7 /bin/bash 0 ozrootpw root oz-0.17.0/oz/auto/OpenSUSE12.2.auto000066400000000000000000000163471344320532700164430ustar00rootroot00000000000000 hd0 /dev/vda true false false false true false false /boot/message false 2 8 processor thermal ata_piix virtio_pci fan jbd ext3 virtio_blk edd console=tty0 console=ttyS0,115200 grub false false false true true none true true true true false true 33 x video linux 16 x dialout linux bios tty1 tty2 tty3 tty4 tty5 tty6 english-us AUTO true true dhcp eth0 auto no false false /dev/vda CT_DISK all true true 0 true true 0 true true 0 true true 0 autoyast2-installation dhcp-client dhcp-tools autoyast2-installation autoyast2-installation autoyast2-installation apparmor apparmor_opt base console devel_basis enhanced_base enhanced_base_opt sw_management yast2_basis yast2_install_wf 100 video,dialout /home -1 /bin/bash /etc/skel false root 0 /root 99999 0 7 /bin/bash 0 ozrootpw root oz-0.17.0/oz/auto/OpenSUSE12.3.auto000066400000000000000000000162141344320532700164350ustar00rootroot00000000000000 hd0 /dev/vda true false false false true false false /boot/message false 2 8 processor thermal ata_piix virtio_pci fan jbd ext3 virtio_blk edd console=tty0 console=ttyS0,115200 grub false false false true true none true true true true false true 33 x video linux 16 x dialout linux bios tty1 tty2 tty3 tty4 tty5 tty6 english-us AUTO true true dhcp eth0 auto no false false /dev/vda CT_DISK all true true 0 true true 0 true true 0 true true 0 autoyast2-installation dhcp-client dhcp-tools autoyast2-installation autoyast2-installation autoyast2-installation apparmor apparmor_opt base console devel_basis enhanced_base enhanced_base_opt sw_management yast2_basis yast2_install_wf 100 video,dialout /home -1 /bin/bash /etc/skel false root 0 /root 99999 0 7 /bin/bash 0 ozrootpw root oz-0.17.0/oz/auto/OpenSUSE13.1.auto000066400000000000000000000147511344320532700164400ustar00rootroot00000000000000 hd0 /dev/vda true false false false true false false /boot/message false 2 8 processor thermal ata_piix virtio_pci fan jbd ext3 virtio_blk edd console=tty0 console=ttyS0,115200 grub false false false true true none true true true true false true 33 x video linux 16 x dialout linux bios tty1 tty2 tty3 tty4 tty5 tty6 english-us AUTO true true dhcp eth0 auto no false false /dev/vda CT_DISK all true true 0 true true 0 true true 0 true true 0 autoyast2-installation dhcp-client dhcp-tools apparmor apparmor_opt base console devel_basis enhanced_base enhanced_base_opt sw_management yast2_basis yast2_install_wf 100 video,dialout /home -1 /bin/bash /etc/skel false root 0 /root 99999 0 7 /bin/bash 0 ozrootpw root oz-0.17.0/oz/auto/OpenSUSE13.2.auto000066400000000000000000000147521344320532700164420ustar00rootroot00000000000000 hd0 /dev/vda true false false false true false false /boot/message false 2 8 processor thermal ata_piix virtio_pci fan jbd ext3 virtio_blk edd console=tty0 console=ttyS0,115200 grub2 false false false true true none true true true true false true 33 x video linux 16 x dialout linux bios tty1 tty2 tty3 tty4 tty5 tty6 english-us AUTO true true dhcp eth0 auto no false false /dev/vda CT_DISK all true true 0 true true 0 true true 0 true true 0 autoyast2-installation dhcp-client dhcp-tools apparmor apparmor_opt base console devel_basis enhanced_base enhanced_base_opt sw_management yast2_basis yast2_install_wf 100 video,dialout /home -1 /bin/bash /etc/skel false root 0 /root 99999 0 7 /bin/bash 0 ozrootpw root oz-0.17.0/oz/auto/OpenSUSE42.1.auto000066400000000000000000000147521344320532700164430ustar00rootroot00000000000000 hd0 /dev/vda true false false false true false false /boot/message false 2 8 processor thermal ata_piix virtio_pci fan jbd ext3 virtio_blk edd console=tty0 console=ttyS0,115200 grub2 false false false true true none true true true true false true 33 x video linux 16 x dialout linux bios tty1 tty2 tty3 tty4 tty5 tty6 english-us AUTO true true dhcp eth0 auto no false false /dev/vda CT_DISK all true true 0 true true 0 true true 0 true true 0 autoyast2-installation dhcp-client dhcp-tools apparmor apparmor_opt base console devel_basis enhanced_base enhanced_base_opt sw_management yast2_basis yast2_install_wf 100 video,dialout /home -1 /bin/bash /etc/skel false root 0 /root 99999 0 7 /bin/bash 0 ozrootpw root oz-0.17.0/oz/auto/OpenSUSE42.2.auto000066400000000000000000000147521344320532700164440ustar00rootroot00000000000000 hd0 /dev/vda true false false false true false false /boot/message false 2 8 processor thermal ata_piix virtio_pci fan jbd ext3 virtio_blk edd console=tty0 console=ttyS0,115200 grub2 false false false true true none true true true true false true 33 x video linux 16 x dialout linux bios tty1 tty2 tty3 tty4 tty5 tty6 english-us AUTO true true dhcp eth0 auto no false false /dev/vda CT_DISK all true true 0 true true 0 true true 0 true true 0 autoyast2-installation dhcp-client dhcp-tools apparmor apparmor_opt base console devel_basis enhanced_base enhanced_base_opt sw_management yast2_basis yast2_install_wf 100 video,dialout /home -1 /bin/bash /etc/skel false root 0 /root 99999 0 7 /bin/bash 0 ozrootpw root oz-0.17.0/oz/auto/RHEL2.1.auto000066400000000000000000000012141344320532700154750ustar00rootroot00000000000000install text url --url REPLACE_ME keyboard us lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=hda part /boot --fstype ext3 --size=200 --ondisk=hda part / --fstype ext3 --size=1024 --grow --ondisk=hda part swap --size 768 --grow --maxsize=1536 --ondisk=hda reboot %packages @ Network Support @ Advanced Server compat-libstdc++ libpcap nc wget oz-0.17.0/oz/auto/RHEL3.auto000066400000000000000000000011371344320532700153430ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=hda part /boot --fstype ext3 --size=200 --ondisk=hda part / --fstype ext3 --size=1024 --grow --ondisk=hda part swap --size 768 --grow --maxsize=1536 --ondisk=hda reboot %packages @ admin-tools @ text-internet nc wget %post oz-0.17.0/oz/auto/RHEL4.auto000066400000000000000000000013231344320532700153410ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all part /boot --fstype ext3 --size=200 part pv.2 --size=1 --grow volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @ admin-tools @ text-internet %post oz-0.17.0/oz/auto/RHEL5.auto000066400000000000000000000013061344320532700153430ustar00rootroot00000000000000install text key --skip keyboard us lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all part /boot --fstype ext3 --size=200 part pv.2 --size=1 --grow volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages @base %post oz-0.17.0/oz/auto/RHEL6.auto000066400000000000000000000012301344320532700153400ustar00rootroot00000000000000install text key --skip keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all part /boot --fstype ext4 --size=200 part pv.2 --size=1 --grow volgroup VolGroup00 --pesize=32768 pv.2 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536 logvol / --fstype ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow reboot %packages --nobase openssh-server openssh-clients %post oz-0.17.0/oz/auto/RHEL7.auto000066400000000000000000000006041344320532700153450ustar00rootroot00000000000000install text keyboard us lang en_US.UTF-8 skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr clearpart --all --initlabel autopart --type=lvm reboot %packages openssh-clients @core %end oz-0.17.0/oz/auto/RedHatLinux7.0.auto000066400000000000000000000007251344320532700171440ustar00rootroot00000000000000install text url --url REPLACE_ME keyboard us lang en_US mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% auth --useshadow --enablemd5 timezone --utc America/New_York lilo --location mbr --linear zerombr yes clearpart --all --drives=hda part /boot --size=200 --ondisk=hda part / --size=1024 --grow --ondisk=hda part swap --size 768 --grow --maxsize=1536 --ondisk=hda reboot %packages python openssh openssh-server telnet oz-0.17.0/oz/auto/RedHatLinux7.1.auto000066400000000000000000000007521344320532700171450ustar00rootroot00000000000000install text url --url REPLACE_ME keyboard us lang en_US mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled auth --useshadow --enablemd5 timezone --utc America/New_York lilo --location mbr --linear zerombr yes clearpart --all --drives=hda part /boot --size=200 --ondisk=hda part / --size=1024 --grow --ondisk=hda part swap --size 768 --grow --maxsize=1536 --ondisk=hda reboot %packages python openssh openssh-server nc wget oz-0.17.0/oz/auto/RedHatLinux7.2.auto000066400000000000000000000011711344320532700171420ustar00rootroot00000000000000install text url --url REPLACE_ME keyboard us lang en_US langsupport --default en_US en_US mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=hda part /boot --fstype ext3 --size=200 --ondisk=hda part / --fstype ext3 --size=1024 --grow --ondisk=hda part swap --size 768 --grow --maxsize=1536 --ondisk=hda reboot %packages @ Network Support @ Network Managed Workstation @ Utilities nc wget oz-0.17.0/oz/auto/RedHatLinux7.3.auto000066400000000000000000000012131344320532700171400ustar00rootroot00000000000000install text url --url REPLACE_ME keyboard us lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=hda part /boot --fstype ext3 --size=200 --ondisk=hda part / --fstype ext3 --size=1024 --grow --ondisk=hda part swap --size 768 --grow --maxsize=1536 --ondisk=hda reboot %packages @ Network Support @ Network Managed Workstation @ Utilities nc wget oz-0.17.0/oz/auto/RedHatLinux8.auto000066400000000000000000000011071344320532700170020ustar00rootroot00000000000000install text url --url REPLACE_ME keyboard us lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=hda part /boot --fstype ext3 --size=200 --ondisk=hda part / --fstype ext3 --size=1024 --grow --ondisk=hda part swap --size 768 --grow --maxsize=1536 --ondisk=hda reboot %packages oz-0.17.0/oz/auto/RedHatLinux9.auto000066400000000000000000000012061344320532700170030ustar00rootroot00000000000000install text url --url REPLACE_ME keyboard us lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 mouse generic3ps/2 --device psaux skipx network --device eth0 --bootproto dhcp rootpw %ROOTPW% firewall --disabled authconfig --enableshadow --enablemd5 timezone --utc America/New_York bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" zerombr yes clearpart --all --drives=hda part /boot --fstype ext3 --size=200 --ondisk=hda part / --fstype ext3 --size=1024 --grow --ondisk=hda part swap --size 768 --grow --maxsize=1536 --ondisk=hda reboot %packages @ Administration Tools @ Editors @ Text-based Internet nc wget oz-0.17.0/oz/auto/Ubuntu10.04.auto000066400000000000000000000022651344320532700163760ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note oz-0.17.0/oz/auto/Ubuntu10.10.auto000066400000000000000000000021311344320532700163630ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note oz-0.17.0/oz/auto/Ubuntu11.04.auto000066400000000000000000000066251344320532700164030ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note # In Debian/Ubuntu, ssh keys are generated at package install time. Because # the disk image may be cached, we need to remove the ssh keys, but this means # that ssh'ing into the server won't work later. So we remove the keys, but # setup a service that will generate the keys on boot if necessary. d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub ; \ echo '#! /bin/sh' > /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh oz-0.17.0/oz/auto/Ubuntu11.10.auto000066400000000000000000000066251344320532700164000ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note # In Debian/Ubuntu, ssh keys are generated at package install time. Because # the disk image may be cached, we need to remove the ssh keys, but this means # that ssh'ing into the server won't work later. So we remove the keys, but # setup a service that will generate the keys on boot if necessary. d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub ; \ echo '#! /bin/sh' > /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh oz-0.17.0/oz/auto/Ubuntu12.04.auto000066400000000000000000000066251344320532700164040ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note # In Debian/Ubuntu, ssh keys are generated at package install time. Because # the disk image may be cached, we need to remove the ssh keys, but this means # that ssh'ing into the server won't work later. So we remove the keys, but # setup a service that will generate the keys on boot if necessary. d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub ; \ echo '#! /bin/sh' > /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh oz-0.17.0/oz/auto/Ubuntu12.10.auto000066400000000000000000000066251344320532700164010ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note # In Debian/Ubuntu, ssh keys are generated at package install time. Because # the disk image may be cached, we need to remove the ssh keys, but this means # that ssh'ing into the server won't work later. So we remove the keys, but # setup a service that will generate the keys on boot if necessary. d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub ; \ echo '#! /bin/sh' > /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh oz-0.17.0/oz/auto/Ubuntu13.04.auto000066400000000000000000000072511344320532700164010ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note # workaround for 13.04 casper bug (Desktop build only) ubiquity ubiquity/success_command string sed -i 's/eject -p -m.*/&; [ "$prompt" ] || return 0/' /etc/init.d/casper # In Debian/Ubuntu, ssh keys are generated at package install time. Because # the disk image may be cached, we need to remove the ssh keys, but this means # that ssh'ing into the server won't work later. So we remove the keys, but # setup a service that will generate the keys on boot if necessary. d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub ; \ echo '#! /bin/sh' > /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh ; \ echo "GRUB_TERMINAL=console" >> /target/etc/default/grub ; \ in-target /usr/sbin/update-grub oz-0.17.0/oz/auto/Ubuntu13.10.auto000066400000000000000000000066251344320532700164020ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note # In Debian/Ubuntu, ssh keys are generated at package install time. Because # the disk image may be cached, we need to remove the ssh keys, but this means # that ssh'ing into the server won't work later. So we remove the keys, but # setup a service that will generate the keys on boot if necessary. d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub ; \ echo '#! /bin/sh' > /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh oz-0.17.0/oz/auto/Ubuntu14.04.auto000066400000000000000000000104171344320532700164000ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note # In Debian/Ubuntu, ssh keys are generated at package install time. Because # the disk image may be cached, we need to remove the ssh keys, but this means # that ssh'ing into the server won't work later. So we remove the keys, but # setup a service that will generate the keys on boot if necessary. d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub ; \ echo '#! /bin/sh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### BEGIN INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Provides: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Start: $local_fs $network' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Stop: $local_fs' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Start: 2 3 4 5' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Stop: 0 1 6' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Short-Description: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Description: regenerate ssh keys on first boot' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### END INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh oz-0.17.0/oz/auto/Ubuntu14.10.auto000066400000000000000000000105701344320532700163750ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note # In Debian/Ubuntu, ssh keys are generated at package install time. Because # the disk image may be cached, we need to remove the ssh keys, but this means # that ssh'ing into the server won't work later. So we remove the keys, but # setup a service that will generate the keys on boot if necessary. d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub ; \ echo '#! /bin/sh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### BEGIN INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Provides: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Start: $local_fs $network' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Stop: $local_fs' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Start: 2 3 4 5' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Stop: 0 1 6' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Short-Description: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Description: regenerate ssh keys on first boot' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### END INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh ; \ echo "GRUB_TERMINAL=console" >> /target/etc/default/grub ; \ in-target /usr/sbin/update-grub oz-0.17.0/oz/auto/Ubuntu15.04.auto000066400000000000000000000105701344320532700164010ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note # In Debian/Ubuntu, ssh keys are generated at package install time. Because # the disk image may be cached, we need to remove the ssh keys, but this means # that ssh'ing into the server won't work later. So we remove the keys, but # setup a service that will generate the keys on boot if necessary. d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub ; \ echo '#! /bin/sh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### BEGIN INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Provides: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Start: $local_fs $network' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Stop: $local_fs' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Start: 2 3 4 5' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Stop: 0 1 6' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Short-Description: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Description: regenerate ssh keys on first boot' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### END INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh ; \ echo "GRUB_TERMINAL=console" >> /target/etc/default/grub ; \ in-target /usr/sbin/update-grub oz-0.17.0/oz/auto/Ubuntu15.10.auto000066400000000000000000000105701344320532700163760ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note # In Debian/Ubuntu, ssh keys are generated at package install time. Because # the disk image may be cached, we need to remove the ssh keys, but this means # that ssh'ing into the server won't work later. So we remove the keys, but # setup a service that will generate the keys on boot if necessary. d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub ; \ echo '#! /bin/sh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### BEGIN INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Provides: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Start: $local_fs $network' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Stop: $local_fs' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Start: 2 3 4 5' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Stop: 0 1 6' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Short-Description: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Description: regenerate ssh keys on first boot' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### END INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh ; \ echo "GRUB_TERMINAL=console" >> /target/etc/default/grub ; \ in-target /usr/sbin/update-grub oz-0.17.0/oz/auto/Ubuntu16.04.auto000066400000000000000000000105701344320532700164020ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note # In Debian/Ubuntu, ssh keys are generated at package install time. Because # the disk image may be cached, we need to remove the ssh keys, but this means # that ssh'ing into the server won't work later. So we remove the keys, but # setup a service that will generate the keys on boot if necessary. d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub ; \ echo '#! /bin/sh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### BEGIN INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Provides: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Start: $local_fs $network' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Stop: $local_fs' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Start: 2 3 4 5' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Stop: 0 1 6' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Short-Description: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Description: regenerate ssh keys on first boot' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### END INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh ; \ echo "GRUB_TERMINAL=console" >> /target/etc/default/grub ; \ in-target /usr/sbin/update-grub oz-0.17.0/oz/auto/Ubuntu16.10.auto000066400000000000000000000105701344320532700163770ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note # In Debian/Ubuntu, ssh keys are generated at package install time. Because # the disk image may be cached, we need to remove the ssh keys, but this means # that ssh'ing into the server won't work later. So we remove the keys, but # setup a service that will generate the keys on boot if necessary. d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub ; \ echo '#! /bin/sh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### BEGIN INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Provides: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Start: $local_fs $network' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Stop: $local_fs' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Start: 2 3 4 5' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Stop: 0 1 6' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Short-Description: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Description: regenerate ssh keys on first boot' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### END INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh ; \ echo "GRUB_TERMINAL=console" >> /target/etc/default/grub ; \ in-target /usr/sbin/update-grub oz-0.17.0/oz/auto/Ubuntu17.04.auto000066400000000000000000000105701344320532700164030ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note # In Debian/Ubuntu, ssh keys are generated at package install time. Because # the disk image may be cached, we need to remove the ssh keys, but this means # that ssh'ing into the server won't work later. So we remove the keys, but # setup a service that will generate the keys on boot if necessary. d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub ; \ echo '#! /bin/sh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### BEGIN INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Provides: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Start: $local_fs $network' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Stop: $local_fs' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Start: 2 3 4 5' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Stop: 0 1 6' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Short-Description: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Description: regenerate ssh keys on first boot' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### END INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh ; \ echo "GRUB_TERMINAL=console" >> /target/etc/default/grub ; \ in-target /usr/sbin/update-grub oz-0.17.0/oz/auto/Ubuntu17.10.auto000066400000000000000000000105701344320532700164000ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note # In Debian/Ubuntu, ssh keys are generated at package install time. Because # the disk image may be cached, we need to remove the ssh keys, but this means # that ssh'ing into the server won't work later. So we remove the keys, but # setup a service that will generate the keys on boot if necessary. d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub ; \ echo '#! /bin/sh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### BEGIN INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Provides: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Start: $local_fs $network' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Stop: $local_fs' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Start: 2 3 4 5' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Stop: 0 1 6' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Short-Description: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Description: regenerate ssh keys on first boot' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### END INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh ; \ echo "GRUB_TERMINAL=console" >> /target/etc/default/grub ; \ in-target /usr/sbin/update-grub oz-0.17.0/oz/auto/Ubuntu18.04.auto000066400000000000000000000105701344320532700164040ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i pkgsel/include/install-recommends boolean true d-i pkgsel/include string openssh-server d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note # In Debian/Ubuntu, ssh keys are generated at package install time. Because # the disk image may be cached, we need to remove the ssh keys, but this means # that ssh'ing into the server won't work later. So we remove the keys, but # setup a service that will generate the keys on boot if necessary. d-i preseed/late_command string \ in-target rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub ; \ echo '#! /bin/sh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### BEGIN INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Provides: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Start: $local_fs $network' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Required-Stop: $local_fs' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Start: 2 3 4 5' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Default-Stop: 0 1 6' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Short-Description: oz-generate-ssh' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Description: regenerate ssh keys on first boot' >> /target/etc/init.d/oz-generate-ssh ; \ echo '### END INIT INFO' >> /target/etc/init.d/oz-generate-ssh ; \ echo '' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Debian/Ubuntu generate ssh host keys at package installation time.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# This is problematic for Oz, since the final disk image may be cached' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# and reused, leading to duplicate host keys. To work around this, Oz' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# deletes the SSH host keys at the end of installation. This solves' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# the above problem, but introduces the problem of having no way to' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# SSH into the machine without manual intervention. This service checks' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# to see if host keys are already installed, and if not, recreates them.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '# Note that after the very first boot, this service could be removed.' >> /target/etc/init.d/oz-generate-ssh ; \ echo '#' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'case "$1" in' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' start)' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' [ -r /etc/ssh/ssh_host_rsa_key ] || /usr/sbin/dpkg-reconfigure openssh-server' >> /target/etc/init.d/oz-generate-ssh ; \ echo ' ;;' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'esac' >> /target/etc/init.d/oz-generate-ssh ; \ echo 'exit 0' >> /target/etc/init.d/oz-generate-ssh ; \ in-target chmod 755 /etc/init.d/oz-generate-ssh ; \ in-target ln -s /etc/init.d/oz-generate-ssh /etc/rc2.d/S40oz-generate-ssh ; \ echo "GRUB_TERMINAL=console" >> /target/etc/default/grub ; \ in-target /usr/sbin/update-grub oz-0.17.0/oz/auto/Ubuntu5.04.auto000066400000000000000000000026361344320532700163240ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string base-config tzconfig/gmt boolean true base-config tzconfig/choose_country_zone/US select Eastern d-i partman-auto/disk string /dev/hda d-i partman-auto/method string regular d-i partman-auto/choose_recipe select Separate /home partition d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select Finish partitioning and write changes to disk d-i partman/confirm boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% d-i pkgsel/install-language-support boolean false tasksel tasksel/first multiselect ubuntu-standard, ubuntu-desktop d-i mirror/http/proxy string d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false d-i finish-install/reboot_in_progress note d-i prebaseconfig/reboot_in_progress note xserver-xorg xserver-xorg/config/display/modes select 1024x768 base-config base-config/late_command string mv /etc/inittab.real /etc/inittab ; /sbin/shutdown -h now oz-0.17.0/oz/auto/Ubuntu5.10.auto000066400000000000000000000026361344320532700163210ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string base-config tzconfig/gmt boolean true base-config tzconfig/choose_country_zone/US select Eastern d-i partman-auto/disk string /dev/hda d-i partman-auto/method string regular d-i partman-auto/choose_recipe select Separate /home partition d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select Finish partitioning and write changes to disk d-i partman/confirm boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% d-i pkgsel/install-language-support boolean false tasksel tasksel/first multiselect ubuntu-standard, ubuntu-desktop d-i mirror/http/proxy string d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false d-i finish-install/reboot_in_progress note d-i prebaseconfig/reboot_in_progress note xserver-xorg xserver-xorg/config/display/modes select 1024x768 base-config base-config/late_command string mv /etc/inittab.real /etc/inittab ; /sbin/shutdown -h now oz-0.17.0/oz/auto/Ubuntu6.06.auto000066400000000000000000000023301344320532700163160ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/disk string /dev/hda d-i partman-auto/method string regular d-i partman-auto/choose_recipe select Separate /home partition d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select Finish partitioning and write changes to disk d-i partman/confirm boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% d-i pkgsel/install-language-support boolean false tasksel tasksel/first multiselect ubuntu-standard, ubuntu-desktop d-i mirror/http/proxy string d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false d-i finish-install/reboot_in_progress note d-i prebaseconfig/reboot_in_progress note oz-0.17.0/oz/auto/Ubuntu6.10.auto000066400000000000000000000021731344320532700163160ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/disk string /dev/hda d-i partman-auto/method string regular d-i partman-auto/choose_recipe select Separate /home partition d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select Finish partitioning and write changes to disk d-i partman/confirm boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect ubuntu-standard, ubuntu-desktop d-i mirror/http/proxy string d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false d-i finish-install/reboot_in_progress note oz-0.17.0/oz/auto/Ubuntu7.04.auto000066400000000000000000000022601344320532700163170ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/init_automatically_partition select Use the largest continuous free space d-i partman-auto/method string regular d-i partman-auto/choose_recipe select Separate /home partition d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select Finish partitioning and write changes to disk d-i partman/confirm boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect ubuntu-standard, ubuntu-desktop d-i mirror/http/proxy string d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false d-i finish-install/reboot_in_progress note oz-0.17.0/oz/auto/Ubuntu7.10.auto000066400000000000000000000021111344320532700163070ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i mirror/http/proxy string d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note oz-0.17.0/oz/auto/Ubuntu8.04.auto000066400000000000000000000020541344320532700163210ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note oz-0.17.0/oz/auto/Ubuntu8.10.auto000066400000000000000000000020541344320532700163160ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note oz-0.17.0/oz/auto/Ubuntu9.04.auto000066400000000000000000000020541344320532700163220ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note oz-0.17.0/oz/auto/Ubuntu9.10.auto000066400000000000000000000020541344320532700163170ustar00rootroot00000000000000d-i debian-installer/locale string en_US d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i partman-auto/method string regular d-i partman-auto/choose_recipe select home d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password %ROOTPW% d-i passwd/root-password-again password %ROOTPW% tasksel tasksel/first multiselect standard d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i apt-setup/security_host string base-config apt-setup/security-updates boolean false ubiquity ubiquity/summary note ubiquity ubiquity/reboot boolean true d-i finish-install/reboot_in_progress note oz-0.17.0/oz/auto/Windows10.auto000066400000000000000000000072171344320532700163260ustar00rootroot00000000000000 OnError 1 1 Primary 0 true true true NTFS C 1 1 /IMAGE/INDEX 1 0 1 OnError true en-US en-US en-US en-US %ROOTPW% true</PlainText> </AdministratorPassword> </UserAccounts> <AutoLogon> <Password> <Value>%ROOTPW%</Value> <PlainText>true</PlainText> </Password> <Enabled>true</Enabled> <LogonCount>5</LogonCount> <Username>Administrator</Username> </AutoLogon> <OOBE> <NetworkLocation>Work</NetworkLocation> <HideEULAPage>true</HideEULAPage> <ProtectYourPC>3</ProtectYourPC> <SkipMachineOOBE>true</SkipMachineOOBE> <SkipUserOOBE>true</SkipUserOOBE> </OOBE> <FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> <Description>Turn Off Network Selection pop-up</Description> <CommandLine>cmd /c reg add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff"</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>2</Order> <Description>Shutting down Windows</Description> <CommandLine>cmd /C shutdown /s /t 0</CommandLine> </SynchronousCommand> </FirstLogonCommands> </component> </settings> <settings pass="specialize"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ProductKey></ProductKey> </component> </settings> </unattend> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/oz/auto/Windows2000.auto������������������������������������������������������������������0000664�0000000�0000000�00000001260�13443205327�0016457�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������;SetupMgrTag [Data] AutoPartition=1 MsDosInitiated=No UnattendedInstall=Yes [Unattended] UnattendMode=FullUnattended OemSkipEula=Yes OemPreinstall=No TargetPath=\WINNT Repartition=Yes WaitForReboot="No" UnattendSwitch="Yes" [GuiUnattended] AdminPassword=%ROOTPW% AutoLogon=Yes AutoLogonCount=1 OEMSkipRegional=1 TimeZone=35 OemSkipWelcome=1 [UserData] ProductID= FullName="OZ" ComputerName= [Display] BitsPerPel=16 Xresolution=640 YResolution=480 Vrefresh=60 [RegionalSettings] LanguageGroup=1 [Identification] JoinWorkgroup=WORKGROUP [Networking] InstallDefaultComponents=Yes ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/oz/auto/Windows2003.auto������������������������������������������������������������������0000664�0000000�0000000�00000001532�13443205327�0016464�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������;SetupMgrTag [Data] AutoPartition=1 MsDosInitiated="0" UnattendedInstall="Yes" [Unattended] UnattendMode=FullUnattended OemSkipEula=Yes OemPreinstall=No TargetPath=\WINDOWS Repartition=Yes WaitForReboot="No" UnattendSwitch="Yes" [GuiUnattended] AdminPassword="%ROOTPW%" EncryptedAdminPassword=NO AutoLogon=Yes AutoLogonCount=1 OEMSkipRegional=1 TimeZone=35 OemSkipWelcome=1 [UserData] ProductKey= FullName="OZ" OrgName="" ComputerName= [LicenseFilePrintData] AutoMode=PerServer AutoUsers=5 [Identification] JoinWorkgroup=WORKGROUP [Networking] InstallDefaultComponents=Yes [SetupParams] UserExecute = "sc config TlntSvr start= auto" [WindowsFirewall] Profiles = WindowsFirewall.TurnOffFirewall [WindowsFirewall.TurnOffFirewall] Mode = 0 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/oz/auto/Windows2008.auto������������������������������������������������������������������0000664�0000000�0000000�00000006440�13443205327�0016474�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="utf-8"?> <unattend xmlns="urn:schemas-microsoft-com:unattend"> <settings pass="windowsPE"> <component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <DiskConfiguration> <WillShowUI>OnError</WillShowUI> <Disk> <CreatePartitions> <CreatePartition> <Order>1</Order> <Size>1</Size> <Type>Primary</Type> </CreatePartition> </CreatePartitions> <DiskID>0</DiskID> <WillWipeDisk>true</WillWipeDisk> <ModifyPartitions> <ModifyPartition> <Active>true</Active> <Extend>true</Extend> <Format>NTFS</Format> <Label>C drive</Label> <Letter>C</Letter> <Order>1</Order> <PartitionID>1</PartitionID> </ModifyPartition> </ModifyPartitions> </Disk> </DiskConfiguration> <ImageInstall> <OSImage> <InstallFrom> <MetaData wcm:action="add"> <Key>/IMAGE/INDEX</Key> <Value>1</Value> </MetaData> </InstallFrom> <InstallTo> <DiskID>0</DiskID> <PartitionID>1</PartitionID> </InstallTo> <WillShowUI>OnError</WillShowUI> </OSImage> </ImageInstall> <UserData> <AcceptEula>true</AcceptEula> </UserData> </component> <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SetupUILanguage> <UILanguage>en-US</UILanguage> </SetupUILanguage> <SystemLocale>en-US</SystemLocale> <UILanguage>en-US</UILanguage> <UserLocale>en-US</UserLocale> </component> </settings> <settings pass="oobeSystem"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <UserAccounts> <AdministratorPassword> <Value></Value> <PlainText>true</PlainText> </AdministratorPassword> </UserAccounts> <AutoLogon> <Password> <Value></Value> <PlainText>true</PlainText> </Password> <Enabled>true</Enabled> <LogonCount>5</LogonCount> <Username>Administrator</Username> </AutoLogon> <RegisteredOwner/> <OOBE> <HideEULAPage>true</HideEULAPage> <ProtectYourPC>3</ProtectYourPC> </OOBE> <FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> <Description>Shutting down Windows</Description> <CommandLine>cmd /C shutdown /s /t 0</CommandLine> </SynchronousCommand> </FirstLogonCommands> </component> </settings> <settings pass="specialize"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ProductKey></ProductKey> </component> </settings> </unattend> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/oz/auto/Windows2012.auto������������������������������������������������������������������0000664�0000000�0000000�00000006440�13443205327�0016467�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="utf-8"?> <unattend xmlns="urn:schemas-microsoft-com:unattend"> <settings pass="windowsPE"> <component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <DiskConfiguration> <WillShowUI>OnError</WillShowUI> <Disk> <CreatePartitions> <CreatePartition> <Order>1</Order> <Size>1</Size> <Type>Primary</Type> </CreatePartition> </CreatePartitions> <DiskID>0</DiskID> <WillWipeDisk>true</WillWipeDisk> <ModifyPartitions> <ModifyPartition> <Active>true</Active> <Extend>true</Extend> <Format>NTFS</Format> <Label>C drive</Label> <Letter>C</Letter> <Order>1</Order> <PartitionID>1</PartitionID> </ModifyPartition> </ModifyPartitions> </Disk> </DiskConfiguration> <ImageInstall> <OSImage> <InstallFrom> <MetaData wcm:action="add"> <Key>/IMAGE/INDEX</Key> <Value>1</Value> </MetaData> </InstallFrom> <InstallTo> <DiskID>0</DiskID> <PartitionID>1</PartitionID> </InstallTo> <WillShowUI>OnError</WillShowUI> </OSImage> </ImageInstall> <UserData> <AcceptEula>true</AcceptEula> </UserData> </component> <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SetupUILanguage> <UILanguage>en-US</UILanguage> </SetupUILanguage> <SystemLocale>en-US</SystemLocale> <UILanguage>en-US</UILanguage> <UserLocale>en-US</UserLocale> </component> </settings> <settings pass="oobeSystem"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <UserAccounts> <AdministratorPassword> <Value></Value> <PlainText>true</PlainText> </AdministratorPassword> </UserAccounts> <AutoLogon> <Password> <Value></Value> <PlainText>true</PlainText> </Password> <Enabled>true</Enabled> <LogonCount>5</LogonCount> <Username>Administrator</Username> </AutoLogon> <RegisteredOwner/> <OOBE> <HideEULAPage>true</HideEULAPage> <ProtectYourPC>3</ProtectYourPC> </OOBE> <FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> <Description>Shutting down Windows</Description> <CommandLine>cmd /C shutdown /s /t 0</CommandLine> </SynchronousCommand> </FirstLogonCommands> </component> </settings> <settings pass="specialize"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ProductKey></ProductKey> </component> </settings> </unattend> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/oz/auto/Windows2016.auto������������������������������������������������������������������0000664�0000000�0000000�00000006440�13443205327�0016473�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="utf-8"?> <unattend xmlns="urn:schemas-microsoft-com:unattend"> <settings pass="windowsPE"> <component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <DiskConfiguration> <WillShowUI>OnError</WillShowUI> <Disk> <CreatePartitions> <CreatePartition> <Order>1</Order> <Size>1</Size> <Type>Primary</Type> </CreatePartition> </CreatePartitions> <DiskID>0</DiskID> <WillWipeDisk>true</WillWipeDisk> <ModifyPartitions> <ModifyPartition> <Active>true</Active> <Extend>true</Extend> <Format>NTFS</Format> <Label>C drive</Label> <Letter>C</Letter> <Order>1</Order> <PartitionID>1</PartitionID> </ModifyPartition> </ModifyPartitions> </Disk> </DiskConfiguration> <ImageInstall> <OSImage> <InstallFrom> <MetaData wcm:action="add"> <Key>/IMAGE/INDEX</Key> <Value>1</Value> </MetaData> </InstallFrom> <InstallTo> <DiskID>0</DiskID> <PartitionID>1</PartitionID> </InstallTo> <WillShowUI>OnError</WillShowUI> </OSImage> </ImageInstall> <UserData> <AcceptEula>true</AcceptEula> </UserData> </component> <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SetupUILanguage> <UILanguage>en-US</UILanguage> </SetupUILanguage> <SystemLocale>en-US</SystemLocale> <UILanguage>en-US</UILanguage> <UserLocale>en-US</UserLocale> </component> </settings> <settings pass="oobeSystem"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <UserAccounts> <AdministratorPassword> <Value></Value> <PlainText>true</PlainText> </AdministratorPassword> </UserAccounts> <AutoLogon> <Password> <Value></Value> <PlainText>true</PlainText> </Password> <Enabled>true</Enabled> <LogonCount>5</LogonCount> <Username>Administrator</Username> </AutoLogon> <RegisteredOwner/> <OOBE> <HideEULAPage>true</HideEULAPage> <ProtectYourPC>3</ProtectYourPC> </OOBE> <FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> <Description>Shutting down Windows</Description> <CommandLine>cmd /C shutdown /s /t 0</CommandLine> </SynchronousCommand> </FirstLogonCommands> </component> </settings> <settings pass="specialize"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ProductKey></ProductKey> </component> </settings> </unattend> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/oz/auto/Windows7.auto���������������������������������������������������������������������0000664�0000000�0000000�00000007217�13443205327�0016254�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="utf-8"?> <unattend xmlns="urn:schemas-microsoft-com:unattend"> <settings pass="windowsPE"> <component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <DiskConfiguration> <WillShowUI>OnError</WillShowUI> <Disk> <CreatePartitions> <CreatePartition> <Order>1</Order> <Size>1</Size> <Type>Primary</Type> </CreatePartition> </CreatePartitions> <DiskID>0</DiskID> <WillWipeDisk>true</WillWipeDisk> <ModifyPartitions> <ModifyPartition> <Active>true</Active> <Extend>true</Extend> <Format>NTFS</Format> <Label>C drive</Label> <Letter>C</Letter> <Order>1</Order> <PartitionID>1</PartitionID> </ModifyPartition> </ModifyPartitions> </Disk> </DiskConfiguration> <ImageInstall> <OSImage> <InstallFrom> <MetaData wcm:action="add"> <Key>/IMAGE/INDEX</Key> <Value>1</Value> </MetaData> </InstallFrom> <InstallTo> <DiskID>0</DiskID> <PartitionID>1</PartitionID> </InstallTo> <WillShowUI>OnError</WillShowUI> </OSImage> </ImageInstall> <UserData> <AcceptEula>true</AcceptEula> </UserData> </component> <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SetupUILanguage> <UILanguage>en-US</UILanguage> </SetupUILanguage> <SystemLocale>en-US</SystemLocale> <UILanguage>en-US</UILanguage> <UserLocale>en-US</UserLocale> </component> </settings> <settings pass="oobeSystem"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <UserAccounts> <AdministratorPassword> <Value>%ROOTPW%</Value> <PlainText>true</PlainText> </AdministratorPassword> </UserAccounts> <AutoLogon> <Password> <Value>%ROOTPW%</Value> <PlainText>true</PlainText> </Password> <Enabled>true</Enabled> <LogonCount>5</LogonCount> <Username>Administrator</Username> </AutoLogon> <OOBE> <NetworkLocation>Work</NetworkLocation> <HideEULAPage>true</HideEULAPage> <ProtectYourPC>3</ProtectYourPC> <SkipMachineOOBE>true</SkipMachineOOBE> <SkipUserOOBE>true</SkipUserOOBE> </OOBE> <FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> <Description>Turn Off Network Selection pop-up</Description> <CommandLine>cmd /c reg add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff"</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>2</Order> <Description>Shutting down Windows</Description> <CommandLine>cmd /C shutdown /s /t 0</CommandLine> </SynchronousCommand> </FirstLogonCommands> </component> </settings> <settings pass="specialize"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ProductKey></ProductKey> </component> </settings> </unattend> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/oz/auto/Windows8.1.auto�������������������������������������������������������������������0000664�0000000�0000000�00000007217�13443205327�0016414�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="utf-8"?> <unattend xmlns="urn:schemas-microsoft-com:unattend"> <settings pass="windowsPE"> <component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <DiskConfiguration> <WillShowUI>OnError</WillShowUI> <Disk> <CreatePartitions> <CreatePartition> <Order>1</Order> <Size>1</Size> <Type>Primary</Type> </CreatePartition> </CreatePartitions> <DiskID>0</DiskID> <WillWipeDisk>true</WillWipeDisk> <ModifyPartitions> <ModifyPartition> <Active>true</Active> <Extend>true</Extend> <Format>NTFS</Format> <Label>C drive</Label> <Letter>C</Letter> <Order>1</Order> <PartitionID>1</PartitionID> </ModifyPartition> </ModifyPartitions> </Disk> </DiskConfiguration> <ImageInstall> <OSImage> <InstallFrom> <MetaData wcm:action="add"> <Key>/IMAGE/INDEX</Key> <Value>1</Value> </MetaData> </InstallFrom> <InstallTo> <DiskID>0</DiskID> <PartitionID>1</PartitionID> </InstallTo> <WillShowUI>OnError</WillShowUI> </OSImage> </ImageInstall> <UserData> <AcceptEula>true</AcceptEula> </UserData> </component> <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SetupUILanguage> <UILanguage>en-US</UILanguage> </SetupUILanguage> <SystemLocale>en-US</SystemLocale> <UILanguage>en-US</UILanguage> <UserLocale>en-US</UserLocale> </component> </settings> <settings pass="oobeSystem"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <UserAccounts> <AdministratorPassword> <Value>%ROOTPW%</Value> <PlainText>true</PlainText> </AdministratorPassword> </UserAccounts> <AutoLogon> <Password> <Value>%ROOTPW%</Value> <PlainText>true</PlainText> </Password> <Enabled>true</Enabled> <LogonCount>5</LogonCount> <Username>Administrator</Username> </AutoLogon> <OOBE> <NetworkLocation>Work</NetworkLocation> <HideEULAPage>true</HideEULAPage> <ProtectYourPC>3</ProtectYourPC> <SkipMachineOOBE>true</SkipMachineOOBE> <SkipUserOOBE>true</SkipUserOOBE> </OOBE> <FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> <Description>Turn Off Network Selection pop-up</Description> <CommandLine>cmd /c reg add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff"</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>2</Order> <Description>Shutting down Windows</Description> <CommandLine>cmd /C shutdown /s /t 0</CommandLine> </SynchronousCommand> </FirstLogonCommands> </component> </settings> <settings pass="specialize"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ProductKey></ProductKey> </component> </settings> </unattend> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/oz/auto/Windows8.auto���������������������������������������������������������������������0000664�0000000�0000000�00000007217�13443205327�0016255�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="utf-8"?> <unattend xmlns="urn:schemas-microsoft-com:unattend"> <settings pass="windowsPE"> <component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <DiskConfiguration> <WillShowUI>OnError</WillShowUI> <Disk> <CreatePartitions> <CreatePartition> <Order>1</Order> <Size>1</Size> <Type>Primary</Type> </CreatePartition> </CreatePartitions> <DiskID>0</DiskID> <WillWipeDisk>true</WillWipeDisk> <ModifyPartitions> <ModifyPartition> <Active>true</Active> <Extend>true</Extend> <Format>NTFS</Format> <Label>C drive</Label> <Letter>C</Letter> <Order>1</Order> <PartitionID>1</PartitionID> </ModifyPartition> </ModifyPartitions> </Disk> </DiskConfiguration> <ImageInstall> <OSImage> <InstallFrom> <MetaData wcm:action="add"> <Key>/IMAGE/INDEX</Key> <Value>1</Value> </MetaData> </InstallFrom> <InstallTo> <DiskID>0</DiskID> <PartitionID>1</PartitionID> </InstallTo> <WillShowUI>OnError</WillShowUI> </OSImage> </ImageInstall> <UserData> <AcceptEula>true</AcceptEula> </UserData> </component> <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SetupUILanguage> <UILanguage>en-US</UILanguage> </SetupUILanguage> <SystemLocale>en-US</SystemLocale> <UILanguage>en-US</UILanguage> <UserLocale>en-US</UserLocale> </component> </settings> <settings pass="oobeSystem"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <UserAccounts> <AdministratorPassword> <Value>%ROOTPW%</Value> <PlainText>true</PlainText> </AdministratorPassword> </UserAccounts> <AutoLogon> <Password> <Value>%ROOTPW%</Value> <PlainText>true</PlainText> </Password> <Enabled>true</Enabled> <LogonCount>5</LogonCount> <Username>Administrator</Username> </AutoLogon> <OOBE> <NetworkLocation>Work</NetworkLocation> <HideEULAPage>true</HideEULAPage> <ProtectYourPC>3</ProtectYourPC> <SkipMachineOOBE>true</SkipMachineOOBE> <SkipUserOOBE>true</SkipUserOOBE> </OOBE> <FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> <Description>Turn Off Network Selection pop-up</Description> <CommandLine>cmd /c reg add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff"</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>2</Order> <Description>Shutting down Windows</Description> <CommandLine>cmd /C shutdown /s /t 0</CommandLine> </SynchronousCommand> </FirstLogonCommands> </component> </settings> <settings pass="specialize"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ProductKey></ProductKey> </component> </settings> </unattend> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/oz/auto/WindowsXP.auto��������������������������������������������������������������������0000664�0000000�0000000�00000001532�13443205327�0016427�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������;SetupMgrTag [Data] AutoPartition=1 MsDosInitiated="0" UnattendedInstall="Yes" [Unattended] UnattendMode=FullUnattended OemSkipEula=Yes OemPreinstall=No TargetPath=\WINDOWS Repartition=Yes WaitForReboot="No" UnattendSwitch="Yes" [GuiUnattended] AdminPassword="%ROOTPW%" EncryptedAdminPassword=NO AutoLogon=Yes AutoLogonCount=1 OEMSkipRegional=1 TimeZone=35 OemSkipWelcome=1 [UserData] ProductKey= FullName="OZ" OrgName="" ComputerName= [LicenseFilePrintData] AutoMode=PerServer AutoUsers=5 [Identification] JoinWorkgroup=WORKGROUP [Networking] InstallDefaultComponents=Yes [SetupParams] UserExecute = "sc config TlntSvr start= auto" [WindowsFirewall] Profiles = WindowsFirewall.TurnOffFirewall [WindowsFirewall.TurnOffFirewall] Mode = 0 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/oz/icicle.rng�����������������������������������������������������������������������������0000664�0000000�0000000�00000001533�13443205327�0014624�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0"?> <!-- A Relax NG schema for the ICICLE (Content and Intended Configuration Language) format --> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> <ref name='icicle'/> </start> <define name='icicle'> <element name='icicle'> <interleave> <element name='packages'> <zeroOrMore> <element name='package'> <attribute name='name'> <text/> </attribute> <optional> <element name='extra'> <text/> </element> </optional> </element> </zeroOrMore> </element> <optional> <element name='description'> <text/> </element> </optional> </interleave> </element> </define> </grammar> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/oz/ozutil.py������������������������������������������������������������������������������0000664�0000000�0000000�00000112657�13443205327�0014576�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2010,2011 Chris Lalancette <clalance@redhat.com> # Copyright (C) 2012-2018 Chris Lalancette <clalancette@gmail.com> # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; # version 2.1 of the License. # This library 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 # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ Miscellaneous utility functions. """ import collections try: import configparser except ImportError: import ConfigParser as configparser import errno import fcntl import ftplib import gzip import logging import os import random import select import shutil import socket import stat import struct import subprocess import sys import time import urllib import lxml.etree import monotonic import requests def generate_full_auto_path(relative): """ Function to find the absolute path to an unattended installation file. """ # all of the automated installation paths are installed to $pkg_path/auto, # so we just need to find it and generate the right path here if relative is None: raise Exception("The relative path cannot be None") pkg_path = os.path.dirname(__file__) return os.path.abspath(os.path.join(pkg_path, "auto", relative)) def executable_exists(program): """ Function to find out whether an executable exists in the PATH of the user. If so, the absolute path to the executable is returned. If not, an exception is raised. """ def is_exe(fpath): """ Helper method to check if a file exists and is executable """ return os.path.exists(fpath) and os.access(fpath, os.X_OK) if program is None: raise Exception("Invalid program name passed") fpath, fname_unused = os.path.split(program) if fpath: if is_exe(program): return program else: for path in os.environ["PATH"].split(os.pathsep): exe_file = os.path.join(path, program) if is_exe(exe_file): return exe_file raise Exception("Could not find %s" % (program)) def write_bytes_to_fd(fd, buf): """ Function to write all bytes in "buf" to "fd". This handles both EINTR and short writes. """ size = len(buf) offset = 0 while size > 0: try: bytes_written = os.write(fd, buf[offset:]) offset += bytes_written size -= bytes_written except OSError as err: # python's os.write() can raise an exception on EINTR, which # according to the man page can happen if a signal was # received before any data was written. Therefore, we don't # need to update destlen or size, but just retry if err.errno == errno.EINTR: continue raise return offset def read_bytes_from_fd(fd, num): """ Function to read and return bytes from fd. This handles the EINTR situation where no bytes were read before a signal happened. """ read_done = False while not read_done: try: ret = os.read(fd, num) read_done = True except OSError as err: # python's os.read() can raise an exception on EINTR, which # according to the man page can happen if a signal was # received before any data was read. In this case we need to retry if err.errno == errno.EINTR: continue raise return ret def copyfile_sparse(src, dest): """ Function to copy a file sparsely if possible. The logic here is all taken from coreutils cp, specifically the 'sparse_copy' function. """ if src is None: raise Exception("Source of copy cannot be None") if dest is None: raise Exception("Destination of copy cannot be None") if not os.path.exists(src): raise Exception("Source '%s' does not exist" % (src)) if os.path.exists(dest) and os.path.samefile(src, dest): raise Exception("Source '%s' and dest '%s' are the same file" % (src, dest)) base = os.path.dirname(dest) if not os.path.exists(base): mkdir_p(base) src_fd = os.open(src, os.O_RDONLY) try: dest_fd = os.open(dest, os.O_WRONLY | os.O_CREAT | os.O_TRUNC) try: sb = os.fstat(src_fd) # See io_blksize() in coreutils for an explanation of why 32*1024 buf_size = max(32 * 1024, sb.st_blksize) size = sb.st_size destlen = 0 while size != 0: buf = read_bytes_from_fd(src_fd, min(buf_size, size)) if not buf: break buflen = len(buf) if buf == '\0' * buflen: os.lseek(dest_fd, buflen, os.SEEK_CUR) else: write_bytes_to_fd(dest_fd, buf) destlen += buflen size -= buflen os.ftruncate(dest_fd, destlen) finally: os.close(dest_fd) finally: os.close(src_fd) def bsd_split(line, digest_type): """ Function to split a BSD-style checksum line into a filename and checksum. """ current = len(digest_type) if line[current] == ' ': current += 1 if line[current] != '(': return None, None current += 1 # find end of filename. The BSD 'md5' and 'sha1' commands do not escape # filenames, so search backwards for the last ')' file_end = line.rfind(')') if file_end == -1: # could not find the ending ), fail return None, None filename = line[current:file_end] line = line[(file_end + 1):] line = line.lstrip() if line[0] != '=': return None, None line = line[1:] line = line.lstrip() if line[-1] == '\n': line = line[:-1] return line, filename def sum_split(line, digest_bits): """ Function to split a normal Linux checksum line into a filename and checksum. """ digest_hex_bytes = digest_bits // 4 min_digest_line_length = digest_hex_bytes + 2 + 1 # length of hex message digest + blank and binary indicator (2 bytes) + minimum file length (1 byte) min_length = min_digest_line_length if line[0] == '\\': min_length = min_length + 1 if len(line) < min_length: # if the line is too short, skip it return None, None if line[0] == '\\': current = digest_hex_bytes + 1 hex_digest = line[1:current] escaped_filename = True else: current = digest_hex_bytes hex_digest = line[0:current] escaped_filename = False # if the digest is not immediately followed by a white space, it is an # error if line[current] != ' ' and line[current] != '\t': return None, None current += 1 # if the whitespace is not immediately followed by another space or a *, # it is an error if line[current] != ' ' and line[current] != '*': return None, None current += 1 filename = line[current:] if line[-1] == '\n': filename = line[current:-1] if escaped_filename: # FIXME: a \0 is not allowed in the sum file format, but # string_escape allows it. We'd probably have to implement our # own codec to fix this if sys.version_info.major == 2: filename = filename.decode('string_escape') else: filename = filename.encode('utf-8').decode('unicode_escape') return hex_digest, filename def get_sum_from_file(sumfile, file_to_find, digest_bits, digest_type): """ Function to get a checksum digest out of a checksum file given a filename. """ retval = None with open(sumfile, 'r') as f: for line in f: # remove any leading whitespace line = line.lstrip() # ignore blank lines if not line: continue # ignore comment lines if line[0] == '#': continue if line.startswith(digest_type): # OK, if it starts with a string of ["MD5", "SHA1", "SHA256"], then # this is a BSD-style sumfile hex_digest, filename = bsd_split(line, digest_type) else: # regular sumfile hex_digest, filename = sum_split(line, digest_bits) if hex_digest is None or filename is None: continue if filename == file_to_find: retval = hex_digest break return retval def get_md5sum_from_file(sumfile, file_to_find): """ Function to get an MD5 checksum out of a checksum file given a filename. """ return get_sum_from_file(sumfile, file_to_find, 128, "MD5") def get_sha1sum_from_file(sumfile, file_to_find): """ Function to get a SHA1 checksum out of a checksum file given a filename. """ return get_sum_from_file(sumfile, file_to_find, 160, "SHA1") def get_sha256sum_from_file(sumfile, file_to_find): """ Function to get a SHA256 checksum out of a checksum file given a filename. """ return get_sum_from_file(sumfile, file_to_find, 256, "SHA256") def string_to_bool(instr): """ Function to take a string and determine whether it is True, Yes, False, or No. It takes a single argument, which is the string to examine. Returns True if instr is "Yes" or "True", False if instr is "No" or "False", and None otherwise. """ if instr is None: raise Exception("Input string was None!") lower = instr.lower() if lower == 'no' or lower == 'false': return False if lower == 'yes' or lower == 'true': return True return None def generate_macaddress(): """ Function to generate a random MAC address. """ mac = [0x52, 0x54, 0x00, random.randint(0x00, 0xff), random.randint(0x00, 0xff), random.randint(0x00, 0xff)] return ':'.join(["%02x" % x for x in mac]) class SubprocessException(Exception): """ Class for subprocess exceptions. In addition to a error message, it also has a retcode member that has the returncode from the command. """ def __init__(self, msg, retcode): Exception.__init__(self, msg) self.retcode = retcode def subprocess_check_output(*popenargs, **kwargs): """ Function to call a subprocess and gather the output. """ if 'stdout' in kwargs: raise ValueError('stdout argument not allowed, it will be overridden.') if 'stderr' in kwargs: raise ValueError('stderr argument not allowed, it will be overridden.') printfn = None if 'printfn' in kwargs: printfn = kwargs['printfn'] del kwargs['printfn'] executable_exists(popenargs[0][0]) process = subprocess.Popen(stdout=subprocess.PIPE, stderr=subprocess.PIPE, *popenargs, **kwargs) poller = select.poll() select_POLLIN_POLLPRI = select.POLLIN | select.POLLPRI poller.register(process.stdout.fileno(), select_POLLIN_POLLPRI) poller.register(process.stderr.fileno(), select_POLLIN_POLLPRI) stdout = '' stderr = '' retcode = process.poll() while retcode is None: start = time.time() try: ready = poller.poll(1000) except select.error as e: if e.args[0] == errno.EINTR: continue raise for fd, mode in ready: if mode & select_POLLIN_POLLPRI: data = os.read(fd, 4096) if not data: poller.unregister(fd) else: data = data.decode('utf-8') if printfn is not None: printfn(data) if fd == process.stdout.fileno(): stdout += data else: stderr += data else: # Ignore hang up or errors. poller.unregister(fd) end = time.time() if (end - start) < 1: time.sleep(1 - (end - start)) retcode = process.poll() tmpout, tmperr = process.communicate() tmpout = tmpout.decode('utf-8') tmperr = tmperr.decode('utf-8') stdout += tmpout stderr += tmperr if printfn is not None: printfn(tmperr) printfn(tmpout) if retcode: cmd = ' '.join(*popenargs) raise SubprocessException("'%s' failed(%d): %s" % (cmd, retcode, stderr + stdout), retcode) return (stdout, stderr, retcode) def mkdir_p(path): """ Function to make a directory and all intermediate directories as necessary. The functionality differs from os.makedirs slightly, in that this function does *not* raise an error if the directory already exists. """ if path is None: raise Exception("Path cannot be None") if path == '': # this can happen if the user did something like call os.path.dirname() # on a file without directories. Since os.makedirs throws an exception # in that case, check for it here and allow it. return try: os.makedirs(path) except OSError as err: if err.errno != errno.EEXIST or not os.path.isdir(path): raise def copytree_merge(src, dst, symlinks=False, ignore=None): """ Function to copy an entire directory recursively. The functionality differs from shutil.copytree, in that this function does *not* raise an exception if the directory already exists. It is based on: http://docs.python.org/2.7/library/shutil.html#copytree-example """ names = os.listdir(src) if ignore is not None: ignored_names = ignore(src, names) else: ignored_names = set() mkdir_p(dst) errors = [] for name in names: if name in ignored_names: continue srcname = os.path.join(src, name) dstname = os.path.join(dst, name) try: if symlinks and os.path.islink(srcname): linkto = os.readlink(srcname) os.symlink(linkto, dstname) elif os.path.isdir(srcname): copytree_merge(srcname, dstname, symlinks, ignore) else: shutil.copy2(srcname, dstname) # FIXME: What about devices, sockets etc.? except (IOError, os.error) as why: errors.append((srcname, dstname, str(why))) # catch the Error from the recursive copytree so that we can # continue with other files except shutil.Error as err: errors.extend(err.args[0]) try: shutil.copystat(src, dst) except OSError as why: errors.extend((src, dst, str(why))) if errors: raise shutil.Error(errors) def copy_modify_file(inname, outname, subfunc): """ Function to copy a file from inname to outname, passing each line through subfunc first. subfunc is expected to be a method that takes a single argument in (the next line), and returns a string to be written to the output file after modification (if any). """ if inname is None: raise Exception("input filename is None") if outname is None: raise Exception("output filename is None") if subfunc is None: raise Exception("subfunction is None") if not isinstance(subfunc, collections.Callable): raise Exception("subfunction is not callable") infile = open(inname, 'r') outfile = open(outname, 'w') for line in infile: outfile.write(subfunc(line)) infile.close() outfile.close() def write_cpio(inputdict, outputfile): """ Function to write a CPIO archive in the "New ASCII Format". The inputlist is a dictionary of files to put in the archive, where the dictionary key is the path to the file on the local filesystem and the dictionary value is the location that the file should have in the cpio archive. The outputfile is the location of the final cpio archive that will be written. """ if inputdict is None: raise Exception("input dictionary was None") if outputfile is None: raise Exception("output file was None") outf = open(outputfile, "w") try: for inputfile, destfile in list(inputdict.items()): inf = open(inputfile, 'r') st = os.fstat(inf.fileno()) # 070701 is the magic for new CPIO (newc in cpio parlance) outf.write("070701") # inode (really just needs to be unique) outf.write("%08x" % (st[stat.ST_INO])) # mode outf.write("%08x" % (st[stat.ST_MODE])) # uid is 0 outf.write("00000000") # gid is 0 outf.write("00000000") # nlink (always a single link for a single file) outf.write("00000001") # mtime outf.write("%08x" % (st[stat.ST_MTIME])) # filesize outf.write("%08x" % (st[stat.ST_SIZE])) # devmajor outf.write("%08x" % (os.major(st[stat.ST_DEV]))) # dev minor outf.write("%08x" % (os.minor(st[stat.ST_DEV]))) # rdevmajor (always 0) outf.write("00000000") # rdevminor (always 0) outf.write("00000000") # namesize (the length of the name plus 1 for the NUL padding) outf.write("%08x" % (len(destfile) + 1)) # check (always 0) outf.write("00000000") # write the name of the inputfile minus the leading / stripped = destfile.lstrip('/') outf.write(stripped) # we now need to write sentinel NUL byte(s). We need to make the # header (110 bytes) plus the filename, plus the sentinel a # multiple of 4 bytes. Note that we always need at *least* one NUL, # so if it is exactly a multiple of 4 we need to write 4 NULs outf.write("\x00" * (4 - ((110 + len(stripped)) % 4))) # now write the data from the input file outf.writelines(inf) inf.close() # we now need to write out NUL byte(s) to make it a multiple of 4. # note that unlike the name, we do *not* have to have any NUL bytes, # so if it is already aligned on 4 bytes do nothing remainder = st[stat.ST_SIZE] % 4 if remainder != 0: outf.write("\x00" * (4 - remainder)) # now that we have written all of the file entries, write the trailer outf.write("070701") # zero inode outf.write("00000000") # zero mode outf.write("00000000") # zero uid outf.write("00000000") # zero gid outf.write("00000000") # one nlink outf.write("00000001") # zero mtime outf.write("00000000") # zero filesize outf.write("00000000") # zero devmajor outf.write("00000000") # zero devminor outf.write("00000000") # zero rdevmajor outf.write("00000000") # zero rdevminor outf.write("00000000") # 0xB namesize outf.write("0000000B") # zero check outf.write("00000000") # trailer outf.write("TRAILER!!!") # finally, we need to pad to the closest 512 bytes outf.write("\x00" * (512 - (outf.tell() % 512))) except: os.unlink(outputfile) raise outf.close() def config_get_key(config, section, key, default): """ Function to retrieve config parameters out of the config file. """ if config is not None and config.has_section(section) and config.has_option(section, key): return config.get(section, key) return default def config_get_boolean_key(config, section, key, default): """ Function to retrieve boolean config parameters out of the config file. """ value = config_get_key(config, section, key, None) if value is None: return default retval = string_to_bool(value) if retval is None: raise Exception("Configuration parameter '%s' must be True, Yes, False, or No" % (key)) return retval def config_get_path(config, section, key, default): """ Function to get an user-expanded path out of the config file at the passed in section and key. If the value is not in the config file, then the default value is returned. If the expanded path is not absolute, an error is raised. """ path = os.path.expanduser(config_get_key(config, section, key, default)) if not os.path.isabs(path): raise Exception("Config key '%s' must have an absolute path" % (key)) return path def rmtree_and_sync(directory): """ Function to remove a directory tree and do an fsync afterwards. Because the removal of the directory tree can cause a lot of metadata updates, it can cause a lot of disk activity. By doing the fsync, we ensure that any metadata updates caused by us will not cause subsequent steps to fail. This cannot help if the system is otherwise very busy, but it does ensure that the problem is not self-inflicted. """ try: shutil.rmtree(directory) fd = os.open(os.path.dirname(directory), os.O_RDONLY) try: os.fsync(fd) finally: os.close(fd) except OSError as err: if err.errno == 2: pass else: raise def parse_config(config_file): """ Function to parse the configuration file. If the passed in config_file is None, then the default configuration file is used. """ config = configparser.SafeConfigParser() if config_file is not None: # If the config_file passed in is not None, then we want to try to read # that config file (after expanding it). If that config file doesn't # exist, we want to throw an error (which is why we use readfp here). config.readfp(open(os.path.expanduser(config_file))) else: # The config file was not passed in, so we want to use one of the # defaults. First we check to see if a ~/.oz/oz.cfg exists; if it does, # we use that. Otherwise we fall back to the system-wide version in # /etc/oz/oz.cfg. If neither of those exist, we don't throw an error # but instead let Oz pick sane defaults internally. parsed = config.read(os.path.expanduser("~/.oz/oz.cfg")) if not parsed and os.geteuid() == 0: config.read("/etc/oz/oz.cfg") return config def default_output_dir(): """ Function to get the default path to the output directory. """ if os.geteuid() == 0: return "/var/lib/libvirt/images" return "~/.oz/images" def default_data_dir(): """ Function to get the default path to the data directory. """ if os.geteuid() == 0: return "/var/lib/oz" return "~/.oz" def default_sshprivkey(): """ Function to get the default path to the SSH private key. """ if os.geteuid() == 0: return "/etc/oz/id_rsa-icicle-gen" return "~/.oz/id_rsa-icicle-gen" def default_screenshot_dir(): """ Function to get the default path to the screenshot directory. The directory is generated relative to the default data directory. """ return os.path.join(default_data_dir(), "screenshots") class LocalFileAdapter(requests.adapters.BaseAdapter): ''' This class implements an adapter for requests so we can properly deal with file:// local files. ''' @staticmethod def _chkpath(method, path): """Return an HTTP status for the given filesystem path.""" if method.lower() in ('put', 'delete'): return 501, "Not Implemented" elif method.lower() not in ('get', 'head', 'post'): return 405, "Method Not Allowed" elif os.path.isdir(path): return 400, "Path Not A File" elif not os.path.isfile(path): return 404, "File Not Found" elif not os.access(path, os.R_OK): return 403, "Access Denied" return 200, "OK" def send(self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None): """Return the file specified by the given request @type req: C{PreparedRequest} @todo: Should I bother filling `response.headers` and processing If-Modified-Since and friends using `os.stat`? """ if sys.version_info.major == 2: path = os.path.normcase(os.path.normpath(urllib.url2pathname(request.path_url))) # pylint: disable=no-member else: path = os.path.normcase(os.path.normpath(urllib.request.url2pathname(request.path_url))) response = requests.Response() response.status_code, response.reason = self._chkpath(request.method, path) if response.status_code == 200 and request.method.lower() != 'head': try: response.raw = open(path, 'rb') except (OSError, IOError) as err: response.status_code = 500 response.reason = str(err) if isinstance(request.url, bytes): response.url = request.url.decode('utf-8') else: response.url = request.url response.headers['Content-Length'] = os.path.getsize(path) response.headers['Accept-Ranges'] = 'bytes' response.headers['Redirect-URL'] = request.url response.request = request response.connection = self return response def close(self): pass def http_get_header(url, redirect=True): """ Function to get the HTTP headers from a URL. The available headers will be returned in a dictionary. If redirect=True (the default), then this function will automatically follow http redirects through to the final destination, entirely transparently to the caller. If redirect=False, then this function will follow http redirects through to the final destination, and also store that information in the 'Redirect-URL' key. Note that 'Redirect-URL' will always be None in the redirect=True case, and may be None in the redirect=True case if no redirects were required. """ with requests.Session() as requests_session: requests_session.mount('file://', LocalFileAdapter()) response = requests_session.head(url, allow_redirects=redirect, stream=True, timeout=10) info = response.headers info['HTTP-Code'] = response.status_code if not redirect: info['Redirect-URL'] = response.headers.get('Location') else: info['Redirect-URL'] = None return info def http_download_file(url, fd, show_progress, logger): """ Function to download a file from url to file descriptor fd. """ with requests.Session() as requests_session: requests_session.mount('file://', LocalFileAdapter()) response = requests_session.get(url, stream=True, allow_redirects=True, headers={'Accept-Encoding': ''}) file_size = int(response.headers.get('Content-Length')) chunk_size = 10 * 1024 * 1024 done = 0 for chunk in response.iter_content(chunk_size): write_bytes_to_fd(fd, chunk) done += len(chunk) if show_progress: logger.debug("%dkB of %dkB" % (done / 1024, file_size / 1024)) def ftp_download_directory(server, username, password, basepath, destination, port=None): """ Function to recursively download an entire directory structure over FTP. """ ftp = ftplib.FTP() ftp.connect(server, port) ftp.login(username, password) def _recursive_ftp_download(sourcepath): """ Function to iterate and download a remote ftp folder """ original_dir = ftp.pwd() try: ftp.cwd(sourcepath) except ftplib.error_perm: relativesourcepath = os.path.relpath(sourcepath, basepath) destinationpath = os.path.join(destination, relativesourcepath) if not os.path.exists(os.path.dirname(destinationpath)): os.makedirs(os.path.dirname(destinationpath)) ftp.retrbinary("RETR " + sourcepath, open(destinationpath, "wb").write) return names = ftp.nlst() for name in names: _recursive_ftp_download(os.path.join(sourcepath, name)) ftp.cwd(original_dir) _recursive_ftp_download(basepath) ftp.close() def _gzip_file(inputfile, outputfile, outputmode): """ Internal function to gzip the input file and place it in the outputfile. If the outputmode is 'ab', then the input file will be appended to the output file, and if the outputmode is 'wb' then the input file will be written over the output file. """ with open(inputfile, 'rb') as f: gzf = gzip.GzipFile(outputfile, mode=outputmode) gzf.writelines(f) gzf.close() def gzip_append(inputfile, outputfile): """ Function to gzip and append the data from inputfile onto output file. """ _gzip_file(inputfile, outputfile, 'ab') def gzip_create(inputfile, outputfile): """ Function to gzip the data from inputfile and place it into outputfile, overwriting any existing data in outputfile. """ try: _gzip_file(inputfile, outputfile, 'wb') except: # since we created the output file, we should clean it up if os.access(outputfile, os.F_OK): os.unlink(outputfile) raise def check_qcow_size(filename): """ Function to detect if an image is in qcow format. If it is, return the size of the underlying disk image. If it isn't, return None. """ # For interested parties, this is the QCOW header struct in C # struct qcow_header { # uint32_t magic; # uint32_t version; # uint64_t backing_file_offset; # uint32_t backing_file_size; # uint32_t cluster_bits; # uint64_t size; /* in bytes */ # uint32_t crypt_method; # uint32_t l1_size; # uint64_t l1_table_offset; # uint64_t refcount_table_offset; # uint32_t refcount_table_clusters; # uint32_t nb_snapshots; # uint64_t snapshots_offset; # }; # And in Python struct format string-ese qcow_struct = ">IIQIIQIIQQIIQ" # > means big-endian qcow_magic = 0x514649FB # 'Q' 'F' 'I' 0xFB f = open(filename, "r") pack = f.read(struct.calcsize(qcow_struct)) f.close() unpack = struct.unpack(qcow_struct, pack) if unpack[0] == qcow_magic: return unpack[5] return None def recursively_add_write_bit(inputdir): """ Function to walk a directory tree, adding the write it to every file and directory. This is mostly useful right before deleting a tree of files extracted from an ISO, since those were all read-only to begin with. """ for dirpath, dirnames_unused, filenames in os.walk(inputdir): # If the path is a symlink, and it is an absolute symlink, this would # attempt to change the permissions of the *host* file, not the # file that is relative to here. That is no good, and could be a # security problem if Oz is being run as root. We skip all paths that # are symlinks; what they point to will be changed later on. if os.path.islink(dirpath): continue os.chmod(dirpath, os.stat(dirpath).st_mode | stat.S_IWUSR) for name in filenames: fullpath = os.path.join(dirpath, name) # we have the same guard for symlinks as above, for the same reason if os.path.islink(fullpath): continue try: # if there are broken symlinks in the ISO, # then the below might fail. This probably # isn't fatal, so just allow it and go on os.chmod(fullpath, os.stat(fullpath).st_mode | stat.S_IWUSR) except OSError as err: if err.errno != errno.ENOENT: raise def find_uefi_firmware(arch): ''' A function to find the UEFI firmware file that corresponds to a certain architecture. ''' # Yuck. Finding the UEFI firmware to start certain guests (like aarch64) # is a really nasty process. While slightly out of date, this blog post # describes the mess: http://blog.wikichoon.com/2016/01/uefi-support-in-virt-install-and-virt.html # Here, we replicate what libguestfs is doing here, which is to essentially # hardcode paths where UEFI firmware can be found on popular distributions. # I verified that these files exist on both Fedora/RHEL and Ubuntu. # Hopefully there will be a nicer way to do this in the future. class UEFI(object): ''' A private class to hold the path to the loader and the path to the NVRAM file. ''' def __init__(self, loader, nvram): self.loader = loader self.nvram = nvram def exists(self): ''' A method that returns True if both the loader and the NVRAM files exist, False otherwise. ''' if os.path.exists(self.loader) and os.path.exists(self.nvram): return True return False if arch in ['i386', 'i486', 'i586', 'i686']: uefi_list = [UEFI('/usr/share/edk2.git/ovmf-ia32/OVMF_CODE-pure-efi.fd', '/usr/share/edk2.git/ovmf-ia32/OVMF_VARS-pure-efi.fd')] elif arch in ['x86_64']: uefi_list = [UEFI('/usr/share/OVMF/OVMF_CODE.fd', '/usr/share/OVMF/OVMF_VARS.fd'), UEFI('/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd', '/usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd')] elif arch in ['aarch64']: uefi_list = [UEFI('/usr/share/AAVMF/AAVMF_CODE.fd', '/usr/share/AAVMF/AAVMF_VARS.fd'), UEFI('/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw', '/usr/share/edk2/aarch64/vars-template-pflash.raw'), UEFI('/usr/share/edk2.git/aarch64/QEMU_EFI-pflash.raw', '/usr/share/edk2.git/aarch64/vars-template-pflash.raw')] else: raise Exception("Invalid arch for UEFI firmware") for uefi in uefi_list: if uefi.exists(): return uefi.loader, uefi.nvram raise Exception("UEFI firmware is not installed!") def open_locked_file(filename): """ A function to open and lock a file. Returns a file descriptor referencing the open and locked file. """ outdir = os.path.dirname(filename) mkdir_p(outdir) fd = os.open(filename, os.O_RDWR | os.O_CREAT) try: fcntl.lockf(fd, fcntl.LOCK_EX) except: os.close(fd) raise return (fd, outdir) def lxml_subelement(root, name, text=None, attributes=None): """ Function to add a new element to an LXML tree, optionally include text and a dictionary of attributes. """ tmp = lxml.etree.SubElement(root, name) if text is not None: tmp.text = text if attributes is not None: for k, v in attributes.items(): tmp.set(k, v) return tmp def timed_loop(max_time, cb, msg, cb_arg=None): ''' A function to deal with waiting for an event to occur. Given a maximum time to wait, a callback, and a message, it will wait until the maximum time for the event to occur. Each time through the loop, it will do the following: 1. Check to see if it has been at least 10 seconds since it last logged. If so, it will log right now. 2. Call the callback to check for the event. If the callback returns True, the loop quits immediately. If it returns False, go on to step 3. 3. Sleep for the portion of 1 second that was not taken up by the callback. If the event occurred (the callback returned True), then this function returns True. If we timed out while waiting for the event to occur, this function returns False. ''' log = logging.getLogger('%s' % (__name__)) now = monotonic.monotonic() end = now + max_time next_print = now while now < end: now = monotonic.monotonic() if now >= next_print: left = int(end) - int(now) if left < 0: left = 0 log.debug("%s, %d/%d", msg, left, max_time) next_print = now + 10 if cb(cb_arg): return True # It's possible that the callback took longer than one second. # In that case, just skip our sleep altogether in an attempt to # catch up. sleep_time = 1.0 - (monotonic.monotonic() - now) if sleep_time > 0: # Otherwise, sleep for a time. Note that we try to maintain # on our starting boundary, so we'll sleep less than a second # here almost always. time.sleep(sleep_time) return False def get_free_port(): """ A function to find a free TCP port on the host. """ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Bind to port 0 which will use a free socket to listen to. sock.bind(("", 0)) listen_port = sock.getsockname()[1] # Close the socket to free it up for libvirt sock.close() return listen_port ���������������������������������������������������������������������������������oz-0.17.0/oz/tdl.rng��������������������������������������������������������������������������������0000664�0000000�0000000�00000021527�13443205327�0014164�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0"?> <!-- A Relax NG schema for the TDL (template description language) format --> <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <start> <ref name='template'/> </start> <define name='template'> <element name='template'> <optional> <attribute name='version'> <choice> <value>1.0</value> </choice> </attribute> </optional> <interleave> <element name='name'> <text/> </element> <element name='os'> <interleave> <element name='name'> <text/> </element> <element name='version'> <text/> </element> <element name='arch'> <choice> <value>i386</value> <value>x86_64</value> <value>ppc64</value> <value>ppc64le</value> <value>aarch64</value> <value>armv7l</value> <value>s390x</value> </choice> </element> <optional> <element name='kernelparam'> <text/> </element> </optional> <element name='install'> <choice> <ref name='url'/> <ref name='iso'/> </choice> <optional> <element name='extras'> <oneOrMore> <choice> <element name='directory'> <attribute name='source'> <text/> </attribute> <attribute name='destination'> <text/> </attribute> </element> <element name='file'> <attribute name='source'> <text/> </attribute> <attribute name='destination'> <text/> </attribute> </element> </choice> </oneOrMore> </element> </optional> </element> <optional> <element name='rootpw'> <text/> </element> </optional> <optional> <element name='key'> <text/> </element> </optional> <optional> <element name='icicle'> <element name='extra_command'> <text/> </element> </element> </optional> </interleave> </element> <optional> <element name='description'> <text/> </element> </optional> <optional> <element name='packages'> <zeroOrMore> <element name='package'> <attribute name='name'> <text/> </attribute> <interleave> <optional> <element name='repository'> <text/> </element> </optional> <optional> <element name='file'> <text/> </element> </optional> <optional> <element name='arguments'> <text/> </element> </optional> </interleave> </element> </zeroOrMore> </element> </optional> <optional> <element name='files'> <zeroOrMore> <element name='file'> <attribute name='name'> <text/> </attribute> <choice> <ref name='rawtype'/> <ref name='base64_or_emptytype'/> <ref name='urltype'/> </choice> </element> </zeroOrMore> </element> </optional> <optional> <element name='commands'> <zeroOrMore> <element name='command'> <attribute name='name'> <text/> </attribute> <optional> <attribute name='position'> <ref name='number'/> </attribute> </optional> <choice> <ref name='rawtype'/> <ref name='base64type'/> <ref name='urltype'/> </choice> </element> </zeroOrMore> </element> </optional> <optional> <element name='precommands'> <zeroOrMore> <element name='command'> <attribute name='name'> <text/> </attribute> <optional> <attribute name='position'> <ref name='number'/> </attribute> </optional> <choice> <ref name='rawtype'/> <ref name='base64type'/> <ref name='urltype'/> </choice> </element> </zeroOrMore> </element> </optional> <optional> <element name='repositories'> <zeroOrMore> <element name='repository'> <attribute name='name'> <text/> </attribute> <interleave> <element name='url'> <text/> </element> <optional> <element name='signed'> <ref name='bool'/> </element> </optional> <optional> <element name='persisted'> <ref name='bool'/> </element> </optional> <optional> <element name='sslverify'> <ref name='bool'/> </element> </optional> </interleave> </element> </zeroOrMore> </element> </optional> <optional> <element name='disk'> <element name='size'> <ref name='disk_size'/> </element> </element> </optional> </interleave> </element> </define> <define name='url'> <attribute name='type'> <value>url</value> </attribute> <element name='url'> <text/> </element> </define> <define name='iso'> <attribute name='type'> <value>iso</value> </attribute> <interleave> <element name='iso'> <text/> </element> <optional> <choice> <element name='md5sum'> <text/> </element> <element name='sha1sum'> <text/> </element> <element name='sha256sum'> <text/> </element> </choice> </optional> </interleave> </define> <define name='bool'> <choice> <data type="string"> <param name="pattern">[Tt][Rr][Uu][Ee]</param> </data> <data type="string"> <param name="pattern">[Ff][Aa][Ll][Ss][Ee]</param> </data> <data type="string"> <param name="pattern">[Yy][Ee][Ss]</param> </data> <data type="string"> <param name="pattern">[Nn][Oo]</param> </data> </choice> </define> <define name='rawtype'> <optional> <attribute name='type'> <value>raw</value> </attribute> </optional> <text/> </define> <define name='base64'> <data type="string"> <param name="pattern">[a-zA-Z0-9+/]+={0,2}</param> </data> </define> <define name='base64_or_empty'> <choice> <ref name='base64'/> <empty/> </choice> </define> <define name='base64_or_emptytype'> <attribute name='type'> <value>base64</value> </attribute> <ref name='base64_or_empty'/> </define> <define name='base64type'> <attribute name='type'> <value>base64</value> </attribute> <ref name='base64'/> </define> <define name='urltype'> <attribute name='type'> <value>url</value> </attribute> <text/> </define> <define name='number'> <data type="string"> <param name="pattern">[0-9]*</param> </data> </define> <define name='disk_size'> <data type="string"> <param name="pattern">([0-9]*) *([GT]?)</param> </data> </define> </grammar> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/pylint.conf�������������������������������������������������������������������������������0000664�0000000�0000000�00000014163�13443205327�0014425�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������[MASTER] # Specify a configuration file. #rcfile= # Python code to execute, usually for sys.path manipulation such as # pygtk.require(). #init-hook= # Add <file or directory> to the black list. It should be a base name, not a # path. You may set this option multiple times. ignore=CVS # Pickle collected data for later comparisons. persistent=yes # List of plugins (as comma separated values of python modules names) to load, # usually to register additional checkers. load-plugins= [MESSAGES CONTROL] # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option # multiple time. #enable= # Disable the message, report, category or checker with the given id(s). You # can either give multiple identifier separated by comma (,) or put this option # multiple time (only on the command line, not in the configuration file where # it should appear only once). disable=C0325,C0103 [REPORTS] # Set the output format. Available formats are text, parseable, colorized, msvs # (visual studio) and html output-format=text # Put messages in a separate file for each module / package specified on the # command line instead of printing them on stdout. Reports (if any) will be # written in a file name "pylint_global.[txt|html]". files-output=no # Tells whether to display a full report or only the messages reports=yes # Python expression which should return a note less than 10 (10 is the highest # note). You have access to the variables errors warning, statement which # respectively contain the number of errors / warnings messages and the total # number of statements analyzed. This is used by the global evaluation report # (RP0004). evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) [TYPECHECK] # Tells whether missing members accessed in mixin class should be ignored. A # mixin class is detected if its name ends with "mixin" (case insensitive). ignore-mixin-members=yes # List of classes names for which member attributes should not be checked # (useful for classes with attributes dynamically set). ignored-classes=SQLObject # List of members which are set dynamically and missed by pylint inference # system, and so shouldn't trigger E0201 when accessed. generated-members=REQUEST,acl_users,aq_parent [FORMAT] # Maximum number of characters on a single line. max-line-length=200 # Maximum number of lines in a module max-module-lines=2000 # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 # tab). indent-string=' ' [VARIABLES] # Tells whether we should check for unused import in __init__ files. init-import=no # A regular expression matching the beginning of the name of dummy variables # (i.e. not used). dummy-variables-rgx=.*_unused$ # List of additional names supposed to be defined in builtins. Remember that # you should avoid to define new builtins when possible. additional-builtins= [MISCELLANEOUS] # List of note tags to take in consideration, separated by a comma. notes=FIXME,XXX,TODO [BASIC] # List of builtins function names that should not be used, separated by a comma bad-functions=filter,apply,input # Regular expression which should only match correct module names module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9_]+))$ # Regular expression which should only match correct module level names const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ # Regular expression which should only match correct class names class-rgx=[A-Z_][a-zA-Z0-9]+$ # Regular expression which should only match correct function names function-rgx=[a-z_][a-z0-9_]{2,30}$ # Regular expression which should only match correct method names method-rgx=[a-z_][a-zA-Z0-9_]{2,30}$ # Regular expression which should only match correct instance attribute names attr-rgx=[a-z_][a-z0-9_]{2,30}$ # Regular expression which should only match correct argument names argument-rgx=[a-z_][a-zA-Z0-9_]{0,30}$ # Regular expression which should only match correct variable names variable-rgx=[a-z_][a-zA-Z0-9_]{0,30}$ # Regular expression which should only match correct list comprehension / # generator expression variable names inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ # Good variable names which should always be accepted, separated by a comma good-names=i,j,k,ex,Run,_ # Bad variable names which should always be refused, separated by a comma bad-names=foo,bar,baz,toto,tutu,tata # Regular expression which should only match functions or classes name which do # not require a docstring no-docstring-rgx=__.*__ [SIMILARITIES] # Minimum lines number of a similarity. min-similarity-lines=4 # Ignore comments when computing similarities. ignore-comments=yes # Ignore docstrings when computing similarities. ignore-docstrings=yes [IMPORTS] # Deprecated modules which should not be used, separated by a comma deprecated-modules=regsub,string,TERMIOS,Bastion,rexec # Create a graph of every (i.e. internal and external) dependencies in the # given file (report RP0402 must not be disabled) import-graph= # Create a graph of external dependencies in the given file (report RP0402 must # not be disabled) ext-import-graph= # Create a graph of internal dependencies in the given file (report RP0402 must # not be disabled) int-import-graph= [DESIGN] # Maximum number of arguments for function / method max-args=20 # Argument names that match this expression will be ignored. Default to name # with leading underscore ignored-argument-names=_.* # Maximum number of locals for function / method body max-locals=30 # Maximum number of return / yield for function / method body max-returns=6 # Maximum number of branch for function / method body max-branches=30 # Maximum number of statements in function / method body max-statements=100 # Maximum number of parents for a class (see R0901). max-parents=7 # Maximum number of attributes for a class (see R0902). max-attributes=30 # Minimum number of public methods for a class (see R0903). min-public-methods=0 # Maximum number of public methods for a class (see R0904). max-public-methods=20 [CLASSES] # List of method names used to declare (i.e. assign) instance attributes. defining-attr-methods=__init__,__new__,setUp �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/requirements.txt��������������������������������������������������������������������������0000664�0000000�0000000�00000000046�13443205327�0015516�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������requests m2crypto libvirt-python lxml ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/setup.py����������������������������������������������������������������������������������0000664�0000000�0000000�00000005026�13443205327�0013747�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������from distutils.core import setup, Command from distutils.command.sdist import sdist as _sdist import subprocess import time VERSION = '0.17.0' RELEASE = '1' datafiles = [('share/man/man1', ['man/oz-install.1', 'man/oz-generate-icicle.1', 'man/oz-customize.1', 'man/oz-examples.1', 'man/oz-cleanup-cache.1']) ] class sdist(_sdist): """ custom sdist command, to prep oz.spec file for inclusion """ def run(self): global VERSION global RELEASE # Create a development release string for later use git_head = subprocess.Popen("git log -1 --pretty=format:%h", shell=True, stdout=subprocess.PIPE).communicate()[0].strip() date = time.strftime("%Y%m%d%H%M%S", time.gmtime()) git_release = "%sgit%s" % (date, git_head) # Expand macros in oz.spec.in and create oz.spec spec_in = open('oz.spec.in', 'r') spec = open('oz.spec', 'w') for line in spec_in.xreadlines(): if "@VERSION@" in line: line = line.replace("@VERSION@", VERSION) elif "@RELEASE@" in line: # If development release, include date+githash in %{release} if RELEASE.startswith('0'): RELEASE += '.' + git_release line = line.replace("@RELEASE@", RELEASE) spec.write(line) spec_in.close() spec.close() # Run parent constructor _sdist.run(self) class pytest(Command): user_options = [] def initialize_options(self): pass def finalize_options(self): pass def run(self): try: errno = subprocess.call('py.test-3 tests --verbose --tb=short --junitxml=tests/results.xml'.split()) except OSError as e: if e.errno == 2: raise OSError(2, "No such file or directory: py.test") raise raise SystemExit(errno) setup(name='oz', version=VERSION, description='Oz automated installer', author='Chris Lalancette', author_email='clalancette@gmail.com', license='LGPLv2', url='http://github.com/clalancette/oz', package_dir={'oz': 'oz'}, package_data={'oz': ['auto/*', '*.rng']}, packages=['oz'], scripts=['oz-install', 'oz-generate-icicle', 'oz-customize', 'oz-cleanup-cache'], cmdclass={'sdist': sdist, 'test' : pytest }, data_files = datafiles, ) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/������������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�13443205327�0013374�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/factory/����������������������������������������������������������������������������0000775�0000000�0000000�00000000000�13443205327�0015043�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/factory/test_factory.py�������������������������������������������������������������0000775�0000000�0000000�00000033677�13443205327�0020146�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/python from __future__ import print_function import sys try: import configparser except ImportError: import ConfigParser as configparser try: from StringIO import StringIO except: from io import StringIO import logging import os # Find oz library prefix = '.' for i in range(0,3): if os.path.isdir(os.path.join(prefix, 'oz')): sys.path.insert(0, prefix) break else: prefix = '../' + prefix try: import oz.TDL import oz.GuestFactory except ImportError as e: print(e) print('Unable to import oz. Is oz installed or in your PYTHONPATH?') sys.exit(1) try: import py.test except ImportError: print('Unable to import py.test. Is py.test installed?') sys.exit(1) def default_route(): route_file = "/proc/net/route" d = open(route_file) for line in d: info = line.split() if (len(info) != 11): # 11 = typical num of fields in the file logging.warn(_("Invalid line length while parsing %s.") % (route_file)) break try: route = int(info[1], 16) if route == 0: return info[0] except ValueError: continue raise Exception("Could not find default route") # we find the default route for this machine. Note that this very well # may not be a bridge, but for the purposes of testing the factory, it # doesn't really matter; it just has to have an IP address route = default_route() def runtest(**kwargs): distro = kwargs['distro'] version = kwargs['version'] arch = kwargs['arch'] installtype = kwargs['installtype'] expect_success = kwargs['expect_success'] print("Testing %s-%s-%s-%s" % (distro, version, arch, installtype)) tdlxml = """ <template> <name>tester</name> <os> <name>%s</name> <version>%s</version> <arch>%s</arch> <install type='%s'> <%s>file://example.org</%s> </install> <key>1234</key> </os> </template> """ % (distro, version, arch, installtype, installtype, installtype) success = None saved_exc = None try: tdl = oz.TDL.TDL(tdlxml) config = configparser.SafeConfigParser() config.readfp(StringIO("[libvirt]\nuri=qemu:///session\nbridge_name=%s" % route)) if os.getenv('DEBUG') is not None: logging.basicConfig(level=logging.DEBUG, format="%(message)s") else: logging.basicConfig(level=logging.ERROR, format="%(message)s") oz.GuestFactory.guest_factory(tdl, config, None) if not expect_success: assert(False) except oz.OzException.OzException as e: if expect_success: raise def test_bad_distro(): runtest(distro='foo', version='1', arch='i386', installtype='url', expect_success=False) def test_bad_installtype(): runtest(distro='Fedora', version='14', arch='i386', installtype='duh', expect_success=False) def test_bad_arch(): runtest(distro='Fedora', version='14', arch='ia64', installtype='iso', expect_success=False) def test_fedora_core(): for version in ["1", "2", "3", "4", "5", "6"]: for arch in ["i386", "x86_64"]: for installtype in ["url", "iso"]: runtest(distro='FedoraCore', version=version, arch=arch, installtype=installtype, expect_success=True) runtest(distro='FedoraCore', version='24', arch='x86_64', installtype='iso', expect_success=False) runtest(distro='FedoraCore', version='6', arch='ia64', installtype='iso', expect_success=False) runtest(distro='FedoraCore', version='6', arch='x86_64', installtype='foo', expect_success=False) def test_fedora(): for version in ["7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28"]: for arch in ["i386", "x86_64"]: for installtype in ["url", "iso"]: runtest(distro='Fedora', version=version, arch=arch, installtype=installtype, expect_success=True) runtest(distro='Fedora', version='1', arch='x86_64', installtype='iso', expect_success=False) runtest(distro='Fedora', version='1', arch='ia64', installtype='iso', expect_success=False) runtest(distro='Fedora', version='1', arch='x86_64', installtype='foo', expect_success=False) def test_rhl(): for version in ["7.0", "7.1", "7.2", "7.3", "8", "9"]: runtest(distro='RHL', version=version, arch='i386', installtype='url', expect_success=True) runtest(distro='RHL', version='10', arch='i386', installtype='url', expect_success=False) runtest(distro='RHL', version='9', arch='x86_64', installtype='url', expect_success=False) runtest(distro='RHL', version='9', arch='i386', installtype='iso', expect_success=False) def test_rhel21(): for version in ["GOLD", "U2", "U3", "U4", "U5", "U6"]: runtest(distro='RHEL-2.1', version=version, arch='i386', installtype='url', expect_success=True) runtest(distro='RHEL-2.1', version='U7', arch='i386', installtype='url', expect_success=False) runtest(distro='RHEL-2.1', version='U6', arch='x86_64', installtype='url', expect_success=False) runtest(distro='RHEL-2.1', version='U6', arch='i386', installtype='iso', expect_success=False) def test_rhel3(): for distro in ["RHEL-3", "CentOS-3"]: for version in ["GOLD", "U1", "U2", "U3", "U4", "U5", "U6", "U7", "U8", "U9"]: for arch in ["i386", "x86_64"]: runtest(distro=distro, version=version, arch=arch, installtype='url', expect_success=True) runtest(distro='RHEL-3', version='U10', arch='x86_64', installtype='url', expect_success=False) runtest(distro='RHEL-3', version='U9', arch='ia64', installtype='iso', expect_success=False) runtest(distro='RHEL-3', version='U9', arch='x86_64', installtype='foo', expect_success=False) def test_rhel4(): for distro in ["RHEL-4", "CentOS-4", "ScientificLinux-4"]: for version in ["GOLD", "U1", "U2", "U3", "U4", "U5", "U6", "U7", "U8", "U9"]: for arch in ["i386", "x86_64"]: for installtype in ["url", "iso"]: runtest(distro=distro, version=version, arch=arch, installtype=installtype, expect_success=True) runtest(distro='RHEL-4', version='U10', arch='x86_64', installtype='url', expect_success=False) runtest(distro='RHEL-4', version='U9', arch='ia64', installtype='iso', expect_success=False) runtest(distro='RHEL-4', version='U9', arch='x86_64', installtype='foo', expect_success=False) def test_rhel5(): for distro in ["RHEL-5", "CentOS-5", "ScientificLinux-5"]: for version in ["GOLD", "U1", "U2", "U3", "U4", "U5", "U6", "U7", "U8", "U9", "U10", "U11"]: for arch in ["i386", "x86_64"]: for installtype in ["url", "iso"]: runtest(distro=distro, version=version, arch=arch, installtype=installtype, expect_success=True) runtest(distro='RHEL-5', version='U20', arch='x86_64', installtype='url', expect_success=False) runtest(distro='RHEL-5', version='U9', arch='ia64', installtype='iso', expect_success=False) runtest(distro='RHEL-5', version='U9', arch='x86_64', installtype='foo', expect_success=False) def test_rhel6(): for distro in ["RHEL-6", "CentOS-6", "ScientificLinux-6", "OEL-6"]: for version in ["0", "1", "2", "3", "4", "5", "6", "7", "8"]: for arch in ["i386", "x86_64"]: for installtype in ["url", "iso"]: runtest(distro=distro, version=version, arch=arch, installtype=installtype, expect_success=True) runtest(distro='RHEL-6', version='U9', arch='x86_64', installtype='url', expect_success=False) runtest(distro='RHEL-6', version='8', arch='ia64', installtype='iso', expect_success=False) runtest(distro='RHEL-6', version='8', arch='x86_64', installtype='foo', expect_success=False) def test_rhel7(): for distro in ["RHEL-7", "CentOS-7"]: for version in ["0", "1", "2"]: for arch in ["i386", "x86_64"]: for installtype in ["url", "iso"]: runtest(distro=distro, version=version, arch=arch, installtype=installtype, expect_success=True) runtest(distro='RHEL-7', version='U9', arch='x86_64', installtype='url', expect_success=False) runtest(distro='RHEL-7', version='2', arch='ia64', installtype='iso', expect_success=False) runtest(distro='RHEL-7', version='2', arch='x86_64', installtype='foo', expect_success=False) def test_debian(): for version in ["5", "6", "7", "8", "9"]: for arch in ["i386", "x86_64"]: runtest(distro='Debian', version=version, arch=arch, installtype='iso', expect_success=True) runtest(distro='Debian', version='U9', arch='x86_64', installtype='url', expect_success=False) runtest(distro='Debian', version='9', arch='ia64', installtype='iso', expect_success=False) runtest(distro='Debian', version='9', arch='x86_64', installtype='foo', expect_success=False) def test_windows(): runtest(distro='Windows', version='2000', arch='i386', installtype='iso', expect_success=True) for version in ["XP", "2003", "2008", "7", "8", "2012", "8.1", "2016", "10"]: for arch in ["i386", "x86_64"]: runtest(distro='Windows', version=version, arch=arch, installtype='iso', expect_success=True) runtest(distro='Windows', version='U9', arch='x86_64', installtype='iso', expect_success=False) runtest(distro='Windows', version='2012', arch='ia64', installtype='iso', expect_success=False) runtest(distro='Windows', version='2012', arch='x86_64', installtype='foo', expect_success=False) runtest(distro='Windows', version='2000', arch='x86_64', installtype='iso', expect_success=False) def test_opensuse(): for version in ["10.3", "11.0", "11.1", "11.2", "11.3", "11.4", "12.1", "12.2", "12.3", "13.1", "13.2"]: for arch in ["i386", "x86_64"]: runtest(distro='OpenSUSE', version=version, arch=arch, installtype='iso', expect_success=True) runtest(distro='OpenSUSE', version='U9', arch='x86_64', installtype='iso', expect_success=False) runtest(distro='OpenSUSE', version='13.2', arch='ia64', installtype='iso', expect_success=False) runtest(distro='OpenSUSE', version='13.2', arch='x86_64', installtype='foo', expect_success=False) def test_ubuntu(): for version in ["5.04", "5.10", "6.06", "6.06.1", "6.06.2", "6.10", "7.04", "7.10", "8.04", "8.04.1", "8.04.2", "8.04.3", "8.04.4", "8.10", "9.04", "9.10", "10.04", "10.04.1", "10.04.2", "10.04.3", "10.10", "11.04", "11.10", "12.04", "12.04.1", "12.04.2", "12.04.3", "12.10", "13.04", "13.10", "14.04", "14.10", "15.04", "15.10", "16.04", "16.10", "17.04", "17.10", "18.04"]: for arch in ["i386", "x86_64"]: for installtype in ["iso", "url"]: runtest(distro='Ubuntu', version=version, arch=arch, installtype=installtype, expect_success=True) runtest(distro='Ubuntu', version='U9', arch='x86_64', installtype='iso', expect_success=False) runtest(distro='Ubuntu', version='16.04', arch='ia64', installtype='iso', expect_success=False) runtest(distro='Ubuntu', version='16.04', arch='x86_64', installtype='foo', expect_success=False) def test_mandrake(): for version in ["8.2", "9.1", "9.2", "10.0", "10.1"]: runtest(distro='Mandrake', version=version, arch='i386', installtype='iso', expect_success=True) runtest(distro='Mandrake', version='U9', arch='x86_64', installtype='iso', expect_success=False) runtest(distro='Mandrake', version='10.1', arch='ia64', installtype='iso', expect_success=False) runtest(distro='Mandrake', version='10.1', arch='x86_64', installtype='foo', expect_success=False) runtest(distro='Mandrake', version='10.1', arch='x86_64', installtype='url', expect_success=False) def test_mandriva(): for version in ["2005", "2006.0", "2007.0", "2008.0"]: for arch in ["i386", "x86_64"]: runtest(distro='Mandriva', version=version, arch=arch, installtype='iso', expect_success=True) runtest(distro='Mandriva', version='U9', arch='x86_64', installtype='iso', expect_success=False) runtest(distro='Mandriva', version='2008.0', arch='ia64', installtype='iso', expect_success=False) runtest(distro='Mandriva', version='2008.0', arch='x86_64', installtype='foo', expect_success=False) runtest(distro='Mandriva', version='2008.0', arch='x86_64', installtype='url', expect_success=False) def test_mageia(): for version in ["2", "3", "4", "4.1", "5"]: for arch in ["i386", "x86_64"]: runtest(distro='Mageia', version=version, arch=arch, installtype='iso', expect_success=True) runtest(distro='Mageia', version='U9', arch='x86_64', installtype='iso', expect_success=False) runtest(distro='Mageia', version='5', arch='ia64', installtype='iso', expect_success=False) runtest(distro='Mageia', version='5', arch='x86_64', installtype='foo', expect_success=False) �����������������������������������������������������������������oz-0.17.0/tests/guest/������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�13443205327�0014523�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/libvirt/����������������������������������������������������������������������0000775�0000000�0000000�00000000000�13443205327�0016176�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/libvirt/test_get_disks_and_interfaces.xml�������������������������������������0000664�0000000�0000000�00000002043�13443205327�0024757�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0"?> <domain type="qemu"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <target dev="vnet7"/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <serial type="tcp"> <source mode="bind" host="127.0.0.1" service="%s"/> <protocol type="raw"/> <target port="1"/> </serial> <disk device="disk" type="file"> <target dev="vda" bus="virtio"/> <source file="%s"/> <driver name="qemu" type="raw"/> </disk> </devices> </domain> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/libvirt/test_get_disks_and_interfaces_missing_disk_target.xml�����������������0000664�0000000�0000000�00000001774�13443205327�0031102�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0"?> <domain type="qemu"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <target dev="vnet7"/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <serial type="tcp"> <source mode="bind" host="127.0.0.1" service="%s"/> <protocol type="raw"/> <target port="1"/> </serial> <disk device="disk" type="file"> <source file="%s"/> <driver name="qemu" type="raw"/> </disk> </devices> </domain> ����oz-0.17.0/tests/guest/libvirt/test_get_disks_and_interfaces_missing_disk_target_device.xml����������0000664�0000000�0000000�00000002031�13443205327�0032404�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0"?> <domain type="qemu"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <target dev="vnet7"/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <serial type="tcp"> <source mode="bind" host="127.0.0.1" service="%s"/> <protocol type="raw"/> <target port="1"/> </serial> <disk device="disk" type="file"> <target bus="virtio"/> <source file="%s"/> <driver name="qemu" type="raw"/> </disk> </devices> </domain> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/libvirt/test_get_disks_and_interfaces_missing_interface_target.xml������������0000664�0000000�0000000�00000002007�13443205327�0032076�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0"?> <domain type="qemu"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <serial type="tcp"> <source mode="bind" host="127.0.0.1" service="%s"/> <protocol type="raw"/> <target port="1"/> </serial> <disk device="disk" type="file"> <target dev="vda" bus="virtio"/> <source file="%s"/> <driver name="qemu" type="raw"/> </disk> </devices> </domain> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/libvirt/test_get_disks_and_interfaces_missing_interface_target_device.xml�����0000664�0000000�0000000�00000002027�13443205327�0033417�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0"?> <domain type="qemu"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <target/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <serial type="tcp"> <source mode="bind" host="127.0.0.1" service="%s"/> <protocol type="raw"/> <target port="1"/> </serial> <disk device="disk" type="file"> <target dev="vda" bus="virtio"/> <source file="%s"/> <driver name="qemu" type="raw"/> </disk> </devices> </domain> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/libvirt/test_modify_libvirt_xml_diskimage.xml���������������������������������0000664�0000000�0000000�00000002015�13443205327�0025674�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<domain type="qemu"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <target dev="vnet7"/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <serial type="tcp"> <source mode="bind" host="127.0.0.1" service="%s"/> <protocol type="raw"/> <target port="1"/> </serial> <disk device="disk" type="file"> <target dev="vda" bus="virtio"/> <source file="%s"/> <driver name="qemu" type="raw"/> </disk> </devices> </domain> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/libvirt/test_modify_libvirt_xml_diskimage_final.xml���������������������������0000664�0000000�0000000�00000002017�13443205327�0027047�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<domain type="qemu"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <target dev="vnet7"/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <serial type="tcp"> <source mode="bind" host="127.0.0.1" service="%s"/> <protocol type="raw"/> <target port="1"/> </serial> <disk device="disk" type="file"> <target dev="vda" bus="virtio"/> <source file="%s"/> <driver name="qemu" type="qcow2"/> </disk> </devices> </domain> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/libvirt/test_modify_libvirt_xml_diskimage_missing_disk_source.xml�������������0000664�0000000�0000000�00000002011�13443205327�0032013�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0"?> <domain type="qemu"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <target dev="vnet7"/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <serial type="tcp"> <source mode="bind" host="127.0.0.1" service="%s"/> <protocol type="raw"/> <target port="1"/> </serial> <disk device="disk" type="file"> <target dev="vda" bus="virtio"/> <driver name="qemu" type="raw"/> </disk> </devices> </domain> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/libvirt/test_modify_libvirt_xml_diskimage_too_many_drivers.xml����������������0000664�0000000�0000000�00000002114�13443205327�0031337�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0"?> <domain type="qemu"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <target dev="vnet7"/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <serial type="tcp"> <source mode="bind" host="127.0.0.1" service="%s"/> <protocol type="raw"/> <target port="1"/> </serial> <disk device="disk" type="file"> <target dev="vda" bus="virtio"/> <source file="%s"/> <driver name="qemu" type="raw"/> <driver name="qemu" type="qcow2"/> </disk> </devices> </domain> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/libvirt/test_modify_libvirt_xml_for_serial.xml��������������������������������0000664�0000000�0000000�00000002015�13443205327�0026064�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<domain type="qemu"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <target dev="vnet7"/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <serial type="tcp"> <source mode="bind" host="127.0.0.1" service="%s"/> <protocol type="raw"/> <target port="1"/> </serial> <disk device="disk" type="file"> <target dev="vda" bus="virtio"/> <source file="%s"/> <driver name="qemu" type="raw"/> </disk> </devices> </domain> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/libvirt/test_modify_libvirt_xml_for_serial_final.xml��������������������������0000664�0000000�0000000�00000001756�13443205327�0027250�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<domain type="qemu"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <target dev="vnet7"/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <disk device="disk" type="file"> <target dev="vda" bus="virtio"/> <source file="%s"/> <driver name="qemu" type="raw"/> </disk> <serial type="tcp"><source mode="bind" host="127.0.0.1" service="%s"/><protocol type="raw"/><target port="1"/></serial></devices> </domain> ������������������oz-0.17.0/tests/guest/libvirt/test_modify_libvirt_xml_for_serial_missing_devices.xml����������������0000664�0000000�0000000�00000000646�13443205327�0031327�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0"?> <domain type="qemu"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> </domain> ������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/libvirt/test_modify_libvirt_xml_for_serial_too_many_devices.xml���������������0000664�0000000�0000000�00000003241�13443205327�0031475�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0"?> <domain type="qemu"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <target dev="vnet7"/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <serial type="tcp"> <source mode="bind" host="127.0.0.1" service="%s"/> <protocol type="raw"/> <target port="1"/> </serial> <disk device="disk" type="file"> <target dev="vda" bus="virtio"/> <source file="%s"/> <driver name="qemu" type="raw"/> </disk> </devices> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <target dev="vnet7"/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <serial type="tcp"> <source mode="bind" host="127.0.0.1" service="%s"/> <protocol type="raw"/> <target port="1"/> </serial> <disk device="disk" type="file"> <target dev="vda" bus="virtio"/> <source file="%s"/> <driver name="qemu" type="raw"/> </disk> </devices> </domain> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/libvirt/test_modify_libvirt_xml_for_serial_too_many_targets.xml���������������0000664�0000000�0000000�00000002074�13443205327�0031527�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0"?> <domain type="qemu"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <target dev="vnet7"/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <serial type="tcp"> <source mode="bind" host="127.0.0.1" service="%s"/> <protocol type="raw"/> <target port="1"/> <target port="2"/> </serial> <disk device="disk" type="file"> <target dev="vda" bus="virtio"/> <source file="%s"/> <driver name="qemu" type="raw"/> </disk> </devices> </domain> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/libvirt/test_xml_generation_1.xml���������������������������������������������0000664�0000000�0000000�00000001760�13443205327�0023216�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<domain type="kvm"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <serial type="tcp"> <source mode="bind" host="127.0.0.1" service="%s"/> <protocol type="raw"/> <target port="1"/> </serial> <disk device="disk" type="file"> <target dev="vda" bus="virtio"/> <source file="%s"/> <driver name="qemu" type="raw"/> </disk> </devices> </domain> ����������������oz-0.17.0/tests/guest/libvirt/test_xml_generation_2.xml���������������������������������������������0000664�0000000�0000000�00000002312�13443205327�0023211�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<domain type="kvm"> <name>tester</name> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <uuid>%s</uuid> <clock offset="utc"/> <vcpu>1</vcpu> <features> <acpi/> <apic/> <pae/> </features> <os> <type>hvm</type> <boot dev="hd"/> <kernel>kernel option</kernel> <initrd>initrd option</initrd> <cmdline>command line</cmdline> </os> <on_poweroff>destroy</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> <devices> <graphics port="-1" type="vnc"/> <interface type="bridge"> <source bridge="%s"/> <mac address="52:54:00:04:cc:a6"/> <model type="virtio"/> </interface> <input bus="ps2" type="mouse"/> <serial type="pty"> <target port="0"/> </serial> <serial type="tcp"> <source mode="bind" host="127.0.0.1" service="%s"/> <protocol type="raw"/> <target port="1"/> </serial> <disk device="disk" type="file"> <target dev="vda" bus="virtio"/> <source file="%s"/> <driver name="qemu" type="raw"/> </disk> <disk type="file" device="blue"> <source file="/var/bin/foo"/> <target dev="muni"/> </disk> </devices> </domain> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/test.icicle�������������������������������������������������������������������0000664�0000000�0000000�00000004167�13443205327�0016664�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<icicle> <description>Icicle Description</description> <packages> <package name="accountsservice"/> <package name="adduser"/> <package name="apparmor"/> <package name="apt"/> <package name="apt-transport-https"/> <package name="apt-utils"/> <package name="apt-xapian-index"/> <package name="aptitude"/> <package name="at"/> <package name="base-files"/> <package name="base-passwd"/> <package name="bash"/> <package name="bash-completion"/> <package name="bind9-host"/> <package name="binutils"/> <package name="bsdmainutils"/> <package name="bsdutils"/> <package name="build-essential"/> <package name="busybox-initramfs"/> <package name="busybox-static"/> <package name="bzip2"/> <package name="ca-certificates"/> <package name="chef"/> <package name="cloud-init"/> <package name="cloud-initramfs-growroot"/> <package name="cloud-initramfs-rescuevol"/> <package name="cloud-utils"/> <package name="comerr-dev"/> <package name="console-setup"/> <package name="coreutils"/> <package name="cpio"/> <package name="cpp"/> <package name="cpp-4.6"/> <package name="crda"/> <package name="cron"/> <package name="curl"/> <package name="dash"/> <package name="dbus"/> <package name="debconf"/> <package name="debconf-i18n"/> <package name="debianutils"/> <package name="denyhosts"/> <package name="diffutils"/> <package name="discover"/> <package name="discover-data"/> <package name="dkms"/> <package name="dmidecode"/> <package name="dmsetup"/> <package name="dnsutils"/> <package name="dosfstools"/> <package name="dpkg"/> <package name="dpkg-dev"/> <package name="e2fslibs"/> <package name="e2fsprogs"/> <package name="ed"/> <package name="eject"/> <package name="euca2ools"/> <package name="fakeroot"/> <package name="file"/> <package name="findutils"/> <package name="friendly-recovery"/> <package name="ftp"/> <package name="fuse"/> <package name="g++"/> <package name="g++-4.6"/> </packages> </icicle> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/guest/test_guest.py�����������������������������������������������������������������0000664�0000000�0000000�00000047005�13443205327�0017271�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/python import sys import getpass try: import configparser except ImportError: import ConfigParser as configparser try: from StringIO import StringIO except: from io import StringIO import logging import os # Find oz library prefix = '.' for i in range(0,3): if os.path.isdir(os.path.join(prefix, 'oz')): sys.path.insert(0, prefix) break else: prefix = '../' + prefix try: import oz.TDL import oz.GuestFactory except ImportError as e: print(e) print('Unable to import oz. Is oz installed or in your PYTHONPATH?') sys.exit(1) try: import py.test except ImportError: print('Unable to import py.test. Is py.test installed?') sys.exit(1) def default_route(): route_file = "/proc/net/route" d = open(route_file) defn = 0 for line in d: info = line.split() if (len(info) != 11): # 11 = typical num of fields in the file logging.warn(_("Invalid line length while parsing %s.") % (route_file)) break try: route = int(info[1], 16) if route == 0: return info[0] except ValueError: continue raise Exception("Could not find default route") # we find the default route for this machine. Note that this very well # may not be a bridge, but for the purposes of testing the factory, it # doesn't really matter; it just has to have an IP address route = default_route() def setup_guest(xml, macaddress=None): tdl = oz.TDL.TDL(xml) config = configparser.SafeConfigParser() config.readfp(StringIO("[libvirt]\nuri=qemu:///session\nbridge_name=%s" % route)) guest = oz.GuestFactory.guest_factory(tdl, config, None, macaddress=macaddress) return guest tdlxml = """ <template> <name>tester</name> <os> <name>Fedora</name> <version>14</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux//releases/14/Fedora/x86_64/os/</url> </install> </os> </template> """ tdlxml2 = """ <template> <name>tester</name> <os> <name>Fedora</name> <version>14</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux//releases/14/Fedora/x86_64/os/</url> </install> </os> <disk> <size>20</size> </disk> </template> """ def test_geteltorito_none_src(): guest = setup_guest(tdlxml) with py.test.raises(oz.OzException.OzException): guest._geteltorito(None, None) def test_geteltorito_none_dst(tmpdir): guest = setup_guest(tdlxml) src = os.path.join(str(tmpdir), 'src') open(src, 'w').write('src') with py.test.raises(oz.OzException.OzException): guest._geteltorito(src, None) def test_geteltorito_short_pvd(tmpdir): guest = setup_guest(tdlxml) src = os.path.join(str(tmpdir), 'src') open(src, 'w').write('foo') dst = os.path.join(str(tmpdir), 'dst') with py.test.raises(Exception): guest._geteltorito(src, dst) def test_geteltorito_bogus_pvd_desc(tmpdir): guest = setup_guest(tdlxml) src = os.path.join(str(tmpdir), 'src') fd = open(src, 'w') fd.seek(16*2048) fd.write('\0'*128) fd.close() dst = os.path.join(str(tmpdir), 'dst') with py.test.raises(oz.OzException.OzException): guest._geteltorito(src, dst) def test_geteltorito_bogus_pvd_ident(tmpdir): guest = setup_guest(tdlxml) src = os.path.join(str(tmpdir), 'src') fd = open(src, 'w') fd.seek(16*2048) fd.write("\x01") fd.write('\0'*127) fd.close() dst = os.path.join(str(tmpdir), 'dst') with py.test.raises(oz.OzException.OzException): guest._geteltorito(src, dst) def test_geteltorito_bogus_pvd_unused(tmpdir): guest = setup_guest(tdlxml) src = os.path.join(str(tmpdir), 'src') fd = open(src, 'w') fd.seek(16*2048) fd.write("\x01") fd.write("CD001") fd.write("\0x1") fd.write('\0'*127) fd.close() dst = os.path.join(str(tmpdir), 'dst') with py.test.raises(oz.OzException.OzException): guest._geteltorito(src, dst) def test_geteltorito_bogus_pvd_unused2(tmpdir): guest = setup_guest(tdlxml) src = os.path.join(str(tmpdir), 'src') fd = open(src, 'w') fd.seek(16*2048) fd.write("\x01") fd.write("CD001") fd.write("\x01") fd.write("\x00") fd.write("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") fd.write("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB") fd.write("\x01") fd.write('\0'*127) fd.close() dst = os.path.join(str(tmpdir), 'dst') with py.test.raises(oz.OzException.OzException): guest._geteltorito(src, dst) def test_geteltorito_short_boot_sector(tmpdir): guest = setup_guest(tdlxml) src = os.path.join(str(tmpdir), 'src') fd = open(src, 'w') fd.seek(16*2048) fd.write("\x01") fd.write("CD001") fd.write("\x01") fd.write("\x00") fd.write("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") fd.write("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB") fd.write("\x00") fd.write('\0'*127) fd.close() dst = os.path.join(str(tmpdir), 'dst') with py.test.raises(Exception): guest._geteltorito(src, dst) def test_geteltorito_bogus_boot_sector(tmpdir): guest = setup_guest(tdlxml) src = os.path.join(str(tmpdir), 'src') fd = open(src, 'w') fd.seek(16*2048) fd.write("\x01") fd.write("CD001") fd.write("\x01") fd.write("\x00") fd.write("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") fd.write("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB") fd.write("\x00") fd.write('\0'*127) fd.seek(17*2048) fd.write("\x01") fd.write('\0'*75) fd.close() dst = os.path.join(str(tmpdir), 'dst') with py.test.raises(oz.OzException.OzException): guest._geteltorito(src, dst) def test_geteltorito_bogus_boot_isoident(tmpdir): guest = setup_guest(tdlxml) src = os.path.join(str(tmpdir), 'src') fd = open(src, 'w') fd.seek(16*2048) fd.write("\x01") fd.write("CD001") fd.write("\x01") fd.write("\x00") fd.write("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") fd.write("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB") fd.write("\x00") fd.write('\0'*127) fd.seek(17*2048) fd.write("\x00") fd.write("AAAAA") fd.write('\0'*75) fd.close() dst = os.path.join(str(tmpdir), 'dst') with py.test.raises(oz.OzException.OzException): guest._geteltorito(src, dst) def test_geteltorito_bogus_boot_version(tmpdir): guest = setup_guest(tdlxml) src = os.path.join(str(tmpdir), 'src') fd = open(src, 'w') fd.seek(16*2048) fd.write("\x01") fd.write("CD001") fd.write("\x01") fd.write("\x00") fd.write("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") fd.write("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB") fd.write("\x00") fd.write('\0'*127) fd.seek(17*2048) fd.write("\x00") fd.write("CD001") fd.write('\0'*75) fd.close() dst = os.path.join(str(tmpdir), 'dst') with py.test.raises(oz.OzException.OzException): guest._geteltorito(src, dst) def test_geteltorito_bogus_boot_torito(tmpdir): guest = setup_guest(tdlxml) src = os.path.join(str(tmpdir), 'src') fd = open(src, 'w') fd.seek(16*2048) fd.write("\x01") fd.write("CD001") fd.write("\x01") fd.write("\x00") fd.write("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") fd.write("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB") fd.write("\x00") fd.write('\0'*127) fd.seek(17*2048) fd.write("\x00") fd.write("CD001") fd.write("\x01") fd.write('\0'*75) fd.close() dst = os.path.join(str(tmpdir), 'dst') with py.test.raises(oz.OzException.OzException): guest._geteltorito(src, dst) def test_geteltorito_bogus_bootp(tmpdir): guest = setup_guest(tdlxml) src = os.path.join(str(tmpdir), 'src') fd = open(src, 'w') fd.seek(16*2048) fd.write("\x01") fd.write("CD001") fd.write("\x01") fd.write("\x00") fd.write("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") fd.write("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB") fd.write("\x00") fd.write('\0'*127) fd.seek(17*2048) fd.write("\x00") fd.write("CD001") fd.write("\x01") fd.write("EL TORITO SPECIFICATION") fd.write('\0'*41) fd.write("\x20\x00\x00\x00") fd.close() dst = os.path.join(str(tmpdir), 'dst') with py.test.raises(Exception): guest._geteltorito(src, dst) def test_init_guest(): guest = setup_guest(tdlxml2) assert guest.disksize == 20 assert guest.image_name() == 'tester' assert guest.output_image_path() == '/home/%s/.oz/images/tester.dsk' % getpass.getuser() assert guest.default_auto_file() == True def test_init_guest_bad_arch(): tdl = oz.TDL.TDL(tdlxml) tdl.arch = 'armhf' # Done here to make sure the TDL class doesn't error config = configparser.SafeConfigParser() config.readfp(StringIO("[libvirt]\nuri=qemu:///session\nbridge_name=%s" % route)) with py.test.raises(Exception): oz.GuestFactory.guest_factory(tdl, config, None) def test_icicle_generation(): guest = setup_guest(tdlxml) with open(os.path.dirname(__file__) + '/test.icicle', 'r') as handle: test_icicle = handle.read() packages = [ "accountsservice", "adduser", "apparmor", "apt", "apt-transport-https", "apt-utils", "apt-xapian-index", "aptitude", "at", "base-files", "base-passwd", "bash", "bash-completion", "bind9-host", "binutils", "bsdmainutils", "bsdutils", "build-essential", "busybox-initramfs", "busybox-static", "bzip2", "ca-certificates", "chef", "cloud-init", "cloud-initramfs-growroot", "cloud-initramfs-rescuevol", "cloud-utils", "comerr-dev", "console-setup", "coreutils", "cpio", "cpp", "cpp-4.6", "crda", "cron", "curl", "dash", "dbus", "debconf", "debconf-i18n", "debianutils", "denyhosts", "diffutils", "discover", "discover-data", "dkms", "dmidecode", "dmsetup", "dnsutils", "dosfstools", "dpkg", "dpkg-dev", "e2fslibs", "e2fsprogs", "ed", "eject", "euca2ools", "fakeroot", "file", "findutils", "friendly-recovery", "ftp", "fuse", "g++", "g++-4.6" ] icicle = guest._output_icicle_xml(packages, 'Icicle Description') assert test_icicle == icicle def test_xml_generation_1(): # Provide a macaddress so testing is easier guest = setup_guest(tdlxml, macaddress='52:54:00:04:cc:a6') with open(os.path.dirname(__file__) + '/libvirt/test_xml_generation_1.xml', 'r') as handle: test_xml = handle.read() # Replace various smaller items as they are auto generated test_xml = test_xml % (guest.uuid, route, guest.listen_port, guest.diskimage) bootdev = 'hd' installdev = None libvirt = guest._generate_xml(bootdev, installdev) assert test_xml == libvirt def test_xml_generation_2(): # Provide a macaddress so testing is easier guest = setup_guest(tdlxml, macaddress='52:54:00:04:cc:a6') with open(os.path.dirname(__file__) + '/libvirt/test_xml_generation_2.xml', 'r') as handle: test_xml = handle.read() # Replace various smaller items as they are auto generated test_xml = test_xml % (guest.uuid, route, guest.listen_port, guest.diskimage) bootdev = 'hd' installdev = guest._InstallDev('blue', '/var/bin/foo', 'muni') libvirt = guest._generate_xml(bootdev, installdev, kernel='kernel option', initrd='initrd option', cmdline='command line') assert test_xml == libvirt def test_get_disks_and_interfaces(): # Provide a macaddress so testing is easier guest = setup_guest(tdlxml, macaddress='52:54:00:04:cc:a6') path = os.path.dirname(__file__) + '/libvirt/test_get_disks_and_interfaces.xml' # Get the comparision xml with open(path, 'r') as handle: # Replace various smaller items as they are auto generated test_xml = handle.read() % (guest.uuid, route, guest.listen_port, guest.diskimage) disks, interfaces = guest._get_disks_and_interfaces(test_xml) assert disks == ['vda'] assert interfaces == ['vnet7'] def test_get_disks_and_interfaces_missing_interface_target(): # Provide a macaddress so testing is easier guest = setup_guest(tdlxml, macaddress='52:54:00:04:cc:a6') path = os.path.dirname(__file__) + '/libvirt/test_get_disks_and_interfaces_missing_interface_target.xml' # Get the comparision xml with open(path, 'r') as handle: with py.test.raises(Exception): # Replace various smaller items as they are auto generated test_xml = handle.read() % (guest.uuid, route, guest.listen_port, guest.diskimage) guest._get_disks_and_interfaces(test_xml) def test_get_disks_and_interfaces_missing_interface_target_device(): # Provide a macaddress so testing is easier guest = setup_guest(tdlxml, macaddress='52:54:00:04:cc:a6') path = os.path.dirname(__file__) + '/libvirt/test_get_disks_and_interfaces_missing_interface_target_device.xml' # Get the comparision xml with open(path, 'r') as handle: with py.test.raises(Exception): # Replace various smaller items as they are auto generated test_xml = handle.read() % (guest.uuid, route, guest.listen_port, guest.diskimage) guest._get_disks_and_interfaces(test_xml) def test_get_disks_and_interfaces_missing_disk_target(): # Provide a macaddress so testing is easier guest = setup_guest(tdlxml, macaddress='52:54:00:04:cc:a6') path = os.path.dirname(__file__) + '/libvirt/test_get_disks_and_interfaces_missing_disk_target.xml' # Get the comparision xml with open(path, 'r') as handle: with py.test.raises(Exception): # Replace various smaller items as they are auto generated test_xml = handle.read() % (guest.uuid, route, guest.listen_port, guest.diskimage) guest._get_disks_and_interfaces(test_xml) def test_get_disks_and_interfaces_missing_disk_target_device(): # Provide a macaddress so testing is easier guest = setup_guest(tdlxml, macaddress='52:54:00:04:cc:a6') # Get the comparision xml path = os.path.dirname(__file__) + '/libvirt/test_get_disks_and_interfaces_missing_disk_target_device.xml' with open(path, 'r') as handle: with py.test.raises(Exception): # Replace various smaller items as they are auto generated test_xml = handle.read() % (guest.uuid, route, guest.listen_port, guest.diskimage) guest._get_disks_and_interfaces(test_xml) def test_modify_libvirt_xml_for_serial(): # Provide a macaddress so testing is easier guest = setup_guest(tdlxml, macaddress='52:54:00:04:cc:a6') # Get the comparision xml path = os.path.dirname(__file__) + '/libvirt/test_modify_libvirt_xml_for_serial.xml' with open(path, 'r') as handle: # Replace various smaller items as they are auto generated test_xml = handle.read() % (guest.uuid, route, guest.listen_port, guest.diskimage) final = guest._modify_libvirt_xml_for_serial(test_xml) path = os.path.dirname(__file__) + '/libvirt/test_modify_libvirt_xml_for_serial_final.xml' with open(path, 'r') as handle: # Replace various smaller items as they are auto generated final_xml = handle.read() % (guest.uuid, route, guest.diskimage, guest.listen_port) assert final_xml == final def test_modify_libvirt_xml_for_serial_too_many_targets(): # Provide a macaddress so testing is easier guest = setup_guest(tdlxml, macaddress='52:54:00:04:cc:a6') # Get the comparision xml path = os.path.dirname(__file__) + '/libvirt/test_modify_libvirt_xml_for_serial_too_many_targets.xml' with open(path, 'r') as handle: with py.test.raises(Exception): # Replace various smaller items as they are auto generated test_xml = handle.read() % (guest.uuid, route, guest.listen_port, guest.diskimage) guest._modify_libvirt_xml_for_serial(test_xml) def test_modify_libvirt_xml_for_serial_missing_devices(): # Provide a macaddress so testing is easier guest = setup_guest(tdlxml, macaddress='52:54:00:04:cc:a6') # Get the comparision xml path = os.path.dirname(__file__) + '/libvirt/test_modify_libvirt_xml_for_serial_missing_devices.xml' with open(path, 'r') as handle: with py.test.raises(Exception): # Replace various smaller items as they are auto generated test_xml = handle.read() % (guest.uuid, route, guest.listen_port, guest.diskimage) guest._modify_libvirt_xml_for_serial(test_xml) def test_modify_libvirt_xml_for_serial_too_many_devices(): # Provide a macaddress so testing is easier guest = setup_guest(tdlxml, macaddress='52:54:00:04:cc:a6') # Get the comparision xml path = os.path.dirname(__file__) + '/libvirt/test_modify_libvirt_xml_for_serial_too_many_devices.xml' with open(path, 'r') as handle: with py.test.raises(Exception): # Replace various smaller items as they are auto generated test_xml = handle.read() % (guest.uuid, route, guest.listen_port, guest.diskimage) guest._modify_libvirt_xml_for_serial(test_xml) def test_modify_libvirt_xml_diskimage(): # Provide a macaddress so testing is easier guest = setup_guest(tdlxml, macaddress='52:54:00:04:cc:a6') # Get the comparision xml path = os.path.dirname(__file__) + '/libvirt/test_modify_libvirt_xml_diskimage.xml' with open(path, 'r') as handle: # Replace various smaller items as they are auto generated test_xml = handle.read() % (guest.uuid, route, guest.listen_port, guest.diskimage) name, ext = os.path.splitext(guest.diskimage) image = name + '.qcow2' final = guest._modify_libvirt_xml_diskimage(test_xml, image, 'qcow2') path = os.path.dirname(__file__) + '/libvirt/test_modify_libvirt_xml_diskimage_final.xml' with open(path, 'r') as handle: # Replace various smaller items as they are auto generated final_xml = handle.read() % (guest.uuid, route, guest.listen_port, image) assert final_xml == final def test_modify_libvirt_xml_diskimage_missing_disk_source(): # Provide a macaddress so testing is easier guest = setup_guest(tdlxml, macaddress='52:54:00:04:cc:a6') # Get the comparision xml path = os.path.dirname(__file__) + '/libvirt/test_modify_libvirt_xml_diskimage_missing_disk_source.xml' with open(path, 'r') as handle: with py.test.raises(Exception): # Replace various smaller items as they are auto generated test_xml = handle.read() % (guest.uuid, route, guest.listen_port, guest.diskimage) guest._modify_libvirt_xml_diskimage(test_xml, guest.diskimage, 'qcow2') def test_modify_libvirt_xml_diskimage_too_many_drivers(): # Provide a macaddress so testing is easier guest = setup_guest(tdlxml, macaddress='52:54:00:04:cc:a6') # Get the comparision xml path = os.path.dirname(__file__) + '/libvirt/test_modify_libvirt_xml_diskimage_too_many_drivers.xml' with open(path, 'r') as handle: with py.test.raises(Exception): # Replace various smaller items as they are auto generated test_xml = handle.read() % (guest.uuid, route, guest.listen_port, guest.diskimage) guest._modify_libvirt_xml_diskimage(test_xml, guest.diskimage, 'qcow2') ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/ozutil/�����������������������������������������������������������������������������0000775�0000000�0000000�00000000000�13443205327�0014722�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/ozutil/test_ozutil.py���������������������������������������������������������������0000664�0000000�0000000�00000035313�13443205327�0017666�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/python import sys import os try: import py.test except ImportError: print('Unable to import py.test. Is py.test installed?') sys.exit(1) # Find oz prefix = '.' for i in range(0,3): if os.path.isdir(os.path.join(prefix, 'oz')): sys.path.insert(0, prefix) break else: prefix = '../' + prefix try: import oz.ozutil except ImportError: print('Unable to import oz. Is oz installed?') sys.exit(1) # test oz.ozutil.generate_full_auto_path def test_auto(): assert(oz.ozutil.generate_full_auto_path('fedora-14-jeos.ks') == os.path.realpath(os.path.join(prefix, 'oz', 'auto', 'fedora-14-jeos.ks'))) def test_auto_none(): with py.test.raises(Exception): oz.ozutil.generate_full_auto_path(None) # test oz.ozutil.executable_exists def test_exe_exists_bin_ls(): assert(oz.ozutil.executable_exists('/bin/ls')) def test_exe_exists_foo(): with py.test.raises(Exception): oz.ozutil.executable_exists('foo') def test_exe_exists_full_foo(): with py.test.raises(Exception): oz.ozutil.executable_exists('/bin/foo') def test_exe_exists_not_x(): with py.test.raises(Exception): oz.ozutil.executable_exists('/etc/hosts') def test_exe_exists_relative_false(): assert(oz.ozutil.executable_exists('false')) def test_exe_exists_none(): with py.test.raises(Exception): oz.ozutil.executable_exists(None) # test oz.ozutil.copyfile_sparse def test_copy_sparse_none_src(): with py.test.raises(Exception): oz.ozutil.copyfile_sparse(None, None) def test_copy_sparse_none_dst(tmpdir): fullname = os.path.join(str(tmpdir), 'src') open(fullname, 'w').write('src') with py.test.raises(Exception): oz.ozutil.copyfile_sparse(fullname, None) def test_copy_sparse_bad_src_mode(tmpdir): if os.geteuid() == 0: # this test won't work as root, since root can copy any mode files return fullname = os.path.join(str(tmpdir), 'writeonly') open(fullname, 'w').write('writeonly') os.chmod(fullname, 0000) # because copyfile_sparse uses os.open() instead of open(), it throws an # OSError with py.test.raises(OSError): oz.ozutil.copyfile_sparse(fullname, 'output') def test_copy_sparse_bad_dst_mode(tmpdir): if os.geteuid() == 0: # this test won't work as root, since root can copy any mode files return srcname = os.path.join(str(tmpdir), 'src') open(srcname, 'w').write('src') dstname = os.path.join(str(tmpdir), 'dst') open(dstname, 'w').write('dst') os.chmod(dstname, 0o444) with py.test.raises(OSError): oz.ozutil.copyfile_sparse(srcname, dstname) def test_copy_sparse_zero_size_src(tmpdir): srcname = os.path.join(str(tmpdir), 'src') fd = open(srcname, 'w') fd.close() dstname = os.path.join(str(tmpdir), 'dst') oz.ozutil.copyfile_sparse(srcname, dstname) assert(os.stat(dstname).st_size == 0) def test_copy_sparse_small_src(tmpdir): srcname = os.path.join(str(tmpdir), 'src') open(srcname, 'w').write('src') dstname = os.path.join(str(tmpdir), 'dst') oz.ozutil.copyfile_sparse(srcname, dstname) assert(os.stat(dstname).st_size == 3) def test_copy_sparse_one_block_src(tmpdir): with open('/dev/urandom', 'rb') as infd: # we read 32*1024 to make sure we use one big buf_size block (see the # implementation of copyfile_sparse) data = infd.read(32*1024) srcname = os.path.join(str(tmpdir), 'src') with open(srcname, 'wb') as outfd: outfd.write(data) dstname = os.path.join(str(tmpdir), 'dst') oz.ozutil.copyfile_sparse(srcname, dstname) assert(os.stat(dstname).st_size == 32*1024) def test_copy_sparse_many_blocks_src(tmpdir): with open('/dev/urandom', 'rb') as infd: # we read 32*1024 to make sure we use one big buf_size block (see the # implementation of copyfile_sparse) data = infd.read(32*1024*10) srcname = os.path.join(str(tmpdir), 'src') with open(srcname, 'wb') as outfd: outfd.write(data) dstname = os.path.join(str(tmpdir), 'dst') oz.ozutil.copyfile_sparse(srcname, dstname) assert(os.stat(dstname).st_size == 32*1024*10) def test_copy_sparse_zero_blocks(tmpdir): with open('/dev/urandom', 'rb') as infd: # we read 32*1024 to make sure we use one big buf_size block (see the # implementation of copyfile_sparse) data1 = infd.read(32*1024) data2 = infd.read(32*1024) srcname = os.path.join(str(tmpdir), 'src') with open(srcname, 'wb') as outfd: outfd.write(data1) outfd.write(b'\0'*32*1024) outfd.write(data2) dstname = os.path.join(str(tmpdir), 'dst') oz.ozutil.copyfile_sparse(srcname, dstname) assert(os.stat(dstname).st_size == 32*1024*3) def test_copy_sparse_src_not_exists(tmpdir): srcname = os.path.join(str(tmpdir), 'src') dstname = os.path.join(str(tmpdir), 'dst') open(dstname, 'w').write('dst') with py.test.raises(Exception): oz.ozutil.copyfile_sparse(srcname, dstname) def test_copy_sparse_dest_not_exists(tmpdir): srcname = os.path.join(str(tmpdir), 'src') open(srcname, 'w').write('src') dstname = os.path.join(str(tmpdir), 'dst') oz.ozutil.copyfile_sparse(srcname, dstname) assert(os.stat(dstname).st_size == 3) def test_copy_sparse_src_is_dir(tmpdir): dstname = os.path.join(str(tmpdir), 'dst') open(dstname, 'w').write('dst') with py.test.raises(Exception): oz.ozutil.copyfile_sparse(tmpdir, dstname) def test_copy_sparse_dst_is_dir(tmpdir): srcname = os.path.join(str(tmpdir), 'src') open(srcname, 'w').write('src') with py.test.raises(Exception): oz.ozutil.copyfile_sparse(srcname, tmpdir) # test oz.ozutil.string_to_bool def test_stb_no(): for nletter in ['n', 'N']: for oletter in ['o', 'O']: curr = nletter+oletter assert(oz.ozutil.string_to_bool(curr) == False) def test_stb_false(): for fletter in ['f', 'F']: for aletter in ['a', 'A']: for lletter in ['l', 'L']: for sletter in ['s', 'S']: for eletter in ['e', 'E']: curr = fletter+aletter+lletter+sletter+eletter assert(oz.ozutil.string_to_bool(curr) == False) def test_stb_yes(): for yletter in ['y', 'Y']: for eletter in ['e', 'E']: for sletter in ['s', 'S']: curr = yletter+eletter+sletter assert(oz.ozutil.string_to_bool(curr) == True) def test_stb_true(): for tletter in ['t', 'T']: for rletter in ['r', 'R']: for uletter in ['u', 'U']: for eletter in ['e', 'E']: curr = tletter+rletter+uletter+eletter assert(oz.ozutil.string_to_bool(curr) == True) def test_stb_none(): with py.test.raises(Exception): oz.ozutil.string_to_bool(None) def test_stb_invalid(): assert(oz.ozutil.string_to_bool('foobar') is None) # test oz.ozutil.generate_macaddress def test_genmac(): mac = oz.ozutil.generate_macaddress() assert(type(mac) == str) assert(len(mac) == 17) # test oz.ozutil.mkdir_p def test_mkdir_p(tmpdir): fullname = os.path.join(str(tmpdir), 'foo') oz.ozutil.mkdir_p(fullname) def test_mkdir_p_twice(tmpdir): fullname = os.path.join(str(tmpdir), 'foo') oz.ozutil.mkdir_p(fullname) oz.ozutil.mkdir_p(fullname) def test_mkdir_p_file_exists(tmpdir): fullname = os.path.join(str(tmpdir), 'file_exists') open(fullname, 'w').write('file_exists') with py.test.raises(OSError): oz.ozutil.mkdir_p(fullname) def test_mkdir_p_none(): with py.test.raises(Exception): oz.ozutil.mkdir_p(None) def test_mkdir_p_empty_string(): oz.ozutil.mkdir_p('') # test oz.ozutil.copy_modify_file def test_copy_modify_none_src(): with py.test.raises(Exception): oz.ozutil.copy_modify_file(None, None, None) def test_copy_modify_none_dst(tmpdir): fullname = os.path.join(str(tmpdir), 'src') open(fullname, 'w').write('src') with py.test.raises(Exception): oz.ozutil.copy_modify_file(fullname, None, None) def test_copy_modify_none_subfunc(tmpdir): src = os.path.join(str(tmpdir), 'src') open(src, 'w').write('src') dst = os.path.join(str(tmpdir), 'dst') with py.test.raises(Exception): oz.ozutil.copy_modify_file(src, dst, None) def test_copy_modify_bad_src_mode(tmpdir): if os.geteuid() == 0: # this test won't work as root, since root can copy any mode files return def sub(line): return line fullname = os.path.join(str(tmpdir), 'writeonly') open(fullname, 'w').write('writeonly') os.chmod(fullname, 0000) dst = os.path.join(str(tmpdir), 'dst') with py.test.raises(IOError): oz.ozutil.copy_modify_file(fullname, dst, sub) def test_copy_modify_empty_file(tmpdir): def sub(line): return line src = os.path.join(str(tmpdir), 'src') f = open(src, 'w') f.close() dst = os.path.join(str(tmpdir), 'dst') oz.ozutil.copy_modify_file(src, dst, sub) assert(os.stat(dst).st_size == 0) def test_copy_modify_file(tmpdir): def sub(line): return line src = os.path.join(str(tmpdir), 'src') with open(src, 'w') as f: f.write("this is a line in the file\n") f.write("this is another line in the file\n") dst = os.path.join(str(tmpdir), 'dst') oz.ozutil.copy_modify_file(src, dst, sub) assert(os.stat(dst).st_size == 60) # test oz.ozutil.write_cpio def test_write_cpio_none_input(): with py.test.raises(Exception): oz.ozutil.write_cpio(None, None) def test_write_cpio_none_output(): with py.test.raises(Exception): oz.ozutil.write_cpio({}, None) def test_write_cpio_empty_dict(tmpdir): dst = os.path.join(str(tmpdir), 'dst') oz.ozutil.write_cpio({}, dst) def test_write_cpio_existing_file(tmpdir): if os.geteuid() == 0: # this test won't work as root, since root can copy any mode files return dst = os.path.join(str(tmpdir), 'dst') open(dst, 'w').write('hello') os.chmod(dst, 0000) with py.test.raises(IOError): oz.ozutil.write_cpio({}, dst) def test_write_cpio_single_file(tmpdir): src = os.path.join(str(tmpdir), 'src') open(src, 'w').write('src') dst = os.path.join(str(tmpdir), 'dst') oz.ozutil.write_cpio({src: 'src'}, dst) def test_write_cpio_multiple_files(tmpdir): src1 = os.path.join(str(tmpdir), 'src1') open(src1, 'w').write('src1') src2 = os.path.join(str(tmpdir), 'src2') open(src2, 'w').write('src2') dst = os.path.join(str(tmpdir), 'dst') oz.ozutil.write_cpio({src1: 'src1', src2: 'src2'}, dst) def test_write_cpio_not_multiple_of_4(tmpdir): src = os.path.join(str(tmpdir), 'src') open(src, 'w').write('src') dst = os.path.join(str(tmpdir), 'dst') oz.ozutil.write_cpio({src: 'src'}, dst) def test_write_cpio_exception(tmpdir): if os.geteuid() == 0: # this test won't work as root, since root can copy any mode files return src = os.path.join(str(tmpdir), 'src') open(src, 'w').write('src') os.chmod(src, 0000) dst = os.path.join(str(tmpdir), 'dst') with py.test.raises(IOError): oz.ozutil.write_cpio({src: 'src'}, dst) def test_md5sum_regular(tmpdir): src = os.path.join(str(tmpdir), 'md5sum') with open(src, 'w') as f: f.write('# this is a comment line, followed by a blank line\n\n6e812e782e52b536c0307bb26b3c244e *Fedora-11-i386-DVD.iso\n') oz.ozutil.get_md5sum_from_file(src, 'Fedora-11-i386-DVD.iso') def test_sha1sum_regular(tmpdir): src = os.path.join(str(tmpdir), 'md5sum') with open(src, 'w') as f: f.write('6e812e782e52b536c0307bb26b3c244e1c42b644 *Fedora-11-i386-DVD.iso\n') oz.ozutil.get_sha1sum_from_file(src, 'Fedora-11-i386-DVD.iso') def test_sha256sum_regular(tmpdir): src = os.path.join(str(tmpdir), 'md5sum') with open(src, 'w') as f: f.write('6e812e782e52b536c0307bb26b3c244e1c42b644235f5a4b242786b1ef375358 *Fedora-11-i386-DVD.iso\n') oz.ozutil.get_sha256sum_from_file(src, 'Fedora-11-i386-DVD.iso') def test_md5sum_bsd(tmpdir): src = os.path.join(str(tmpdir), 'md5sum') with open(src, 'w') as f: f.write('MD5 (Fedora-11-i386-DVD.iso)=6e812e782e52b536c0307bb26b3c244e1c42b644235f5a4b242786b1ef375358\n') oz.ozutil.get_md5sum_from_file(src, 'Fedora-11-i386-DVD.iso') def test_md5sum_bsd_no_start_paren(tmpdir): src = os.path.join(str(tmpdir), 'md5sum') with open(src, 'w') as f: # if BSD is missing a paren, we don't raise an exception, just ignore and # continue f.write('MD5 Fedora-11-i386-DVD.iso)=6e812e782e52b536c0307bb26b3c244e1c42b644235f5a4b242786b1ef375358\n') oz.ozutil.get_md5sum_from_file(src, 'Fedora-11-i386-DVD.iso') def test_md5sum_bsd_no_end_paren(tmpdir): src = os.path.join(str(tmpdir), 'md5sum') with open(src, 'w') as f: # if BSD is missing a paren, we don't raise an exception, just ignore and # continue f.write('MD5 (Fedora-11-i386-DVD.iso=6e812e782e52b536c0307bb26b3c244e1c42b644235f5a4b242786b1ef375358\n') oz.ozutil.get_md5sum_from_file(src, 'Fedora-11-i386-DVD.iso') def test_md5sum_bsd_no_equal(tmpdir): src = os.path.join(str(tmpdir), 'md5sum') with open(src, 'w') as f: # if BSD is missing a paren, we don't raise an exception, just ignore and # continue f.write('MD5 (Fedora-11-i386-DVD.iso) 6e812e782e52b536c0307bb26b3c244e1c42b644235f5a4b242786b1ef375358\n') oz.ozutil.get_md5sum_from_file(src, 'Fedora-11-i386-DVD.iso') def test_md5sum_regular_escaped(tmpdir): src = os.path.join(str(tmpdir), 'md5sum') with open(src, 'w') as f: f.write('\\6e812e782e52b536c0307bb26b3c244e *Fedora-11-i386-DVD.iso\n') oz.ozutil.get_md5sum_from_file(src, 'Fedora-11-i386-DVD.iso') def test_md5sum_regular_too_short(tmpdir): src = os.path.join(str(tmpdir), 'md5sum') with open(src, 'w') as f: f.write('6e *F\n') oz.ozutil.get_md5sum_from_file(src, 'Fedora-11-i386-DVD.iso') def test_md5sum_regular_no_star(tmpdir): src = os.path.join(str(tmpdir), 'md5sum') with open(src, 'w') as f: f.write('6e812e782e52b536c0307bb26b3c244e Fedora-11-i386-DVD.iso\n') oz.ozutil.get_md5sum_from_file(src, 'Fedora-11-i386-DVD.iso') def test_md5sum_regular_no_newline(tmpdir): src = os.path.join(str(tmpdir), 'md5sum') with open(src, 'w') as f: f.write('6e812e782e52b536c0307bb26b3c244e *Fedora-11-i386-DVD.iso') oz.ozutil.get_md5sum_from_file(src, 'Fedora-11-i386-DVD.iso') def test_md5sum_regular_no_space(tmpdir): src = os.path.join(str(tmpdir), 'md5sum') with open(src, 'w') as f: f.write('6e812e782e52b536c0307bb26b3c244e_*Fedora-11-i386-DVD.iso\n') oz.ozutil.get_md5sum_from_file(src, 'Fedora-11-i386-DVD.iso') ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/��������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�13443205327�0014157�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/hello.cmd�����������������������������������������������������������������������0000664�0000000�0000000�00000000050�13443205327�0015742�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������echo "hello from file://url" > /tmp/foo ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-01-simple-iso.tdl����������������������������������������������������������0000664�0000000�0000000�00000000421�13443205327�0020135�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> </template> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-02-simple-url.tdl����������������������������������������������������������0000664�0000000�0000000�00000000421�13443205327�0020146�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='iso'> <iso>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</iso> </install> </os> </template> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-03-empty-template.tdl������������������������������������������������������0000664�0000000�0000000�00000000027�13443205327�0021027�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> </template> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-04-no-os.tdl���������������������������������������������������������������0000664�0000000�0000000�00000000052�13443205327�0017112�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>wow</name> </template> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-05-no-name.tdl�������������������������������������������������������������0000664�0000000�0000000�00000000372�13443205327�0017417�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> </template> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-06-simple-iso-description.tdl����������������������������������������������0000664�0000000�0000000�00000000506�13443205327�0022467�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> </template> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-07-packages-no-package.tdl�������������������������������������������������0000664�0000000�0000000�00000000454�13443205327�0021651�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <packages> </packages> </template> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-08-repositories-no-repository.tdl������������������������������������������0000664�0000000�0000000�00000000464�13443205327�0023450�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <repositories> </repositories> </template> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-09-os-invalid-arch.tdl�����������������������������������������������������0000664�0000000�0000000�00000000416�13443205327�0021050�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>arm</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> </template> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-10-os-invalid-install-type.tdl���������������������������������������������0000664�0000000�0000000�00000000417�13443205327�0022551�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='foo'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> </template> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-11-description-packages-repositories.tdl�����������������������������������0000664�0000000�0000000�00000001153�13443205327�0024704�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <repositories> <repository name='myrepo'> <url>http://path/to/my/repo</url> </repository> </repositories> <packages> <package name='chris'> <repository>myrepo</repository> <file>myfilename</file> <arguments>args</arguments> </package> </packages> </template> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-12-os-no-name.tdl����������������������������������������������������������0000664�0000000�0000000�00000000371�13443205327�0020033�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> </template> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-13-os-no-version.tdl�������������������������������������������������������0000664�0000000�0000000�00000000367�13443205327�0020606�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> </template> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-14-os-no-arch.tdl����������������������������������������������������������0000664�0000000�0000000�00000000371�13443205327�0020032�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> </template> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-15-os-no-install.tdl�������������������������������������������������������0000664�0000000�0000000�00000000207�13443205327�0020562�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> </os> </template> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-16-signed-repository.tdl���������������������������������������������������0000664�0000000�0000000�00000001206�13443205327�0021552�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <repositories> <repository name='myrepo'> <url>http://path/to/my/repo</url> <signed>yes</signed> </repository> </repositories> <packages> <package name='chris'> <repository>myrepo</repository> <file>myfilename</file> <arguments>args</arguments> </package> </packages> </template> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-17-repo-invalid-signed.tdl�������������������������������������������������0000664�0000000�0000000�00000001206�13443205327�0021725�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <repositories> <repository name='myrepo'> <url>http://path/to/my/repo</url> <signed>foo</signed> </repository> </repositories> <packages> <package name='chris'> <repository>myrepo</repository> <file>myfilename</file> <arguments>args</arguments> </package> </packages> </template> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-18-rootpw.tdl��������������������������������������������������������������0000664�0000000�0000000�00000000452�13443205327�0017422�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> <rootpw>foo</rootpw> </os> </template> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-19-key.tdl�����������������������������������������������������������������0000664�0000000�0000000�00000000401�13443205327�0016653�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>windows</name> <os> <name>Windows</name> <version>2003</version> <arch>i386</arch> <install type='iso'> <iso>file:///example.org/Windows2003.iso</iso> </install> <key>1234-456-789</key> </os> </template> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-20-multiple-install.tdl����������������������������������������������������0000664�0000000�0000000�00000000503�13443205327�0021355�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>windows</name> <os> <name>Windows</name> <version>2003</version> <arch>i386</arch> <install type='iso'> <iso>file:///example.org/Windows2003.iso</iso> </install> <install type='iso'> <iso>file:///example2.org/Windows2003.iso</iso> </install> </os> </template> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-21-missing-install-type.tdl������������������������������������������������0000664�0000000�0000000�00000000332�13443205327�0022153�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>windows</name> <os> <name>Windows</name> <version>2003</version> <arch>i386</arch> <install> <iso>file:///example.org/Windows2003.iso</iso> </install> </os> </template> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-22-md5sum.tdl��������������������������������������������������������������0000664�0000000�0000000�00000000427�13443205327�0017277�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>windows</name> <os> <name>Windows</name> <version>2003</version> <arch>i386</arch> <install type='iso'> <iso>file:///example.org/Windows2003.iso</iso> <md5sum>file:///example.org/MD5SUM</md5sum> </install> </os> </template> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-23-sha1sum.tdl�������������������������������������������������������������0000664�0000000�0000000�00000000432�13443205327�0017443�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>windows</name> <os> <name>Windows</name> <version>2003</version> <arch>i386</arch> <install type='iso'> <iso>file:///example.org/Windows2003.iso</iso> <sha1sum>file:///example.org/SHA1SUM</sha1sum> </install> </os> </template> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-24-sha256sum.tdl�����������������������������������������������������������0000664�0000000�0000000�00000000440�13443205327�0017617�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>windows</name> <os> <name>Windows</name> <version>2003</version> <arch>i386</arch> <install type='iso'> <iso>file:///example.org/Windows2003.iso</iso> <sha256sum>file:///example.org/SHA256SUM</sha256sum> </install> </os> </template> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-25-md5sum-and-sha1sum.tdl��������������������������������������������������0000664�0000000�0000000�00000000514�13443205327�0021416�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>windows</name> <os> <name>Windows</name> <version>2003</version> <arch>i386</arch> <install type='iso'> <iso>file:///example.org/Windows2003.iso</iso> <md5sum>file:///example.org/MD5SUM</md5sum> <sha1sum>file:///example.org/SHA1SUM</sha1sum> </install> </os> </template> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-26-md5sum-and-sha256sum.tdl������������������������������������������������0000664�0000000�0000000�00000000522�13443205327�0021572�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>windows</name> <os> <name>Windows</name> <version>2003</version> <arch>i386</arch> <install type='iso'> <iso>file:///example.org/Windows2003.iso</iso> <md5sum>file:///example.org/MD5SUM</md5sum> <sha256sum>file:///example.org/SHA256SUM</sha256sum> </install> </os> </template> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-27-sha1sum-and-sha256sum.tdl�����������������������������������������������0000664�0000000�0000000�00000000525�13443205327�0021745�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>windows</name> <os> <name>Windows</name> <version>2003</version> <arch>i386</arch> <install type='iso'> <iso>file:///example.org/Windows2003.iso</iso> <sha1sum>file:///example.org/SHA1SUM</sha1sum> <sha256sum>file:///example.org/SHA256SUM</sha256sum> </install> </os> </template> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-28-package-no-name.tdl�����������������������������������������������������0000664�0000000�0000000�00000000752�13443205327�0021017�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <repositories> <repository name='myrepo'> <url>http://path/to/my/repo</url> </repository> </repositories> <packages> <package/> </packages> </template> ����������������������oz-0.17.0/tests/tdl/test-29-files.tdl���������������������������������������������������������������0000664�0000000�0000000�00000000531�13443205327�0017172�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <files> <file name='/tmp/foo'> hello there </file> </files> </template> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-30-file-no-name.tdl��������������������������������������������������������0000664�0000000�0000000�00000000511�13443205327�0020325�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <files> <file> hello there </file> </files> </template> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-31-file-raw-type.tdl�������������������������������������������������������0000664�0000000�0000000�00000000544�13443205327�0020552�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <files> <file name='/tmp/foo' type='raw'> hello there </file> </files> </template> ������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-32-file-base64-type.tdl����������������������������������������������������0000664�0000000�0000000�00000000536�13443205327�0021047�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <files> <file name='/tmp/foo' type='base64'>aGVsbG8K</file> </files> </template> ������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-33-file-invalid-type.tdl���������������������������������������������������0000664�0000000�0000000�00000000533�13443205327�0021407�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <files> <file name='/tmp/foo' type='foo'>aGVsbG8K</file> </files> </template> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-34-file-invalid-base64.tdl�������������������������������������������������0000664�0000000�0000000�00000000551�13443205327�0021513�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <files> <file name='/tmp/foo' type='base64'>BASE64GOBBLEDYGOOK-</file> </files> </template> �������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-35-repository-no-name.tdl��������������������������������������������������0000664�0000000�0000000�00000000662�13443205327�0021641�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <repositories> <repository> <url>http://path/to/my/repo</url> </repository> </repositories> </template> ������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-36-repository-no-url.tdl���������������������������������������������������0000664�0000000�0000000�00000000627�13443205327�0021525�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <repositories> <repository name='chris'> </repository> </repositories> </template> ���������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-37-command.tdl�������������������������������������������������������������0000664�0000000�0000000�00000000741�13443205327�0017510�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <commands> <command name='cmd1'> echo "hello" > /tmp/foo </command> <command name='cmd2'> echo "there" > /tmp/bar </command> </commands> </template> �������������������������������oz-0.17.0/tests/tdl/test-38-command-no-name.tdl�����������������������������������������������������0000664�0000000�0000000�00000000624�13443205327�0021041�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <commands> <command> echo "hello" > /tmp/foo </command> </commands> </template> ������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-39-command-raw-type.tdl����������������������������������������������������0000664�0000000�0000000�00000000653�13443205327�0021262�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <commands> <command name='cmd1' type='raw'> echo "hello" > /tmp/foo </command> </commands> </template> �������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-40-command-base64-type.tdl�������������������������������������������������0000664�0000000�0000000�00000000661�13443205327�0021544�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <commands> <command name='cmd1' type='base64'>ZWNobyAiaGVsbG8iID4gL3RtcC9mb28K</command> </commands> </template> �������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-41-command-bogus-base64.tdl������������������������������������������������0000664�0000000�0000000�00000000657�13443205327�0021710�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <commands> <command name='cmd1' type='base64'>ZWNobyAiaGVsbG8iID4gL3RtcC!28K</command> </commands> </template> ���������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-42-command-bogus-type.tdl��������������������������������������������������0000664�0000000�0000000�00000000657�13443205327�0021606�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <commands> <command name='cmd1' type='mytype'>ZWNobyAiaGVsbG8iID4gL3RtcC!28K</command> </commands> </template> ���������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-43-persisted-repos.tdl�����������������������������������������������������0000664�0000000�0000000�00000003753�13443205327�0021225�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>rhel5-u7</name> <os> <name>RHEL-5</name> <version>U7</version> <arch>i386</arch> <install type='url'> <url>http://someserver/path/to/installation</url> </install> </os> <description>A RHEL5 Update 7 image</description> <repositories> <!-- Different ways to represent persisted=False --> <repository name='persist-1-false'> <url>http://path/to/my/repo-1</url> <persisted>No</persisted> </repository> <repository name='persist-2-false'> <url>http://path/to/my/repo-2</url> <persisted>no</persisted> </repository> <repository name='persist-3-false'> <url>http://path/to/my/repo-3</url> <persisted>NO</persisted> </repository> <repository name='persist-4-false'> <url>http://path/to/my/repo-4</url> <persisted>false</persisted> </repository> <repository name='persist-5-false'> <url>http://path/to/my/repo-5</url> <persisted>FALSE</persisted> </repository> <repository name='persist-6-false'> <url>http://path/to/my/repo-6</url> <persisted>False</persisted> </repository> <!-- Different ways to represent persisted --> <repository name='persist-7-true'> <url>http://path/to/my/repo-7</url> <persisted>Yes</persisted> </repository> <repository name='persist-8-true'> <url>http://path/to/my/repo-8</url> <persisted>yes</persisted> </repository> <repository name='persist-9-true'> <url>http://path/to/my/repo-9</url> <persisted>YES</persisted> </repository> <repository name='persist-10-true'> <url>http://path/to/my/repo-10</url> <persisted>True</persisted> </repository> <repository name='persist-11-true'> <url>http://path/to/my/repo-11</url> <persisted>true</persisted> </repository> <repository name='persist-12-true'> <url>http://path/to/my/repo-12</url> <persisted>TRUE</persisted> </repository> </repositories> </template> ���������������������oz-0.17.0/tests/tdl/test-44-version.tdl�������������������������������������������������������������0000664�0000000�0000000�00000000450�13443205327�0017552�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template version="1.0"> <name>rhel5-u7</name> <os> <name>RHEL-5</name> <version>U7</version> <arch>i386</arch> <install type='url'> <url>http://someserver/path/to/installation</url> </install> </os> <description>A RHEL5 Update 7 image</description> </template> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-45-bogus-version.tdl�������������������������������������������������������0000664�0000000�0000000�00000000450�13443205327�0020670�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template version="2.0"> <name>rhel5-u7</name> <os> <name>RHEL-5</name> <version>U7</version> <arch>i386</arch> <install type='url'> <url>http://someserver/path/to/installation</url> </install> </os> <description>A RHEL5 Update 7 image</description> </template> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-46-duplicate-name.tdl������������������������������������������������������0000664�0000000�0000000�00000000500�13443205327�0020753�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template version="1.0"> <name>rhel5-u7</name> <name>rhel5-u7</name> <os> <name>RHEL-5</name> <version>U7</version> <arch>i386</arch> <install type='url'> <url>http://someserver/path/to/installation</url> </install> </os> <description>A RHEL5 Update 7 image</description> </template> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-47-invalid-template.tdl����������������������������������������������������0000664�0000000�0000000�00000000442�13443205327�0021330�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<templ version="1.0"> <name>rhel5-u7</name> <os> <name>RHEL-5</name> <version>U7</version> <arch>i386</arch> <install type='url'> <url>http://someserver/path/to/installation</url> </install> </os> <description>A RHEL5 Update 7 image</description> </templ> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-48-file-empty-base64.tdl���������������������������������������������������0000664�0000000�0000000�00000000526�13443205327�0021232�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <files> <file name='/tmp/foo' type='base64'></file> </files> </template> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-49-file-empty-raw.tdl������������������������������������������������������0000664�0000000�0000000�00000000523�13443205327�0020735�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <files> <file name='/tmp/foo' type='raw'></file> </files> </template> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-50-command-base64-empty.tdl������������������������������������������������0000664�0000000�0000000�00000000616�13443205327�0021722�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>help</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <commands> <command name='zazz' type='base64'></command> </commands> </template> ������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-51-disk-size.tdl�����������������������������������������������������������0000664�0000000�0000000�00000000550�13443205327�0017766�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>help</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <disk> <size>10</size> </disk> </template> ��������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-52-command-file-url.tdl����������������������������������������������������0000664�0000000�0000000�00000000652�13443205327�0021223�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <commands> <command name='cmd1' type='url'>file://./tests/tdl/hello.cmd</command> </commands> </template> ��������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-53-command-http-url.tdl����������������������������������������������������0000664�0000000�0000000�00000000716�13443205327�0021265�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <commands> <command name='cmd1' type='url'>https://raw.github.com/clalancette/oz/master/tests/tdl/hello.cmd</command> </commands> </template> ��������������������������������������������������oz-0.17.0/tests/tdl/test-54-files-file-url.tdl������������������������������������������������������0000664�0000000�0000000�00000000555�13443205327�0020713�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <files> <file name='/tmp/foo' type='url'>file://tests/tdl/hello.cmd</file> </files> </template> ���������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-55-files-http-url.tdl������������������������������������������������������0000664�0000000�0000000�00000000623�13443205327�0020750�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>x86_64</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <files> <file name='/tmp/foo' type='url'>https://raw.github.com/clalancette/oz/master/tests/tdl/hello.cmd</file> </files> </template> �������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-56-invalid-disk-size.tdl���������������������������������������������������0000664�0000000�0000000�00000000551�13443205327�0021420�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>help</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <disk> <size>10E</size> </disk> </template> �������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-57-invalid-disk-size.tdl���������������������������������������������������0000664�0000000�0000000�00000000551�13443205327�0021421�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>help</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <disk> <size>T10</size> </disk> </template> �������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-58-disk-size-terabyte.tdl��������������������������������������������������0000664�0000000�0000000�00000000551�13443205327�0021613�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>help</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <disk> <size>10T</size> </disk> </template> �������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-59-command-sorting.tdl�����������������������������������������������������0000664�0000000�0000000�00000001114�13443205327�0021172�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <commands> <command name='cmd1' position="1"> echo "hello" > /tmp/foo </command> <command name='cmd2' position="3"> echo "there" > /tmp/bar </command> <command name='cmd3' position="2"> echo "there" > /tmp/foobar </command> </commands> </template> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-60-command-mix-positions-and-not.tdl���������������������������������������0000664�0000000�0000000�00000001077�13443205327�0023665�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <commands> <command name='cmd1' position="1"> echo "hello" > /tmp/foo </command> <command name='cmd2' position="3"> echo "there" > /tmp/bar </command> <command name='cmd3'> echo "there" > /tmp/foobar </command> </commands> </template> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-61-command-duplicate-position.tdl������������������������������������������0000664�0000000�0000000�00000001114�13443205327�0023312�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <commands> <command name='cmd1' position="1"> echo "hello" > /tmp/foo </command> <command name='cmd2' position="3"> echo "there" > /tmp/bar </command> <command name='cmd3' position="1"> echo "there" > /tmp/foobar </command> </commands> </template> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������oz-0.17.0/tests/tdl/test-62-repository-localhost.tdl������������������������������������������������0000664�0000000�0000000�00000000740�13443205327�0022274�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<template> <name>f12jeos</name> <os> <name>Fedora</name> <version>12</version> <arch>i386</arch> <install type='url'> <url>http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/</url> </install> </os> <description>My Fedora 12 JEOS image</description> <repositories> <repository name='myrepo'> <url>http://localhost/to/my/repo</url> <signed>yes</signed> </repository> </repositories> </template> ��������������������������������oz-0.17.0/tests/tdl/test_tdl.py���������������������������������������������������������������������0000664�0000000�0000000�00000011432�13443205327�0016354�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/python import sys import os try: import lxml.etree except ImportError: print('Unable to import lxml. Is python-lxml installed?') sys.exit(1) try: import py.test except ImportError: print('Unable to import py.test. Is py.test installed?') sys.exit(1) # Find oz prefix = '.' for i in range(0,3): if os.path.isdir(os.path.join(prefix, 'oz')): sys.path.insert(0, prefix) break else: prefix = '../' + prefix try: import oz import oz.TDL except ImportError: print('Unable to import oz. Is oz installed?') sys.exit(1) # the tests dictionary lists all of the test we will run. The key for the # dictionary is the filename of the test, and the value is whether the test # is expected to succeed (True) or not (False) tests = { "test-01-simple-iso.tdl": True, "test-02-simple-url.tdl": True, "test-03-empty-template.tdl": False, "test-04-no-os.tdl": False, "test-05-no-name.tdl": False, "test-06-simple-iso-description.tdl": True, "test-07-packages-no-package.tdl": True, "test-08-repositories-no-repository.tdl": True, "test-09-os-invalid-arch.tdl": False, "test-10-os-invalid-install-type.tdl": False, "test-11-description-packages-repositories.tdl": True, "test-12-os-no-name.tdl": False, "test-13-os-no-version.tdl": False, "test-14-os-no-arch.tdl": False, "test-15-os-no-install.tdl": False, "test-16-signed-repository.tdl": True, "test-17-repo-invalid-signed.tdl": False, "test-18-rootpw.tdl": True, "test-19-key.tdl": True, "test-20-multiple-install.tdl": False, "test-21-missing-install-type.tdl": False, "test-22-md5sum.tdl": True, "test-23-sha1sum.tdl": True, "test-24-sha256sum.tdl": True, "test-25-md5sum-and-sha1sum.tdl": False, "test-26-md5sum-and-sha256sum.tdl": False, "test-27-sha1sum-and-sha256sum.tdl": False, "test-28-package-no-name.tdl": False, "test-29-files.tdl": True, "test-30-file-no-name.tdl": False, "test-31-file-raw-type.tdl": True, "test-32-file-base64-type.tdl": True, "test-33-file-invalid-type.tdl": False, "test-34-file-invalid-base64.tdl": False, "test-35-repository-no-name.tdl": False, "test-36-repository-no-url.tdl": False, "test-37-command.tdl": True, "test-38-command-no-name.tdl": False, "test-39-command-raw-type.tdl": True, "test-40-command-base64-type.tdl": True, "test-41-command-bogus-base64.tdl": False, "test-42-command-bogus-type.tdl": False, "test-43-persisted-repos.tdl": True, "test-44-version.tdl": True, "test-45-bogus-version.tdl": False, "test-46-duplicate-name.tdl": False, "test-47-invalid-template.tdl": False, "test-48-file-empty-base64.tdl": True, "test-49-file-empty-raw.tdl": True, "test-50-command-base64-empty.tdl": False, "test-51-disk-size.tdl": True, "test-52-command-file-url.tdl": True, "test-53-command-http-url.tdl": True, "test-54-files-file-url.tdl": True, "test-55-files-http-url.tdl": True, "test-56-invalid-disk-size.tdl": False, "test-57-invalid-disk-size.tdl": False, "test-58-disk-size-terabyte.tdl": True, "test-59-command-sorting.tdl": True, } # Test that iterates over all .tdl files def test_all(): for (tdl, expected_pass) in list(tests.items()): # locate full path for tdl file tdl_prefix = '' for tdl_prefix in ['tests/tdl/', 'tdl/', '']: if os.path.isfile(tdl_prefix + tdl): break tdl_file = tdl_prefix + tdl test_name = os.path.splitext(tdl,)[0] # Test if the TDL class will parse it. print("Testing %s" % (tdl_file)) with open(tdl_file, 'r') as infp: try: oz.TDL.TDL(infp.read()) if not expected_pass: assert(False) except Exception: if expected_pass: raise ''' def test_persisted(tdl='test-43-persisted-repos.tdl'): # locate full path for tdl file tdl_prefix = '' for tdl_prefix in ['tests/tdl/', 'tdl/', '']: if os.path.isfile(tdl_prefix + tdl): break if not os.path.isfile(tdl_prefix + tdl): raise Exception('Unable to locate TDL: %s' % tdl) tdl_file = tdl_prefix + tdl test_name = os.path.splitext(tdl,)[0] # Grab TDL object tdl = validate_ozlib(tdl_file) def assert_persisted_value(persisted, value): assert persisted == value, \ "expected %s, got %s" % (value, persisted) for repo in list(tdl.repositories.values()): if repo.name.endswith('true'): yield '%s_%s' % (test_name, repo.name), assert_persisted_value, repo.persisted, True else: yield '%s_%s' % (test_name, repo.name), assert_persisted_value, repo.persisted, False ''' ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������