diskimage-builder-2.35.0/0000775000175000017500000000000013640271564015214 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/tox.ini0000664000175000017500000000353013640271474016530 0ustar zuulzuul00000000000000[tox] envlist = pep8,pylint,py37,py36,py35,py27 minversion = 2.0 skipsdist = True [testenv] usedevelop = True install_command = pip install {opts} {packages} deps= -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= python setup.py test --slowest --testr-args='{posargs}' passenv= DUMP_CONFIG_GRAPH [testenv:bindep] deps = bindep commands = bindep test [testenv:pep8] basepython = python3 commands = flake8 {posargs} dib-lint [testenv:pylint] basepython = python3 commands = pylint --rcfile pylint.cfg diskimage_builder [testenv:venv] basepython = python3 commands = {posargs} [testenv:func] envdir = {toxworkdir}/venv commands = {toxinidir}/tests/run_functests.sh {posargs} [testenv:cover] # NOTE: this is "setup.py test" (*not* testr) which is a pbr wrapper # around testr. This understands --coverage-package-name which we # need due to underscore issues. basepython = python3 commands = python setup.py test --coverage --coverage-package-name diskimage_builder --testr-args='{posargs}' [testenv:docs] deps= -r{toxinidir}/doc/requirements.txt basepython = python3 whitelist_externals = rm commands = rm -rf doc/build sphinx-build -W -b html -d doc/build/doctrees doc/source doc/build/html {posargs} [testenv:releasenotes] deps = {[testenv:docs]deps} basepython = python3 commands = sphinx-build -a -W -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [flake8] ignore = E125,E126,E127,H202,H803,W503,W504 exclude = .venv,.git,.tox,dist,doc/build,doc/source,*lib/python*,*egg,build,conf.py [testenv:lower-constraints] basepython = python3 deps = -c{toxinidir}/lower-constraints.txt -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt diskimage-builder-2.35.0/roles/0000775000175000017500000000000013640271564016340 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/0000775000175000017500000000000013640271564022645 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/README.rst0000664000175000017500000000027513640271474024340 0ustar zuulzuul00000000000000dib-setup-gate-mirrors ====================== Create customised repository files as required by the openstack-ci-mirrors element. Path to repo files is set into ``dib_gate_mirror_repos`` diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/0000775000175000017500000000000013640271564024643 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/centos-minimal/0000775000175000017500000000000013640271564027562 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/centos-minimal/8/0000775000175000017500000000000013640271564027731 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/centos-minimal/8/extras.repo.j20000664000175000017500000000024613640271474032442 0ustar zuulzuul00000000000000#additional packages that may be useful [extras] name=CentOS-$releasever - Extras baseurl=http://{{ mirror_fqdn }}/centos/$releasever/extras/$basearch/os/ gpgcheck=0 diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/centos-minimal/8/appstream.repo.j20000664000175000017500000000020713640271474033125 0ustar zuulzuul00000000000000[AppStream] name=CentOS-$releasever - AppStream baseurl=http://{{ mirror_fqdn }}/centos/$releasever/AppStream/$basearch/os/ gpgcheck=0 diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/centos-minimal/8/base.repo.j20000664000175000017500000000017213640271474032044 0ustar zuulzuul00000000000000[base] name=CentOS-$releasever - Base baseurl=http://{{ mirror_fqdn }}/centos/$releasever/BaseOS/$basearch/os/ gpgcheck=0 diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/centos-minimal/7/0000775000175000017500000000000013640271564027730 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/centos-minimal/7/extras.repo.j20000664000175000017500000000024313640271474032436 0ustar zuulzuul00000000000000#additional packages that may be useful [extras] name=CentOS-$releasever - Extras baseurl=http://{{ mirror_fqdn }}/centos/$releasever/extras/$basearch/ gpgcheck=0 diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/centos-minimal/7/updates.repo.j20000664000175000017500000000022013640271474032570 0ustar zuulzuul00000000000000#released updates [updates] name=CentOS-$releasever - Updates baseurl=http://{{ mirror_fqdn }}/centos/$releasever/updates/$basearch/ gpgcheck=0 diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/centos-minimal/7/base.repo.j20000664000175000017500000000016313640271474032043 0ustar zuulzuul00000000000000[base] name=CentOS-$releasever - Base baseurl=http://{{ mirror_fqdn }}/centos/$releasever/os/$basearch/ gpgcheck=0 diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/fedora-minimal/0000775000175000017500000000000013640271564027527 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/fedora-minimal/default/0000775000175000017500000000000013640271564031153 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015600000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/fedora-minimal/default/fedora-updates.repo.j2diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/fedora-minimal/default/fedora-update0000664000175000017500000000036113640271474033616 0ustar zuulzuul00000000000000[updates] name=Fedora $releasever - $basearch - Updates baseurl=http://{{ mirror_fqdn }}/fedora/updates/$releasever/Everything/$basearch/ enabled=1 gpgcheck=0 metadata_expire=6h skip_if_unavailable=False deltarpm=False deltarpm_percentage=0 ././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/fedora-minimal/default/fedora.repo.j2diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/templates/fedora-minimal/default/fedora.repo.j0000664000175000017500000000035213640271474033532 0ustar zuulzuul00000000000000[fedora] name=Fedora $releasever - $basearch baseurl=http://{{ mirror_fqdn }}/fedora/releases/$releasever/Everything/$basearch/os/ enabled=1 metadata_expire=7d gpgcheck=0 skip_if_unavailable=False deltarpm=False deltarpm_percentage=0 diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/tasks/0000775000175000017500000000000013640271564023772 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/tasks/main.yaml0000664000175000017500000000327113640271474025605 0ustar zuulzuul00000000000000- name: Set repo path set_fact: dib_gate_mirror_repos: "{{ ansible_user_dir }}/dib-mirror" - debug: msg="zuul site mirror {{ zuul_site_mirror_fqdn }}" - debug: msg="mirror_fqdn {{ mirror_fqdn }}" - name: Create centos-minimal 7 directory file: path: "{{ dib_gate_mirror_repos }}/centos-minimal/7/yum.repos.d" state: directory mode: 0775 recurse: yes - name: Install centos-minimal 7 repo files template: dest: "{{ dib_gate_mirror_repos }}/centos-minimal/7/yum.repos.d/dib-mirror-{{ item }}" mode: 0644 src: "centos-minimal/7/{{ item }}.j2" with_items: - base.repo - updates.repo - extras.repo - name: Create centos-minimal 8 directory file: path: "{{ dib_gate_mirror_repos }}/centos-minimal/8/yum.repos.d" state: directory mode: 0775 recurse: yes - name: Install centos-minimal 8 repo files template: dest: "{{ dib_gate_mirror_repos }}/centos-minimal/8/yum.repos.d/dib-mirror-{{ item }}" mode: 0644 src: "centos-minimal/8/{{ item }}.j2" with_items: - base.repo - appstream.repo - extras.repo - name: Create fedora-minimal directories file: path: "{{ dib_gate_mirror_repos }}/fedora-minimal/{{ item }}/yum.repos.d" state: directory mode: 0775 recurse: yes # sometimes Fedora moves things and we need different versions; keep # the loops for future use. with_items: - default - name: Install fedora-minimal repo files template: dest: "{{ dib_gate_mirror_repos }}/fedora-minimal/{{ item[0] }}/yum.repos.d/dib-mirror-{{ item[1] }}" mode: 0644 src: "fedora-minimal/{{ item[0] }}/{{ item[1] }}.j2" with_nested: - [ 'default' ] - [ 'fedora.repo', 'fedora-updates.repo' ] diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/defaults/0000775000175000017500000000000013640271564024454 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/roles/dib-setup-gate-mirrors/defaults/main.yaml0000664000175000017500000000007013640271474026261 0ustar zuulzuul00000000000000mirror_fqdn: "{{ zuul_site_mirror_fqdn|default(omit) }}"diskimage-builder-2.35.0/roles/dib-functests/0000775000175000017500000000000013640271564021112 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/roles/dib-functests/README.rst0000664000175000017500000000051513640271474022602 0ustar zuulzuul00000000000000dib-functests ------------- Run diskimage-builder functional tests Installs dib and dependencies, and runs functional tests **Role Variables** .. zuul:rolevar:: python_version :default: 2 The python version to run the test under .. zuul:rolevar:: dib_functests :default: [] The list of functional tests to run diskimage-builder-2.35.0/roles/dib-functests/tasks/0000775000175000017500000000000013640271564022237 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/roles/dib-functests/tasks/main.yaml0000664000175000017500000000254613640271474024056 0ustar zuulzuul00000000000000- name: Install dib extra dependencies command: ./install_test_deps.sh args: chdir: "{{ zuul.project.src_dir }}/tests" become: yes - name: Setup mounted space file: path: '/opt/dib_cache' state: directory mode: ugo+rw become: yes - name: Define upper_constraints set_fact: upper_constraints: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/requirements'].src_dir }}/upper-constraints.txt" - name: Take ourselves out of uppper constraints lineinfile: path: "{{ upper_constraints }}" state: absent regexp: '^diskimage-builder' - name: Install diskimage-builder pip: name: "file://{{ ansible_user_dir }}/{{ zuul.project.src_dir }}" virtualenv: "{{ dib_virtualenv }}" virtualenv_python: "{{ dib_python }}" extra_args: "-c {{ upper_constraints }}" - name: Setup log output file: path: "{{ ansible_user_dir }}/logs" state: directory mode: ugo+rw - name: Run dib functional tests shell: cmd: | source {{ dib_virtualenv }}/bin/activate {{ zuul.project.src_dir }}/tests/run_functests.sh \ -L {{ ansible_user_dir }}/logs {{ dib_functests | join(' ') }} \ {{ dib_functests_extra | join(' ') }} args: executable: /bin/bash environment: DIB_NO_TMPFS: 1 TMPDIR: /opt/dib_cache DIB_OS_CI_YUM_REPOS: "{{ dib_gate_mirror_repos|default(omit) }}" diskimage-builder-2.35.0/roles/dib-functests/defaults/0000775000175000017500000000000013640271564022721 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/roles/dib-functests/defaults/main.yaml0000664000175000017500000000046113640271474024532 0ustar zuulzuul00000000000000--- dib_python: python3 dib_virtualenv: "{{ ansible_user_dir }}/dib-venv" dib_functests: [] # This is a bit of hack; it allows us to template out jobs where the # base tests are defined in dib_functests, but then add a few extra # tests to run in this variable for a specific test. dib_functests_extra: []diskimage-builder-2.35.0/doc/0000775000175000017500000000000013640271564015761 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/doc/source/0000775000175000017500000000000013640271564017261 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/doc/source/elements.rst0000664000175000017500000000042013640271474021623 0ustar zuulzuul00000000000000Elements ======== Elements are found in the subdirectory elements. Each element is in a directory named after the element itself. Elements *should* have a README.rst in the root of the element directory describing what it is for. .. toctree:: :glob: elements/*/* diskimage-builder-2.35.0/doc/source/conf.py0000664000175000017500000001735713640271474020575 0ustar zuulzuul00000000000000import sys import os # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. sys.path.append(os.path.abspath('../lib')) extensions = ['openstackdocstheme', 'element_deps', 'sphinx.ext.autodoc'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'diskimage-builder' copyright = u'2015-2016, Various Authors' # openstackdocstheme options repository_name = 'openstack/diskimage-builder' bug_project = 'diskimage-builder' bug_tag = '' html_last_updated_fmt = '%Y-%m-%d %H:%M' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # import pbr.version version_info = pbr.version.VersionInfo('diskimage-builder') # The short X.Y version. release = version_info.release_string() # The full version, including alpha/beta/rc tags. version = version_info.version_string() # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build', 'doc/build', '.tox', '.venv', 'elements/*/test-elements'] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'openstackdocs' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". #html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. #html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. html_sidebars = { '**': ['globaltoc.html', 'relations.html', 'sourcelink.html', 'searchbox.html'], } # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'diskimage-builderdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', 'diskimage-builder.tex', u'diskimage-builder Documentation', u'OpenStack', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'diskimage-builder', u'diskimage-builder Documentation', [u'OpenStack'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'diskimage-builder', u'diskimage-builder Documentation', u'OpenStack', 'diskimage-builder', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False diskimage-builder-2.35.0/doc/source/index.rst0000664000175000017500000000310713640271474021123 0ustar zuulzuul00000000000000Diskimage-builder Documentation =============================== ``diskimage-builder`` is a tool for automatically building customized operating-system images for use in clouds and other environments. It includes support for building images based on many major distributions and can produce cloud-images in all common formats (``qcow2``, ``vhd``, ``raw``, etc), bare metal file-system images and ram-disk images. These images are composed from the many included ``elements``; ``diskimage-builder`` acts as a framework to easily add your own elements for even further customization. ``diskimage-builder`` is used extensively by the `TripleO project `__ and within `OpenStack Infrastructure `__. Code ---- Release notes for the latest and previous versions are available at: * `https://docs.openstack.org/releasenotes/diskimage-builder/ `__ The code is available at: * `https://opendev.org/openstack/diskimage-builder/ `__ Issues ------ Issues are tracked on launchpad at: * ``__ Communication ------------- Communication among the diskimage-builder developers happens on IRC in ``#openstack-dib`` on freenode and on the ``openstack-discuss`` mailing list (``openstack-discuss@lists.openstack.org``). Table of Contents ----------------- .. toctree:: :maxdepth: 2 user_guide/index developer/index elements specs/README diskimage-builder-2.35.0/doc/source/specs/0000775000175000017500000000000013640271564020376 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/doc/source/specs/v1/0000775000175000017500000000000013640271564020724 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/doc/source/specs/v1/approved/0000775000175000017500000000000013640271564022544 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/doc/source/specs/v1/approved/block-device-lvl1-partitioning.rst0000664000175000017500000001565113640271474031216 0ustar zuulzuul00000000000000e. This work is licensed under a Creative Commons Attribution 3.0 Unported License. http://creativecommons.org/licenses/by/3.0/legalcode ======================================== Block Device Setup Level 1: Partitioning ======================================== During the creation of a disk image (e.g. for a VM), there is the need to create, setup, configure and afterwards detach some kind of storage where the newly installed OS can be copied to or directly installed in. Remark ------ The implementation for this proposed changed already exists, was discussed and is currently waiting for reviews [1]. To have a complete overview over the block device setup, this document is provided. The dependencies are not implemented as they should be, because * the spec process is currently in the phase of discussion and not finalized [2], * the implementation was finished and reviewed before the spec process was described. [1] Problem description =================== When setting up a block device there is the need to partitioning the block device. Use Cases --------- User (Actor: End User) wants to create multiple partitions in multiple block devices where the new system is installed in. The user wants to specify if the image should be optimized for speed or for size. The user wants the same behavior independently of the current host or target OS. Proposed change =============== Move the partitioning functionality from `elements/vm/block-device.d/10-partition` to a new block_device python module: `level1/partitioning.py`. Instead of using a program or a library, the data is written directly with the help of python `file.write()` into the disk image. Alternatives ------------ The existing implementation uses the `parted` program (old versions of DIB were using `sfdisk`). The first implementations of this change used the python-parted library. All these approaches have a major drawback: they automatically *optimize* based on information collected on the host system - and not of the target system. Therefore the resulting partitioning layout may lead to a degradation of performance on the target system. A change in these external programs and libraries also lead to errors during a DIB run [4] or there are general issues [7]. Also everything build around GNU parted falls under the GPL2 (not LGPL2) license - which is incompatible with the currently used Apache license in diskimage-builder. API impact ---------- Extends the (optional) environment variable ``DIB_BLOCK_DEVICE_CONFIG``: a JSON structure to configure the (complete) block device setup. For this proposal the second entry in the original list will be used (the first part (as described in [5]) is used by the level 0 modules). The name of this module is `partitioning` (element[0]). The value (element[1]) is a dictionary. For each disk that should be partitioned there exists one entry in the dictionary. The key is the name of the disk (see [5] how to specify names for block device level 0). The value is a dictionary that defines the partitioning of each disk. There are the following key / value pairs to define one disk: label (mandatory) Possible values: 'mbr' This uses the Master Boot Record (MBR) layout for the disk. (Later on this can be extended, e.g. using GPT). align (optional - default value '1MiB') Set the alignment of the partition. This must be a multiple of the block size (i.e. 512 bytes). The default of 1MiB (~ 2048 * 512 bytes blocks) is the default for modern systems and known to perform well on a wide range of targets [6]. For each partition there might be some space that is not used - which is `align` - 512 bytes. For the default of 1MiB exactly 1048064 bytes (= 1 MiB - 512 byte) are not used in the partition itself. Please note that if a boot loader should be written to the disk or partition, there is a need for some space. E.g. grub needs 63 * 512 byte blocks between the MBR and the start of the partition data; this means when grub will be installed, the `align` must be set at least to 64 * 512 byte = 32 KiB. partitions (mandatory) A list of dictionaries. Each dictionary describes one partition. The following key / value pairs can be given for each partition: name (mandatory) The name of the partition. With the help of this name, the partition can later be referenced, e.g. while creating a file system. flags (optional) List of flags for the partition. Default: empty. Possible values: boot Sets the boot flag for the partition size (mandatory) The size of the partition. The size can either be an absolute number using units like `10GiB` or `1.75TB` or relative (percentage) numbers: in the later case the size is calculated based on the remaining free space. Example: .. code-block:: yaml ["partitioning", {"rootdisk": { "label": "mbr", "partitions": [{"name": "part-01", "flags": ["boot"], "size": "100%"}]}}] Security impact --------------- None - functionality stays the same. Other end user impact --------------------- None. Performance Impact ------------------ Measurements showed there is a performance degradation for the target system of the partition table is not correctly aligned: writing takes about three times longer on an incorrect aligned system vs. one that is correctly aligned. Implementation ============== Assignee(s) ----------- Primary assignee: ansreas (andreas@florath.net) Work Items ---------- None - this is already a small part of a bigger change [1]. Dependencies ============ None. Testing ======= The refactoring introduces no new test cases: the functionality is tested during each existing test building VM images. Documentation Impact ==================== End user: the additional environment variable is described. References ========== [1] Refactor: block-device handling (partitioning) https://review.opendev.org/322671 [2] Add specs dir https://review.opendev.org/336109 [3] Old implementation using parted-lib https://review.opendev.org/#/c/322671/1..7/elements/block-device/pylib/block-device/level1/Partitioning.py [4] ERROR: embedding is not possible, but this is required for cross-disk install http://lists.openstack.org/pipermail/openstack-dev/2016-June/097789.html [5] Refactor: block-device handling (local loop) https://review.opendev.org/319591 [6] Proper alignment of partitions on an Advanced Format HDD using Parted http://askubuntu.com/questions/201164/proper-alignment-of-partitions-on-an-advanced-format-hdd-using-parted [7] Red Hat Enterprise Linux 6 - Creating a 7TB Partition Using parted Always Shows "The resulting partition is not properly aligned for best performance" http://h20564.www2.hpe.com/hpsc/doc/public/display?docId=emr_na-c03479326&DocLang=en&docLocale=en_US&jumpid=reg_r11944_uken_c-001_title_r0001 [8] Spec for changing the block device handling https://review.opendev.org/336946 diskimage-builder-2.35.0/doc/source/specs/v1/approved/v1-template.rst0000664000175000017500000001352113640271474025437 0ustar zuulzuul00000000000000.. This work is licensed under a Creative Commons Attribution 3.0 Unported License. http://creativecommons.org/licenses/by/3.0/legalcode ============================================== Example Spec - The title of your specification ============================================== Introduction paragraph -- why are we doing anything? A single paragraph of prose that operators can understand. The title and this first paragraph should be used as the subject line and body of the commit message respectively. Some notes about the diskimage-bulider spec process: * Not all changes need a spec. For more information see * The aim of this document is first to define the problem we need to solve, and second agree the overall approach to solve that problem. * This is not intended to be extensive documentation for a new feature. * You should aim to get your spec approved before writing your code. While you are free to write prototypes and code before getting your spec approved, its possible that the outcome of the spec review process leads you towards a fundamentally different solution than you first envisaged. * But, API changes are held to a much higher level of scrutiny. As soon as an API change merges, we must assume it could be in production somewhere, and as such, we then need to support that API change forever. To avoid getting that wrong, we do want lots of details about API changes upfront. Some notes about using this template: * Your spec should be in ReSTructured text, like this template. * Please wrap text at 79 columns. * Please do not delete any of the sections in this template. If you have nothing to say for a whole section, just write: None * For help with syntax, see http://sphinx-doc.org/rest.html * If you would like to provide a diagram with your spec, ascii diagrams are required. http://asciiflow.com/ is a very nice tool to assist with making ascii diagrams. The reason for this is that the tool used to review specs is based purely on plain text. Plain text will allow review to proceed without having to look at additional files which can not be viewed in gerrit. It will also allow inline feedback on the diagram itself. Problem description =================== A detailed description of the problem. What problem is this blueprint addressing? Use Cases --------- What use cases does this address? What impact on actors does this change have? Ensure you are clear about the actors in each use case: Developer, End User, etc. Proposed change =============== Here is where you cover the change you propose to make in detail. How do you propose to solve this problem? If this is one part of a larger effort make it clear where this piece ends. In other words, what's the scope of this effort? At this point, if you would like to just get feedback on if the problem and proposed change fit in diskimage-builder, you can stop here and post this for review to get preliminary feedback. If so please say: Posting to get preliminary feedback on the scope of this spec. Alternatives ------------ What other ways could we do this thing? Why aren't we using those? This doesn't have to be a full literature review, but it should demonstrate that thought has been put into why the proposed solution is an appropriate one. API impact ---------- Describe how this will effect our public interfaces. Will this be adding new environment variables? Deprecating existing ones? Adding a new command line argument? Security impact --------------- Describe any potential security impact on the system. Other end user impact --------------------- Aside from the API, are there other ways a user will interact with this feature? Performance Impact ------------------ Describe any potential performance impact on the system, for example how often will new code be called, does it perform any intense processing or data manipulation. Implementation ============== Assignee(s) ----------- Who is leading the writing of the code? Or is this a blueprint where you're throwing it out there to see who picks it up? If more than one person is working on the implementation, please designate the primary author and contact. Primary assignee: Other contributors: Work Items ---------- Work items or tasks -- break the feature up into the things that need to be done to implement it. Those parts might end up being done by different people, but we're mostly trying to understand the timeline for implementation. Dependencies ============ * Include specific references to specs in diskimage-builder or in other projects, that this one either depends on or is related to. * If this requires functionality of another project that is not currently used by diskimage-builder document that fact. Testing ======= Please discuss the important scenarios needed to test here, as well as specific edge cases we should be ensuring work correctly. For each scenario please specify if this requires specialized hardware, or software. Is this untestable in gate given current limitations (specific hardware / software configurations available)? If so, are there mitigation plans (gate enhancements, etc). Documentation Impact ==================== Which audiences are affected most by this change, and which documentation files need to be changed. Do we need to add information about this change to the developer guide, the user guide, certain elements, etc. References ========== Please add any useful references here. You are not required to have any reference. Moreover, this specification should still make sense when your references are unavailable. Examples of what you could include are: * Links to mailing list or IRC discussions * Links to notes from a summit session * Links to relevant research, if appropriate * Related specifications as appropriate * Anything else you feel it is worthwhile to refer to diskimage-builder-2.35.0/doc/source/specs/v1/approved/block-device-overview.rst0000664000175000017500000001204513640271474027473 0ustar zuulzuul00000000000000.. This work is licensed under a Creative Commons Attribution 3.0 Unported License. http://creativecommons.org/licenses/by/3.0/legalcode ================== Block Device Setup ================== During the creation of a disk image (e.g. for a VM), there is the need to create, setup, configure and afterwards detach some kind of storage where the newly installed OS can be copied to or directly installed in. Problem description =================== Currently dib is somewhat limited when it comes to setting up the block device: only one partition that can be used for data. LVM, encryption, multi-device or installation in an already existing block device is not supported. In addition there are several places (main, lib, elements) where the current way of handling the block device is used (spread knowledge and implementation). Also it is not possible, to implement the handling as different elements: it is not possible to pass results of one element in the same phase to another element. Passing results from one phase to dib main is limited. Use Cases --------- Possible use cases are (Actor: End User) #. User wants to use an existing block device to install an system image in (like hd, iSCSI, SAN lun, ...). #. User wants that the system will be installed in multiple partitions. #. User wants that the partitioning is done in a specific way (optimize for speed, optimize for size). #. User wants to use LVM to install the system in (multiple PV, VG and LV). #. User wants to encrypt a partition or a LV where (parts) of the system are installed in. #. User wants specific file systems on specific partitions or LVs. Please note that these are only examples and details are described and implemented by different sub-specs. Proposed change =============== Because of the current way to execute elements, it is not possible to have different elements for each feature. Instead the changes will be implemented in a python module 'block_device' placed in the 'diskimage_builder' directory. The entry-point mechanism is used to create callable python programs. These python programs are directly called from within the dib-main. There is the need to implement some functions or classes that take care about common used new functionality: e.g. storing state between phases, calling python sub-modules and passing arguments around. These functionality is implemented as needed - therefore it is most likely that the first patch implements also big parts of these infrastructure tasks. Alternatives ------------ #. Rewrite DIB in the way that elements can interchange data, even if they are called during one phase. This would influence the way all existing elements are called - and might lead to unpredictable results. #. In addition there is the need to introduce at least two additional phases: because major parts of the block device handling are currently done in main and these must be passed over to elements. #. Another way would be to implement everything in one element: this has the disadvantage, that other elements are not allowed to use the 'block_device' phase any longer and also passing around configuration and results is still not possible (see [3]). API impact ---------- Is described in the sub-elements. Security impact --------------- Is described in the sub-elements. Other end user impact --------------------- Paradigm changes from execute script to configuration for block_device phase. Performance Impact ------------------ Is described in the sub-elements. Implementation ============== Assignee(s) ----------- Primary assignee: ansreas (andreas@florath.net) Would be good, if other people would support this - and specify and implement modules. Work Items ---------- This is an overview over changes in the block device layer. Each level or module needs it's own spec. A first step is to reimplement the existing functionality, this contains: #. Level 0: Local Loop module Use loop device on local image file (This is already implemented: [1]) #. Level 1: partitioning module (This is already implemented: [4]) #. Level 2: Create File System An initial module uses ext4 only #. Level 3: Mounting As a second step the following functionality can be added: * Level 1: LVM module * Level 2: Create File System (swap) * Level 2: Create File System (vfat, needed for UEFI) * Level 2: Create File System (xfs) Of course any other functionality can also be added when needed and wanted. Dependencies ============ Is described in the sub-elements. Testing ======= Is described in the sub-elements. Documentation Impact ==================== Is described in the sub-elements. References ========== [1] Implementation of Level 0: Local Loop module https://review.opendev.org/319591 [2] 'Block Device Setup for Disk-Image-Builder' https://etherpad.openstack.org/p/C80jjsAs4x [3] partitioning-parted This was a first try to implement everything as an element - it shows the limitation. https://review.opendev.org/313938 [4] Implementation of Level 1: partitioning module https://review.opendev.org/322671 diskimage-builder-2.35.0/doc/source/specs/README.rst0000664000175000017500000000635113640271474022072 0ustar zuulzuul00000000000000================================ diskimage-builder Specifications ================================ Overview ======== This directory is used to hold approved design specifications for changes to the diskimage-builder project. Reviews of the specs are done in gerrit, using a similar workflow to how we review and merge changes to the code itself. For specific policies around specification review, refer to the end of this document. The layout of this directory is:: specs/v/ Where there are two sub-directories: - specs/v/approved: specifications approved but not yet implemented - specs/v/implemented: implemented specifications - specs/v/backlog: unassigned specifications The lifecycle of a specification -------------------------------- Developers proposing a specification should propose a new file in the ``approved`` directory. diskimage-builder-core will review the change in the usual manner for the project, and eventually it will get merged if a consensus is reached. When a specification has been implemented either the developer or someone from diskimage-builder-core will move the implemented specification from the ``approved`` directory to the ``implemented`` directory. It is important to create redirects when this is done so that existing links to the approved specification are not broken. Redirects aren't symbolic links, they are defined in a file which sphinx consumes. An example is at ``specs/v1/redirects``. This directory structure allows you to see what we thought about doing, decided to do, and actually got done. Users interested in functionality in a given release should only refer to the ``implemented`` directory. Example specifications ---------------------- You can find an example spec in :doc:`v1/approved/v1-template` Backlog specifications ---------------------- Additionally, we allow the proposal of specifications that do not have a developer assigned to them. These are proposed for review in the same manner as above, but are added to:: specs/backlog/approved Specifications in this directory indicate the original author has either become unavailable, or has indicated that they are not going to implement the specification. The specifications found here are available as projects for people looking to get involved with diskimage-builder. If you are interested in claiming a spec, start by posting a review for the specification that moves it from this directory to the next active release. Please set yourself as the new `primary assignee` and maintain the original author in the `other contributors` list. Specification review policies ============================= There are some special review policies which diskimage-builder-core will apply when reviewing proposed specifications. They are: Trivial specifications ---------------------- Proposed changes which are trivial (very small amounts of code) and don't change any of our public APIs are sometimes not required to provide a specification. The decision of whether something is trivial or not is a judgement made by the author or by consensus of the project cores, generally trying to err on the side of spec creation. Approved Specifications ======================= .. toctree:: :glob: v1/approved/* diskimage-builder-2.35.0/doc/source/ci.md0000664000175000017500000000250213640271474020175 0ustar zuulzuul00000000000000CI needs for image building =========================== Eventually, if/when TripleO becomes an official OpenStack project, all CI for it should be on OpenStack systems. Until then we still need CI. Jenkins ------- * Jenkins from jenkins apt repo. * IRC notification service, notify-only on #triple on freenode, port 7000 ssl. * Github OAuth plugin, permit all from tripleo organisation, and organisation members as service admins. * Grant jenkins builders sudo [may want lxc containers or cloud instances for security isolation] * Jobs to build: * base ubuntu VM. disk-image-create vm base -o base -a i386 * ramdisk deploy image build ramdisk-image-create deploy Copyright ========= Copyright 2012, 2013 Hewlett-Packard Development Company, L.P. Copyright (c) 2012 NTT DOCOMO, INC. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diskimage-builder-2.35.0/doc/source/user_guide/0000775000175000017500000000000013640271564021414 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/doc/source/user_guide/supported_distros.rst0000664000175000017500000000076513640271474025752 0ustar zuulzuul00000000000000Supported Distributions ======================= Distributions which are supported as a build host: - Centos 6, 7 - Debian 8 ("jessie") - Fedora 30, 31 - RHEL 6, 7 - Ubuntu 14.04 ("trusty") - Gentoo - openSUSE Leap 42.3, 15.0, 15.1 and Tumbleweed Distributions which are supported as a target for an image: - Centos 6, 7 - Debian 8 ("jessie") - Fedora 30, 31 - RHEL 6, 7 - Ubuntu 12.04 ("precise"), 14.04 ("trusty") - Gentoo - openSUSE Leap 42.3, 15.0, 15.1 and Tumbleweed (opensuse-minimal only) diskimage-builder-2.35.0/doc/source/user_guide/index.rst0000664000175000017500000000020013640271474023245 0ustar zuulzuul00000000000000User Guide ========== .. toctree:: :maxdepth: 1 supported_distros installation building_an_image install_types diskimage-builder-2.35.0/doc/source/user_guide/installation.rst0000664000175000017500000000245713640271474024657 0ustar zuulzuul00000000000000Installation ============ If your distribution does not provide packages, you should install ``diskimage-builder`` via ``pip``, mostly likely in a ``virtualenv`` to keep it separate. For details, see the installation section in the :ref:`dev_install`. Once installed, you will be able to :doc:`build images ` using ``disk-image-create`` and the elements included in the main ``diskimage-builder`` repository. Requirements ------------ Most image formats require the ``qemu-img`` tool which is provided by the ``qemu-utils`` package on Ubuntu/Debian or the ``qemu`` package on Fedora/RHEL/opensuse/Gentoo. When generating images with partitions, the ``kpartx`` tool is needed, which is provided by the ``kpartx`` package. Some image formats, such as ``VHD``, may require additional tools. Please see the ``disk-image-create`` help output for more information. Individual elements can also have additional dependencies for the build host. It is recommended you check the documentation for each element you are using to determine if there are any additional dependencies. Of particular note is the need for the `dev-python/pyyaml` package on Gentoo hosts. Package Installation -------------------- On Gentoo you can emerge diskimage-builder directly. :: emerge app-emulation/diskimage-builder diskimage-builder-2.35.0/doc/source/user_guide/building_an_image.rst0000664000175000017500000005650313640271474025574 0ustar zuulzuul00000000000000Building An Image ================= Now that you have diskimage-builder properly :doc:`installed ` you can get started by building your first disk image. VM Image -------- Our first image is going to be a bootable vm image using one of the standard supported distribution :doc:`elements <../elements>` (Ubuntu or Fedora). The following command will start our image build (distro must be either 'ubuntu' or 'fedora'): :: disk-image-create vm This will create a qcow2 file 'image.qcow2' which can then be booted. Elements -------- It is important to note that we are passing in a list of :doc:`elements <../elements>` to disk-image-create in our above command. Elements are how we decide what goes into our image and what modifications will be performed. Some elements provide a root filesystem, such as the ubuntu or fedora element in our example above, which other elements modify to create our image. At least one of these 'distro elements' must be specified when performing an image build. It's worth pointing out that there are many distro elements (you can even create your own), and even multiples for some of the distros. This is because there are often multiple ways to install a distro which are very different. For example: One distro element might use a cloud image while another uses a package installation tool to build a root filesystem for the same distro. Other elements modify our image in some way. The 'vm' element in our example above ensures that our image has a bootloader properly installed. This is only needed for certain use cases and certain output formats and therefore it is not performed by default. Output Formats -------------- By default a qcow2 image is created by the disk-image-create command. Other output formats may be specified using the `-t ` argument. Multiple output formats can also be specified by comma separation. The supported output formats are: * qcow2 * tar * tgz * squashfs * vhd * docker * raw When building a tgz image, note that the `DIB_GZIP_BIN` environment variable can be used to set the path of the gzip executable. Disk Image Layout ----------------- The disk image layout (like number of images, partitions, LVM, disk encryption) is something which should be set up during the initial image build: it is mostly not possible to change these things later on. There are currently two defaults: * When using the ``vm`` element, an element that provides ``block-device`` should be included. Available ``block-device-*`` elements cover the common case of a single partition that fills up the whole disk and used as root device. Currently there are MBR, GPT and EFI versions. For example, to use a GPT disk you could build with :: disk-image-create -o output.qcow vm block-device-gpt ubuntu-minimal * When not using the ``vm`` element a plain filesystem image, without any partitioning, is created. If you wish to customise the top-level ``block-device-default.yaml`` file from one of the ``block-device-*`` elements, set the environment variable `DIB_BLOCK_DEVICE_CONFIG`. This variable must hold YAML structured configuration data or be a ``file://`` URL reference to a on-disk configuration file. There are a lot of different options for the different levels. The following sections describe each level in detail. General Remarks +++++++++++++++ In general each module that depends on another module has a `base` element that points to the depending base. Also each module has a `name` that can be used to reference the module. Tree-Like vs. Complete Digraph Configuration ++++++++++++++++++++++++++++++++++++++++++++ The configuration is specified as a digraph_. Each module is a node; a edge is the relation of the current element to its `base`. Because the general digraph_ approach is somewhat complex when it comes to write it down, the configuration can also be given as a tree_. .. _digraph: https://en.wikipedia.org/wiki/Directed_graph .. _tree: https://en.wikipedia.org/wiki/Tree_(graph_theory) Example: The tree like notation .. code-block:: yaml mkfs: name: root_fs base: root_part mount: mount_point: / is exactly the same as writing .. code-block:: yaml mkfs: name: root_fs base: root_part mount: name: mount_root_fs base: root_fs mount_point: / Non existing `name` and `base` entries in the tree notation are automatically generated: the `name` is the name of the base module prepended by the type-name of the module itself; the `base` element is automatically set to the parent node in the tree. In mostly all cases the much simpler tree notation can be used. Nevertheless there are some use cases when the more general digraph notation is needed. Example: when there is the need to combine two or more modules into one new, like combining a couple of physical volumes into one volume group. Tree and digraph notations can be mixed as needed in a configuration. Limitations +++++++++++ To provide an interface towards the existing elements, there are currently three fixed keys used - which are not configurable: * `root-label`: this is the label of the block device that is mounted at `/`. * `image-block-partition`: if there is a block device with the name `root` this is used else the block device with the name `image0` is used. * `image-path`: the path of the image that contains the root file system is taken from the `image0`. Level 0 +++++++ Module: Local Loop .................. This module generates a local image file and uses the loop device to create a block device from it. The symbolic name for this module is `local_loop`. Configuration options: name (mandatory) The name of the image. This is used as the name for the image in the file system and also as a symbolic name to be able to reference this image (e.g. to create a partition table on this disk). size (optional) The size of the disk. The size can be expressed using unit names like TiB (1024^4 bytes) or GB (1000^3 bytes). Examples: 2.5GiB, 12KB. If the size is not specified here, the size as given to disk-image-create (--image-size) or the automatically computed size is used. directory (optional) The directory where the image is created. Example: .. code-block:: yaml local_loop: name: image0 local_loop: name: data_image size: 7.5GiB directory: /var/tmp This creates two image files and uses the loop device to use them as block devices. One image file called `image0` is created with default size in the default temp directory. The second image has the size of 7.5GiB and is created in the `/var/tmp` folder. Level 1 +++++++ Module: Partitioning .................... This module generates partitions on existing block devices. This means that it is possible to take any kind of block device (e.g. LVM, encrypted, ...) and create partition information in it. The symbolic name for this module is `partitioning`. MBR *** It is possible to create primary or logical partitions or a mix of them. The numbering of the primary partitions will start at 1, e.g. `/dev/vda1`; logical partitions will typically start with `5`, e.g. `/dev/vda5` for the first partition, `/dev/vda6` for the second and so on. The number of logical partitions created by this module is theoretical unlimited and it was tested with more than 1000 partitions inside one block device. Nevertheless the Linux kernel and different tools (like `parted`, `sfdisk`, `fdisk`) have some default maximum number of partitions that they can handle. Please consult the documentation of the appropriate software you plan to use and adapt the number of partitions. Partitions are created in the order they are configured. Primary partitions - if needed - must be first in the list. GPT *** GPT partitioning requires the ``sgdisk`` tool to be available. Options ******* There are the following key / value pairs to define one partition table: base (mandatory) The base device to create the partitions in. label (mandatory) Possible values: 'mbr', 'gpt' Configure use of either the Master Boot Record (MBR) or GUID Partition Table (GPT) formats align (optional - default value '1MiB'; MBR only) Set the alignment of the partition. This must be a multiple of the block size (i.e. 512 bytes). The default of 1MiB (~ 2048 * 512 bytes blocks) is the default for modern systems and known to perform well on a wide range of targets. For each partition there might be some space that is not used - which is `align` - 512 bytes. For the default of 1MiB exactly 1048064 bytes (= 1 MiB - 512 byte) are not used in the partition itself. Please note that if a boot loader should be written to the disk or partition, there is a need for some space. E.g. grub needs 63 * 512 byte blocks between the MBR and the start of the partition data; this means when grub will be installed, the `align` must be set at least to 64 * 512 byte = 32 KiB. partitions (mandatory) A list of dictionaries. Each dictionary describes one partition. The following key / value pairs can be given for each partition: name (mandatory) The name of the partition. With the help of this name, the partition can later be referenced, e.g. when creating a file system. flags (optional) List of flags for the partition. Default: empty. Possible values: boot (MBR only) Sets the boot flag for the partition primary (MBR only) Partition should be a primary partition. If not set a logical partition will be created. size (mandatory) The size of the partition. The size can either be an absolute number using units like `10GiB` or `1.75TB` or relative (percentage) numbers: in the later case the size is calculated based on the remaining free space. type (optional) The partition type stored in the MBR or GPT partition table entry. For MBR the default value is '0x83' (Linux Default partition). Any valid one byte hexadecimal value may be specified here. For GPT the default value is '8300' (Linux Default partition). Any valid two byte hexadecimal value may be specified here. Due to ``sgdisk`` leading '0x' should not be used. Example: .. code-block:: yaml - partitioning: base: image0 label: mbr partitions: - name: part-01 flags: [ boot ] size: 1GiB - name: part-02 size: 100% - partitioning: base: data_image label: mbr partitions: - name: data0 size: 33% - name: data1 size: 50% - name: data2 size: 100% - partitioning: base: gpt_image label: gpt partitions: - name: ESP type: EF00 size: 16MiB - name: data1 size: 1GiB - name: lvmdata type: 8E00 size: 100% On the `image0` two partitions are created. The size of the first is 1GiB, the second uses the remaining free space. On the `data_image` three partitions are created: all are about 1/3 of the disk size. On the `gpt_image` three partitions are created: 16MiB one for EFI bootloader, 1GiB Linux filesystem one and rest of disk will be used for LVM partition. Module: LVM ........... This module generates volumes on existing block devices. This means that it is possible to take any previous created partition, and create volumes information in it. The symbolic name for this module is `lvm`. There are the following key / value pairs to define one set of volumes: pvs (mandatory) A list of dictionaries. Each dictionary describes one physical volume. vgs (mandatory) A list of dictionaries. Each dictionary describes one volume group. lvs (mandatory) A list of dictionaries. Each dictionary describes one logical volume. The following key / value pairs can be given for each `pvs`: name (mandatory) The name of the physical volume. With the help of this name, the physical volume can later be referenced, e.g. when creating a volume group. base (mandatory) The name of the partition where the physical volume needs to be created. options (optional) List of options for the physical volume. It can contain any option supported by the `pvcreate` command. The following key / value pairs can be given for each `vgs`: name (mandatory) The name of the volume group. With the help of this name, the volume group can later be referenced, e.g. when creating a logical volume. base (mandatory) The name(s) of the physical volumes where the volume groups needs to be created. As a volume group can be created on one or more physical volumes, this needs to be a list. options (optional) List of options for the volume group. It can contain any option supported by the `vgcreate` command. The following key / value pairs can be given for each `lvs`: name (mandatory) The name of the logical volume. With the help of this name, the logical volume can later be referenced, e.g. when creating a filesystem. base (mandatory) The name of the volume group where the logical volume needs to be created. size (optional) The exact size of the volume to be created. It accepts the same syntax as the -L flag of the `lvcreate` command. extents (optional) The relative size in extents of the volume to be created. It accepts the same syntax as the -l flag of the `lvcreate` command. Either size or extents need to be passed on the volume creation. options (optional) List of options for the logical volume. It can contain any option supported by the `lvcreate` command. Example: .. code-block:: yaml - lvm: name: lvm pvs: - name: pv options: ["--force"] device: root vgs: - name: vg base: ["pv"] options: ["--force"] lvs: - name: lv_root base: vg size: 1800M - name: lv_tmp base: vg size: 100M - name: lv_var base: vg size: 500M - name: lv_log base: vg size: 100M - name: lv_audit base: vg size: 100M - name: lv_home base: vg size: 200M On the `root` partition a physical volume is created. On that physical volume, a volume group is created. On top of this volume group, six logical volumes are created. Please note that in order to build images that are bootable using volumes, your ramdisk image will need to have that support. If the image you are using does not have it, you can add the needed modules and regenerate it, by including the `dracut-regenerate` element when building it. Level 2 +++++++ Module: Mkfs ............ This module creates file systems on the block device given as `base`. The following key / value pairs can be given: base (mandatory) The name of the block device where the filesystem will be created on. name (mandatory) The name of the partition. This can be used to reference (e.g. mounting) the filesystem. type (mandatory) The type of the filesystem, like `ext4` or `xfs`. label (optional - defaults to the name) The label of the filesystem. This can be used e.g. by grub or in the fstab. opts (optional - defaults to empty list) Options that will passed to the mkfs command. uuid (optional - no default / not used if not givem) The UUID of the filesystem. Not all file systems might support this. Currently there is support for `ext2`, `ext3`, `ext4` and `xfs`. Example: .. code-block:: yaml - mkfs: name: mkfs_root base: root type: ext4 label: cloudimage-root uuid: b733f302-0336-49c0-85f2-38ca109e8bdb opts: "-i 16384" Level 3 +++++++ Module: Mount ............. This module mounts a filesystem. The options are: base (mandatory) The name of the filesystem that will be mounted. name (mandatory) The name of the mount point. This can be used for reference the mount (e.g. creating the fstab). mount_point (mandatory) The mount point of the filesystem. There is no need to list the mount points in the correct order: an algorithm will automatically detect the mount order. Example: .. code-block:: yaml - mount: name: root_mnt base: mkfs_root mount_point: / Level 4 +++++++ Module: fstab ............. This module creates fstab entries. The following options exists. For details please consult the fstab man page. base (mandatory) The name of the mount point that will be written to fstab. name (mandatory) The name of the fstab entry. This can be used later on as reference - and is currently unused. options (optional, defaults to `default`) Special mount options can be given. This is used as the fourth field in the fstab entry. dump-freq (optional, defaults to 0 - don't dump) This is passed to dump to determine which filesystem should be dumped. This is used as the fifth field in the fstab entry. fsck-passno (optional, defaults to 2) Determines the order to run fsck. Please note that this should be set to 1 for the root file system. This is used as the sixth field in the fstab entry. Example: .. code-block:: yaml - fstab: name: var_log_fstab base: var_log_mnt options: nodev,nosuid dump-freq: 2 Legacy global filesystem configuration -------------------------------------- The ``disk-image-create`` tool has a number of historic global disk-related command-line options which are maintained for backwards compatibility. These options are merged as necessary by the block-device layer into the active configuration. If you are using more complicated block-device layouts with multiple partitions, you may need to take into account the special behaviour described below. The ``local_loop`` module will take it's default size from the following arguments: ``--image-size`` The size of loopback device which the image will be generated in, in gigabytes. If this is left unset, the size will be calculated from the on-disk size of the image and then scaled up by a fixed 60% factor. Can also set ``DIB_IMAGE_SIZE``. ``--image-extra-size`` Extra space to add when automatically calculating image size, in megabytes. This overrides the default 60% scale up as described above for ``--image-size``. Can also set ``DIB_IMAGE_EXTRA_SIZE``. The special node named ``mkfs_root`` is affected by the following; this reflects that the standard layout has only a single root partition so the options are, in effect, global for the default configuration. Note that if you are using multiple partitions, settings such as ``--mkfs-options`` will *not* apply to other partitions. The file-system type for the ``mkfs_root`` node is set by the ``FS_TYPE`` environment variable, and defaults to ``ext4``. ``xfs`` should also work. There is no command-line argument for this. The following options also affect the ``mkfs_root`` node configuration: ``--mkfs-options`` Options passed to mkfs when making the root partition. For ``ext4`` partitions, this by default sets a 4k byte-to-inode ratio (see below) and a default journal size of 64MiB. Note ``--mkfs-options`` are options passed to the mfks *driver* (i.e. ``mkfs.ext4``) rather than ``mkfs`` itself (i.e. arguments come after the initial ``mkfs -t `` argument). You also need to be careful with quoting. Can also set ``MKFS_OPTS``. By default, ``disk-image-create`` uses a 4k byte-to-inode ratio when creating the filesystem in the image. This allows large 'whole-system' images to utilize several TB disks without exhausting inodes. In contrast, when creating images intended for tenant instances, this ratio consumes more disk space than an end-user would expect (e.g. a 50GB root disk has 47GB available). If the image is intended to run within a tens to hundrededs of gigabyte disk, setting the byte-to-inode ratio to the ext4 default of 16k will allow for more usable space on the instance. The default can be overridden by passing ``'-i 16384'`` as a ``--mkfs-options`` argument. ``--mkfs-journal-size`` Only valid for ``FS_TYPE==ext4``. This value set the filesystem journal size in MB; overriding the default of 64MiB. Note the image size will be grown to fit the journal, unless ``DIB_IMAGE_SIZE`` is explicitly set. Can also set ``DIB_JOURNAL_SIZE``. ``--max-online-resize`` Only valid for ``FS_TYPE==ext4``; this value sets the maximum filesystem blocks when resizing. Can also set ``MAX_ONLINE_RESIZE``. ``--root-label`` The file-system label specified when creating the root file system. Defaults to ``cloudimg-rootfs`` for ``ext4`` and ``img-rootfs`` for ``xfs``. Can also set ``ROOT_LABEL``. Speedups -------- If you have 4GB of available physical RAM (as reported by /proc/meminfo MemTotal), or more, diskimage-builder will create a tmpfs mount to build the image in. This will improve image build time by building it in RAM. By default, the tmpfs file system uses 50% of the available RAM. Therefore, the RAM should be at least the double of the minimum tmpfs size required. For larger images, when no sufficient amount of RAM is available, tmpfs can be disabled completely by passing --no-tmpfs to disk-image-create. ramdisk-image-create builds a regular image and then within that image creates ramdisk. If tmpfs is not used, you will need enough room in /tmp to store two uncompressed cloud images. If tmpfs is used, you would still need /tmp space for one uncompressed cloud image and about 20% of that image for working files. Nameservers ----------- To ensure elements can access the network, ``disk-image-create`` replaces the ``/etc/resolv.conf`` within the chroot with a copy of the host's file early in the image creation process. The final ``/etc/resolv.conf`` can be controlled in a number of ways. If, during the build, the ``/etc/resolv.conf`` file within the chroot is replaced with a symlink, this will be retained in the final image [1]_. If the file is marked immutable, it will also not be touched. .. [1] This somewhat odd case was added for installation of the ``resolvconf`` package, which replaces ``/etc/resolv.conf`` with a symlink to it's version. Depending on its contents, and what comes after the installation in the build, this mostly works. If you would like specific contents within the final ``/etc/resolv.conf`` you can place them into ``/etc/resolv.conf.ORIG`` during the build. As one of the final steps, this file will be ``mv`` to ``/etc/resolv.conf``. Chosing an Architecture ----------------------- If needed you can specify an override the architecture selection by passing a ``-a`` argument like: :: disk-image-create -a ... Notes about PowerPC Architectures +++++++++++++++++++++++++++++++++ PowerPC can operate in either Big or Little Endian mode. ``ppc64`` always refers to Big Endian operation. When running in little endian mode it can be referred to as ``ppc64le`` or ``ppc64el``. Typically ``ppc64el`` refers to a ``.deb`` based distribution architecture, and ``ppc64le`` refers to a ``.rpm`` based distribution. Regardless of the distribution the kernel architecture is always ``ppc64le``. Notes about s390x (z Systems) Architecture ++++++++++++++++++++++++++++++++++++++++++ Images for s390x can only be build on s390x hosts. Trying to build it with the architecture override on other architecture will cause the build to fail. diskimage-builder-2.35.0/doc/source/user_guide/install_types.rst0000664000175000017500000000337613640271474025051 0ustar zuulzuul00000000000000Install Types ============= Install types permit elements to be installed from different sources, such as git repositories, distribution packages, or pip. The default install type is 'source' but it can be modified on the disk-image-create command line via the --install-type option. For example you can set: --install-type=package to enable package installs by default. Alternately, you can also set DIB\_DEFAULT\_INSTALLTYPE. Many elements expose different install types. The different implementations live under `--install` directories under an element's install.d. The base element enables the chosen install type by symlinking the correct hook scripts under install.d directly. `` can be a string of alphanumeric and '-' characters, but typically corresponds to the element name. For example, the nova element would provide: nova/install.d/nova-package-install/74-nova nova/install.d/nova-source-install/74-nova The following symlink would be created for the package install type: install.d/74-nova -> nova-package-install/74-nova Or, for the source install type: install.d/74-nova -> nova-source-install/74-nova All other scripts that exist under install.d for an element will be executed as normal. This allows common install code to live in a script under install.d. To set the install type for an element define an environment variable `DIB_INSTALLTYPE_`. Note that if you used `-` characters in your install directory prefix, those need to be replaced with `_` in the environment variable. For example, to enable the package install type for the set of nova elements that use `nova` as the install type prefix, define the following: export DIB_INSTALLTYPE_nova=package diskimage-builder-2.35.0/doc/source/developer/0000775000175000017500000000000013640271564021246 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/doc/source/developer/invocation.rst0000664000175000017500000000514313640271474024154 0ustar zuulzuul00000000000000.. _dev_install: Developer Installation ====================== Note that for non-development use you can use distribution packages or install the latest release via ``pip`` (usually in a separate ``virtualenv`` environment). For development purposes, you can use ``pip -e`` to install the latest git tree checkout into a local development/testing ``virtualenv``. However, the recommended way is to use provided ``tox`` environments; e.g. .. code-block:: shell-session $ git clone https://opendev.org/openstack/diskimage-builder $ cd diskimage-builder $ tox -e bindep $ sudo apt-get install $ tox -e venv -- disk-image-create ... This will ensure you run with the right requirements. Invocation ---------- The ``image-create`` scripts should be run from the ``$PATH``; this should will be automatically set if using a ``virtualenv`` or ``tox``. A range of options can be set on the command-line. Try ``-h`` for help. Other options can be set by exporting variables; some variables for export are listed in ``lib/img-defaults``. See specific element instructions for other variables that may be obeyed. The image building scripts expect to be able to invoke commands with ``sudo``. Thus if you want them to run non-interactively, you should either run them as root, with ``sudo -E``, or allow your build user to run any ``sudo`` command without password. Element priority ---------------- The variable ``ELEMENTS_PATH`` is a colon (:) separated path list to search for elements. The included ``elements`` tree is used when no path is supplied and is always added to the end of the path if a path is supplied. Earlier elements will override later elements, i.e. with ``ELEMENTS_PATH=foo:bar`` the element ``my-element`` will be chosen from ``foo/my-element`` over ``bar/my-element``, or any in-built element of the same name. Output ------ By default, the image building scripts will not overwrite existing disk images, allowing you to compare the newly built image with the existing one. To change that behaviour, set the variable ``OVERWRITE_OLD_IMAGE`` to any value that isn't ``0``. If this value is zero then any existing image will be moved before the new image is written to the destination. Size reports ------------ Setting the variable ``DIB_SHOW_IMAGE_USAGE`` will print out a summarised disk-usage report for the final image of files and directories over 10MiB in size. Setting ``DIB_SHOW_IMAGE_USAGE_FULL`` will show all files and directories. These settings can be useful additions to the logs in automated build situations where debugging image-growth may be important. diskimage-builder-2.35.0/doc/source/developer/stable_interfaces.rst0000664000175000017500000000130213640271474025451 0ustar zuulzuul00000000000000Stable Interfaces ================= diskimage-builder and the elements provide several 'stable' interfaces for both developers and users which we aim to preserve during a major version release. These interfaces consist of: The names and arguments of the executable scripts included with diskimage-builder in the bin directory will remain stable. The environment variables that diskimage-builder provides for elements to use will remain stable. The environment variables documented in each element and the values accepted by these environment variables will remain stable. Required environment variables for an element will not be added. Support for build or target distributions will not be removed. diskimage-builder-2.35.0/doc/source/developer/index.rst0000664000175000017500000000226513640271474023114 0ustar zuulzuul00000000000000Developer Guide =============== .. toctree:: :maxdepth: 1 design components invocation caches developing_elements dib_lint stable_interfaces vhd_creation This documentation explains how to get started with creating your own disk-image-builder elements as well as some high level concepts for element creation. Quickstart ---------- To get started developing with ``diskimage-builder``, install to a ``virtualenv``:: $ mkdir dib $ cd dib $ virtualenv env $ source env/bin/activate $ git clone https://opendev.org/openstack/diskimage-builder $ cd diskimage-builder $ pip install -e . You can now simply use ``disk-image-create`` to start building images and testing your changes. When you are done editing, use ``git review`` to submit changes to the upstream gerrit. Python module documentation --------------------------- For internal documentation on the DIB python components, see the :ref:`modindex` Finding Work ------------ We maintain a list of low-hanging-fruit tags on launchpad: * `https://bugs.launchpad.net/diskimage-builder/+bugs?field.tag=low-hanging-fruit` diskimage-builder-2.35.0/doc/source/developer/developing_elements.rst0000664000175000017500000004333713640271474026042 0ustar zuulzuul00000000000000.. _developing-elements: Developing Elements =================== Conform to the following conventions: * Use the environment for overridable defaults, prefixing environment variable names with ``DIB_``. For example: .. sourcecode:: sh DIB_MYDEFAULT=${DIB_MYDEFAULT:-default} If you do not use the ``DIB`` prefix you may find that your overrides are discarded as the build environment is sanitised. * Consider that your element co-exists with many others and try to guard against undefined behaviours. Some examples: * Two elements use the source-repositories element, but use the same filename for the source-repositories config file. Files such as these (and indeed the scripts in the various .d directories :ref:`listed below `) should be named such that they are unique. If they are not unique, when the combined tree is created by disk-image-builder for injecting into the build environment, one of the files will be overwritten. * Two elements copy different scripts into ``/usr/local/bin`` with the same name. If they both use ``set -e`` and ``cp -n`` then the conflict will be caught and cause the build to fail. * If your element mounts anything into the image build tree (``$TMP_BUILD_DIR``) then it will be automatically unmounted when the build tree is unmounted - and not remounted into the filesystem image - if the mount point is needed again, your element will need to remount it at that point. * If caching is required, elements should use a location under ``$DIB_IMAGE_CACHE``. * Elements should allow for remote data to be cached. When ``$DIB_OFFLINE`` is set, this cached data should be used if possible. See the :ref:`dev-global-image-build-variables` section of this document for more information. * Elements in the upstream diskimage-builder elements should not create executables which run before 10- or after 90- in any of the phases if possible. This is to give downstream elements the ability to easily make executables which run after our upstream ones. .. _phase-subdirectories: Phase Subdirectories ^^^^^^^^^^^^^^^^^^^^ Make as many of the following subdirectories as you need, depending on what part of the process you need to customise. The subdirectories are executed in the order given here. Scripts within the subdirectories should be named with a two-digit numeric prefix, and are executed in numeric order. Only files which are marked executable (+x) will be run, so other files can be stored in these directories if needed. As a convention, we try to only store executable scripts in the phase subdirectories and store data files elsewhere in the element. The phases are: #. ``root.d`` #. ``extra-data.d`` #. ``pre-install.d`` #. ``install.d`` #. ``post-install.d`` #. ``post-root.d`` #. ``block-device.d`` #. ``pre-finalise.d`` #. ``finalise.d`` #. ``cleanup.d`` ``root.d`` Create or adapt the initial root filesystem content. This is where alternative distribution support is added, or customisations such as building on an existing image. Only one element can use this at a time unless particular care is taken not to blindly overwrite but instead to adapt the context extracted by other elements. * runs: **outside chroot** * inputs: * ``$ARCH=i386|amd64|armhf|arm64`` * ``$TARGET_ROOT=/path/to/target/workarea`` ``extra-data.d`` Pull in extra data from the host environment that hooks may need during image creation. This should copy any data (such as SSH keys, http proxy settings and the like) somewhere under ``$TMP_HOOKS_PATH``. * runs: **outside chroot** * inputs: ``$TMP_HOOKS_PATH`` * outputs: None Contents placed under ``$TMP_HOOKS_PATH`` will be available at ``/tmp/in_target.d`` inside the chroot. ``pre-install.d`` Run code in the chroot before customisation or packages are installed. A good place to add apt repositories. * runs: **in chroot** ``install.d`` Runs after ``pre-install.d`` in the chroot. This is a good place to install packages, chain into configuration management tools or do other image specific operations. * runs: **in chroot** ``post-install.d`` Run code in the chroot. This is a good place to perform tasks you want to handle after the OS/application install but before the first boot of the image. Some examples of use would be * Run ``chkconfig`` to disable unneeded services * Clean the cache left by the package manager to reduce the size of the image. * runs: **in chroot** ``post-root.d`` Run code outside the chroot. This is a good place to perform tasks that cannot run inside the chroot and must run after installing things. The root filesystem content is rooted at ``$TMP_BUILD_DIR/mnt``. * runs: **outside chroot** ``block-device.d`` Customise the block device that the image will be made on (for example to make partitions). Runs after the target tree has been fully populated but before the ``cleanup.d`` phase runs. * runs: **outside chroot** * inputs: * ``$IMAGE_BLOCK_DEVICE={path}`` * ``$TARGET_ROOT={path}`` * outputs: ``$IMAGE_BLOCK_DEVICE={path}`` ``pre-finalise.d`` Final tuning of the root filesystem, outside the chroot. Filesystem content has been copied into the final file system which is rooted at ``$TMP_BUILD_DIR/mnt``. You might do things like re-mount a cache directory that was used during the build in this phase (with subsequent unmount in ``cleanup.d``). * runs: **outside chroot** ``finalise.d`` Perform final tuning of the root filesystem. Runs in a chroot after the root filesystem content has been copied into the mounted filesystem: this is an appropriate place to reset SELinux metadata, install grub bootloaders and so on. Because this happens inside the final image, it is important to limit operations here to only those necessary to affect the filesystem metadata and image itself. For most operations, ``post-install.d`` is preferred. * runs: **in chroot** ``cleanup.d`` Perform cleanup of the root filesystem content. For instance, temporary settings to use the image build environment HTTP proxy are removed here in the dpkg element. * runs: **outside chroot** * inputs: * ``$ARCH=i386|amd64|armhf|arm64`` * ``$TARGET_ROOT=/path/to/target/workarea`` Other Subdirectories ^^^^^^^^^^^^^^^^^^^^ Elements may have other subdirectories that are processed by specific elements rather than the diskimage-builder tools themselves. One example of this is the ``bin`` directory. The `rpm-distro`, :doc:`../elements/dpkg/README` and :doc:`../elements/opensuse/README` elements install all files found in the ``bin`` directory into ``/usr/local/bin`` within the image as executable files. Environment Variables ^^^^^^^^^^^^^^^^^^^^^ To set environment variables for other hooks, add a file to your element ``environment.d``. This directory contains bash script snippets that are sourced before running scripts in each phase. Note that because environment includes are sourced together, they should not set global flags like ``set -x`` because they will affect all preceeding imports. Dependencies ^^^^^^^^^^^^ Each element can use the following files to define or affect dependencies: ``element-deps`` A plain text, newline separated list of elements which will be added to the list of elements built into the image at image creation time. ``element-provides`` A plain text, newline separated list of elements which are provided by this element. These elements will be excluded from elements built into the image at image creation time. For example if element A depends on element B and element C includes element B in its ``element-provides`` file and A and C are included when building an image, then B is not used. Operating system elements ^^^^^^^^^^^^^^^^^^^^^^^^^ Some elements define the base structure for an operating system -- for example, the ``opensuse`` element builds a base openSUSE system. Such elements have more requirements than the other elements: * they must have ``operating-system`` in their element-provides, so this indicates they are an "operating system". * they must export the ``DISTRO_NAME`` environment variable with the name of the distribution built, using an environment.d script. For example, the ``opensuse`` element exports ``DISTRO_NAME=opensuse``. Ramdisk Elements ^^^^^^^^^^^^^^^^ Ramdisk elements support the following files in their element directories: ``binary-deps.d`` Text files listing executables required to be fed into the ramdisk. These need to be present in ``$PATH`` in the build chroot (i.e. need to be installed by your elements as described above). ``init.d`` POSIX shell script fragments that will be appended to the default script executed as the ramdisk is booted (``/init``). ``ramdisk-install.d`` Called to copy files into the ramdisk. The variable ``$TMP_MOUNT_PATH`` points to the root of the tree that will be packed into the ramdisk. ``udev.d`` ``udev`` rules files that will be copied into the ramdisk. Element coding standard ^^^^^^^^^^^^^^^^^^^^^^^ - lines should not include trailing whitespace. - there should be no hard tabs in the file. - indents are 4 spaces, and all indentation should be some multiple of them. - `do` and `then` keywords should be on the same line as the if, while or for conditions. .. _dev-global-image-build-variables: Global image-build variables ---------------------------- ``DIB_OFFLINE`` This is always set. When not empty, any operations that perform remote data access should avoid it if possible. If not possible the operation should still be attempted as the user may have an external cache able to keep the operation functional. ``DIB_IMAGE_ROOT_FS_UUID`` This contains the UUID of the root filesystem, when diskimage-builder is building a disk image. This works only for ext filesystems. ``DIB_IMAGE_CACHE`` Path to where cached inputs to the build process are stored. Defaults to ``~/.cache/image_create``. Structure of an element ----------------------- The above-mentioned global content can be further broken down in a way that encourages composition of elements and reusability of their components. One possible approach to this would be to label elements as either a "driver", "service", or "config" element. Below are some examples. - Driver-specific elements should only contain the necessary bits for that driver:: elements/ driver-mellanox/ init - modprobe line install.d/ 10-mlx - package installation - An element that installs and configures Nova might be a bit more complex, containing several scripts across several phases:: elements/ service-nova/ source-repository-nova - register a source repository pre-install.d/ 50-my-ppa - add a PPA install.d/ 10-user - common Nova user accts 50-my-pack - install packages from my PPA 60-nova - install nova and some dependencies - In the general case, configuration should probably be handled either by the meta-data service (eg, o-r-c) or via normal CM tools (eg, salt). That being said, it may occasionally be desirable to create a set of elements which express a distinct configuration of the same software components. In this way, depending on the hardware and in which availability zone it is to be deployed, an image would be composed of: * zero or more driver-elements * one or more service-elements * zero or more config-elements It should be noted that this is merely a naming convention to assist in managing elements. Diskimage-builder is not, and should not be, functionally dependent upon specific element names. diskimage-builder has the ability to retrieve source code for an element and place it into a directory on the target image during the extra-data phase. The default location/branch can then be overridden by the process running diskimage-builder, making it possible to use the same element to track more then one branch of a git repository or to get source for a local cache. See :doc:`../elements/source-repositories/README` for more information. Finding other elements ---------------------- DIB exposes an internal ``$IMAGE_ELEMENT_YAML`` variable which provides elements access to the full set of included elements and their paths. This can be used to process local in-element files across all the elements (``pkg-map`` for example). .. code-block:: python import os import yaml elements = yaml.load(os.getenv('IMAGE_ELEMENT_YAML')) for element, path in elements: ... For elements written in Bash, there is a function ``get_image_element_array`` that can be used to instantiate an associative-array of elements and paths (note arrays can not be exported in bash). .. code-block:: bash # note eval to expand the result of the get function eval declare -A image_elements=($(get_image_element_array)) for i in ${!image_elements[$i]}; do element=$i path=${image_elements[$i]} done Debugging elements ------------------ Export ``break`` to drop to a shell during the image build. Break points can be set either before or after any of the hook points by exporting "break=[before|after]-hook-name". Multiple break points can be specified as a comma-delimited string. Some examples: * ``break=before-block-device-size`` will break before the block device size hooks are called. * ``break=before-pre-install`` will break before the pre-install hooks. * ``break=after-error`` will break after an error during an in target hookpoint. The :doc:`../elements/manifests/README` element will make a range of manifest information generated by other elements available for inspection inside and outside the built image. Environment and command line arguments are captured as described in the documentation and can be useful for debugging. Images are built such that the Linux kernel is instructed not to switch into graphical consoles (i.e. it will not activate KMS). This maximises compatibility with remote console interception hardware, such as HP's iLO. However, you will typically only see kernel messages on the console - init daemons (e.g. upstart) will usually be instructed to output to a serial console so nova's console-log command can function. There is an element in the tripleo-image-elements repository called "remove-serial-console" which will force all boot messages to appear on the main console. Ramdisk images can be debugged at run-time by passing ``troubleshoot`` as a kernel command line argument, or by pressing "t" when an error is reached. This will spawn a shell on the console (this can be extremely useful when network interfaces or disks are not detected correctly). Testing Elements ---------------- An element can have functional tests encapsulated inside the element itself. The tests can be written either as shell or python unit tests. shell """"" In order to create a test case, follow these steps: * Create a directory called ``test-elements`` inside your element. * Inside the test-elements directory, create a directory with the name of your test case. The test case directory should have the same structure as an element. For example:: elements/apt-sources/test-elements/test-case-1 * Assert state during each of the element build phases you would like to test. You can exit 1 to indicate a failure. * To exit early and indicate a success, touch a file ``/tmp/dib-test-should-fail`` in the image chroot, then exit 1. Tests are run with ``tools/run_functests.sh``. Running ``run_functests.sh -l`` will show available tests (the example above would be called ``apt-sources/test-case-1``, for example). Specify your test (or a series of tests as separate arguments) on the command line to run it. If it should not be run as part of the default CI run, you can submit a change with it added to ``DEFAULT_SKIP_TESTS`` in that file. Running the functional tests is time consuming. Multiple parallel jobs can be started by specifying ``-j ``. Each of the jobs uses a lot resources (CPU, disk space, RAM) - therefore the job count must carefully be chosen. python """""" To run functional tests locally, install and start docker, then use the following tox command:: tox -efunc Note that running functional tests requires *sudo* rights, thus you may be asked for your password. To run functional tests for one element, append its name to the command:: tox -efunc ironic-agent Additionally, elements can be tested using python unittests. To create a a python test: * Create a directory called ``tests`` in the element directory. * Create an empty file called ``__init__.py`` to make it into a python package. * Create your test files as ``test\whatever.py``, using regular python test code. To run all the tests use testr - ``testr run``. To run just some tests provide one or more regex filters - tests matching any of them are run - ``testr run apt-proxy``. Third party elements -------------------- Additional elements can be incorporated by setting ``ELEMENTS_PATH``, for example if one were building tripleo-images, the variable would be set like: .. sourcecode:: sh export ELEMENTS_PATH=tripleo-image-elements/elements disk-image-create rhel7 cinder-api Linting ------- You should always run ``bin/dib-lint`` over your elements. It will warn you of common issues. sudo """" Using ``sudo`` outside the chroot environment can cause breakout issues where you accidentally modify parts of the host system. ``dib-lint`` will warn if it sees ``sudo`` calls that do not use the path arguments given to elements running outside the chroot. To disable the error for a call you know is safe, add :: # dib-lint: safe_sudo to the end of the ``sudo`` command line. To disable the check for an entire file, add :: # dib-lint: disable=safe_sudo diskimage-builder-2.35.0/doc/source/developer/caches.rst0000664000175000017500000000277313640271474023237 0ustar zuulzuul00000000000000Caches and offline mode ======================= Since retrieving and transforming operating system image files, git repositories, Python or Ruby packages, and so on can be a significant overhead, we cache many of the inputs to the build process. The cache location is read from ``DIB_IMAGE_CACHE``. :ref:`developing-elements` describes the interface within disk-image-builder for caching. When invoking disk-image-builder, the ``--offline`` option will instruct disk-image-builder to not refresh cached resources. Alternatively you can set ``DIB_OFFLINE=1``. Note that we don't maintain operating system package caches, instead depending on your local infrastructure (e.g. Squid cache, or an APT or Yum proxy) to facilitate caching of that layer, so you need to arrange independently for offline mode. For more information about setting up a squid proxy, consult the `TripleO documentation `_. Base images ----------- These are cached by the standard elements - :doc:`../elements/fedora/README`, :doc:`../elements/redhat-common/README`, :doc:`../elements/ubuntu/README`, :doc:`../elements/debian/README` and :doc:`../elements/opensuse/README`. source-repositories ------------------- Git repositories and tarballs obtained via the :doc:`../elements/source-repositories/README` element will be cached. PyPI ---- The :doc:`../elements/pypi/README` element will bind mount a PyPI mirror from the cache dir and configure pip and easy-install to use it. diskimage-builder-2.35.0/doc/source/developer/dib_lint.rst0000664000175000017500000000332413640271474023566 0ustar zuulzuul00000000000000dib-lint ======== dib-lint provides a way to check for common errors in diskimage-builder elements. To use it, simply run the ``dib-lint`` script in a directory containing an ``elements`` directory. The checks will be run against every file found under ``elements``. The following is a list of what is currently caught by dib-lint: * executable: Ensure any files that begin with #! are executable * indent: Ensure that all source code is using an indent of four spaces * element-deps ordering: Ensure all element-deps files are alphabetized * /bin/bash: Ensure all scripts are using bash explicitly * sete: Ensure all scripts are set -e * setu: Ensure all scripts are set -u * setpipefail: Ensure all scripts are set -o pipefail * dibdebugtrace: Ensure all scripts respect the DIB_DEBUG_TRACE variable * tabindent: Ensure no tabs are used for indentation * newline: Ensure that every file ends with a newline * mddocs: Ensure that only markdown-formatted documentation is used * yaml validation: Ensure that any yaml files in the repo have valid syntax Some of the checks can be omitted, either for an entire project or for an individual file. Project exclusions go in tox.ini, using the following section format:: [dib-lint] ignore=sete setpipefail This will cause the set -e and set -o pipefail checks to be ignored. File-specific exclusions are specified as a comment in the relevant file, using the following format:: # dib-lint: disable=sete setpipefail This will exclude the same tests, but only for the file in which the comment appears. Only some of the checks can be disabled. The ones available for exclusion are: * executable * indent * sete * setu * setpipefail * dibdebugtrace * tabindent * newline * mddocs diskimage-builder-2.35.0/doc/source/developer/design.rst0000664000175000017500000000654513640271474023263 0ustar zuulzuul00000000000000Design ====== Images are built using a chroot and bind mounted /proc /sys and /dev. The goal of the image building process is to produce blank slate machines that have all the necessary bits to fulfill a specific purpose in the running of an OpenStack cloud: e.g. a nova-compute node. Images produce either a filesystem image with a label of cloudimg-rootfs, or can be customised to produce whole disk images (but will still contain a filesystem labelled cloudimg-rootfs). Once the file system tree is assembled a loopback device with filesystem (or partition table and file system) is created and the tree copied into it. The file system created is an ext4 filesystem just large enough to hold the file system tree and can be resized up to 1PB in size. To produce the smallest image the utility fstrim is used. When deleting a file the space is simply marked as free on the disk, the file is still there until it is overwritten. fstrim informs the underlying disk to drop those bytes the end result of which is like writting zeros over those sectors. The same effect could be achieved by creating a large file full of zeros and removing that file, however that method is far more IO intensive. An element is a particular set of code that alters how the image is built, or runs within the chroot to prepare the image. E.g. the local-config element copies in the http proxy and ssh keys of the user running the image build process into the image, whereas the vm element makes the image build a regular VM image with partition table and installed grub boot sector. The mellanox element adds support for mellanox infiniband hardware to both the deploy ramdisk and the built images. Images must specify a base distribution image element. Currently base distribution elements exist for fedora, rhel, ubuntu, debian and opensuse. Other distributions may be added in future, the infrastructure deliberately makes few assumptions about the exact operating system in use. The base image has opensshd running (a new key generated on first boot) and accepts keys via the cloud metadata service, loading them into the distribution specific default user account. The goal of a built image is to have any global configuration ready to roll, but nothing that ties it to a specific cloud instance: images should be able to be dropped into a test cloud and validated, and then deployed into a production cloud (usually via bare metal nova) for production use. As such, the image contents can be modelled as three distinct portions: - global content: the actual code, kernel, always-applicable config (like disabling password authentication to sshd). - metadata / config management provided configuration: user ssh keys, network address and routes, configuration management server location and public key, credentials to access other servers in the cloud. These are typically refreshed on every boot. - persistent state: sshd server key, database contents, swift storage areas, nova instance disk images, disk image cache. These would typically be stored on a dedicated partition and not overwritten when re-deploying the image. The goal of the image building tools is to create machine images that contain the correct global content and are ready for 'last-mile' configuration by the nova metadata API, after which a configuration management system can take over (until the next deploy, when it all starts over from scratch). diskimage-builder-2.35.0/doc/source/developer/components.rst0000664000175000017500000000262213640271474024167 0ustar zuulzuul00000000000000Components ========== `disk-image-create [-a i386|amd64|armhf|arm64] -o filename {element} [{element} ...]` Create an image of element {element}, optionally mixing in other elements. Element dependencies are automatically included. Support for other architectures depends on your environment being able to run binaries of that platform and/or packages being available for the architecture. For instance, to enable armhf on Ubuntu install the qemu-user-static package, or to enable arm64 on CentOS setup the RDO aarch64 package repositories. The default output format from disk-image-create is qcow2. To instead output a tarball pass in "-t tar". This tarball could then be used as an image for a linux container(see docs/docker.md). `ramdisk-image-create -o filename {element} [{element} ...]` Create a kernel+ ramdisk pair for running maintenance on bare metal machines (deployment, inventory, burnin etc). To generate kernel+ramdisk pair for use with nova-baremetal, use:: ramdisk-image-create -o deploy.ramdisk deploy-baremetal To generate kernel+ramdisk pair for use with ironic, use:: ramdisk-image-create -o deploy.ramdisk ironic-agent `element-info` Extract information about elements. `tests/run_functests.sh` This runs a set of functional tests for diskimage-builder. elements can be found in the top level elements directory. diskimage-builder-2.35.0/doc/source/developer/vhd_creation.rst0000664000175000017500000002252013640271474024446 0ustar zuulzuul00000000000000vhd creation ============ There is currently a hard dependency on the patched version of ``vhd-utils`` to create Xenserver VHD compatible images. The main target for these images is the Rackspace Public Cloud. This note should explain the current issues. The patch to include ``convert`` as an option to ``vhd-utils``, avaialble at https://github.com/citrix-openstack/xenserver-utils/, is built by infra into a PPA available at https://launchpad.net/~openstack-ci-core/+archive/ubuntu/vhd-util. Upstream Xen has actually removed all the code related to ``blktap2`` with https://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=5c883cf036cf5ab8b1b79390549e2475f7a568dd. The tools have been removed from Debuntu with https://bugs.debian.org/917907. So this patch is even less trivial to apply; the project has seemingly been split into https://github.com/xapi-project/blktap/ but support status is unclear. It is tempting to use ``qemu-img`` image conversion routines. Indeed this supports converting RAW images to VPC output. However, VPC is a fairly flexible standard across a number of different hypervisors. The main standard is available from Microsoft at https://www.microsoft.com/en-us/download/confirmation.aspx?id=23850 and is what ``qemu-img`` impelements. However, trying to boot an image created with this results in a "resize" error. This is described in https://bugs.launchpad.net/nova/+bug/862653 but comes down to the following in https://github.com/xapi-project/blktap/blob/master/vhd/lib/vhd-util-resize.c#L1055:: if (!vhd_creator_tapdisk(&vhd)) { printf("%s not created by xen; resize not supported\n", name); err = -EINVAL; } It seems that Xen will refuse to grow a image without a creator ``tap\0``. It is tempting to patch ``qemu-img`` to do this (patch follows for those interested). However, if you look at the output with ``vhd-util read -p -n ./.vhd`` you will notice it complains about an invalid ``batmap``. The ``batmap`` appears to be a Xen extension to the VPC standard. Checking ``vhd_has_batmap`` at https://github.com/xen-project/xen/blob/365aabb6e5023cee476adf81106729efd49c644f/tools/blktap2/vhd/lib/libvhd.c#L1193 it seems we can fool Xen by setting the vhd version tags low enough that it thinks the image doesn't have a ``batmap`` (i.e. presumably created with tools before ``batmap``'s existed). Side note: there is a bunch of qemu work to implement overlay VHD disks with https://patchwork.ozlabs.org/project/qemu-devel/list/?submitter=64750 which has never merged. This also seems to include a ``batmap`` implementation. With the full patch applied below, we get images that appear fairly similar from (patched) ``vhd-util`` and ``qemu-img``; generated from the same ``.raw`` file. qemu-img output:: VHD Footer Summary: ------------------- Cookie : conectix Features : (0x00000002) File format version : Major: 1, Minor: 0 Data offset : 512 Timestamp : Wed Oct 30 06:25:41 2019 Creator Application : 'tap' Creator version : Major: 1, Minor: 0 Creator OS : Unknown! Original disk size : 16667 MB (17477591040 Bytes) Current disk size : 16667 MB (17477591040 Bytes) Geometry : Cyl: 33865, Hds: 16, Sctrs: 63 : = 16667 MB (17477591040 Bytes) Disk type : Dynamic hard disk Checksum : 0xffffec8c|0xffffec8c (Good!) UUID : 1bfda481-dd4d-43aa-8f3a-84689b5ab3d7 Saved state : No Hidden : 0 VHD Header Summary: ------------------- Cookie : cxsparse Data offset (unusd) : 18446744073709 Table offset : 1536 Header version : 0x00010000 Max BAT size : 8334 Block size : 2097152 (2 MB) Parent name : Parent UUID : 00000000-0000-0000-0000-000000000000 Parent timestamp : Sat Jan 1 00:00:00 2000 Checksum : 0xfffff3c9|0xfffff3c9 (Good!) vhd-utils output:: VHD Footer Summary: ------------------- Cookie : conectix Features : (0x00000002) File format version : Major: 1, Minor: 0 Data offset : 512 Timestamp : Tue Oct 8 09:18:54 2019 Creator Application : 'tap' Creator version : Major: 1, Minor: 3 Creator OS : Unknown! Original disk size : 16668 MB (17477664768 Bytes) Current disk size : 16668 MB (17477664768 Bytes) Geometry : Cyl: 33865, Hds: 16, Sctrs: 63 : = 16667 MB (17477591040 Bytes) Disk type : Dynamic hard disk Checksum : 0xffffeebb|0xffffeebb (Good!) UUID : 14f2710a-b9b8-48f7-94bb-005ba6d566b2 Saved state : No Hidden : 0 VHD Header Summary: ------------------- Cookie : cxsparse Data offset (unusd) : 18446744073709 Table offset : 1536 Header version : 0x00010000 Max BAT size : 8334 Block size : 2097152 (2 MB) Parent name : Parent UUID : 00000000-0000-0000-0000-000000000000 Parent timestamp : Sat Jan 1 00:00:00 2000 Checksum : 0xfffff3c9|0xfffff3c9 (Good!) VHD Batmap Summary: ------------------- Batmap offset : 35840 Batmap size (secs) : 3 Batmap version : 0x00010002 Checksum : 0xfffbf214|0xfffbf214 (Good!) This does upload and boot in RAX, but the root disk does not appear to grow correctly. Emperically, it also seems that fixed sized disks (generated with ``subformat=fixed``) will not import (at least into Rackspace). I also tried resizing the dynamic ``vhd`` (with ``vhd-util resize --debug -n ./test.vhd -s $((32 * 1024 * 1024 )) -j resize.log``), which looked correct in ``vhd-util`` output (``Current disk size`` grew) but Rackspace would not import this image. qemu patch ========== Applies against qemu at HEAD ``16884391c750d0c5e863f55ad7aaaa146fc5181e`` :: diff --git a/block/vpc.c b/block/vpc.c index a655502..d1716f0 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -60,6 +60,7 @@ enum vhd_type { #define VHD_MAX_GEOMETRY (VHD_CHS_MAX_C * VHD_CHS_MAX_H * VHD_CHS_MAX_S) #define VPC_OPT_FORCE_SIZE "force_size" +#define VPC_OPT_XENSERVER_COMPAT "xenserver_compat" /* always big-endian */ typedef struct vhd_footer { @@ -1042,12 +1043,16 @@ static int coroutine_fn vpc_co_create(BlockdevCreateOptions *opts, memset(buf, 0, 1024); memcpy(footer->creator, "conectix", 8); - if (vpc_opts->force_size) { + if (vpc_opts->xenserver_compat) { + memcpy(footer->creator_app, "tap\0", 4); + memcpy(footer->creator_os, "\0\0\0\0", 4); + } else if (vpc_opts->force_size) { memcpy(footer->creator_app, "qem2", 4); + memcpy(footer->creator_os, "Wi2k", 4); } else { memcpy(footer->creator_app, "qemu", 4); + memcpy(footer->creator_os, "Wi2k", 4); } - memcpy(footer->creator_os, "Wi2k", 4); footer->features = cpu_to_be32(0x02); footer->version = cpu_to_be32(0x00010000); @@ -1058,9 +1063,14 @@ static int coroutine_fn vpc_co_create(BlockdevCreateOptions *opts, } footer->timestamp = cpu_to_be32(time(NULL) - VHD_TIMESTAMP_BASE); - /* Version of Virtual PC 2007 */ - footer->major = cpu_to_be16(0x0005); - footer->minor = cpu_to_be16(0x0003); + if (vpc_opts->xenserver_compat) { + footer->major = cpu_to_be16(0x0001); + footer->minor = cpu_to_be16(0x0000); + } else { + /* Version of Virtual PC 2007 */ + footer->major = cpu_to_be16(0x0005); + footer->minor = cpu_to_be16(0x0003); + } footer->orig_size = cpu_to_be64(total_size); footer->current_size = cpu_to_be64(total_size); footer->cyls = cpu_to_be16(cyls); @@ -1101,6 +1111,7 @@ static int coroutine_fn vpc_co_create_opts(const char *filename, static const QDictRenames opt_renames[] = { { VPC_OPT_FORCE_SIZE, "force-size" }, + { VPC_OPT_XENSERVER_COMPAT, "xenserver-compat" }, { NULL, NULL }, }; @@ -1220,6 +1231,11 @@ static QemuOptsList vpc_create_opts = { "specified, rather than using the nearest CHS-based " "calculation" }, + { + .name = VPC_OPT_XENSERVER_COMPAT, + .type = QEMU_OPT_BOOL, + .help = "Set creator to tap" + }, { /* end of list */ } } }; diff --git a/qapi/block-core.json b/qapi/block-core.json index aa97ee2..68daa3c 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -4669,6 +4669,7 @@ # @force-size Force use of the exact byte size instead of rounding to the # next size that can be represented in CHS geometry # (default: false) +# @xenserver-compat Xenserver comapt # # Since: 2.12 ## @@ -4676,7 +4677,9 @@ 'data': { 'file': 'BlockdevRef', 'size': 'size', '*subformat': 'BlockdevVpcSubformat', - '*force-size': 'bool' } } + '*force-size': 'bool', + '*xenserver-compat': 'bool' + } } ## # @BlockdevCreateOptions: diskimage-builder-2.35.0/doc/lib/0000775000175000017500000000000013640271564016527 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/doc/lib/element_deps.py0000664000175000017500000000445513640271474021555 0ustar zuulzuul00000000000000# # Copyright 2017 Andreas Florath (andreas@florath.net) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # # Scan the element directory, looks for element dependencies and # writes them out when the directive # .. element_deps:: # is used. # This was developed only for internal use and must be called # from the source top directory. from diskimage_builder.element_dependencies import _find_all_elements from diskimage_builder.paths import get_path from docutils.parsers.rst import Directive import os all_elements = _find_all_elements(get_path("elements")) def make_dep_list(title, deps): lines = [] lines.append(title) lines.append("+" * len(title)) for dep in sorted(deps): lines.append("* :doc:`../%s/README`" % dep) lines.append('') # careful to end with a blank line return lines class ElementDepsDirective(Directive): # this enables content in the directive has_content = True def run(self): source = self.state_machine.input_lines.source( self.lineno - self.state_machine.input_offset - 1) # Extract the element from the source attribute of the document element_name = os.path.basename(os.path.dirname( self.state_machine.document.attributes['source'])) lines = ["Element Dependencies", "--------------------"] # This should not fail -- sphinx would be finding an element # that dib doesn't know about? element = all_elements[element_name] if element.depends: lines.extend(make_dep_list("Uses", element.depends)) if element.r_depends: lines.extend(make_dep_list("Used by", element.r_depends)) self.state_machine.insert_input(lines, source) return [] def setup(app): app.add_directive('element_deps', ElementDepsDirective) diskimage-builder-2.35.0/doc/requirements.txt0000664000175000017500000000062713640271474021252 0ustar zuulzuul00000000000000# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. openstackdocstheme>=1.18.1 # Apache-2.0 sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD reno>=2.5.0 # Apache-2.0 diskimage-builder-2.35.0/PKG-INFO0000664000175000017500000000560013640271564016312 0ustar zuulzuul00000000000000Metadata-Version: 1.1 Name: diskimage-builder Version: 2.35.0 Summary: Golden Disk Image builder. Home-page: https://docs.openstack.org/diskimage-builder/latest/ Author: OpenStack Author-email: openstack-discuss@lists.openstack.org License: Apache License (2.0) Description: Image building tools for OpenStack ================================== ``diskimage-builder`` is a flexible suite of components for building a wide-range of disk images, filesystem images and ramdisk images for use with OpenStack. This repository has the core functionality for building such images, both virtual and bare metal. Images are composed using `elements`; while fundamental elements are provided here, individual projects have the flexibility to customise the image build with their own elements. For example:: $ DIB_RELEASE=trusty disk-image-create -o ubuntu-trusty.qcow2 vm ubuntu will create a bootable Ubuntu Trusty based ``qcow2`` image. ``diskimage-builder`` is useful to anyone looking to produce customised images for deployment into clouds. These tools are the components of `TripleO `__ that are responsible for building disk images. They are also used extensively to build images for testing OpenStack itself, particularly with `nodepool `__. Platforms supported include Ubuntu, CentOS, RHEL and Fedora. Full documentation, the source of which is in ``doc/source/``, is published at: * https://docs.openstack.org/diskimage-builder/latest/ Copyright ========= Copyright 2012 Hewlett-Packard Development Company, L.P. Copyright (c) 2012 NTT DOCOMO, INC. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Environment :: Console diskimage-builder-2.35.0/LICENSE0000664000175000017500000002613613640271474016231 0ustar zuulzuul00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diskimage-builder-2.35.0/bin/0000775000175000017500000000000013640271564015764 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/bin/dib-lint0000775000175000017500000002320413640271474017415 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2014 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. # This script checks all files in the "elements" directory for some # common mistakes and exits with a non-zero status if it finds any. set -eu set -o pipefail ELEMENTS_DIR=${ELEMENTS_DIR:-diskimage_builder/elements} LIB_DIR=${LIB_DIR:-diskimage_builder/lib} parse_exclusions() { # Per-file exclusions # Example: # dib-lint: disable=sete setpipefail local filename=$1 local disable_pattern="# dib-lint: disable=" local exclusions=$(grep "^$disable_pattern.*$" $filename | sed "s/$disable_pattern//g") # Global exclusions read from tox.ini # Example section in tox.ini: # [dib-lint] # ignore = sete setu section="dib-lint" option="ignore" global_exclusions=$(python - < ${UNSORTED} sort ${UNSORTED} > ${SORTED} if [ -n "$(diff -c ${UNSORTED} ${SORTED})" ]; then error "$i is not sorted alphabetically" diff -y ${UNSORTED} ${SORTED} fi fi # for consistency, let's just use #!/bin/bash everywhere (not # /usr/bin/env, etc) regex='^#!.*bash' if [[ "$firstline" =~ $regex && "$firstline" != "#!/bin/bash" ]]; then error "$i : only use #!/bin/bash for scripts" fi # Check that all scripts are set -eu -o pipefail and look for # DIB_DEBUG_TRACE # NOTE(bnemec): This doesn't verify that the set call occurs high # enough in the file to be useful, but hopefully nobody will be # sticking set calls at the end of their file to trick us. And if # they are, that's easy enough to catch in reviews. # Also, this is only going to check bash scripts - we've decided to # explicitly require bash for any scripts that don't have a specific # need to run under other shells, and any exceptions to that rule # may not want these checks either. if [[ "$firstline" =~ '#!/bin/bash' ]]; then if ! excluded sete; then if [ -z "$(grep "^set -[^ ]*e" $i)" ]; then error "$i is not set -e" fi fi if ! excluded setu; then if [ -z "$(grep "^set -[^ ]*u" $i)" ]; then error "$i is not set -u" fi fi if ! excluded setpipefail; then if [ -z "$(grep "^set -o pipefail" $i)" ]; then error "$i is not set -o pipefail" fi fi if ! excluded dibdebugtrace; then if [ -z "$(grep "DIB_DEBUG_TRACE" $i)" ]; then error "$i does not follow DIB_DEBUG_TRACE" fi fi fi # check that environment files don't "set -x" and they have no executable # bits set if [[ "$i" =~ (environment.d) ]]; then if grep -q "set -x" $i; then error "Environment file $i should not set tracing" fi if [[ -x $i ]]; then error "Environment file $i should not be marked as executable" fi fi # check for # export FOO=$(bar) # calls. These are dangerous, because the export hides the return # code of the $(bar) call. Split this into 2 lines and -e will # fail on the assignment if grep -q 'export .*\$(' $i; then error "Split export and assignments in $i" fi # check that sudo calls in phases run outside the chroot look # "safe"; meaning that they seem to operate within the chroot # somehow. This is not fool-proof, but catches egregious errors, # and makes you think about it if you're doing something outside # the box. if ! excluded safe_sudo; then if [[ $(dirname $i) =~ (root.d|extra-data.d|block-device.d|finalise.d|cleanup.d) ]]; then while read LINE do if [[ $LINE =~ "sudo " ]]; then # messy regex ahead! Don't match: # - explicitly ignored # - basic comments # - install-packages ... sudo ... # - any of the paths passed into the out-of-chroot elements if [[ $LINE =~ (dib-lint: safe_sudo|^#|install-packages|TARGET_ROOT|IMAGE_BLOCK_DEVICE|TMP_MOUNT_PATH|TMP_IMAGE_PATH) ]]; then continue fi error "$i : potentially unsafe sudo\n -- $LINE" fi done < $i fi fi # check that which calls are not used. It is not built in and is missing # from some constrained environments if ! excluded which; then while read LINE do if [[ $LINE =~ "which " ]]; then # Don't match: # - explicitly ignored # - commented if [[ $LINE =~ (dib-lint: which|^#) ]]; then continue fi error "$i : potential use of which\n -- $LINE" fi done < $i fi done echo "Checking indents..." for i in $(find $ELEMENTS_DIR -type f -and -name '*.rst' -or -type f -executable) \ $(find $LIB_DIR -type f); do # Skip files in .gitignore if git check-ignore -q "$i" ; then echo Skipping $i continue fi # Check for tab indentation if ! excluded tabindent; then if grep -q $'^ *\t' ${i}; then error "$i contains tab characters" fi fi if ! excluded newline; then if [ "$(tail -c 1 $i)" != "" ]; then error "No newline at end of file: $i" fi fi done if ! excluded mddocs; then md_docs=$(find $ELEMENTS_DIR -name '*.md') if [ -n "$md_docs" ]; then error ".md docs found: $md_docs" fi fi echo "Checking YAML parsing..." for i in $(find $ELEMENTS_DIR -type f -name '*.yaml'); do echo "Parsing $i" py_check=" import yaml import sys try: objs = yaml.safe_load(open('$i')) except yaml.parser.ParserError: sys.exit(1) " if ! python -c "$py_check"; then error "$i is not a valid YAML file" fi done echo "Checking pkg-map files..." for i in $(find $ELEMENTS_DIR -type f \ -name 'pkg-map' -a \! -executable); do echo "Parsing $i" py_check=" import json import sys try: objs = json.load(open('$i')) except ValueError: sys.exit(1) " if ! python -c "$py_check"; then error "$i is not a valid JSON file" fi done if [[ $rc == 0 ]]; then echo "PASS" else echo "*** FAIL: Some tests failed!" fi exit $rc diskimage-builder-2.35.0/diskimage_builder.egg-info/0000775000175000017500000000000013640271564022351 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder.egg-info/PKG-INFO0000664000175000017500000000560013640271564023447 0ustar zuulzuul00000000000000Metadata-Version: 1.1 Name: diskimage-builder Version: 2.35.0 Summary: Golden Disk Image builder. Home-page: https://docs.openstack.org/diskimage-builder/latest/ Author: OpenStack Author-email: openstack-discuss@lists.openstack.org License: Apache License (2.0) Description: Image building tools for OpenStack ================================== ``diskimage-builder`` is a flexible suite of components for building a wide-range of disk images, filesystem images and ramdisk images for use with OpenStack. This repository has the core functionality for building such images, both virtual and bare metal. Images are composed using `elements`; while fundamental elements are provided here, individual projects have the flexibility to customise the image build with their own elements. For example:: $ DIB_RELEASE=trusty disk-image-create -o ubuntu-trusty.qcow2 vm ubuntu will create a bootable Ubuntu Trusty based ``qcow2`` image. ``diskimage-builder`` is useful to anyone looking to produce customised images for deployment into clouds. These tools are the components of `TripleO `__ that are responsible for building disk images. They are also used extensively to build images for testing OpenStack itself, particularly with `nodepool `__. Platforms supported include Ubuntu, CentOS, RHEL and Fedora. Full documentation, the source of which is in ``doc/source/``, is published at: * https://docs.openstack.org/diskimage-builder/latest/ Copyright ========= Copyright 2012 Hewlett-Packard Development Company, L.P. Copyright (c) 2012 NTT DOCOMO, INC. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Environment :: Console diskimage-builder-2.35.0/diskimage_builder.egg-info/entry_points.txt0000664000175000017500000000153413640271564025652 0ustar zuulzuul00000000000000[console_scripts] dib-block-device = diskimage_builder.block_device.cmd:main disk-image-create = diskimage_builder.disk_image_create:main element-info = diskimage_builder.element_dependencies:main ramdisk-image-create = diskimage_builder.disk_image_create:main [diskimage_builder.block_device.plugin] fstab = diskimage_builder.block_device.level4.fstab:Fstab local_loop = diskimage_builder.block_device.level0.localloop:LocalLoop lvm = diskimage_builder.block_device.level1.lvm:LVMPlugin mkfs = diskimage_builder.block_device.level2.mkfs:Mkfs mount = diskimage_builder.block_device.level3.mount:Mount partitioning = diskimage_builder.block_device.level1.partitioning:Partitioning [diskimage_builder.block_device.plugin_test] test_a = diskimage_builder.block_device.tests.plugin.test_a:TestA test_b = diskimage_builder.block_device.tests.plugin.test_b:TestB diskimage-builder-2.35.0/diskimage_builder.egg-info/SOURCES.txt0000664000175000017500000016633313640271564024251 0ustar zuulzuul00000000000000.testr.conf AUTHORS ChangeLog LICENSE README.rst babel.cfg bindep.txt lower-constraints.txt pylint.cfg requirements.txt setup.cfg setup.py test-requirements.txt tox.ini .zuul.d/jobs.yaml .zuul.d/project.yaml bin/dib-lint contrib/setup-gate-mirrors.sh diskimage_builder/__init__.py diskimage_builder/disk_image_create.py diskimage_builder/element_dependencies.py diskimage_builder/logging_config.py diskimage_builder/paths.py diskimage_builder/version.py diskimage_builder.egg-info/PKG-INFO diskimage_builder.egg-info/SOURCES.txt diskimage_builder.egg-info/dependency_links.txt diskimage_builder.egg-info/entry_points.txt diskimage_builder.egg-info/not-zip-safe diskimage_builder.egg-info/pbr.json diskimage_builder.egg-info/requires.txt diskimage_builder.egg-info/top_level.txt diskimage_builder/block_device/__init__.py diskimage_builder/block_device/blockdevice.py diskimage_builder/block_device/cmd.py diskimage_builder/block_device/config.py diskimage_builder/block_device/exception.py diskimage_builder/block_device/plugin.py diskimage_builder/block_device/utils.py diskimage_builder/block_device/level0/__init__.py diskimage_builder/block_device/level0/localloop.py diskimage_builder/block_device/level1/__init__.py diskimage_builder/block_device/level1/lvm.py diskimage_builder/block_device/level1/mbr.py diskimage_builder/block_device/level1/partition.py diskimage_builder/block_device/level1/partitioning.py diskimage_builder/block_device/level2/__init__.py diskimage_builder/block_device/level2/mkfs.py diskimage_builder/block_device/level3/__init__.py diskimage_builder/block_device/level3/mount.py diskimage_builder/block_device/level4/__init__.py diskimage_builder/block_device/level4/fstab.py diskimage_builder/block_device/tests/__init__.py diskimage_builder/block_device/tests/test_base.py diskimage_builder/block_device/tests/test_config.py diskimage_builder/block_device/tests/test_gpt.py diskimage_builder/block_device/tests/test_lvm.py diskimage_builder/block_device/tests/test_mbr.py diskimage_builder/block_device/tests/test_mkfs.py diskimage_builder/block_device/tests/test_mount_order.py diskimage_builder/block_device/tests/test_state.py diskimage_builder/block_device/tests/test_utils.py diskimage_builder/block_device/tests/config/bad_edge_graph.yaml diskimage_builder/block_device/tests/config/bad_plugin.yaml diskimage_builder/block_device/tests/config/cmd_create.yaml diskimage_builder/block_device/tests/config/deep_graph.yaml diskimage_builder/block_device/tests/config/deep_tree.yaml diskimage_builder/block_device/tests/config/duplicate_fs_labels.yaml diskimage_builder/block_device/tests/config/duplicate_name.yaml diskimage_builder/block_device/tests/config/gpt_efi.yaml diskimage_builder/block_device/tests/config/lvm_graph.yaml diskimage_builder/block_device/tests/config/lvm_tree.yaml diskimage_builder/block_device/tests/config/lvm_tree_multiple_partitions.yaml diskimage_builder/block_device/tests/config/lvm_tree_multiple_pv.yaml diskimage_builder/block_device/tests/config/lvm_tree_multiple_pv_vg.yaml diskimage_builder/block_device/tests/config/lvm_tree_partition_ordering.yaml diskimage_builder/block_device/tests/config/lvm_tree_spanned_vg.yaml diskimage_builder/block_device/tests/config/multi_key_node.yaml diskimage_builder/block_device/tests/config/multiple_partitions_graph.yaml diskimage_builder/block_device/tests/config/multiple_partitions_tree.yaml diskimage_builder/block_device/tests/config/rollback.yaml diskimage_builder/block_device/tests/config/simple_graph.yaml diskimage_builder/block_device/tests/config/simple_tree.yaml diskimage_builder/block_device/tests/config/too_long_fs_label.yaml diskimage_builder/block_device/tests/plugin/__init__.py diskimage_builder/block_device/tests/plugin/test_a.py diskimage_builder/block_device/tests/plugin/test_b.py diskimage_builder/elements/__init__.py diskimage_builder/elements/apt-conf/README.rst diskimage_builder/elements/apt-conf/extra-data.d/99-override-default-apt-conf diskimage_builder/elements/apt-preferences/README.rst diskimage_builder/elements/apt-preferences/extra-data.d/99-set-apt-package-pins diskimage_builder/elements/apt-sources/README.rst diskimage_builder/elements/apt-sources/extra-data.d/99-override-default-apt-sources diskimage_builder/elements/apt-sources/test-elements/test-sources/element-deps diskimage_builder/elements/apt-sources/test-elements/test-sources/environment.d/00-set-apt-sources diskimage_builder/elements/apt-sources/test-elements/test-sources/extra-data.d/00-write-apt-sources diskimage_builder/elements/apt-sources/test-elements/test-sources/pre-install.d/00-test-apt-sources diskimage_builder/elements/baremetal/README.rst diskimage_builder/elements/baremetal/cleanup.d/99-extract-kernel-and-ramdisk diskimage_builder/elements/base/README.rst diskimage_builder/elements/base/element-deps diskimage_builder/elements/base/pkg-map diskimage_builder/elements/base/environment.d/10-base-defaults diskimage_builder/elements/base/install.d/00-baseline-environment diskimage_builder/elements/base/install.d/00-up-to-date diskimage_builder/elements/base/install.d/10-cloud-init diskimage_builder/elements/base/pre-install.d/03-baseline-tools diskimage_builder/elements/block-device-efi/README.rst diskimage_builder/elements/block-device-efi/block-device-default.yaml diskimage_builder/elements/block-device-efi/element-provides diskimage_builder/elements/block-device-efi/environment.d/15-block-device.bash diskimage_builder/elements/block-device-gpt/README.rst diskimage_builder/elements/block-device-gpt/block-device-default.yaml diskimage_builder/elements/block-device-gpt/block-device-ppc64el.yaml diskimage_builder/elements/block-device-gpt/element-provides diskimage_builder/elements/block-device-gpt/environment.d/15-block-device.bash diskimage_builder/elements/block-device-mbr/README.rst diskimage_builder/elements/block-device-mbr/block-device-default.yaml diskimage_builder/elements/block-device-mbr/block-device-ppc64el.yaml diskimage_builder/elements/block-device-mbr/element-provides diskimage_builder/elements/block-device-mbr/environment.d/15-block-device.bash diskimage_builder/elements/bootloader/README.rst diskimage_builder/elements/bootloader/pkg-map diskimage_builder/elements/bootloader/cleanup.d/51-bootloader diskimage_builder/elements/bootloader/environment.d/10-bootloader-default-cmdline diskimage_builder/elements/bootloader/finalise.d/50-bootloader diskimage_builder/elements/cache-url/README.rst diskimage_builder/elements/cache-url/__init__.py diskimage_builder/elements/cache-url/element-deps diskimage_builder/elements/cache-url/package-installs.yaml diskimage_builder/elements/cache-url/pkg-map diskimage_builder/elements/cache-url/bin/cache-url diskimage_builder/elements/cache-url/tests/__init__.py diskimage_builder/elements/cache-url/tests/test_cache_url.py diskimage_builder/elements/centos/README.rst diskimage_builder/elements/centos/element-deps diskimage_builder/elements/centos/element-provides diskimage_builder/elements/centos-minimal/README.rst diskimage_builder/elements/centos-minimal/element-deps diskimage_builder/elements/centos-minimal/element-provides diskimage_builder/elements/centos-minimal/environment.d/10-centos-distro-name.bash diskimage_builder/elements/centos-minimal/environment.d/11-yum-dnf.bash diskimage_builder/elements/centos-minimal/test-elements/7-build-succeeds/README.rst diskimage_builder/elements/centos-minimal/test-elements/7-build-succeeds/element-deps diskimage_builder/elements/centos-minimal/test-elements/8-build-succeeds/README.rst diskimage_builder/elements/centos-minimal/test-elements/8-build-succeeds/element-deps diskimage_builder/elements/centos-minimal/test-elements/8-build-succeeds/environment.d/09-set-distro.bash diskimage_builder/elements/centos-minimal/yum.repos.d/7/yum.repo diskimage_builder/elements/centos-minimal/yum.repos.d/8/appstream.repo diskimage_builder/elements/centos-minimal/yum.repos.d/8/base.repo diskimage_builder/elements/centos/environment.d/10-centos-distro-name.bash diskimage_builder/elements/centos/environment.d/11-yum-dnf.bash diskimage_builder/elements/centos/pre-install.d/01-set-centos-mirror diskimage_builder/elements/centos/pre-install.d/02-set-machine-id diskimage_builder/elements/centos/root.d/10-centos-cloud-image diskimage_builder/elements/centos/test-elements/8-build-succeeds/README.rst diskimage_builder/elements/centos/test-elements/8-build-succeeds/element-deps diskimage_builder/elements/centos/test-elements/8-build-succeeds/test-output-formats diskimage_builder/elements/centos/test-elements/8-build-succeeds/environment.d/10-set-distro.bash diskimage_builder/elements/centos7/README.rst diskimage_builder/elements/centos7/element-deps diskimage_builder/elements/centos7/environment.d/00-centos7-element-deprecation.bash diskimage_builder/elements/centos7/environment.d/09-centos7-distro-name.bash diskimage_builder/elements/centos7/environment.d/10-centos7-distro-name.bash diskimage_builder/elements/centos7/test-elements/build-succeeds/README.rst diskimage_builder/elements/centos7/test-elements/build-succeeds/element-deps diskimage_builder/elements/cleanup-kernel-initrd/README.rst diskimage_builder/elements/cleanup-kernel-initrd/cleanup.d/99-cleanup-kernel-initrd diskimage_builder/elements/cloud-init/README.rst diskimage_builder/elements/cloud-init/element-deps diskimage_builder/elements/cloud-init/package-installs.yaml diskimage_builder/elements/cloud-init/pkg-map diskimage_builder/elements/cloud-init-datasources/README.rst diskimage_builder/elements/cloud-init-datasources/install.d/05-set-cloud-init-sources diskimage_builder/elements/cloud-init-disable-resizefs/README.rst diskimage_builder/elements/cloud-init-disable-resizefs/post-install.d/50-cloud-init-disable-resizefs diskimage_builder/elements/cloud-init-nocloud/README.rst diskimage_builder/elements/cloud-init-nocloud/element-deps diskimage_builder/elements/cloud-init-nocloud/environment.d/10-cloud-init-nocloud.bash diskimage_builder/elements/cloud-init-nocloud/install.d/05-inject-local-source-data diskimage_builder/elements/cloud-init/post-install.d/20-enable-cloud-init diskimage_builder/elements/cloud-init/post-install.d/21-cloud-init-allow-password-auth diskimage_builder/elements/debian/README.rst diskimage_builder/elements/debian/element-deps diskimage_builder/elements/debian/package-installs.yaml diskimage_builder/elements/debian-minimal/README.rst diskimage_builder/elements/debian-minimal/element-deps diskimage_builder/elements/debian-minimal/element-provides diskimage_builder/elements/debian-minimal/package-installs.yaml diskimage_builder/elements/debian-minimal/environment.d/10-debian-minimal.bash diskimage_builder/elements/debian-minimal/root.d/75-debian-minimal-baseinstall diskimage_builder/elements/debian-minimal/test-elements/stable-build-succeeds/README.rst diskimage_builder/elements/debian-minimal/test-elements/stable-build-succeeds/environment.d/10-set-distro.bash diskimage_builder/elements/debian-minimal/test-elements/stable-vm/README.rst diskimage_builder/elements/debian-minimal/test-elements/stable-vm/element-deps diskimage_builder/elements/debian-minimal/test-elements/stable-vm/environment.d/10-set-distro.bash diskimage_builder/elements/debian-minimal/test-elements/testing-build-succeeds/README.rst diskimage_builder/elements/debian-minimal/test-elements/testing-build-succeeds/environment.d/10-set-distro.bash diskimage_builder/elements/debian-systemd/README.rst diskimage_builder/elements/debian-systemd/element-deps diskimage_builder/elements/debian-systemd/root.d/05-debian-systemd diskimage_builder/elements/debian-upstart/README.rst diskimage_builder/elements/debian-upstart/element-deps diskimage_builder/elements/debian-upstart/root.d/05-debian-upstart diskimage_builder/elements/debian-upstart/root.d/20-debian-fix-upstart-jobs diskimage_builder/elements/debian/install.d/10-cloud-opinions diskimage_builder/elements/debian/test-elements/build-succeeds/README.rst diskimage_builder/elements/debian/test-elements/build-succeeds/element-deps diskimage_builder/elements/debian/test-elements/build-succeeds/environment.d/09-debian-stable diskimage_builder/elements/debootstrap/README.rst diskimage_builder/elements/debootstrap/element-deps diskimage_builder/elements/debootstrap/package-installs.yaml diskimage_builder/elements/debootstrap/pkg-map diskimage_builder/elements/debootstrap/cleanup.d/99-clean-up-cache diskimage_builder/elements/debootstrap/environment.d/10-debootstrap-default-locale diskimage_builder/elements/debootstrap/environment.d/20-network-interface-names diskimage_builder/elements/debootstrap/install.d/10-debian-networking diskimage_builder/elements/debootstrap/install.d/12-debian-locale-gen diskimage_builder/elements/debootstrap/install.d/15-cleanup-debootstrap diskimage_builder/elements/debootstrap/root.d/08-debootstrap diskimage_builder/elements/deploy-baremetal/README.rst diskimage_builder/elements/deploy-baremetal/element-deps diskimage_builder/elements/deploy-baremetal/package-installs.yaml diskimage_builder/elements/deploy-baremetal/binary-deps.d/deploy diskimage_builder/elements/deploy-baremetal/init.d/80-deploy diskimage_builder/elements/deploy-kexec/README.rst diskimage_builder/elements/deploy-kexec/element-deps diskimage_builder/elements/deploy-kexec/package-installs.yaml diskimage_builder/elements/deploy-kexec/binary-deps.d/deploy-kexec diskimage_builder/elements/deploy-kexec/init.d/81-deploy-kexec diskimage_builder/elements/deploy-targetcli/README.rst diskimage_builder/elements/deploy-targetcli/element-deps diskimage_builder/elements/deploy-targetcli/package-installs.yaml diskimage_builder/elements/deploy-targetcli/binary-deps.d/deploy-targetcli diskimage_builder/elements/deploy-targetcli/dracut-drivers.d/targetcli-drivers diskimage_builder/elements/deploy-targetcli/extra-data.d/50-add-targetcli-module diskimage_builder/elements/deploy-targetcli/extra-data.d/module/iscsi-func diskimage_builder/elements/deploy-targetcli/extra-data.d/module/module-setup.sh diskimage_builder/elements/deploy-targetcli/extra-data.d/module/targetcli-wrapper diskimage_builder/elements/deploy-tgtadm/README.rst diskimage_builder/elements/deploy-tgtadm/package-installs.yaml diskimage_builder/elements/deploy-tgtadm/binary-deps.d/deploy-tgtadm diskimage_builder/elements/deploy-tgtadm/extra-data.d/50-inject-tgtadm-iscsi-func diskimage_builder/elements/deploy-tgtadm/extra-data.d/scripts/iscsi-func diskimage_builder/elements/devuser/README.rst diskimage_builder/elements/devuser/element-deps diskimage_builder/elements/devuser/package-installs.yaml diskimage_builder/elements/devuser/pkg-map diskimage_builder/elements/devuser/environment.d/50-devuser diskimage_builder/elements/devuser/extra-data.d/50-devuser diskimage_builder/elements/devuser/install.d/50-devuser diskimage_builder/elements/dhcp-all-interfaces/README.rst diskimage_builder/elements/dhcp-all-interfaces/element-deps diskimage_builder/elements/dhcp-all-interfaces/package-installs.yaml diskimage_builder/elements/dhcp-all-interfaces/pkg-map diskimage_builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces diskimage_builder/elements/dhcp-all-interfaces/install.d/60-remove-cloud-image-interfaces diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces-udev.rules diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.conf diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.init diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.sh diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-interface@.service diskimage_builder/elements/dib-init-system/README.rst diskimage_builder/elements/dib-init-system/environment.d/99-dib-init-system diskimage_builder/elements/dib-init-system/install.d/20-install-init-scripts diskimage_builder/elements/dib-init-system/post-install.d/10-enable-init-scripts diskimage_builder/elements/dib-init-system/pre-install.d/04-dib-init-system diskimage_builder/elements/dib-python/README.rst diskimage_builder/elements/dib-python/cleanup.d/50-dib-python diskimage_builder/elements/dib-python/environment.d/50-dib-python-version diskimage_builder/elements/dib-python/pre-install.d/01-dib-python diskimage_builder/elements/dib-run-parts/README.rst diskimage_builder/elements/dib-run-parts/package-installs.yaml diskimage_builder/elements/disable-nouveau/README.rst diskimage_builder/elements/disable-nouveau/element-deps diskimage_builder/elements/disable-nouveau/dracut.conf.d/disable-nouveau.conf diskimage_builder/elements/disable-nouveau/modprobe.d/disable-nouveau.conf diskimage_builder/elements/disable-selinux/README.rst diskimage_builder/elements/disable-selinux/post-install.d/15-disable-selinux diskimage_builder/elements/dkms/README.rst diskimage_builder/elements/dkms/element-deps diskimage_builder/elements/dkms/package-installs.yaml diskimage_builder/elements/dkms/post-install.d/97-dkms diskimage_builder/elements/docker/README.rst diskimage_builder/elements/docker/element-provides diskimage_builder/elements/docker/extra-data.d/01-docker-minimal diskimage_builder/elements/docker/root.d/08-docker diskimage_builder/elements/dpkg/README.rst diskimage_builder/elements/dpkg/element-deps diskimage_builder/elements/dpkg/bin/install-packages diskimage_builder/elements/dpkg/cleanup.d/40-unblock-daemons diskimage_builder/elements/dpkg/cleanup.d/50-remove-img-build-proxy diskimage_builder/elements/dpkg/cleanup.d/60-untrim-dpkg diskimage_builder/elements/dpkg/extra-data.d/01-copy-apt-keys diskimage_builder/elements/dpkg/finalise.d/99-clean-up-cache diskimage_builder/elements/dpkg/finalise.d/99-write-dpkg-manifest diskimage_builder/elements/dpkg/pre-install.d/00-disable-apt-recommends diskimage_builder/elements/dpkg/pre-install.d/02-add-apt-keys diskimage_builder/elements/dpkg/pre-install.d/99-apt-get-update diskimage_builder/elements/dpkg/root.d/50-block-apt-translations diskimage_builder/elements/dpkg/root.d/50-block-daemons diskimage_builder/elements/dpkg/root.d/50-build-with-http-cache diskimage_builder/elements/dpkg/root.d/50-shared-apt-cache diskimage_builder/elements/dpkg/root.d/50-trim-dpkg diskimage_builder/elements/dracut-network/README.rst diskimage_builder/elements/dracut-ramdisk/README.rst diskimage_builder/elements/dracut-ramdisk/element-deps diskimage_builder/elements/dracut-ramdisk/pkg-map diskimage_builder/elements/dracut-ramdisk/source-repository-dracut diskimage_builder/elements/dracut-ramdisk/binary-deps.d/dracut-ramdisk diskimage_builder/elements/dracut-ramdisk/dracut-drivers.d/base-drivers diskimage_builder/elements/dracut-ramdisk/environment.d/10-dracut-version.bash diskimage_builder/elements/dracut-ramdisk/extra-data.d/scripts/module/deploy-cmdline.sh diskimage_builder/elements/dracut-ramdisk/extra-data.d/scripts/module/module-setup.sh diskimage_builder/elements/dracut-ramdisk/init.d/00-override-troubleshoot diskimage_builder/elements/dracut-ramdisk/install.d/20-install-dracut-deps diskimage_builder/elements/dracut-ramdisk/post-install.d/01-ensure-drivers diskimage_builder/elements/dracut-ramdisk/post-install.d/99-build-dracut-ramdisk diskimage_builder/elements/dracut-regenerate/README.rst diskimage_builder/elements/dracut-regenerate/element-deps diskimage_builder/elements/dracut-regenerate/package-installs.yaml diskimage_builder/elements/dracut-regenerate/pkg-map diskimage_builder/elements/dracut-regenerate/environment.d/10-dracut-regenerate diskimage_builder/elements/dracut-regenerate/extra-data.d/50-dracut-conf diskimage_builder/elements/dracut-regenerate/finalise.d/50-dracut-regenerate diskimage_builder/elements/dynamic-login/README.rst diskimage_builder/elements/dynamic-login/element-deps diskimage_builder/elements/dynamic-login/init-scripts/systemd/dynamic-login.service diskimage_builder/elements/dynamic-login/init-scripts/sysv/dynamic-login.init diskimage_builder/elements/dynamic-login/init-scripts/upstart/dynamic-login.conf diskimage_builder/elements/dynamic-login/install.d/70-enable-dynamic-login-services diskimage_builder/elements/dynamic-login/static/usr/local/bin/dynamic-login diskimage_builder/elements/element-manifest/README.rst diskimage_builder/elements/element-manifest/element-deps diskimage_builder/elements/element-manifest/extra-data.d/75-inject-element-manifest diskimage_builder/elements/enable-serial-console/README.rst diskimage_builder/elements/enable-serial-console/cleanup.d/99-fix-grub diskimage_builder/elements/enable-serial-console/install.d/20-stty diskimage_builder/elements/enable-serial-console/install.d/serial-console-udev.rules diskimage_builder/elements/enable-serial-console/install.d/ttySx.conf diskimage_builder/elements/ensure-venv/README.rst diskimage_builder/elements/ensure-venv/element-deps diskimage_builder/elements/ensure-venv/package-installs.yaml diskimage_builder/elements/ensure-venv/pkg-map diskimage_builder/elements/epel/README.rst diskimage_builder/elements/epel/element-deps diskimage_builder/elements/epel/package-installs.yaml diskimage_builder/elements/epel/pkg-map diskimage_builder/elements/epel/pre-install.d/05-rpm-epel-release diskimage_builder/elements/fedora/README.rst diskimage_builder/elements/fedora/element-deps diskimage_builder/elements/fedora/element-provides diskimage_builder/elements/fedora/package-installs.yaml diskimage_builder/elements/fedora-minimal/README.rst diskimage_builder/elements/fedora-minimal/element-deps diskimage_builder/elements/fedora-minimal/element-provides diskimage_builder/elements/fedora-minimal/environment.d/10-fedora-distro-name.bash diskimage_builder/elements/fedora-minimal/environment.d/11-yum-dnf.bash diskimage_builder/elements/fedora-minimal/test-elements/build-succeeds/README.rst diskimage_builder/elements/fedora-minimal/test-elements/build-succeeds/element-deps diskimage_builder/elements/fedora-minimal/yum.repos.d/yum.repo diskimage_builder/elements/fedora/environment.d/10-fedora-distro-name.bash diskimage_builder/elements/fedora/environment.d/11-yum-dnf.bash diskimage_builder/elements/fedora/pre-install.d/01-set-fedora-mirror diskimage_builder/elements/fedora/pre-install.d/02-set-machine-id diskimage_builder/elements/fedora/root.d/10-fedora-cloud-image diskimage_builder/elements/fedora/test-elements/build-succeeds/element-deps diskimage_builder/elements/gentoo/README.rst diskimage_builder/elements/gentoo/element-deps diskimage_builder/elements/gentoo/element-provides diskimage_builder/elements/gentoo/package-installs.yaml diskimage_builder/elements/gentoo/bin/fix_shm diskimage_builder/elements/gentoo/bin/install-packages diskimage_builder/elements/gentoo/bin/unfix_shm diskimage_builder/elements/gentoo/cleanup.d/05-unmount diskimage_builder/elements/gentoo/environment.d/00-gentoo-envars.bash diskimage_builder/elements/gentoo/extra-data.d/gentoo-releng.gpg diskimage_builder/elements/gentoo/finalise.d/99-cleanup diskimage_builder/elements/gentoo/pre-finalise.d/01-gentoo-cache diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-00-set-profile diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-01-migrate-pax diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-02-flags diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-03-enable-overlays diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-04-install-desired-python diskimage_builder/elements/gentoo/root.d/10-gentoo-image diskimage_builder/elements/gentoo/root.d/50-gentoo-cache diskimage_builder/elements/gentoo/test-elements/build-succeeds/README.rst diskimage_builder/elements/gentoo/test-elements/build-succeeds/element-deps diskimage_builder/elements/growroot/README.rst diskimage_builder/elements/growroot/element-deps diskimage_builder/elements/growroot/package-installs.yaml diskimage_builder/elements/growroot/pkg-map diskimage_builder/elements/growroot/init-scripts/openrc/growroot diskimage_builder/elements/growroot/init-scripts/systemd/growroot.service diskimage_builder/elements/growroot/init-scripts/upstart/growroot.conf diskimage_builder/elements/growroot/post-install.d/80-growroot diskimage_builder/elements/growroot/static/usr/local/sbin/growroot diskimage_builder/elements/grub2/README.rst diskimage_builder/elements/grub2/package-installs.yaml diskimage_builder/elements/grub2/pkg-map diskimage_builder/elements/grub2/post-install.d/01-delete-grubenv diskimage_builder/elements/hpdsa/README.rst diskimage_builder/elements/hpdsa/package-installs.yaml diskimage_builder/elements/hpdsa/post-install.d/95-hpdsa diskimage_builder/elements/hpdsa/post-install.d/98-hpdsa-post-dkms diskimage_builder/elements/hpdsa/pre-install.d/06-hpdsa diskimage_builder/elements/hpdsa/root.d/10-hpdsa-check-distro diskimage_builder/elements/hwburnin/README.rst diskimage_builder/elements/hwburnin/binary-deps.d/hwburnin diskimage_builder/elements/hwburnin/init.d/70-hwburnin diskimage_builder/elements/hwdiscovery/README.rst diskimage_builder/elements/hwdiscovery/element-deps diskimage_builder/elements/hwdiscovery/package-installs.yaml diskimage_builder/elements/hwdiscovery/binary-deps.d/hwdiscovery diskimage_builder/elements/hwdiscovery/init.d/60-hwdiscovery diskimage_builder/elements/ibft-interfaces/README.rst diskimage_builder/elements/ibft-interfaces/element-deps diskimage_builder/elements/ibft-interfaces/package-installs.yaml diskimage_builder/elements/ibft-interfaces/pkg-map diskimage_builder/elements/ibft-interfaces/init-scripts/systemd/init-ibft-interfaces.service diskimage_builder/elements/ibft-interfaces/init-scripts/sysv/init-ibft-interfaces.init diskimage_builder/elements/ibft-interfaces/init-scripts/upstart/init-ibft-interfaces.conf diskimage_builder/elements/ibft-interfaces/post-install.d/70-init-ibft-interfaces diskimage_builder/elements/ibft-interfaces/static/etc/modules-load.d/ibft.conf diskimage_builder/elements/ibft-interfaces/static/usr/local/sbin/init-ibft-interfaces.sh diskimage_builder/elements/ilo/README.rst diskimage_builder/elements/ilo/extra-data.d/50-ilo-firmware diskimage_builder/elements/ilo/init.d/50-ilo-firmware diskimage_builder/elements/ilo/ramdisk-install.d/50-ilo-firmware diskimage_builder/elements/install-bin/README.rst diskimage_builder/elements/install-bin/pre-install.d/01-install-bin diskimage_builder/elements/install-static/README.rst diskimage_builder/elements/install-static/element-deps diskimage_builder/elements/install-static/package-installs.yaml diskimage_builder/elements/install-static/install.d/10-install-static-files diskimage_builder/elements/install-types/README.rst diskimage_builder/elements/install-types/extra-data.d/99-enable-install-types diskimage_builder/elements/ironic-agent/README.rst diskimage_builder/elements/ironic-agent/element-deps diskimage_builder/elements/ironic-agent/element-provides diskimage_builder/elements/ironic-agent/package-installs.yaml diskimage_builder/elements/ironic-agent/pkg-map diskimage_builder/elements/ironic-agent/source-repository-ironic-agent diskimage_builder/elements/ironic-agent/svc-map diskimage_builder/elements/ironic-agent/cleanup.d/99-ramdisk-create diskimage_builder/elements/ironic-agent/environment.d/01-ironic-agent.sh diskimage_builder/elements/ironic-agent/extra-data.d/15-ssl-ca-copy diskimage_builder/elements/ironic-agent/finalise.d/99-remove-extra-packages diskimage_builder/elements/ironic-agent/install.d/ironic-agent-package-install/package-installs-ironic-agent diskimage_builder/elements/ironic-agent/install.d/ironic-agent-source-install/60-ironic-agent-install diskimage_builder/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.conf diskimage_builder/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.init diskimage_builder/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.service diskimage_builder/elements/ironic-agent/post-install.d/80-ironic-agent diskimage_builder/elements/ironic-agent/static/etc/systemd/system/ironic-agent-create-rescue-user.path diskimage_builder/elements/ironic-agent/static/etc/systemd/system/ironic-agent-create-rescue-user.service diskimage_builder/elements/ironic-agent/static/usr/local/bin/ironic-python-agent-create-rescue-user.sh diskimage_builder/elements/ironic-agent/test-elements/build-succeeds-fedora/element-deps diskimage_builder/elements/ironic-agent/test-elements/build-succeeds-fedora/element-type diskimage_builder/elements/iscsi-boot/README.rst diskimage_builder/elements/iscsi-boot/element-deps diskimage_builder/elements/iscsi-boot/package-installs.yaml diskimage_builder/elements/iscsi-boot/environment.d/open-iscsi-config diskimage_builder/elements/iscsi-boot/extra-data.d/50-check-dracut-regenerate diskimage_builder/elements/iscsi-boot/finalise.d/51-open-iscsi-config diskimage_builder/elements/iscsi-boot/post-install.d/open-iscsi-config diskimage_builder/elements/iso/README.rst diskimage_builder/elements/iso/element-deps diskimage_builder/elements/iso/package-installs.yaml diskimage_builder/elements/iso/pkg-map diskimage_builder/elements/iso/cleanup.d/100-build-iso diskimage_builder/elements/iso/post-install.d/01-copy-bootloaders diskimage_builder/elements/journal-to-console/README.rst diskimage_builder/elements/journal-to-console/post-install.d/30-journal-to-console diskimage_builder/elements/local-config/README.rst diskimage_builder/elements/local-config/element-deps diskimage_builder/elements/local-config/environment.d/62-ssh-key diskimage_builder/elements/local-config/extra-data.d/62-ssh-key diskimage_builder/elements/local-config/install.d/62-ssh-key diskimage_builder/elements/local-config/pre-install.d/02-proxy-settings diskimage_builder/elements/lvm/README.rst diskimage_builder/elements/lvm/element-deps diskimage_builder/elements/lvm/package-installs.yaml diskimage_builder/elements/lvm/finalise.d/60-bootloader diskimage_builder/elements/lvm/root.d/10-lvm-check-distro diskimage_builder/elements/manifests/README.rst diskimage_builder/elements/manifests/cleanup.d/01-copy-manifests-dir diskimage_builder/elements/manifests/environment.d/14-manifests diskimage_builder/elements/manifests/extra-data.d/20-manifest-dir diskimage_builder/elements/mellanox/README.rst diskimage_builder/elements/mellanox/element-deps diskimage_builder/elements/mellanox/package-installs.yaml diskimage_builder/elements/mellanox/pkg-map diskimage_builder/elements/mellanox/init.d/01-mellanox diskimage_builder/elements/mellanox/install.d/65-mellanox diskimage_builder/elements/mellanox/install.d/mellanox-rules.udev diskimage_builder/elements/mellanox/udev.d/81-mellanox-drivers.rules diskimage_builder/elements/modprobe/README.rst diskimage_builder/elements/modprobe-blacklist/README.rst diskimage_builder/elements/modprobe-blacklist/install.d/80-modprobe-blacklist diskimage_builder/elements/modprobe/extra-data.d/50-modprobe-blacklist diskimage_builder/elements/modprobe/install.d/80-modprobe-blacklist diskimage_builder/elements/no-final-image/README.rst diskimage_builder/elements/oat-client/README.rst diskimage_builder/elements/oat-client/element-deps diskimage_builder/elements/oat-client/package-installs.yaml diskimage_builder/elements/oat-client/yum.repos.d/fedora-oat.repo diskimage_builder/elements/openssh-server/README.rst diskimage_builder/elements/openssh-server/element-deps diskimage_builder/elements/openssh-server/package-installs.yaml diskimage_builder/elements/openssh-server/pkg-map diskimage_builder/elements/openssh-server/post-install.d/80-enable-sshd-service diskimage_builder/elements/openssh-server/post-install.d/99-harden-sshd-config diskimage_builder/elements/openstack-ci-mirrors/README.rst diskimage_builder/elements/openstack-ci-mirrors/environment.d/11-dib-distribution-mirror.bash diskimage_builder/elements/openstack-ci-mirrors/extra-data.d/75-copy-mirror-info diskimage_builder/elements/openstack-ci-mirrors/root.d/10-apt-disable-gpg diskimage_builder/elements/opensuse/README.rst diskimage_builder/elements/opensuse/element-deps diskimage_builder/elements/opensuse/element-provides diskimage_builder/elements/opensuse/package-installs.yaml diskimage_builder/elements/opensuse-minimal/README.rst diskimage_builder/elements/opensuse-minimal/element-deps diskimage_builder/elements/opensuse-minimal/element-provides diskimage_builder/elements/opensuse-minimal/environment.d/10-opensuse-distro-name.bash diskimage_builder/elements/opensuse-minimal/test-elements/opensuse15-build-succeeds/README.rst diskimage_builder/elements/opensuse-minimal/test-elements/opensuse15-build-succeeds/element-deps diskimage_builder/elements/opensuse-minimal/test-elements/opensuse15-build-succeeds/environment.d/10-set-distro.bash diskimage_builder/elements/opensuse/environment.d/10-opensuse-distro-name.bash diskimage_builder/elements/opensuse/extra-data.d/01-inject-defaults diskimage_builder/elements/opensuse/root.d/10-opensuse-cloud-image diskimage_builder/elements/opensuse/test-elements/build-succeeds/README.rst diskimage_builder/elements/opensuse/test-elements/build-succeeds/element-deps diskimage_builder/elements/opensuse/test-elements/opensuse15-build-succeeds/README.rst diskimage_builder/elements/opensuse/test-elements/opensuse15-build-succeeds/environment.d/10-set-distro.bash diskimage_builder/elements/package-installs/README.rst diskimage_builder/elements/package-installs/__init__.py diskimage_builder/elements/package-installs/element-deps diskimage_builder/elements/package-installs/bin/package-installs diskimage_builder/elements/package-installs/bin/package-installs-squash diskimage_builder/elements/package-installs/bin/package-installs-v2 diskimage_builder/elements/package-installs/bin/package-uninstalls diskimage_builder/elements/package-installs/extra-data.d/99-squash-package-install diskimage_builder/elements/package-installs/install.d/01-package-installs diskimage_builder/elements/package-installs/install.d/99-package-uninstalls diskimage_builder/elements/package-installs/post-install.d/00-package-installs diskimage_builder/elements/package-installs/post-install.d/95-package-uninstalls diskimage_builder/elements/package-installs/pre-install.d/02-package-installs diskimage_builder/elements/package-installs/pre-install.d/99-package-uninstalls diskimage_builder/elements/package-installs/tests/__init__.py diskimage_builder/elements/package-installs/tests/test_package_squash.py diskimage_builder/elements/pip-and-virtualenv/README.rst diskimage_builder/elements/pip-and-virtualenv/element-deps diskimage_builder/elements/pip-and-virtualenv/package-installs.yaml diskimage_builder/elements/pip-and-virtualenv/pkg-map diskimage_builder/elements/pip-and-virtualenv/source-repository-pip-and-virtualenv diskimage_builder/elements/pip-and-virtualenv/environment.d/51-pip-and-virutalenv-default.bash diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip diskimage_builder/elements/pip-and-virtualenv/post-install.d/89-clean-up-pip-cache diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-fedora/element-deps diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-fedora/environment.d/10-source-installtype-pip-and-virtualenv diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-opensuse/element-deps diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-opensuse/environment.d/10-source-installtype-pip-and-virtualenv diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-ubuntu/element-deps diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-ubuntu/environment.d/10-source-installtype-pip-and-virtualenv diskimage_builder/elements/pip-cache/README.rst diskimage_builder/elements/pip-cache/environment.d/10-pip-cache diskimage_builder/elements/pip-cache/root.d/11-pip-cache diskimage_builder/elements/pkg-map/README.rst diskimage_builder/elements/pkg-map/element-deps diskimage_builder/elements/pkg-map/bin/pkg-map diskimage_builder/elements/pkg-map/extra-data.d/10-create-pkg-map-dir diskimage_builder/elements/posix/README.rst diskimage_builder/elements/posix/element-deps diskimage_builder/elements/posix/package-installs.yaml diskimage_builder/elements/posix/pkg-map diskimage_builder/elements/proliant-tools/README.rst diskimage_builder/elements/proliant-tools/element-deps diskimage_builder/elements/proliant-tools/package-installs.yaml diskimage_builder/elements/proliant-tools/pkg-map diskimage_builder/elements/proliant-tools/install.d/65-proliant-tools-install diskimage_builder/elements/pypi/README.rst diskimage_builder/elements/pypi/element-deps diskimage_builder/elements/pypi/extra-data.d/00-mount-pypi-mirror diskimage_builder/elements/pypi/post-install.d/00-unconfigure-pypi-mirror diskimage_builder/elements/pypi/pre-install.d/04-configure-pypi-mirror diskimage_builder/elements/python-brickclient/README.rst diskimage_builder/elements/python-brickclient/element-deps diskimage_builder/elements/python-brickclient/package-installs.yaml diskimage_builder/elements/python-brickclient/pkg-map diskimage_builder/elements/python-brickclient/post-install.d/55-brick-client-install diskimage_builder/elements/python-stow-versions/README.rst diskimage_builder/elements/python-stow-versions/element-deps diskimage_builder/elements/python-stow-versions/package-installs.yaml diskimage_builder/elements/python-stow-versions/pkg-map diskimage_builder/elements/python-stow-versions/source-repository-pyenv diskimage_builder/elements/python-stow-versions/install.d/70-python-build diskimage_builder/elements/python-stow-versions/post-install.d/70-python-build diskimage_builder/elements/python-stow-versions/test-elements/test-python-stow/element-deps diskimage_builder/elements/python-stow-versions/test-elements/test-python-stow/environment.d/70-test-python-stow.bash diskimage_builder/elements/python-stow-versions/test-elements/test-python-stow/install.d/69-test-python-stow diskimage_builder/elements/python-stow-versions/test-elements/test-python-stow/install.d/71-test-python-stow diskimage_builder/elements/ramdisk/README.rst diskimage_builder/elements/ramdisk/element-deps diskimage_builder/elements/ramdisk/pkg-map diskimage_builder/elements/ramdisk-base/README.rst diskimage_builder/elements/ramdisk-base/cleanup.d/99-extract-ramdisk-files diskimage_builder/elements/ramdisk-base/extra-data.d/01-inject-ramdisk-build-files diskimage_builder/elements/ramdisk-base/extra-data.d/scripts/init diskimage_builder/elements/ramdisk-base/extra-data.d/scripts/init-end diskimage_builder/elements/ramdisk-base/extra-data.d/scripts/d/init-func diskimage_builder/elements/ramdisk-base/init.d/20-init-variables diskimage_builder/elements/ramdisk-base/init.d/40-check-network-ready diskimage_builder/elements/ramdisk-base/post-install.d/01-ensure-binaries diskimage_builder/elements/ramdisk-base/udev.d/60-persistent-storage.rules diskimage_builder/elements/ramdisk/binary-deps.d/ramdisk diskimage_builder/elements/ramdisk/init.d/10-start-base-system diskimage_builder/elements/ramdisk/init.d/30-start-network diskimage_builder/elements/ramdisk/install.d/20-install-dhcp-client diskimage_builder/elements/ramdisk/install.d/52-ramdisk-install-busybox diskimage_builder/elements/ramdisk/post-install.d/99-build-ramdisk diskimage_builder/elements/rax-nova-agent/README.rst diskimage_builder/elements/rax-nova-agent/element-deps diskimage_builder/elements/rax-nova-agent/package-installs.yaml diskimage_builder/elements/rax-nova-agent/source-repository-nova-agent diskimage_builder/elements/rax-nova-agent/source-repository-xen-tools diskimage_builder/elements/rax-nova-agent/install.d/05-xen-tools diskimage_builder/elements/rax-nova-agent/install.d/10-nova-agent diskimage_builder/elements/redhat-common/README.rst diskimage_builder/elements/redhat-common/element-deps diskimage_builder/elements/redhat-common/package-installs.yaml diskimage_builder/elements/redhat-common/pkg-map diskimage_builder/elements/redhat-common/bin/extract-image diskimage_builder/elements/redhat-common/bin/map-packages diskimage_builder/elements/redhat-common/environment.d/50-redhat-common diskimage_builder/elements/redhat-common/finalise.d/01-clean-old-kernels diskimage_builder/elements/rhel/README.rst diskimage_builder/elements/rhel/element-deps diskimage_builder/elements/rhel/element-provides diskimage_builder/elements/rhel-common/README.rst diskimage_builder/elements/rhel-common/finalise.d/60-unregister diskimage_builder/elements/rhel-common/install.d/10-openstack-selinux-rhel diskimage_builder/elements/rhel-common/os-refresh-config/pre-configure.d/06-rhel-registration diskimage_builder/elements/rhel-common/pre-install.d/00-rhel-registration diskimage_builder/elements/rhel-common/pre-install.d/00-rhsm diskimage_builder/elements/rhel-common/pre-install.d/10-rhel-blacklist diskimage_builder/elements/rhel/environment.d/10-rhel-distro-name.bash diskimage_builder/elements/rhel/environment.d/11-yum-dnf.bash diskimage_builder/elements/rhel/pre-install.d/02-set-machine-id diskimage_builder/elements/rhel/root.d/10-rhel-cloud-image diskimage_builder/elements/rhel7/README.rst diskimage_builder/elements/rhel7/element-deps diskimage_builder/elements/rhel7/environment.d/00-rhel7-element-deprecation.bash diskimage_builder/elements/rhel7/environment.d/10-rhel7-distro-name.bash diskimage_builder/elements/rpm-distro/README.rst diskimage_builder/elements/rpm-distro/cleanup.d/99-selinux-fixfiles-restore diskimage_builder/elements/rpm-distro/post-install.d/06-network-config-nonzeroconf diskimage_builder/elements/rpm-distro/pre-install.d/00-fix-requiretty diskimage_builder/elements/rpm-distro/pre-install.d/00-usr-local-bin-secure-path diskimage_builder/elements/rpm-distro/pre-install.d/01-override-yum-arch diskimage_builder/elements/runtime-ssh-host-keys/README.rst diskimage_builder/elements/runtime-ssh-host-keys/element-deps diskimage_builder/elements/runtime-ssh-host-keys/package-installs.yaml diskimage_builder/elements/runtime-ssh-host-keys/pkg-map diskimage_builder/elements/runtime-ssh-host-keys/cleanup.d/90-remove-ssh-host-keys diskimage_builder/elements/runtime-ssh-host-keys/init-scripts/systemd/ssh-keygen.service diskimage_builder/elements/runtime-ssh-host-keys/init-scripts/upstart/ssh-keygen.conf diskimage_builder/elements/runtime-ssh-host-keys/post-install.d/80-ssh-keygen diskimage_builder/elements/runtime-ssh-host-keys/static/usr/local/sbin/runtime-ssh-host-keys.sh diskimage_builder/elements/select-boot-kernel-initrd/README.rst diskimage_builder/elements/select-boot-kernel-initrd/bin/select-boot-kernel-initrd diskimage_builder/elements/select-boot-kernel-initrd/cleanup.d/99-remove-dib-img-functions diskimage_builder/elements/select-boot-kernel-initrd/extra-data.d/99-copy-dib-img-functions diskimage_builder/elements/selinux-permissive/README.rst diskimage_builder/elements/selinux-permissive/pre-install.d/11-selinux-permissive diskimage_builder/elements/simple-init/README.rst diskimage_builder/elements/simple-init/element-deps diskimage_builder/elements/simple-init/package-installs.yaml diskimage_builder/elements/simple-init/pkg-map diskimage_builder/elements/simple-init/source-repository-simple-init diskimage_builder/elements/simple-init/environment.d/15-simple-init-networkmanager diskimage_builder/elements/simple-init/environment.d/50-disable-cloud-init diskimage_builder/elements/simple-init/install.d/50-simple-init diskimage_builder/elements/simple-init/install.d/60-simple-init-remove-interfaces diskimage_builder/elements/simple-init/install.d/simple-init-repo-install/40-glean diskimage_builder/elements/simple-init/install.d/simple-init-source-install/40-glean diskimage_builder/elements/simple-init/post-install.d/80-simple-init diskimage_builder/elements/source-repositories/README.rst diskimage_builder/elements/source-repositories/element-deps diskimage_builder/elements/source-repositories/package-installs.yaml diskimage_builder/elements/source-repositories/pkg-map diskimage_builder/elements/source-repositories/extra-data.d/98-source-repositories diskimage_builder/elements/stable-interface-names/README.rst diskimage_builder/elements/stable-interface-names/element-deps diskimage_builder/elements/stable-interface-names/package-installs.yaml diskimage_builder/elements/stable-interface-names/install.d/02-stable-interface-names diskimage_builder/elements/svc-map/README.rst diskimage_builder/elements/svc-map/__init__.py diskimage_builder/elements/svc-map/package-installs.yaml diskimage_builder/elements/svc-map/pkg-map diskimage_builder/elements/svc-map/bin/svc-map diskimage_builder/elements/svc-map/extra-data.d/10-merge-svc-map-files diskimage_builder/elements/svc-map/extra-data.d/11-copy-svc-map-file diskimage_builder/elements/svc-map/tests/__init__.py diskimage_builder/elements/svc-map/tests/test_data_merge.py diskimage_builder/elements/sysctl/README.rst diskimage_builder/elements/sysctl/bin/sysctl-set-value diskimage_builder/elements/sysctl/bin/sysctl-write-value diskimage_builder/elements/sysprep/README.rst diskimage_builder/elements/sysprep/finalise.d/01-clear-machine-id diskimage_builder/elements/uboot/README.rst diskimage_builder/elements/uboot/cleanup.d/98-uboot diskimage_builder/elements/ubuntu/README.rst diskimage_builder/elements/ubuntu/element-deps diskimage_builder/elements/ubuntu/element-provides diskimage_builder/elements/ubuntu/package-installs.yaml diskimage_builder/elements/ubuntu-common/README.rst diskimage_builder/elements/ubuntu-common/element-deps diskimage_builder/elements/ubuntu-common/environment.d/10-ubuntu-distro-name.bash diskimage_builder/elements/ubuntu-common/environment.d/11-ubuntu-init-system.bash diskimage_builder/elements/ubuntu-common/install.d/80-disable-rfc3041 diskimage_builder/elements/ubuntu-minimal/README.rst diskimage_builder/elements/ubuntu-minimal/element-deps diskimage_builder/elements/ubuntu-minimal/element-provides diskimage_builder/elements/ubuntu-minimal/package-installs.yaml diskimage_builder/elements/ubuntu-minimal/environment.d/11-ubuntu-kernel.bash diskimage_builder/elements/ubuntu-minimal/root.d/75-ubuntu-minimal-baseinstall diskimage_builder/elements/ubuntu-minimal/test-elements/bionic-arm64-build-succeeds/README.rst diskimage_builder/elements/ubuntu-minimal/test-elements/bionic-arm64-build-succeeds/element-deps diskimage_builder/elements/ubuntu-minimal/test-elements/bionic-arm64-build-succeeds/test-output-formats diskimage_builder/elements/ubuntu-minimal/test-elements/bionic-arm64-build-succeeds/environment.d/10-set-distro.bash diskimage_builder/elements/ubuntu-minimal/test-elements/bionic-build-succeeds/README.rst diskimage_builder/elements/ubuntu-minimal/test-elements/bionic-build-succeeds/element-deps diskimage_builder/elements/ubuntu-minimal/test-elements/bionic-build-succeeds/test-output-formats diskimage_builder/elements/ubuntu-minimal/test-elements/bionic-build-succeeds/environment.d/10-set-distro.bash diskimage_builder/elements/ubuntu-minimal/test-elements/trusty-build-succeeds/README.rst diskimage_builder/elements/ubuntu-minimal/test-elements/trusty-build-succeeds/element-deps diskimage_builder/elements/ubuntu-minimal/test-elements/trusty-build-succeeds/environment.d/10-set-distro.bash diskimage_builder/elements/ubuntu-minimal/test-elements/xenial-build-succeeds/README.rst diskimage_builder/elements/ubuntu-minimal/test-elements/xenial-build-succeeds/element-deps diskimage_builder/elements/ubuntu-minimal/test-elements/xenial-build-succeeds/test-output-formats diskimage_builder/elements/ubuntu-minimal/test-elements/xenial-build-succeeds/environment.d/10-set-distro.bash diskimage_builder/elements/ubuntu-signed/README.rst diskimage_builder/elements/ubuntu-signed/element-deps diskimage_builder/elements/ubuntu-signed/package-installs.yaml diskimage_builder/elements/ubuntu-signed/post-install.d/90-get-signed-kernel diskimage_builder/elements/ubuntu-systemd-container/README.rst diskimage_builder/elements/ubuntu-systemd-container/element-deps diskimage_builder/elements/ubuntu-systemd-container/element-provides diskimage_builder/elements/ubuntu-systemd-container/root.d/75-ubuntu-minimal-baseinstall diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-build-succeeds/README.rst diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-build-succeeds/element-deps diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-build-succeeds/test-output-formats diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-build-succeeds/environment.d/10-set-distro.bash diskimage_builder/elements/ubuntu-systemd-container/test-elements/trusty-build-succeeds/README.rst diskimage_builder/elements/ubuntu-systemd-container/test-elements/trusty-build-succeeds/element-deps diskimage_builder/elements/ubuntu-systemd-container/test-elements/trusty-build-succeeds/environment.d/10-set-distro.bash diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-build-succeeds/README.rst diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-build-succeeds/element-deps diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-build-succeeds/test-output-formats diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-build-succeeds/environment.d/10-set-distro.bash diskimage_builder/elements/ubuntu/environment.d/99-cloud-init-datasources.bash diskimage_builder/elements/ubuntu/install.d/99-autoremove diskimage_builder/elements/ubuntu/pre-install.d/00-remove-apt-xapian-index diskimage_builder/elements/ubuntu/pre-install.d/00-remove-grub diskimage_builder/elements/ubuntu/pre-install.d/01-set-ubuntu-mirror diskimage_builder/elements/ubuntu/root.d/10-cache-ubuntu-tarball diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/README.rst diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/element-deps diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/test-output-formats diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/environment.d/10-set-distro.bash diskimage_builder/elements/ubuntu/test-elements/trusty-build-succeeds/README.rst diskimage_builder/elements/ubuntu/test-elements/trusty-build-succeeds/element-deps diskimage_builder/elements/ubuntu/test-elements/trusty-build-succeeds/environment.d/10-set-distro.bash diskimage_builder/elements/ubuntu/test-elements/xenial-build-succeeds/README.rst diskimage_builder/elements/ubuntu/test-elements/xenial-build-succeeds/element-deps diskimage_builder/elements/ubuntu/test-elements/xenial-build-succeeds/test-output-formats diskimage_builder/elements/ubuntu/test-elements/xenial-build-succeeds/environment.d/10-set-distro.bash diskimage_builder/elements/vm/README.rst diskimage_builder/elements/vm/element-deps diskimage_builder/elements/vm/finalise.d/50-remove-bogus-udev-links diskimage_builder/elements/yum/README.rst diskimage_builder/elements/yum/element-deps diskimage_builder/elements/yum-minimal/README.rst diskimage_builder/elements/yum-minimal/element-deps diskimage_builder/elements/yum-minimal/package-installs.yaml diskimage_builder/elements/yum-minimal/pkg-map diskimage_builder/elements/yum-minimal/cleanup.d/95-remove-yum-mirror diskimage_builder/elements/yum-minimal/install.d/10-base-networking diskimage_builder/elements/yum-minimal/install.d/11-ensure-dbus-daemon diskimage_builder/elements/yum-minimal/pre-install.d/03-yum-cleanup diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot diskimage_builder/elements/yum/bin/install-packages diskimage_builder/elements/yum/cleanup.d/99-remove-yum-repo-conf diskimage_builder/elements/yum/extra-data.d/99-yum-repo-conf diskimage_builder/elements/yum/post-install.d/99-reset-yum-conf diskimage_builder/elements/yum/pre-install.d/00-dnf-update diskimage_builder/elements/yum/pre-install.d/01-yum-keepcache diskimage_builder/elements/yum/root.d/50-yum-cache diskimage_builder/elements/zipl/README.rst diskimage_builder/elements/zipl/element-deps diskimage_builder/elements/zipl/element-provides diskimage_builder/elements/zipl/package-installs.yaml diskimage_builder/elements/zipl/environment.d/10-zipl-default-cmdline diskimage_builder/elements/zipl/finalise.d/50-zipl diskimage_builder/elements/zipl/pre-install.d/kernel_config diskimage_builder/elements/zypper/README.rst diskimage_builder/elements/zypper/element-deps diskimage_builder/elements/zypper-minimal/README.rst diskimage_builder/elements/zypper-minimal/element-deps diskimage_builder/elements/zypper-minimal/package-installs.yaml diskimage_builder/elements/zypper-minimal/post-install.d/01-locale-cleanup diskimage_builder/elements/zypper-minimal/pre-install.d/00-disable-zypper-recommends diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot diskimage_builder/elements/zypper/bin/install-packages diskimage_builder/elements/zypper/install.d/01-login-defs diskimage_builder/elements/zypper/post-install.d/10-mkinitrd diskimage_builder/elements/zypper/post-install.d/98-zypper-clean-cache diskimage_builder/elements/zypper/post-install.d/99-zypper-no-keep-packages diskimage_builder/elements/zypper/pre-install.d/01-zypper-keep-packages diskimage_builder/elements/zypper/root.d/50-zypper-cache diskimage_builder/lib/common-defaults diskimage_builder/lib/common-functions diskimage_builder/lib/dib-run-parts diskimage_builder/lib/die diskimage_builder/lib/disk-image-create diskimage_builder/lib/img-defaults diskimage_builder/lib/img-functions diskimage_builder/lib/outfilter.py diskimage_builder/lib/ramdisk-defaults diskimage_builder/lib/ramdisk-functions diskimage_builder/lib/ramdisk-image-create diskimage_builder/tests/__init__.py diskimage_builder/tests/base.py diskimage_builder/tests/test_elementdeps.py diskimage_builder/tests/test_loggingconfig.py diskimage_builder/tests/test_no_dup_filenames.py diskimage_builder/tests/functional/__init__.py doc/requirements.txt doc/lib/element_deps.py doc/source/ci.md doc/source/conf.py doc/source/elements doc/source/elements.rst doc/source/index.rst doc/source/developer/caches.rst doc/source/developer/components.rst doc/source/developer/design.rst doc/source/developer/developing_elements.rst doc/source/developer/dib_lint.rst doc/source/developer/index.rst doc/source/developer/invocation.rst doc/source/developer/stable_interfaces.rst doc/source/developer/vhd_creation.rst doc/source/specs/README.rst doc/source/specs/v1/approved/block-device-lvl1-partitioning.rst doc/source/specs/v1/approved/block-device-overview.rst doc/source/specs/v1/approved/v1-template.rst doc/source/user_guide/building_an_image.rst doc/source/user_guide/index.rst doc/source/user_guide/install_types.rst doc/source/user_guide/installation.rst doc/source/user_guide/supported_distros.rst playbooks/dib-functests/post.yaml playbooks/dib-functests/run.yaml playbooks/dib-nodepool/debootstrap.yaml releasenotes/notes/1.16.0-updates-bad91fc0b36c1755.yaml releasenotes/notes/1.17.0-ef744f36d277dba4.yaml releasenotes/notes/1.18.0-4433d3076627f10d.yaml releasenotes/notes/1.18.1-ceeb514708dcb731.yaml releasenotes/notes/Add-DIB-UBUNTU-KERNEL-5f75a809f3ce9bab.yaml releasenotes/notes/add-centos-8-support-4fd28eb04e11ba43.yaml releasenotes/notes/add-efi-packages-70a19464d31ab8d7.yaml releasenotes/notes/add-modprobe-element-8e3b0287ebb11920.yaml releasenotes/notes/add-version-less-rhel-element-82fac7f2609e16d3.yaml releasenotes/notes/block-device-handling-279cddba8a859718.yaml releasenotes/notes/block-device-lvm-c3b8a214952b4db5.yaml releasenotes/notes/block-device-mkfs-mount-fstab-42d7efe28fc2df04.yaml releasenotes/notes/block-device-partitioning-237249e7ed2bad26.yaml releasenotes/notes/bootloader-commandline-d2db7524f1f9ad28.yaml releasenotes/notes/bootloader-gpt-d1047f81f3a0631b.yaml releasenotes/notes/centos-minimal-8-aca6314862741177.yaml releasenotes/notes/centos-retired-f17ae9f6f03e57e3.yaml releasenotes/notes/dash-p-after-install-58a87549c1c906c3.yaml releasenotes/notes/debian-security-7279855cf464f88b.yaml releasenotes/notes/debian-security-b4f677a148fdf9c9.yaml releasenotes/notes/deprecate-ironic-agent-element.yaml releasenotes/notes/dib-distribution-mirror-8c241c0d3d4a539a.yaml releasenotes/notes/dib-init-system-5647bad17a01c602.yaml releasenotes/notes/dib-init-system_fix_for_debian_jessie-c6f7261ee84dad27.yaml releasenotes/notes/dib-run-parts-6f67d038aa5a4156.yaml releasenotes/notes/dib-run-parts-e18cc3a6c2d66c24.yaml releasenotes/notes/dibv2-omnibus-b30e0c7ecd76db8d.yaml releasenotes/notes/doc-auto-element-dependency-cb7488c5bb7301a4.yaml releasenotes/notes/dracut-network-adaabf90da9f6866.yaml releasenotes/notes/efi-bootloader-disk-size-4c1a9f18967104fb.yaml releasenotes/notes/element-info-entry-point-448bf622be6061a0.yaml releasenotes/notes/element-override-ccda78c24ab4a4ff.yaml releasenotes/notes/element-vars-c6bf2e6795002f01.yaml releasenotes/notes/ensure-venv-d7c16a2a04fd3b8f.yaml releasenotes/notes/fedora26-690b9fd9ac3c3d4f.yaml releasenotes/notes/fix-dnf-clean-old-kernels-use-rpm-to-erase-in-case-running-kernel-0401f78d63daca77.yaml releasenotes/notes/fix_rdisc6_loop-32a308a97de99f0f.yaml releasenotes/notes/gpt-esp-partition-size-200568cb6fcc8788.yaml releasenotes/notes/grub-timeout-1cdd14a2b1467d89.yaml releasenotes/notes/gzip-env-variable-94e61e0c043f4f1f.yaml releasenotes/notes/harden-sshd-config-3f84556136014f95.yaml releasenotes/notes/image-size-padding-24f88d1c4a215221.yaml releasenotes/notes/image-size-padding-mb-574104d40fdd2345.yaml releasenotes/notes/incorrect-grub-label-5d2000215c0cc73e.yaml releasenotes/notes/init-ibft-interfaces-9458d97dfcecc3ae.yaml releasenotes/notes/journal-console-752b46542ec5595e.yaml releasenotes/notes/logfile-quiet-b18f2de4059eecfd.yaml releasenotes/notes/move_tidy_logs_to_main-a8c03427fe1a445c.yaml releasenotes/notes/openssh-server-0f6d065748a2fc18.yaml releasenotes/notes/opensuse-150-default-c047033b850d41ec.yaml releasenotes/notes/opensuse-151-default-67ccfffbc134704d.yaml releasenotes/notes/opensuse-423-default-3bc73fff69374cd0.yaml releasenotes/notes/opensuse-minimal-45267f5be1112c22.yaml releasenotes/notes/package-install-arch-38bb5a6e61794fa5.yaml releasenotes/notes/package-outside-debootstrap-ac93e9ce991819f1.yaml releasenotes/notes/pip-and-virtualenv-args-5d3f2512edd7f3a3.yaml releasenotes/notes/post-root-stage-51da051bcdfbc55f.yaml releasenotes/notes/pre-finalise-stage-574ae7886274bcba.yaml releasenotes/notes/python-venv-d5b04fcf57e460bf.yaml releasenotes/notes/remove-dib-utils-37f70dfad54900a0.yaml releasenotes/notes/remove-solicit-delay-57a035b91922522a.yaml releasenotes/notes/rhel7-element-deprecation-b0c1b57be8cd06ac.yaml releasenotes/notes/root-journal-size-618e064d6681699a.yaml releasenotes/notes/runtime-ssh-host-keys-7a2fc873cc90d33e.yaml releasenotes/notes/selinux-permissive-pre-install-ce19461ef17ec972.yaml releasenotes/notes/simple-init-nm-5d19e249c0a4560b.yaml releasenotes/notes/simple-init-nm-delay-f579e05467785219.yaml releasenotes/notes/simple-init-nm-f0896124dee92a03.yaml releasenotes/notes/skip-packages-env-c97e7b4820f9bfda.yaml releasenotes/notes/squashfs-output-91c1f0dc37474d3c.yaml releasenotes/notes/start-using-reno-446b3d52a467a273.yaml releasenotes/notes/sysprep-f3fd036bc1d2c405.yaml releasenotes/notes/sysprep-fixes-8890b968a8fa7ac1.yaml releasenotes/notes/timestamp-43015aa5434e8ddb.yaml releasenotes/notes/ubuntu-arbitrary-images-c796f5c6dbd40679.yaml releasenotes/notes/upgrade-pip-before-c-d2443847f9d58c7a.yaml releasenotes/notes/yum-cache-removal-148c33012515e56e.yaml releasenotes/notes/yum-minimal-firmware-194846961a6a1cb9.yaml releasenotes/source/conf.py releasenotes/source/index.rst roles/dib-functests/README.rst roles/dib-functests/defaults/main.yaml roles/dib-functests/tasks/main.yaml roles/dib-setup-gate-mirrors/README.rst roles/dib-setup-gate-mirrors/defaults/main.yaml roles/dib-setup-gate-mirrors/tasks/main.yaml roles/dib-setup-gate-mirrors/templates/centos-minimal/7/base.repo.j2 roles/dib-setup-gate-mirrors/templates/centos-minimal/7/extras.repo.j2 roles/dib-setup-gate-mirrors/templates/centos-minimal/7/updates.repo.j2 roles/dib-setup-gate-mirrors/templates/centos-minimal/8/appstream.repo.j2 roles/dib-setup-gate-mirrors/templates/centos-minimal/8/base.repo.j2 roles/dib-setup-gate-mirrors/templates/centos-minimal/8/extras.repo.j2 roles/dib-setup-gate-mirrors/templates/fedora-minimal/default/fedora-updates.repo.j2 roles/dib-setup-gate-mirrors/templates/fedora-minimal/default/fedora.repo.j2 tests/README.rst tests/install_test_deps.sh tests/run_dib_library_tests.sh tests/run_functests.sh tests/run_output_format_test.sh tests/elements/fake-os/README.rst tests/elements/fake-os/element-provides tests/elements/fake-os/root.d/10-fake-osdiskimage-builder-2.35.0/diskimage_builder.egg-info/top_level.txt0000664000175000017500000000002213640271564025075 0ustar zuulzuul00000000000000diskimage_builder diskimage-builder-2.35.0/diskimage_builder.egg-info/pbr.json0000664000175000017500000000005713640271564024031 0ustar zuulzuul00000000000000{"git_version": "21f9ea4f", "is_release": true}diskimage-builder-2.35.0/diskimage_builder.egg-info/not-zip-safe0000664000175000017500000000000113640271564024577 0ustar zuulzuul00000000000000 diskimage-builder-2.35.0/diskimage_builder.egg-info/dependency_links.txt0000664000175000017500000000000113640271564026417 0ustar zuulzuul00000000000000 diskimage-builder-2.35.0/diskimage_builder.egg-info/requires.txt0000664000175000017500000000030213640271564024744 0ustar zuulzuul00000000000000Babel!=2.4.0,>=2.3.4 pbr!=2.1.0,>=2.0.0 PyYAML>=3.12 six>=1.10.0 stevedore>=1.20.0 flake8<4.0.0,>=3.6.0 [:(python_version<'3.0')] networkx<2.3,>=1.10 [:(python_version>='3.4')] networkx>=1.10 diskimage-builder-2.35.0/contrib/0000775000175000017500000000000013640271564016654 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/contrib/setup-gate-mirrors.sh0000775000175000017500000000500213640271474022761 0ustar zuulzuul00000000000000#!/bin/bash set -x # # This tool creates repo/sources files that point to the mirrors for # the host region in the OpenStack CI gate. # # This pre-created on CI nodes by slave scripts source /etc/ci/mirror_info.sh # Tests should probe for this directory and then use the repos/sources # files inside it for the gate tests. BASE_DIR=${WORKSPACE:-$(pwd)}/dib-mirror mkdir -p $BASE_DIR ## REPOS # all should start with "dib-mirror-" # gpg check turned off, because we don't have the keys outside the chroot # fedora-minimal FEDORA_MIN_DIR=$BASE_DIR/fedora-minimal/yum.repos.d mkdir -p $FEDORA_MIN_DIR cat < $FEDORA_MIN_DIR/dib-mirror-fedora.repo [fedora] name=Fedora \$releasever - \$basearch baseurl=$NODEPOOL_FEDORA_MIRROR/releases/\$releasever/Everything/\$basearch/os/ enabled=1 metadata_expire=7d gpgcheck=0 skip_if_unavailable=False deltarpm=False deltarpm_percentage=0 EOF cat < $FEDORA_MIN_DIR/dib-mirror-fedora-updates.repo [updates] name=Fedora \$releasever - \$basearch - Updates baseurl=$NODEPOOL_FEDORA_MIRROR/updates/\$releasever/Everything/\$basearch/ enabled=1 gpgcheck=0 metadata_expire=6h skip_if_unavailable=False deltarpm=False deltarpm_percentage=0 EOF # Centos 7 Minimal CENTOS_MIN_DIR=$BASE_DIR/centos-minimal/yum.repos.d/7 mkdir -p $CENTOS_MIN_DIR cat < $CENTOS_MIN_DIR/dib-mirror-base.repo [base] name=CentOS-\$releasever - Base baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/os/\$basearch/ gpgcheck=0 EOF cat < $CENTOS_MIN_DIR/dib-mirror-updates.repo #released updates [updates] name=CentOS-\$releasever - Updates baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/updates/\$basearch/ gpgcheck=0 EOF cat < $CENTOS_MIN_DIR/dib-mirror-extras.repo #additional packages that may be useful [extras] name=CentOS-\$releasever - Extras baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/extras/\$basearch/ gpgcheck=0 EOF # Centos 8 Minimal CENTOS_MIN_DIR=$BASE_DIR/centos-minimal/yum.repos.d/8 mkdir -p $CENTOS_MIN_DIR cat < $CENTOS_MIN_DIR/dib-mirror-base.repo [base] name=CentOS-\$releasever - Base baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/BaseOS/\$basearch/os/ gpgcheck=0 EOF cat < $CENTOS_MIN_DIR/dib-mirror-appstream.repo [base] name=CentOS-\$releasever - AppStream baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/AppStream/\$basearch/os/ gpgcheck=0 EOF cat < $CENTOS_MIN_DIR/dib-mirror-extras.repo #additional packages that may be useful [extras] name=CentOS-\$releasever - Extras baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/extras/\$basearch/os/ gpgcheck=0 EOF ## apt sources (todo) diskimage-builder-2.35.0/.zuul.d/0000775000175000017500000000000013640271564016513 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/.zuul.d/jobs.yaml0000664000175000017500000002537013640271474020343 0ustar zuulzuul00000000000000- job: name: dib-functests-base abstract: true parent: base run: playbooks/dib-functests/run.yaml post-run: playbooks/dib-functests/post.yaml timeout: 5400 required-projects: - openstack/diskimage-builder - openstack/requirements irrelevant-files: - ^.*\.rst$ - ^doc/.*$ - job: name: dib-functests-default description: | This is the base set of stable tests abstract: true parent: dib-functests-base vars: dib_functests: - apt-sources/test-sources - centos-minimal/7-build-succeeds - centos-minimal/8-build-succeeds - pip-and-virtualenv/source-install-ubuntu - ubuntu-minimal/trusty-build-succeeds - ubuntu-minimal/xenial-build-succeeds - ubuntu-minimal/bionic-build-succeeds - job: name: dib-functests-image description: | This is tests that rely on downloading an upstream image. We generally do not have mirrors for these images so they can be slighlty unreliable. abstract: true voting: false parent: dib-functests-base vars: dib_functests: - centos7/build-succeeds - centos/8-build-succeeds - opensuse/build-succeeds - opensuse/opensuse15-build-succeeds - ubuntu/trusty-build-succeeds - ubuntu/xenial-build-succeeds - ubuntu/bionic-build-succeeds - job: name: dib-functests-extras description: | These are tests which are not as widely supported as the core platforms abstract: true voting: false parent: dib-functests-base vars: dib_functests: - gentoo/build-succeeds - debian-minimal/stable-vm - job: name: dib-functests-containers description: | These are tests for elements focused on containers or other small deployments abstract: true voting: false parent: dib-functests-base vars: dib_functests: - ubuntu-systemd-container/bionic-build-succeeds - ubuntu-systemd-container/xenial-build-succeeds - job: name: dib-functests-arm64 description: | ARM64 build tests abstract: true parent: dib-functests-base vars: dib_functests: - ubuntu-minimal/bionic-arm64-build-succeeds # Bionic / Python3 tests - job: name: dib-functests-bionic-python3 description: | Run the default tests on a Bionic build host with Python 3 parent: dib-functests-default nodeset: ubuntu-bionic vars: # These can only build on bionic dib_functests_extra: - fedora-minimal/build-succeeds - pip-and-virtualenv/source-install-fedora voting: false - job: name: dib-functests-bionic-python3-image description: | The image tests on a Bionic build host with Python 3 parent: dib-functests-image nodeset: ubuntu-bionic vars: dib_functests_extra: - fedora/build-succeeds voting: false - job: name: dib-functests-bionic-python3-extras description: | The extras tests on a Bionic build host with Python 3 parent: dib-functests-extras nodeset: ubuntu-bionic voting: false - job: name: dib-functests-bionic-python3-containers description: | The containers tests on a Bionic build host with Python 3 parent: dib-functests-containers nodeset: ubuntu-bionic voting: false # Xenial / Python3 tests - job: name: dib-functests-xenial-python3 description: | Run the default tests on a Xenial build host with Python 3 parent: dib-functests-default nodeset: ubuntu-xenial - job: name: dib-functests-xenial-python3-image description: | The image tests on a Xenial build host with Python 3 parent: dib-functests-image nodeset: ubuntu-xenial - job: name: dib-functests-xenial-python3-extras description: | The extras tests on a Xenial build host with Python 3 parent: dib-functests-extras nodeset: ubuntu-xenial vars: # opensuse-minimal can only build on xenial ATM, as other # platforms don't have zypper dib_functests_extra: - opensuse-minimal/opensuse15-build-succeeds - job: name: dib-functests-xenial-python3-containers description: | The containers tests on a Xenial build host with Python 3 parent: dib-functests-containers nodeset: ubuntu-xenial voting: false # Centos 7 / Python2 tests - job: name: dib-functests-centos7-python2 description: | Run the default tests on a Centos 7 build host with Python 2 parent: dib-functests-default nodeset: centos-7 vars: dib_python: python2 - job: name: dib-functests-centos7-python2-image description: | The image tests on a Centos 7 build host with Python 2 parent: dib-functests-image nodeset: centos-7 vars: dib_python: python2 - job: name: dib-functests-centos7-python2-extras description: | The extras tests on a Centos 7 build host with Python 2 parent: dib-functests-extras nodeset: centos-7 vars: dib_python: python2 # ARM64 tests - job: name: dib-functests-arm64-bionic description: | ARM64 image tests building on am ARM64 Bionic host nodeset: ubuntu-bionic-arm64 parent: dib-functests-arm64 # Build and boot functional tests - job: name: dib-nodepool-functional-src-base description: | Base job for DIB functional tests, which build and boot a node under nodepool parent: nodepool-functional-openstack-src-base vars: nodepool_debug: true - job: name: dib-nodepool-functional-openstack-centos-7-src description: | Test building and booting a Centos 7 image with Nodepool and OpenStack parent: dib-nodepool-functional-src-base vars: nodepool_extra_packages: - rpm - yum-utils nodepool_diskimage: base_element: centos-minimal release: '7' mirror: "http://{{ zuul_site_mirror_fqdn }}/centos" - job: name: dib-nodepool-functional-openstack-centos-8-src description: | Test building and booting a Centos 8 image with Nodepool and OpenStack parent: dib-nodepool-functional-src-base vars: nodepool_extra_packages: - rpm - yum-utils nodepool_diskimage: base_element: centos-minimal release: '8' mirror: "http://{{ zuul_site_mirror_fqdn }}/centos" - job: name: dib-nodepool-functional-openstack-fedora-30-src description: | Test building and booting a Fedora 30 image with Nodepool and OpenStack parent: dib-nodepool-functional-src-base vars: nodepool_extra_packages: - rpm - yum-utils nodepool_diskimage: base_element: fedora-minimal release: '30' - job: name: dib-nodepool-functional-openstack-fedora-31-src description: | Test building and booting a Fedora 31 image with Nodepool and OpenStack parent: dib-nodepool-functional-src-base vars: nodepool_extra_packages: - rpm - yum-utils nodepool_diskimage: base_element: fedora-minimal release: '31' - job: name: dib-nodepool-functional-openstack-ubuntu-xenial-src description: | Test building and booting an Ubuntu xenial image with Nodepool and OpenStack parent: dib-nodepool-functional-src-base pre-run: playbooks/dib-nodepool/debootstrap.yaml vars: nodepool_extra_packages: - debootstrap nodepool_diskimage: base_element: ubuntu-minimal release: 'xenial' mirror: "http://{{ zuul_site_mirror_fqdn }}/ubuntu" - job: name: dib-nodepool-functional-openstack-ubuntu-bionic description: | Test building and booting an Ubuntu bionic image with Nodepool and OpenStack (using released libraries) parent: nodepool-functional-openstack-base pre-run: playbooks/dib-nodepool/debootstrap.yaml vars: nodepool_debug: true nodepool_extra_packages: - debootstrap nodepool_diskimage: base_element: ubuntu-minimal release: 'bionic' mirror: "http://{{ zuul_site_mirror_fqdn }}/ubuntu" - job: name: dib-nodepool-functional-openstack-ubuntu-bionic-src description: | Test building and booting an Ubuntu bionic image with Nodepool and OpenStack parent: dib-nodepool-functional-src-base pre-run: playbooks/dib-nodepool/debootstrap.yaml vars: nodepool_extra_packages: - debootstrap nodepool_diskimage: base_element: ubuntu-minimal release: 'bionic' mirror: "http://{{ zuul_site_mirror_fqdn }}/ubuntu" - job: name: dib-nodepool-functional-openstack-gentoo-src description: | Test building and booting a Gentoo image with Nodepool and OpenStack parent: dib-nodepool-functional-src-base vars: nodepool_diskimage: base_element: gentoo release: '' env-vars: GENTOO_PROFILE: 'default/linux/amd64/17.1/systemd' - job: name: dib-nodepool-functional-openstack-debian-stretch-src description: | Test building and booting a Debian stretch image with Nodepool and OpenStack parent: dib-nodepool-functional-src-base pre-run: playbooks/dib-nodepool/debootstrap.yaml vars: nodepool_extra_packages: - debootstrap nodepool_diskimage: base_element: debian-minimal release: 'stretch' mirror: "http://{{ zuul_site_mirror_fqdn }}/debian" - job: name: dib-nodepool-functional-openstack-debian-buster-src description: | Test building and booting a Debian buster image with Nodepool and OpenStack parent: dib-nodepool-functional-src-base pre-run: playbooks/dib-nodepool/debootstrap.yaml vars: nodepool_extra_packages: - debootstrap nodepool_diskimage: base_element: debian-minimal release: 'buster' mirror: "http://{{ zuul_site_mirror_fqdn }}/debian" - job: name: dib-nodepool-functional-openstack-opensuse-15-src description: | Test building and booting an openSUSE 15.x image with Nodepool and OpenStack parent: dib-nodepool-functional-src-base nodeset: ubuntu-xenial # Bionic lacks zypper vars: nodepool_extra_packages: - zypper - gnupg2 nodepool_diskimage: base_element: opensuse-minimal release: '15.1' mirror: "http://{{ zuul_site_mirror_fqdn }}/opensuse" - job: name: dib-nodepool-functional-openstack-opensuse-tumbleweed-src description: | Test building and booting an openSUSE tumbleweed image with Nodepool and OpenStack parent: dib-nodepool-functional-src-base nodeset: ubuntu-xenial # Bionic lacks zypper vars: nodepool_extra_packages: - zypper - gnupg2 nodepool_diskimage: base_element: opensuse-minimal release: 'tumbleweed' diskimage-builder-2.35.0/.zuul.d/project.yaml0000664000175000017500000000612413640271474021050 0ustar zuulzuul00000000000000- project: templates: - openstack-cover-jobs - check-requirements - openstack-lower-constraints-jobs - openstack-python-jobs - openstack-python35-jobs - release-notes-jobs - tripleo-buildimage-jobs check: jobs: - openstack-tox-pylint - dib-nodepool-functional-openstack-centos-7-src - dib-nodepool-functional-openstack-centos-8-src - dib-nodepool-functional-openstack-fedora-31-src - dib-nodepool-functional-openstack-ubuntu-xenial-src - dib-nodepool-functional-openstack-ubuntu-bionic - dib-nodepool-functional-openstack-ubuntu-bionic-src - dib-functests-centos7-python2 - dib-functests-centos7-python2-image - dib-functests-centos7-python2-extras - dib-functests-xenial-python3 - dib-functests-xenial-python3-image - dib-functests-xenial-python3-extras - dib-functests-xenial-python3-containers - dib-functests-bionic-python3 - dib-functests-bionic-python3-image - dib-functests-bionic-python3-extras - dib-functests-bionic-python3-containers # IPA jobs that build an image without further validations. # TODO(dtantsur): make the centos8 job voting once things stabilize - ironic-python-agent-check-image-dib-centos8: voting: false # NOTE(dtantsur): this can be removed when DIB drops CentOS 7 # compatibility, but is useful for now since CentOS 7 is used in # ironic Train CI. - ironic-python-agent-check-image-dib-centos7: voting: false # IPA jobs that build AND validate an image via deployment (two ways). - ipa-tempest-wholedisk-bios-ipmi-direct-dib-src: voting: false - ipa-tempest-partition-bios-ipmi-iscsi-dib-src: voting: false check-arm64: jobs: - dib-functests-arm64-bionic gate: jobs: - openstack-tox-pylint - dib-nodepool-functional-openstack-centos-7-src - dib-nodepool-functional-openstack-centos-8-src - dib-nodepool-functional-openstack-fedora-31-src - dib-nodepool-functional-openstack-ubuntu-xenial-src - dib-nodepool-functional-openstack-ubuntu-bionic - dib-nodepool-functional-openstack-ubuntu-bionic-src - dib-functests-xenial-python3 - dib-functests-centos7-python2 experimental: jobs: - dib-nodepool-functional-openstack-gentoo-src - dib-nodepool-functional-openstack-debian-stretch-src - dib-nodepool-functional-openstack-debian-buster-src # NOTE(ianw): 2019-12-10 : this can not build on bionic due to # no zypper; but devstack has dropped Xenial support so can't # build there either. Because devstack install in pre, it # causes multiple retries in zuul, so can't be non-voting. # Paused until we figure out what to do. - dib-nodepool-functional-openstack-opensuse-15-src - dib-nodepool-functional-openstack-opensuse-tumbleweed-src - octavia-v1-dsvm-scenario - octavia-v1-dsvm-py3x-scenario diskimage-builder-2.35.0/bindep.txt0000664000175000017500000000204113640271474017213 0ustar zuulzuul00000000000000# This is a cross-platform list tracking distribution packages needed by tests; # see https://docs.openstack.org/infra/bindep/ for additional information. # common bzip2 util-linux dosfstools gdisk kpartx sudo curl git squashfs-tools [!platform:suse] squashfs [platform:suse] zypper [!platform:debian-stretch !platform:redhat !platform:ubuntu-trusty !platform:ubuntu-bionic] gnupg2 [!platform:redhat !platform:ubuntu-trusty !platform:suse] # ubuntu apt-transport-https [platform:dpkg] inetutils-ping [platform:dpkg] python-lzma [platform:dpkg] qemu-utils [platform:dpkg] rpm [platform:dpkg] uuid-runtime [platform:dpkg] yum-utils [platform:dpkg] debootstrap [platform:dpkg] procps [platform:dpkg] # centos/fedora qemu-img [platform:redhat] policycoreutils-python [platform:rhel-7 platform:centos-7] policycoreutils-python-utils [platform:fedora platform:rhel-8 platform:centos-8] procps-ng [platform:redhat] # suse python-pyliblzma [platform:suse] yum-utils [platform:suse] qemu-tools [platform:suse] debootstrap [platform:suse] procps [platform:suse] diskimage-builder-2.35.0/.testr.conf0000664000175000017500000000062413640271474017304 0ustar zuulzuul00000000000000[DEFAULT] test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \ OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ OS_DEBUG=${OS_DEBUG:-1} \ ${PYTHON:-python} -m subunit.run discover . $LISTOPT $IDOPTION test_id_option=--load-list $IDFILE test_list_option=--list diskimage-builder-2.35.0/README.rst0000664000175000017500000000361613640271474016711 0ustar zuulzuul00000000000000Image building tools for OpenStack ================================== ``diskimage-builder`` is a flexible suite of components for building a wide-range of disk images, filesystem images and ramdisk images for use with OpenStack. This repository has the core functionality for building such images, both virtual and bare metal. Images are composed using `elements`; while fundamental elements are provided here, individual projects have the flexibility to customise the image build with their own elements. For example:: $ DIB_RELEASE=trusty disk-image-create -o ubuntu-trusty.qcow2 vm ubuntu will create a bootable Ubuntu Trusty based ``qcow2`` image. ``diskimage-builder`` is useful to anyone looking to produce customised images for deployment into clouds. These tools are the components of `TripleO `__ that are responsible for building disk images. They are also used extensively to build images for testing OpenStack itself, particularly with `nodepool `__. Platforms supported include Ubuntu, CentOS, RHEL and Fedora. Full documentation, the source of which is in ``doc/source/``, is published at: * https://docs.openstack.org/diskimage-builder/latest/ Copyright ========= Copyright 2012 Hewlett-Packard Development Company, L.P. Copyright (c) 2012 NTT DOCOMO, INC. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diskimage-builder-2.35.0/babel.cfg0000664000175000017500000000002013640271474016732 0ustar zuulzuul00000000000000[python: **.py] diskimage-builder-2.35.0/setup.cfg0000664000175000017500000000432513640271564017041 0ustar zuulzuul00000000000000[metadata] name = diskimage-builder summary = Golden Disk Image builder. description-file = README.rst author = OpenStack author-email = openstack-discuss@lists.openstack.org license = Apache License (2.0) home-page = https://docs.openstack.org/diskimage-builder/latest/ classifier = Development Status :: 5 - Production/Stable License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Environment :: Console [build_sphinx] all_files = 1 build-dir = doc/build source-dir = doc/source warning-is-error = 1 [pbr] autodoc_index_modules = 1 autodoc_exclude_modules = setup.py diskimage_builder.tests.* diskimage_builder.block_device.tests.* diskimage_builder.elements.* diskimage_builder.lib.* [files] packages = diskimage_builder scripts = bin/dib-lint data_files = share/diskimage-builder/scripts = scripts/* [extract_messages] keywords = _ gettext ngettext l_ lazy_gettext mapping_file = babel.cfg output_file = diskimage_builder/locale/diskimage_builder.pot [update_catalog] domain = diskimage_builder output_dir = diskimage_builder/locale input_file = diskimage_builder/locale/diskimage_builder.pot [compile_catalog] directory = diskimage_builder/locale domain = diskimage_builder [wheel] universal = 1 [entry_points] console_scripts = element-info = diskimage_builder.element_dependencies:main dib-block-device = diskimage_builder.block_device.cmd:main disk-image-create = diskimage_builder.disk_image_create:main ramdisk-image-create = diskimage_builder.disk_image_create:main diskimage_builder.block_device.plugin = local_loop = diskimage_builder.block_device.level0.localloop:LocalLoop partitioning = diskimage_builder.block_device.level1.partitioning:Partitioning lvm = diskimage_builder.block_device.level1.lvm:LVMPlugin mkfs = diskimage_builder.block_device.level2.mkfs:Mkfs mount = diskimage_builder.block_device.level3.mount:Mount fstab = diskimage_builder.block_device.level4.fstab:Fstab diskimage_builder.block_device.plugin_test = test_a = diskimage_builder.block_device.tests.plugin.test_a:TestA test_b = diskimage_builder.block_device.tests.plugin.test_b:TestB [egg_info] tag_build = tag_date = 0 diskimage-builder-2.35.0/playbooks/0000775000175000017500000000000013640271564017217 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/playbooks/dib-nodepool/0000775000175000017500000000000013640271564021572 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/playbooks/dib-nodepool/debootstrap.yaml0000664000175000017500000000043213640271474025003 0ustar zuulzuul00000000000000- hosts: all tasks: # We need a fixed debootstrap # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901977 - name: Install updated debootstrap repo become: true shell: | add-apt-repository ppa:openstack-ci-core/debootstrap apt-get update diskimage-builder-2.35.0/playbooks/dib-functests/0000775000175000017500000000000013640271564021771 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/playbooks/dib-functests/run.yaml0000664000175000017500000000016613640271474023464 0ustar zuulzuul00000000000000- hosts: all name: Run dib functional tests roles: - bindep - dib-setup-gate-mirrors - dib-functests diskimage-builder-2.35.0/playbooks/dib-functests/post.yaml0000664000175000017500000000057113640271474023645 0ustar zuulzuul00000000000000- hosts: all tasks: - name: Check logs directory exists stat: path='{{ ansible_user_dir }}/logs/' register: check_path - name: Copy log files from {{ ansible_user_dir }} on node synchronize: src: '{{ ansible_user_dir }}/logs/' dest: '{{ zuul.executor.log_root }}/logs' mode: pull when: check_path.stat.exists == true diskimage-builder-2.35.0/tests/0000775000175000017500000000000013640271564016356 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/tests/run_functests.sh0000775000175000017500000003127413640271474021626 0ustar zuulzuul00000000000000#!/bin/bash set -eu set -o pipefail BASE_DIR=$(cd $(dirname "$0")/.. && pwd) # then execute tests for elements export DIB_CMD="disk-image-create" export DIB_ELEMENTS=$(python -c ' import diskimage_builder.paths diskimage_builder.paths.show_path("elements")') # Setup sane locale defaults, because this information is leaked into DIB. export LANG=en_US.utf8 export LC_ALL= # # Default skip tests # # For time reasons, we do not run these tests by default; i.e. these # tests are not run by "tox -e func" in the gate. # DEFAULT_SKIP_TESTS=( ## These are part of the "extras-nv" job # These require "zypper" on the host which is not available on # all platforms opensuse-minimal/build-succeeds opensuse-minimal/opensuse15-build-succeeds # non-voting; not used by infra currently gentoo/build-succeeds # Needs infra mirroring to move to voting job debian-minimal/stable-build-succeeds debian-minimal/stable-vm ## # These download base images which has shown to be very unreliable # in the gate. Keep them in a -nv job until we can figure out # better caching for the images opensuse/build-succeeds opensuse/opensuse15-build-succeeds centos7/build-succeeds debian/build-succeeds fedora/build-succeeds ubuntu/trusty-build-succeeds ubuntu/xenial-build-succeeds ubuntu/bionic-build-succeeds # No longer reasonable to test upstream (lacks a mirror in infra) # Note this is centos6 and should probably be removed centos/build-succeeds # This job is a bit unreliable, even if we get mirroring debian-minimal/testing-build-succeeds # Replaced by bionic ubuntu-minimal/trusty-build-succeeds ) # The default output formats (specified to disk-image-create's "-t" # command. Elements can override with a test-output-formats file DEFAULT_OUTPUT_FORMATS="tar" function log_with_prefix { local pr=$1 local log while read a; do log="[$pr] $a" # note: dib logs have timestamp by default now echo "${log}" done } # Log job control messages function log_jc { local msg="$1" local log="[JOB-CONTROL] ${msg}" if [[ ${LOG_DATESTAMP} -ne 0 ]]; then log="$(date +"%Y%m%d-%H%M%S.%N") ${log}" fi echo "${log}" } function job_cnt { running_jobs=$(jobs -p) echo ${running_jobs} | wc -w } # This is needed, because the better 'wait -n' is # available since bash 4.3 only. function wait_minus_n { if [ "${BASH_VERSINFO[0]}" -gt 4 \ -o "${BASH_VERSINFO[0]}" = 4 \ -a "${BASH_VERSINFO[1]}" -ge 3 ]; then # Good way: wait on any job wait -n return $? else # Not that good way: wait on one specific job # (others may be finished in the mean time) local wait_for_pid=$(jobs -p | head -1) wait ${wait_for_pid} return $? fi } # This takes the status and the "$logfile" argument passed to # disk-image-create and renames the file, so you can quickly see # in results which tests have failed. function logfile_status { local status="$1" local arg="$2" local filename if [[ -z "${arg// }" ]]; then return fi filename="$(echo $arg | cut -f2 -d' ')" echo "Moving ${filename} to ${filename/.log/.$status.log}" mv "$filename" ${filename/.log/.$status.log} } # run_disk_element_test # Run a disk-image-build build of ELEMENT including any elements # specified by TEST_ELEMENT. Pass OUTPUT_FORMAT to "-t" function run_disk_element_test() { local test_element=$1 local element=$2 local dont_use_tmp=$3 local output_format="$4" local logfile="$5" local use_tmp_flag="" local dest_dir=$(mktemp -d) if [[ ${KEEP_OUTPUT} -ne 1 ]]; then trap "rm -rf $dest_dir" EXIT fi if [ "${dont_use_tmp}" = "yes" ]; then use_tmp_flag="--no-tmpfs" fi if break="after-error" break_outside_target=1 \ break_cmd="cp -v \$TMP_MOUNT_PATH/tmp/dib-test-should-fail ${dest_dir} || true" \ DIB_SHOW_IMAGE_USAGE=1 \ ELEMENTS_PATH=$DIB_ELEMENTS/$element/test-elements \ $DIB_CMD -x -t ${output_format} \ ${use_tmp_flag} \ ${logfile} \ -o $dest_dir/image -n $element $test_element 2>&1 \ | log_with_prefix "${element}/${test_element}"; then if [[ "qcow2" =~ "$output_format" ]]; then if ! [ -f "$dest_dir/image.qcow2" ]; then echo "Error: qcow2 build failed for element: $element, test-element: $test_element." echo "No image $dest_dir/image.qcow2 found!" logfile_status "FAIL" "${logfile}" exit 1 fi fi # check inside the tar for sentinel files if ! [ -f "$dest_dir/image.tar" ]; then echo "Error: Build failed for element: $element, test-element: $test_element." echo "No image $dest_dir/image.tar found!" logfile_status "FAIL" "${logfile}" exit 1 else if tar -tf $dest_dir/image.tar | grep -q /tmp/dib-test-should-fail; then echo "Error: Element: $element, test-element $test_element should have failed, but passed." logfile_status "FAIL" "${logfile}" exit 1 else echo "PASS: Element $element, test-element: $test_element" logfile_status "PASS" "${logfile}" fi fi else if [ -f "${dest_dir}/dib-test-should-fail" ]; then echo "PASS: Element $element, test-element: $test_element" logfile_status "PASS" "${logfile}" else echo "Error: Build failed for element: $element, test-element: $test_element." logfile_status "FAIL" "${logfile}" exit 1 fi fi rm -f /tmp/dib-test-should-fail if [[ ${KEEP_OUTPUT} -ne 1 ]]; then # reset trap and cleanup trap EXIT rm -rf $dest_dir fi } # run_ramdisk_element_test # Run a disk-image-builder default build of ELEMENT including any # elements specified by TEST_ELEMENT function run_ramdisk_element_test() { local test_element=$1 local element=$2 local dont_use_tmp=$3 local output_format="$4" # ignored here local logfile="$5" local dest_dir=$(mktemp -d) local use_tmp_flag="" if [ "${dont_use_tmp}" = "yes" ]; then use_tmp_flag="--no-tmpfs" fi if ELEMENTS_PATH=$DIB_ELEMENTS/$element/test-elements \ $DIB_CMD -x -o ${dest_dir}/image \ ${logfile} \ ${use_tmp_flag} \ ${element} ${test_element} 2>&1 \ | log_with_prefix "${element}/${test_element}"; then # TODO(dtantsur): test also kernel presence once we sort out its naming # problem (vmlinuz vs kernel) if ! [ -f "$dest_dir/image.initramfs" ]; then echo "Error: Build failed for element: $element, test-element: $test_element." echo "No image $dest_dir/image.initramfs found!" logfile_status "FAIL" "${logfile}" exit 1 else echo "PASS: Element $element, test-element: $test_element" logfile_status "PASS" "${logfile}" fi else echo "Error: Build failed for element: $element, test-element: $test_element." logfile_status "FAIL" "${logfile}" exit 1 fi } # # run_functests.sh # run the functional tests for dib elements # # find elements that have functional test elements. TESTS will be an # array with each value being "element/test-element" TESTS=() for e in $DIB_ELEMENTS/*/test-elements/*; do test_element=$(echo $e | awk 'BEGIN {FS="/"}{print $NF}') element=$(echo $e | awk 'BEGIN {FS="/"}{print $(NF-2)}') TESTS+=("$element/$test_element") done # # Default values # JOB_MAX_CNT=1 LOG_DATESTAMP=0 KEEP_OUTPUT=0 LOG_DIRECTORY='' # # Parse args # while getopts ":hlj:tL:" opt; do case $opt in h) echo "run_functests.sh [-h] [-l] ..." echo " -h : show this help" echo " -l : list available tests" echo " -j : parallel job count (default to 1)" echo " -t : prefix log messages with timestamp" echo " -k : keep output directories" echo " -L : output logs into this directory" echo " : functional test to run" echo " Special test 'all' will run all tests" exit 0 ;; l) echo "The available functional tests are:" echo for t in ${TESTS[@]}; do echo -n " $t" if [[ " ${DEFAULT_SKIP_TESTS[@]} " =~ " ${t} " ]]; then echo " [skip]" else echo " [run]" fi done echo exit 0 ;; j) JOB_MAX_CNT=${OPTARG} echo "Running parallel - using [${JOB_MAX_CNT}] jobs" ;; t) LOG_DATESTAMP=1 ;; k) KEEP_OUTPUT=1 ;; L) LOG_DIRECTORY=${OPTARG} ;; \?) echo "Invalid option: -$OPTARG" exit 1 ;; esac done shift $((OPTIND-1)) DONT_USE_TMP="no" if [ "${JOB_MAX_CNT}" -gt 1 ]; then # switch off using tmp dir for image building # (The mem check using the tmp dir is currently done # based on the available memory - and not on the free. # See #1618124 for more details) DONT_USE_TMP="yes" fi # cull the list of tests to run into TESTS_TO_RUN TESTS_TO_RUN=() title="" if [[ -z "$@" ]]; then # remove the skipped tests title="Running default tests:" for test in "${TESTS[@]}"; do if [[ " ${DEFAULT_SKIP_TESTS[@]} " =~ " ${test} " ]]; then continue else TESTS_TO_RUN+=("${test}") fi done elif [[ $1 == "all" ]]; then title="Running all tests:" TESTS_TO_RUN=("${TESTS[@]}") else title="Running specified tests:" for test in $@; do if [[ ! " ${TESTS[@]} " =~ " ${test} " ]]; then echo "${test} : not a known test (see -l)" exit 1 fi TESTS_TO_RUN+=("${test}") done fi if [[ -n "${LOG_DIRECTORY}" ]]; then mkdir -p "${LOG_DIRECTORY}" export DIB_QUIET=1 fi # print a little status info echo "------" echo ${title} for test in "${TESTS_TO_RUN[@]}"; do echo " ${test}" done echo "------" function wait_and_exit_on_failure { local pid=$1 wait ${pid} result=$? if [ "${result}" -ne 0 ]; then exit ${result} fi return 0 } EXIT_CODE=0 for test in "${TESTS_TO_RUN[@]}"; do running_jobs_cnt=$(job_cnt) log_jc "Number of running jobs [${running_jobs_cnt}] max jobs [${JOB_MAX_CNT}]" if [ "${running_jobs_cnt}" -ge "${JOB_MAX_CNT}" ]; then log_jc "Waiting for job to finish" wait_minus_n result=$? if [ "${result}" -ne 0 ]; then EXIT_CODE=1 # If a job fails, do not start any new ones. break fi fi log_jc "Starting new job" # from above; each array value is element/test_element. split it # back up element=${test%/*} test_element=${test#*/} element_dir=$DIB_ELEMENTS/${element}/test-elements/${test_element}/ # tests default to disk-based, but "element-type" can optionally # override that element_type=disk element_type_override=${element_dir}/element-type if [ -f ${element_type_override} ]; then element_type=$(cat ${element_type_override}) fi # override the output format if specified element_output=${DEFAULT_OUTPUT_FORMATS} element_output_override=${element_dir}/test-output-formats if [ -f $element_output_override ]; then element_output=$(cat ${element_output_override}) fi log_argument=' ' if [[ -n "${LOG_DIRECTORY}" ]]; then log_argument="--logfile ${LOG_DIRECTORY}/${element}_${test_element}.log" fi echo "Running $test ($element_type)" run_${element_type}_element_test \ $test_element $element \ ${DONT_USE_TMP} "${element_output}" "$log_argument" & done # Wait for the rest of the jobs while true; do running_jobs_cnt=$(job_cnt) log_jc "Number of running jobs left [${running_jobs_cnt}]" if [ "${running_jobs_cnt}" -eq 0 ]; then break; fi wait_minus_n result=$? if [ "${result}" -ne 0 ]; then EXIT_CODE=1 fi done if [ "${EXIT_CODE}" -eq 0 ]; then echo "Tests passed!" exit 0 else echo "At least one test failed" exit 1 fi diskimage-builder-2.35.0/tests/run_output_format_test.sh0000775000175000017500000000403013640271474023545 0ustar zuulzuul00000000000000#!/bin/bash set -eu set -o pipefail # # run_output_format_test.sh # # Use docker to test generation of various output formats. # BASE_DIR=$(cd $(dirname "$0")/.. && pwd) export DIB_ELEMENTS=$BASE_DIR/elements export TEST_ELEMENTS=$BASE_DIR/tests/elements export DIB_CMD=$BASE_DIR/bin/disk-image-create function build_test_image() { format=${1:-} if [ -n "$format" ]; then type_arg="-t $format" else type_arg= format="qcow2" fi dest_dir=$(mktemp -d) base_dest=$(basename $dest_dir) trap "rm -rf $dest_dir; sudo docker rmi $base_dest/image" EXIT ELEMENTS_PATH=$DIB_ELEMENTS:$TEST_ELEMENTS \ $DIB_CMD -x $type_arg --docker-target=$base_dest/image \ -o $dest_dir/image -n fake-os format=$(echo $format | tr ',' ' ') for format in $format; do if [ $format != 'docker' ]; then img_path="$dest_dir/image.$format" if ! [ -f "$img_path" ]; then echo "Error: No image with name $img_path found!" exit 1 else echo "Found image $img_path." fi else if ! sudo docker images | grep $base_dest/image ; then echo "Error: No docker image with name $base_dest/image found!" exit 1 else echo "Found docker image $base_dest/image" fi fi done trap EXIT rm -rf $dest_dir if sudo docker images | grep $base_dest/image ; then sudo docker rmi $base_dest/image fi } test_formats="tar tgz squashfs raw qcow2 docker aci" for binary in qemu-img docker mksquashfs; do if [ -z "$(type $binary)" ]; then echo "Warning: No $binary binary found, cowardly refusing to run tests." exit 1 fi done for format in '' $test_formats; do build_test_image $format echo "Test passed for output formats '$format'." done combined_format=$(echo $test_formats | tr ' ' ',') build_test_image $combined_format echo "Test passed for output format '$combined_format'." diskimage-builder-2.35.0/tests/run_dib_library_tests.sh0000775000175000017500000000257513640271474023316 0ustar zuulzuul00000000000000#!/bin/bash # unit testing for some of the common-functions # # This is fairly invasive and *may* leave behind mounts, etc, that # need a human in the loop. Thus it's mostly useful for developers # during testing, but not so great for CI source ../diskimage_builder/lib/common-functions # # Directory mounting and unmounting # # make mount points TMP_DIR=$(mktemp -d) cd $TMP_DIR mkdir mnt mkdir mnt/proc mnt/dev mnt/dev/pts mnt/sysfs mnt/sys # for extra complexity, simulate the path being behind a symlink ln -s mnt mnt-symlink TMP_MOUNT_PATH=$TMP_DIR/mnt-symlink # mount devices mount_proc_dev_sys if [ $(grep "$TMP_DIR" /proc/mounts | wc -l) -ne 4 ]; then echo "*** FAILED to mount all directories" # we might be in an unclean state here, but something is broken... # we don't want to delete mounted system directories return 1 else echo "*** PASS : mounted all directories" fi # umount devices unmount_dir $TMP_MOUNT_PATH if grep -q "$TMP_DIR" /proc/mounts; then echo "*** FAILED due to mounts being left behind" return 1 else echo "*** PASS all directories unmounted" fi # unmount missing dir if unmount_dir /this/path/does/not/exist/but/this/should/not/fail; then echo "*** PASS unmount_dir ignored a missing path" else echo "*** FAILED unmount_dir should ignore missing paths" return 1 fi # cleanup rm -rf $TMP_DIR ### TODO more tests here diskimage-builder-2.35.0/tests/README.rst0000664000175000017500000000052413640271474020046 0ustar zuulzuul00000000000000DIB Testing =========== There are several interfaces for testing various parts of DIB * run_dib_library_tests.sh : run unit-tests for internal diskimage-builder library functions * run_functests.sh : run functional testing provided by elements * run_output_format_test.sh : run a test of image conversion (requires docker) diskimage-builder-2.35.0/tests/install_test_deps.sh0000775000175000017500000000102613640271474022434 0ustar zuulzuul00000000000000#!/bin/bash set -eux set -o pipefail sudo apt-get update || true sudo apt-get install -y --force-yes \ docker.io || \ sudo yum -y install --enablerepo=epel \ debootstrap \ dpkg \ docker || \ sudo zypper -n install \ docker || \ sudo emerge \ app-arch/bzip2 \ app-emulation/qemu \ dev-python/pyyaml \ sys-block/parted \ sys-apps/gptfdisk \ sys-fs/multipath-tools \ sys-fs/dosfstools \ qemu-img \ yum-utils diskimage-builder-2.35.0/tests/elements/0000775000175000017500000000000013640271564020172 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/tests/elements/fake-os/0000775000175000017500000000000013640271564021517 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/tests/elements/fake-os/README.rst0000664000175000017500000000024013640271474023202 0ustar zuulzuul00000000000000fake-os ======= This is not the element you are looking for. This element does not provide an operating system, it provides a fake for testing purposes only. diskimage-builder-2.35.0/tests/elements/fake-os/element-provides0000664000175000017500000000002113640271474024715 0ustar zuulzuul00000000000000operating-system diskimage-builder-2.35.0/tests/elements/fake-os/root.d/0000775000175000017500000000000013640271564022724 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/tests/elements/fake-os/root.d/10-fake-os0000775000175000017500000000053213640271474024415 0ustar zuulzuul00000000000000#!/bin/bash set -eux set -o pipefail sudo touch $TARGET_ROOT/fake-os for DIR in etc mnt proc dev sys tmp; do sudo mkdir -p ${TARGET_ROOT}/${DIR} done # We need some size so the mkfs does not fail when making an fs of size 0 # We also need to account for the journal size on the FS dd if=/dev/zero of=$TARGET_ROOT/fake-data bs=1M count=42 diskimage-builder-2.35.0/setup.py0000664000175000017500000000200613640271474016724 0ustar zuulzuul00000000000000# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. # THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT import setuptools # In python < 2.7.4, a lazy loading of package `pbr` will break # setuptools if some other modules registered functions in `atexit`. # solution from: http://bugs.python.org/issue15881#msg170215 try: import multiprocessing # noqa except ImportError: pass setuptools.setup( setup_requires=['pbr>=2.0.0'], pbr=True) diskimage-builder-2.35.0/ChangeLog0000664000175000017500000027134313640271564017000 0ustar zuulzuul00000000000000CHANGES ======= 2.35.0 ------ * Add Fedora 31 support and test jobs * Use rpm -e instead of dnf for cleaning old kernels * Add python-stow-versions element * Add support for build-only packages * bindep: remove lsb-release 2.34.1 ------ * Remove hacking from requirements 2.34.0 ------ * Add ensure-venv element, install glean with it * Remove Fedora 29 job * Do not include efibootmgr and efivars for ppc architectures * Change tgt pkg-map to target-restore CentOS/RHEL-8 * Uncap hacking * Add CentOS 8 support * fix iscsi-boot element exiting build even if dracut-regenerate used * Add efi packages for ironic-agent * Allow python3 to be used in Debian * Fix cache-url -f * Add ironic jobs to the CI * dib-lint: test elements have README.rst file * Enable possibility to select HWE kernel for Ubuntu minimal * Remove trusty jobs 2.33.0 ------ * Fix Yum repositories and GPG keys for CentOS 8.1 * allow building of Gentoo images for non-systemd profiles * modprobe.d: use $TMP\_MOUNT\_PATH * Add arm64 based functional test * Install rng-tools in Red Hat family distro images * Update bindep for RHEL/CentOS 8 2.32.0 ------ * Fix wrong URL in ironic-agent element * Set correct python version for non-chroot scripts * Work around Trusty ext4 metadata\_csum errors on Bionic * Drop Xenial from functional test 2.31.0 ------ * Fix regex for mirror URL substitution * Install ndisc6 package in element script * Make sure DIB\_DEBUG\_TRACE has a default value * Allow zypper repos to be overrideable * Fix login.defs config for tumbleweed * Break retry loop on success in dhcp-all-interfaces 2.30.0 ------ * Stop installing pydistutils.cfg * Update bindep.txt for some missing dependencies * Only wait for checksum processes * Introduce manual setting of DIB\_INIT\_SYSTEM * Add output for mis-configured element scripts * Add grub-efi-x86\_64 pkg-map * Add IPv6 support in dhcp-all-interfaces * Remove unused job * Adds support for GPG keyring * vhd-util : note on Xen/RAX images 2.29.1 ------ * Revert "Drop vhdutil dependency, use qemu-img" 2.29.0 ------ * Revert "Pause Fedora jobs" * Deprecates the existing "ironic-agent" element in DIB * pip-and-virtualenv: include python3-venv for Debuntu * Ensure nouveau is blacklisted in initramfs too * Pause Fedora jobs * Fix syntax error in selinux-fixfiles-restore * Drop vhdutil dependency, use qemu-img * Add security suite name override in debian-minimal 2.28.2 ------ 2.28.1 ------ * centos7; use numeric DIB\_RELEASE * Temporarily disable Fedora 30 build jobs * Remove RA solicit delay * Blacklist sphinx 2.1.0 (autodoc bug) 2.28.0 ------ * CentOS 8 minimal testing and support * Add NetworkManager and dhcp-client for CentOS 8 * Fix networking for CentOS 8 * simple-init: Use wrappers to call pip for glean install * simple-init: default to NetworkManager for CentOS and Fedora * bootloader: make serial console configurable * Add security mirror override for debian-minimal * pip-and-virtualenv : deprecate source for CentOS 8, new variables * yum-minimal: Don't install yum, install libcurl * Use $YUM instead of direct calls in more places * Add environment switch for centos8 to use dnf * Update redhat-common pkg-map for centos 8 * Update locales for Centos 8 * dib-python : handle centos 8 * yum-minimal : update mirrors for Centos 8 * Remove "failovermethod=priority" for Fedora (dnf) 2.27.2 ------ * Install Python 3 libselinux packages for Fedora * Ensure machine-id is not included in images * Update gentoo test to current system profile 2.27.1 ------ * Revert "Fixed use of flake8" * Only install doc requirements if needed * Use x86 architeture specific grub2 packages for RHEL * Move doc related modules to doc/requirements.txt 2.27.0 ------ * Add fedora-30 testing to gate * Uninstall linux-firmware and linux-firmware-whence * Fixed use of flake8 * Rename openSUSE 15.1 testing to 15 * Allow configurable gzip binary name * Do not delete cracklib from /usr/share * Fedora 30 functional and boot tests 2.26.1 ------ * zypper-minimal: Don't get confused by etc/resolv.conf symlink 2.26.0 ------ * simple-init: add configurable RA timeout with network-manager * update gentoo systemd profile to 17.1 from 17.0 * rpm-distro: ensure we selinux relabel underlying directories * Allow extra repositories to be added to images * yum-minimal: install fedora-release-cloud * block-device-efi : expand disk size calculation * Don't show all elements found * dracut-regenerate: catch failures and exit code * Fixes packages for arm64 bootloader * Fixes DIB\_DISTRIBUTION\_MIRROR\_UBUNTU\_IGNORE matching when empty * Fix the pypi element for multiple mirror URLs * Stop regex warning * Create /etc/machine-id for RHEL images * fix comments / spelling errors in gentoo element * support alternate portage directories * journal-to-console: element to send systemd journal to console * Enable nodepool debugging for functional tests * update version of open-iscsi that is installed on musl * Add a nodepool job based on releases 2.25.0 ------ * Only enable dbus-daemon on fedora-29 * Set router solicitation delay with using NM * [RHEL-8] Set \_clear\_old\_files=0 in install-pip element * disable autounmask for emerge * ironic-agent: Use targetcli & python3-devel on rhel8 * Mailing lists change openstack-dev to openstack-discuss * install gnupg2 by default in debian-minimal * set default sources conf for buster as it now has a release * Cleanup: remove useless statement * Enable nodepool testing for opensuse 15.1 * Replace nodepool func jobs * Move existing Zuul project config to projects.yaml * Move Zuul config in-repo * Add DIB\_UBUNTU\_KERNEL to ubuntu-minimal * Sync Sphinx requirement 2.24.0 ------ * Update test coverage for openSUSE/-minimal to 15.1 * Remove the rhel 8 check for xfs * debootstrap: make default network interface names configurable * Move pypi to dib-python * ironic-agent: install mdadm on the ramdisk * Use architecture-specific grub2 RPMs on RHEL8 * Increase size of EFI system partition (again) * bindep: exclude zypper from debian-stretch * Makes image caching more resilient * fail early when lates build information can not be fetched * Deprecate rhel7 in favor of rhel * Add version-less RHEL element for RHEL7 and RHEL8 * allow the use of non-bzip compressed stages for building gentoo * Replace git.openstack.org URLs with opendev.org URLs 2.23.0 ------ * Use megabyte granularity for image extra space * bindep: add sudo * Update test coverage for openSUSE/-minimal to 15.0 * Use fedora-release-common for fedora 30+ 2.22.0 ------ * Only enable dbus-daemon for fedora-29 and below * Switch simple-init to support python3 * openssh-server: harden sshd config * Fix broken requirements url * Support defining the free space in the image * Replace git.openstack.org URLs with opendev.org URLs * Allow specification of filesystem journal size * Document the various global filesystem options * Update to https:// version of \*openstack.org urls * OpenDev Migration Patch * Constraint networkx to <2.3 for Python 2 * Fix Fedora aarch64 image location * debian-minimal buster support * Also use selinuxenabled to check selinux status 2.21.0 ------ * Replace openstack.org git:// URLs with https:// * Replace openstack.org git:// URLs with https:// * Minor clarifications in centos7 element docs * Unmount internal mounts on finalise errors * Add DIB\_APT\_MINIMAL\_CREATE\_INTERFACES toggle * [lvm] Add Ubuntu bionic as supported distro 2.20.3 ------ * Update gentoo-releng gpg key 2.20.2 ------ * Add option to skip update packages * Fix opensuse 42.3 pip-and-virtualenv * Keep git after ironic-agent post * set rhel minor release 2.20.1 ------ * pip-and-virtualenv: handle centos image-based builds 2.20.0 ------ * pip-and-virtualenv : only remove system files on centos * Enable dbus-broker for Fedora 29 * fix systemd import-tar for gentoo * Add python3-setuptools to bindep.txt for Fedora * support cracklib in pam for Gentoo's musl profile * Make sure $TMP\_BUILD\_DIR/mnt is owned by root * [Configuration] Add missing py37 and corrected default envlist * [Core] Change openstack-dev to openstack-discuss 2.19.0 ------ * change to python36 for gentoo * update spelling errors * source-repositories: Replace documentation http with https links * Delete the duplicate words in 50-zipl * Change phase to check for dracut-regenerate in iscsi-boot * Add policycoreutils-python-utils to bindep * Use template for lower-constraints * simple-init: allow for NetworkManager support * package-installs: provide for skip from env var * Revert "Make tripleo-buildimage-overcloud-full-centos-7 non-voting" * Fix unit tests for elements * Capture ramdisk test run logs * Make tripleo-buildimage-overcloud-full-centos-7 non-voting * Only cap pylint for python2 * Fix a typo in the help message of disk-image-create * Add missing ws separator between words * Add an element to configure iBFT network interfaces * move selinux-permissive configure to pre-install phase * Update to Fedora 29 * fix some errors for ill-syntax in README.rst * delete the duplicate words in package-outside-debootstrap-ac93e9ce991819f1.yaml * Increase size of EFI system partition 2.18.0 ------ * Add systemd-containers functional tests * Add ubuntu-systemd-container operating-system element * Remove python3 legacy jobs * Remove legacy playbooks * Native zuulv3 tests * Move several packages to bindep.txt * Turn on quiet mode when logfile specified * Fix epel repo rewrite, add to testing * Add a post-root.d phase * Fix DIB\_DISTRIBUTION\_MIRROR\_UBUNTU\_IGNORE regex typo * Add support for Fedora 28, remove EOL Fedora 26 * Set EPEL mirror during openstack-ci-mirrors * ubuntu: Add options to ignore mirror components and use insecure repos * simplify overlay logic for Gentoo * simplify python3.6 selection on gentoo * Turn down pkg-map and hook copy tracing output * enable caching for gentoo builds * Add a pre-finalise.d phase * Minor documentation updates * Allow debootstrap to cleanup without a kernel * fix a typo * Fail build due to missing kauditd only when SELinux is enabled * Fix DIB ubuntu-minimal running on bionic (18.04) * ubuntu-common: Update default DIB\_RELEASE to bionic * Remove redundant sources change/update * Move common ubuntu environment setting to ubuntu-common element 2.17.0 ------ * Only append DIB\_BOOTLOADER\_DEFAULT\_CMDLINE to default grub entry * Fix CentOS image build failure when dib runs on system where audit disabled * Fix bootloader packages for aarch64 * Replace assertRaisesRegexp with assertRaisesRegex * Remove unsued opensuse jobs * Remove legacy-opensuse-423 nodeset * Install ca-certificate with redhat-common * Add netcat to redhat-common map-packages * Fix typo in installation.rst * Only detach device if all partitions have been cleaned * Move LVM cleanup phase into cleanup * Add DIB element to blacklist nouveau * modprobe DIB\_MODPROBE\_BLACKLIST should be optional * cache-url requires curl 2.16.0 ------ * Update pylint to 1.7.6, uncap networkx * Fix for proper LVM support * Update developing\_elements * Add expected semicolons for dhclient.conf * fix tox python3 overrides * Add keyring if supplied * Call kpartx remove in umount, not cleanup * Move localloop to exec\_sudo * Add new modprobe element * block-device lvm: fix umount phase * Don't quote names with sgdisk * better handle existing keywords files/directories * Add iscsi-boot element for CentOS images * Remove redundant word * Fix /etc/network/interfaces file contents * Convert labels to upper case * Fix bootloader for efi on rhel systems * Don't run setfiles on /boot/efi * Add iscsi-boot element * Fix bootloader packages for rhel 2.15.1 ------ * elements: pip-and-virtualenv: Handle openSUSE Leap 15 * Added release notes for Change 568697 2.15.0 ------ * Don't install zypper on bionic * Rename output log files * Add log directory option to functional tests * Save and close stdout on exit * Reduce path length in PS4 for debug * Use surrogateescape with outfilter.py * Allow to rebuild arbitrary images * Replace the ubuntu-minimal trusty test with a bionic one * Remove non-maintained ubuntu-core element * elements: zypper-minimal: Add support for openSUSE Leap 15.X * Add Ubuntu 18.04 support * IPA requires iptables * Remove duplicate GRUB command line entry * rpm-distro: set the contentdir yum var * Trivial: update url to new url * Fixes add-apt-keys in dpkg element * Add pip cache cleanup to pip-and-virtualenv * Install sudo on Gentoo images by deault * pip-and-virtualenv: fix install-pip when centos-release-openstack is enabled * Stop using slave\_scripts/install-distro-packages.sh 2.14.1 ------ * Fix epel element for centos-minimal 2.14.0 ------ * Revert "debootstrap: Call update-initramfs explicitly" * Remove installed packages before pip install * allow building non-gentoo images on gentoo hosts 2.13.0 ------ * Don't only install python3-virtualenv * Don't use -e to test for what might be broken symlink * add lower-constraints job * Set the dhclient timeout to match DIB\_DHCP\_TIMEOUT * Formalise saving of /etc/resolv.conf * Restore tracing on exit points of block\_device\_create\_config\_file * delete unused module * debootstrap: Call update-initramfs explicitly * Change the GENTOO\_PORTAGE\_CLEANUP variable default * Fix element-provides in debian element * Revert "Remove tripleo jobs" * enable systemd profile for Gentoo * install sudo in the devuser element 2.12.1 ------ * Fix default partition type * Remove tripleo jobs * remove portage git directory 2.12.0 ------ * Updated from global requirements * Updated from global requirements * proliant-tools: add net-tools package to support hpsum utility * Make the build reproducible * Updated from global requirements * secondary architectures use different url * Fix encoding issue during processing output * Fix for rhel7 iso image creation * Fix for passing user defined value for satellite cert for rhel-common * arm64: use HWE kernel and fix console * Choose appropriate bootloader for block-device * Add block-device defaults * Fail if two elements provide the same thing * GPT partitioning support * update Gentoo Hardened profiles (now stable) * Checking link status according to DIB\_DHCP\_TIMEOUT 2.11.0 ------ * Install systemd earlier for Ubuntu Bionic * update gentoo vars for new profile and python * Fix typo doc * Zuul: Remove project name * Remove some redundant indents * Set default label for XFS disks * Don't install dmidecode on Fedora ppc64le * Updated from global requirements * Add support for Fedora 27, remove EOL Fedora 25 * Don't fstrim vfat partitions * Remove RH1 check OVB jobs from configuration * upgrade pip before using -c option * Correct link address * Updated from global requirements * Add SUSE Mapping 2.10.1 ------ * Revert "Dont install python-pip for py3k" 2.10.0 ------ * Adding mapping for SUSE package * Check source-repository-\* files for trailing newline * Update Fedora defaults to 27 * ironic-agent: don't remove make * Remove architecture rules on lshw dependency in ironic-agent * zypper: fix package removal * Avoid tox\_install.sh for constraints support * Fix wrong epel-release-7\* package URL * Add the groundwork for musl profile support * Enable support for Gentoo overlays * Pre-install curl * Install fedora-gpg-keys for F27 * Make preinstall.d more deterministic * Use EPEL for debootstrap on centos * Fix /dev/pts mount options handling * Make python changes more reliable * zuul: add tripleo jobs * Remove setting of version/release from releasenotes * elements: zypper-minimal: Refresh repositories where necessary * Updated from global requirements * elements: Respect devpts mount options * Dont install python-pip for py3k * Enable gentoo in pip-and-virtualenv element * zypper-minimal: Set default locale env to C.UTF-8 * Add zipl element as s390x architecture bootloader * diskimage\_builder: lib: common-functions: Fix options for devpts mount * Zuul: add file extension to playbook path * Move to a common lock-file directory * Create rescue user on ironic agent * Use -t devpts for /dev/pts mounts * Dont install python-virtualenv for py3k in deb * Import legacy playbooks * Add debian minimal requirement for arm64 * Fix grub2 dependency on arm64 * Remove dd from LVM element * Update Gentoo element for element changes * Update proliant-tools to support Gen10 Proliant servers * Move fstrim to block device layer * Add Constraints support 2.9.0 ----- * Revert "Support networkx 2.0" * Support networkx 2.0 * Add initramfs-tools for ubuntu-minimal * Actually sort mount-point list * Change to install a package in 'proliant-tools' * Create /etc/machine-id for fedora * Use latest Fedora .qcow URL * Updated from global requirements * Add missing package dependency for yaml * Mention the need of dracut-regenerate element * Move the ordering of the dracut regenerate command * Remove nested quotes from TAROPTS * Use [[ for =~ matches * Fix cylical systemd config for dhcp-all-interfaces * Updated from global requirements * LVM support for dib-block-device * Increase timeout for removal * Add netbase to ensure /etc/protocols is placed for debian * Add kpartx as a requirement to build images * Clear up debian element documentation * Clear /etc/machine-id to avoid duplicate machine-ids * Bump fedora/fedora-minimal DIB\_RELEASE 26 * Updated from global requirements 2.8.0 ----- * Move selinux packages to redhat-common * Allow users to specify partition type in the MBR PTE 2.7.2 ----- * Use SELinuxfs to check selinux status * Switch openSUSE to 42.3 by default 2.7.1 ----- * elements: zypper-minimal: Install tar package 2.7.0 ----- * Move setfiles to outside chroot with runcon * zypper: Clean caches and don't cache packages locally * doc: supported\_distros: Add openSUSE Leap 42.2/3 and Tumbleweed * Add -m flag to setfiles for Fedora 26 * yum-minimal: pre-install coreutils * Force install during pip-and-virtualenv * Fix latest-limit command line * Updated from global requirements * opensuse-minimal: install glibc-locale * elements: openstack-ci-mirrors: Use openSUSE mirrors for gating jobs * Update the documentation link for doc migration * Remove DIB\_[DISTRO]\_DISTRIBUTION\_MIRROR * doc: Switch from oslosphinx to openstackdocstheme * The correct option for label name in fat and vfat is '-n' * zypper-minimal: No point in preserving the environment here * Remove additional Bumblebee repository for opensuse element * Enable console during kernel boot on Power * fix readme.rst to reflect correct environment variable * Add symlink test for resolv.conf restore * pip-and-virtualenv: Install python3 on openSUSE * Support for Cloud Images on ppc64le for rhel7 and centos7 * bindep.txt: Exclude gnupg2 package on openSUSE * Avoid hanging endlessly on unreachable cache urls * elements: pip-and-virtualenv: Use common packages for openSUSE * Remove mirror create * Remove centos and rhel elements * Updated from global requirements * dib-lint: Ignore editor temp files for linting run * As far as block-device layout is concerned ppc64le == ppc64el * [doc] Add some notes about PowerPC Architecture names * Move image download tests to default skip * Fix mkfs use wrong label option for vfat * Use the dib python to do cleanup 2.6.1 ----- * On suse the python2 dev package is python-devel * Move ironic-agent test to fedora-minimal * Start at using CI mirrors for fedora/centos * Use local mirror for ubuntu-minimal jobs * Move apt-sources to ubuntu-minimal / move debian to skip list * Sync after writing partition table * Install systemd earlier for Stretch * Fix mkfs failure when loop device is not ready * Add timestamp output filter 2.6.0 ----- * PPC bootloader; install to boot partition * Pass all blockdevices to bootloader * Move rollback into NodeBase object * Move global mount tracking into state * Use global state to check for duplicate fs labels * Remove 'state' argument from later cmd\_\* calls * Add state to NodeBase class * Use picked nodes for later cmd\_\* calls * Don't make image & loopdev functions static * Add env var to dump config graph * Use class as super() argument * Move ppc block-device default to right $ARCH * Update tracing in block\_device\_create\_config\_file * Add a keep-output flag for functional tests * Updated from global requirements * Pad state dump * Use https in docs links * Add missing test requirements, fixup pylint env * Move "functional" unit tests under block-device * Replace assertRaisesRegexp with assertRaisesRegex * Adjust package mapping for SUSE family * Drop support for Ubuntu precise * Adjust package installation for openSUSE * Trivial fix typos * Make BlockDeviceState implement a dict * Refactor mount-point sorting * Remove dracut-network element * Remove ccache * Decode string to bytes in dracut-regenerate * Test openSUSE 42.2/42.3 image builds * Add state object, rename "results", add unit tests * allow uninstalls to fail on gentoo * Refactor: use lazy logging * Add pylint with indent check 2.5.0 ----- * Disable recommended package installations for zypper-minimal * Move create\_graph into config.py * Create and use plugin/node abstract classes * Use networkx for digraph * Add a more generic tree->graph parser * Adding unit testing for configuration * drop deprecated map-services/packages from zypper element * Produce API documentation 2.4.1 ----- * Set manifest permissions in the image * dhcp-all-interfaces.sh - Add support for InfiniBand interface DHCP * Move parts of Partition creation into object * Split partition into it's own file * Move exception to it's own file (again) * Add weights to digraph * Switch debian to deb.debian.org * Remove use of 'which' * Add dracut-regenerate elements * Remove \_config\_error thrower * Set manifests to mode 600 and owner root * Use fakelogger in test\_blockdevice\_mbr * Remove PluginBase/NodePluginBase class * Only unmount directories that are mounted * Updated from global requirements * Apply setfiles on all mountpoints * Updated from global requirements 2.4.0 ----- * Refactor: block-device filesystem creation, mount and fstab * Remove args from BlockDevice() init * Move to subparsers * Clear \_\_init\_\_.py from cmd move * Take --params from environment * Create BlockDeviceCmd object * Move YAML parsing into cmd.py; default to env * Move dib-block-device implementation into cmd.py * Move blockdevicesetupexception.py into blockdevice.py * Remove unused val\_else\_none * block\_device: reorder imports * exec\_sudo: check cmd for str, log output and raise exception * Use check\_output * Add sort\_mount\_point method * Refactor documentation on image creation * Add a test to validate we can build debian vms * Introduce exec\_sudo command * Fix py3 error in block-device * Refactor block-device base functions * Add bzip2 to test install * Add refactor of tree-like vs graph * Set LC\_ALL in disk-image-create * Improve documentation for image creation * Refactor block\_device: isolate the getval call * Refactor block\_device: passing command line parameters * Make Gentoo package updates work more often 2.3.3 ----- * Add yum-utils as EPEL dependency * Turn off strict\_id mode for Ec2 datasource * Clean up dib-python symlink * Updated from global requirements 2.3.2 ----- * Skip python3-virtualenv on <= trusty 2.3.1 ----- * pip-and-virtualenv : install python2 & 3, and default to 2 * Install pip with python interpreter 2.3.0 ----- * Move do\_extra\_package\_install to run in install phase * Clean out apt index caches at end of image build * Updated from global requirements * Unify and fix doc of several Debian and Ubuntu elements * Fix package-installs-v2 output * Basic logging for package-installs-squash * Use DIB\_PYTHON\_EXEC to run commands * Fix typo in pip-and-virtualenv * Ignore missing path in unmount\_dir * Run dib-run-parts out of /tmp * Don't provide dib-run-parts * Add flag to disable EPEL * Fix code-block in README of rhel7 element * Fix opensuse-minimal element on non-SUSE hosts 2.2.0 ----- * Have simple-init enable network.service * Use stevedore for plugin config of block device * Use correct Ubuntu distro url on non-x86 arches * Typo fix: curent => current * functests: skip qcow2 generically but add specific test * Add default PPC block-device layout * Capture output in \_exec\_sudo * Adding aarch64 support for CentOS7 * Fix typo in CMDLINE env var for bootloader 2.1.0 ----- * Allow ELEMENTS\_DIR to be configurable * Use sphinx warning-is-error * Updated from global requirements * squash-package-install to use the correct python * Make our virtualenv source py3 safe * blockdevice.py: python3 fixes * Fix dib-init-system for Debian Jessie and Debian Stretch * Replace architecture-emulation-binaries with qemu-debootstrap 2.0.0 ----- * Add 2.0.0 release notes * Send custom parameters in bootloader to GRUB\_CMDLINE 2.0.0rc2 -------- * Run indent checks in diskimage\_builder/lib * Use OrderedDict for partitions instead of simple dictionary * Refactor: block-device partitioning cleanup 1.28.0 ------ * [suse] Handle pip-and-virtualenv install for opensuse * pip-and-virtualenv: also handle rhel distros * [suse] remove --no-confirm from zypper invocation * gentoo: do not manually clean /tmp * Fix requirements update * Fix #1627402: fix grub2 element for ubuntu xenial 2.0.0rc1 -------- * Semi-automatic doc generation of element dependency * Fix up doc errors * Fix up element doc generation * python-brickclient: accommodate python2/3 changes * Move Ubuntu specific use\_tempaddr setting to ubuntu-common element * Fix typo in README.rst * yum/install-packages output cleanup * Preinstall pyOpenSSL * Target map-packages deprecation message * Turn down some low-value tracing output * Move generation of dib\_[environment|args] to manifest element * Check return of \_load\_state * block-device: change top level config from dict to list 1.27.0 ------ * Handle blank lines in element-deps * Don't run unit tests from run\_functests.sh * Git ignore coverage stuff * Refactor: block-device handling (partitioning) * Add DIB\_IPA\_COMPRESS\_CMD option * ironic-agent: use /sbin for modprobe * move post-install.d to finalize.d * Bump fedora release to 25 * Fix dhcp-all-interfaces for ubuntu-minimal xenial * Use strings in package-installs follow output * Don't set base element path in run\_functests.sh * Fix coverage report * Use %i instead of %I in dhcp-interface@.service * Remove hardcoded components * Set grub device in /etc/default/grub * Replace yaml.load() with yaml.safe\_load() * Unify tidy up logs in lib/img-functions * Also check bin/ for tabs * Handle failure of carrier check in dhcp-all-interfaces.sh * Fix Gentoo builds on Ubuntu 16.04 Xenial hosts * Make DHCP timeout configurable * Run dhcp-interface@.service after network.target * Update component docs to refer to ironic-agent * Change "Openstack" to "OpenStack" * update pkg-map entries for python3 1.26.1 ------ * Revert "Revert Xenial to Python 2" * Dont run with VIRTUAL\_ENV set * dib-lint: python3 compatibility fixes * H803 hacking have been deprecated * Update documented default Ubuntu version 1.26.0 ------ * Revert Xenial to Python 2 * debootstrap: avoid duplicate network configuration * Start func testing on centos-minimal again * Increase func testing for ubuntu-minimal element * Remove yum chroot caching * Set grub timeout default * Switch py34 tests to py35 * Add get\_elements; preserve backwards compat for expand\_dependencies * Update our package classifiers * set default DIB\_PYTHON\_VERSION=2 for rhel7 * Add squashfs output image format 1.25.2 ------ * Add output image format tgz support * Install dracut-generic-config package * Switch to openSUSE Leap 42.2 release by default * FIx the DIB\_CLOUD\_INIT\_ALLOW\_SSH\_PWAUTH variable name in README file 1.25.1 ------ * Add ubuntu-precise support to dib-python * Fix bootloader element on ppc * Create ubuntu/fedora test for pip-and-virtualenv 1.25.0 ------ * Recreate initramfs within loopback image * Pip install as 10- incompatible with 05-heat-cfntools * Support sysv init system used by Debian Wheezy * elements: dib-python: Add python2 as the default version for openSUSE * Fix pip-and-virtualenv to work with python3 * Allow package-installs to parse DIB\_PYTHON\_VERSION * Add install-types as pip-and-virtualenv dep * Disable centos6 testing * Move pip-and-virtualenv source install to 10- * Speed up chroot checking loop * Don't set the executable bit on dhcp-interface@.service * Make dib-python use the default python for distro * Allow disto-specific mirror settings * Put MKFS\_OPTS after filesystem type * Update hpssacli to ssacli in proliant-tools element * Update sysctl-write-value to do conflict checking * Delete deprecated Hacking in tox.ini * elements: Drop executable bits from environment files 1.24.0 ------ * Fix --version display * DIB element to support cinder local attach/detach functionality * Perform package install outside of debootstrap * Improve checksum performance for images * Activate virtualenv in disk-image-create * elements: zypper-minimal: Add ca-certificates-mozilla package * Changed author and author-email 1.23.0 ------ 1.22.2 ------ * yum-minimal: add systemd to initial install * Catch errors in DIB\_INIT\_SYSTEM export * Replace six.iteritems() with .items() * Trace package install in package-installs-v2 * Special case dib-python in dib-lint * elements: Drop unneeded DIB\_INIT\_SYSTEM usage * elements: Add new openssh-server element * add option to configure cloud-init to allow password authentication * elements: pip-and-virtualenv: Add python-xml dependency 1.22.1 ------ * Fix runtime ssh host keys script * Turn off tracing around pid/chroot check * Fix a typo 1.22.0 ------ * Change path for dnf arch override so basearch is not overwritten * Fedora AArch64 (64-bit ARM) support in diskimage-builder * Disable all repos in os-refresh-config too * lib: common-functions: Fix tmpfs umounting * add support for SUSE in dhcp-all-interfaces * simplify ARCH param for rhel/centos param can be x86\_64 and amd64 * debian: install dialog package * Install lsb package by map name instead of package name * In disk-image-create, append to INSTALL\_PACKAGES instead of clobbering * Cleanup yumdownloader repos * Updated from global requirements * Remove execute perm from disk-image-create * Move dib-run-parts into diskimage-builder * Avoid disabling rhel-7-server-rh-common-rpms * elements: zypper-minimal: Mount common pseudo filesystems * Updated from global requirements * dhcp-all-interfaces: support Centos/RHEL 6 * Move diskimage-image-create to an entry point * Move elements & lib relative to diskimage\_builder package * Fail on element-info error * elements: zypper-minimal: Refresh repositories after adding the cache * elements: opensuse-minimal: Add support for building Tumbleweed images * Fix ironic-python-agent image not loading vfat mod * Don't include openstack/common in flake8 exclude list * Drop MANIFEST.in - it's not needed by pbr * Changed the home-page of diskimage-builder in setup.cfg * Remove RedHat grub workaround install * Add support for bindep.txt * Don't log datestamp by default in functional tests * elements: zypper: Do not pull recommended packages * Turn down yum install-packages * Don't set tracing in environment files * elements: source-repositories: Add git package mapping for SUSE * elements: growroot: Add SUSE package mappings * elements: runtime-ssh-host-keys: Add openssh-client mapping for SUSE * Don't use ssh-keygen -A for init scripts * elements: simple-init: Remove SUSE interfaces * Document install of diskimage-builder on Gentoo * Add element for setting sysctl values * start cloud-init-local in the boot runlevel * Fix formatting for supported distros in docs * Rename devloper documentation to developer guide * Remove copyright from docs / toc * Use globaltoc in docs for sidebar * Fix developer guide TOC * Add low-hanging-fruit bug tag to docs * Add bugs link to docs * Generate ssh-hostkeys on boot for ironic agent * Enable release notes translation * Add pkg-map for gentoo to runtime-ssh-host-keys * Remove deploy element * Remove deprecated deploy-ironic element * Remove deprecated ironic-discoverd-ramdisk * Remove deprecated expand-dependencies arg * Remove deprecated serial-console element * Remove deprecated map-services * Remove deprecated map-services 1.21.0 ------ * Create (md5|sha256) checksum files for images * Add opensuse-minimal element * Add zypper-minimal element * Move the opensuse mkinitrd script to the zypper element * Fix a command in Developer Documentation * Default to http://ftp.us.debian.org/debian for debian-minimal * Updated from global requirements * Move opensuse utils to zypper so they can be shared by SUSE-based distros 1.20.0 ------ * Disabling all previous repos registered in the system * Fix typo in extracting root partition * Create runtime-ssh-host-keys element * Fix grub installation for RHEL * Add release notes for block device handling * Shorten DHCP timeout in dhcp-all-interfaces 1.19.1 ------ * yum-minimal: Disable excludes when installing pkg manager * Add libselinux-python to yum-minimal * elements: opensuse: Add support for openSUSE Leap 1.19.0 ------ * Remove EPEL as hardcoded dependency of centos elements * Remove unnecessary dkms install from base * Fix mellanox element required kernel modules and user space packages * don't configure 'lo' for dhcp * Move element-info to a standard entry-point * Refactor: block-device handling (local loop) * Convert pkg-map and svc-map copies to explicit variables * Add IMAGE\_ELEMENT\_YAML and get\_image\_element\_array * Making element overriding explicit * fix systemd resource deadlock * Add option to be able to run\_functests.sh in parallel * Document source glean installs in simple-init * Disabled IPv6 privacy extensions * Generate and use upper-constraints for ironic-agent * Explain difference between two envvars * Add tests for building \*-minimal images * Spec for changing the block device handling * Update portage only if needed * Update GRUB\_MKCONFIG for detecting what's installed * Allow ramdisk-create to run without $USER set * Use temp file for du calculations * Clarify OVERWRITE\_OLD\_IMAGE docs * Add blurb about communication to docs landing page * Change DIB\_IPA\_CERT resulting file name * Allow to skip kernel cleanup * Add specs dir * Add "audit"package to yum-minimal * secure\_path in sudoers: deal with possible quotes * Optionally remove portage files * Generalize logic for skipping final image generation 1.18.2 ------ * add no\_proxy when debootstrap trying to use proxy * Correct order of parameters in call to qemu-img convert * Correct order of parameters in call to tune2fs * Fix proliant-tools dependencies * Fix packaging problems for Debian * Remove the escape in the centos7 README file * Spec for changing the block device handling: partitioning * yum-minimal: set locale.conf and tz in chroot * Revert "Revert "Pre-install pip/virtualenv packages"" * Don't create an ironic-agent image just to delete it * Make Fedora 24 the default * Check sudoers file after editing 1.18.1 ------ * Add 1.18.1 releasenotes * Revert "Pre-install pip/virtualenv packages" * package-installs: add list to arch and "not-arch" list * Export YUM variable in centos bases * Clear up "already provided" message * Fix the bug that "mktemp: failed to create directory" * dmidecode does not exist for ppc64/ppc64el * Updated from global requirements 1.18.0 ------ * Convert element\_dependencies to logging * Release notes for 1.18 * Make xenial the ubuntu default * Clean more from ironic-agent ramdisk image * Updated from global requirements * Handle locales install on Fedora 24 * Fix copyright in docs * Run RHEL system unregister element earlier * Updated from global requirements * Fix sphinx-build to not depend on diskimage-builder * Pre-install pip/virtualenv packages * Ironic agent kernel should be owned by user building image * Introspect logging testing more * Add python logger configuration * Remove discover from test-requirements * Move pkg-map to dib-python * Add cinder-backup mappings 1.17.0 ------ * Release notes for 1.17.0 * Cleanup source-repositories output * Refactor: rename temporary directories * Refactor: remove unused functions * Rework yum-minimal locale cleanup * Remove Fedora 21 from test-build * Export die() function * Fix variable unbound error while REPOREF="\*" * Handle file magic type varying order matching * Remove deprecated overriding of cloud-init defaults * Add cloud-initramfs-growroot for Precise * Add release to pkg-map * Export FS\_TYPE and remove hardcoded ext4 values * Add PS4 to show file/function/line in debug output 1.16.1 ------ * Revert "Revert "Properly fail/trap in eval\_run\_d"" and fix PIPESTATUS * Fix path issue for locale-archive.tmpl * Revert "Properly fail/trap in eval\_run\_d" * Add dhcp-all-interfaces.target for syncing units * Small doc update, add link to relnotes 1.16.0 ------ * centos-minimal: can be used with base * Properly fail/trap in eval\_run\_d * Add 1.16.0 releasenotes * Do not remove sudo in ironic-agent * Fail functests if refusing to run tests * Install docker for tests * Fix apt-sources configuration for debian-minimal * Add install-bin element * tests/elements/fake-os: add '/tmp' as top level dir * Updated from global requirements * Add a best-effort sudo safety check * Fix OpenSUSE support * Install proliantutils in IPA's virtualenv * Add documentation for dib-lint * Add test dependency installation on Gentoo 1.15.0 ------ * Use generic "dhcp-client" name * Split YAML & JSON parsing * Add some output to dib-lint * dhcp-all-interfaces depends on dib-init-system * dhcp-all-interfaces depends on dhcp * Add Gentoo to the dhcp-all-interfaces element * Updated from global requirements * yum-minimal: strip locale archive * Add releasenotes * Change to latest CentOS-6 image * Document upstream executable numbering convention * Move selinux restore to end of finalise * yum-minimal : better cleanup of initial yum failure * Add EPEL as requirement of centos-minimal * Allow skipping the md docs check * Don't stop dib-lint on first flake8 failure * Fix up EPEL element * Updated from global requirements * Support to add certificate in ironic-agent * simple-init: Fix path for /etc/ssh test * Fix disk usage report * Add qcow2 generation for better test coverage * Skip gentoo test * Turn of tracing around du invocations 1.14.1 ------ * Fix add-apt-repository package for precise * Fix ssh key cleanup to run in chroot * Debian: dont set always the hostname to debian 1.14.0 ------ * Remove ssh host keys when using simple init * dib-run-parts: make cp to target root more robust * Set tgtd not auto-start on OS boot time 1.13.0 ------ * Handle unconfigured interfaces for dhcp-all-ifaces * Really remove all interfaces in dhcp-all-ifaces * ironic-agent postinst fails on systemd with no iptables * add pkg-map to pip-and-virtualenv element * Turn down tracing for source-repo cache * ironic-python-agent should use console output * Add psmisc to the packages for ironic-agent * Add new posix element * Note requirement for parted on gentoo hosts * Remove all interface configs for simple-init * Set default locale to image in debootstrap element * Make ubuntu-core support releases * Add testing for the Gentoo element * Updated from global requirements 1.12.0 ------ * Use fstrim to prep the block device * Revert "Zerofree the image if possible" * centos-minimal does not provide base * Add lshw package to ironic-agent * yum-minimal: clear our rpm/dnf/yum data in chroot * Add image size report * Zerofree the image if possible * Create new partitioning-sfdisk element * Fix spurious = in dib-python readme * Fix cloud-init-disable-resizefs README title * Reorder developer quickstart docs * Add --version option to disk-image-create * Add Gentoo to the list of supported distributions * Prioritize venv python on host 1.11.1 ------ * Fix building on gentoo hosts * Depend on ifupdown in simple-init * Rework functional test runner * Revert "Correct rhel-common for rhel6" * Adding InfiniBand Support * Add force-confdef in debian package install * Install IPA in a virtual environment * Don't cache debootstrap rootfs by default * Don't remove python3 & grubby in 99-remove-extra-packages 1.11.0 ------ * debian-minimal: configurable debootstrap components 1.10.0 ------ * Remove eclean-dist as it's not available by default * Reorder the package-uninstall action * Do not remove python-dev from ironic-agent image * yum-minimal: pre-install base packages * Fix dpkg element for Ubuntu Xenial * Refactor growroot for debuggabilty * Fix startup race with growroot/systemd * Replace sfdisk partitioning with parted * Switch simple-init to pip-and-virtualenv element * Revert "Skip centos functional testing" * Use dnf to cleanup old kernels * Increase interface has link retries to 20 * Fix growroot for Gentoo's openrc * Fix tar listing in functional tests * Add support for OpenRC to dib-init-system 1.9.0 ----- * Add new cloud-init element * Fix Gentoo hardened support * Skip centos functional testing * Fix package-installs for python3 * Add support for gentoo to simple-init * Mark ironic-discoverd-ramdisk as deprecated in favor of ironic-agent * Add Gentoo support to growroot * Add support for Gentoo to source-repositories * Remove outdated translation files * Only match #!/bin/bash in scripts * Fix debian-minimal image building * Updated from global requirements * Don't use wc -l for the umount check * Cleanup unmount\_dir function * Add systemd/fedora support to growroot * Remove argparse from requirements * Revert "Use pip 7 for ironic" * Updated from global requirements * Force dib-python symlink creation * Remove zero length files * Use pip 7 for ironic 1.8.0 ----- 1.7.2 ----- * Add inetutils-ping to test-deps * Move speedup section to image building guide * Add pkg-map for redhat * Revert "Fix discoverd bug when dmidecode reports GB" * Print unparsable file in pkg-map 1.7.1 ----- * Fill out bootloader pkg-map 1.7.0 ----- * Initial add of gentoo support for diskimage-builder * Prune old branches when updating cache * Correct rhel-common for rhel6 * deploy-ironic: Fix syntax error when checking for root device hints * Add pip-and-virtualenv element * Run package-intalls with py3k if we must * The mirror for installing epel is timing out * Properly account for pipefail during cleanup * Make dkms element depend on dkms package * py26 is no longer supported by Infra's CI 1.6.0 ----- * Fix discoverd bug when dmidecode reports GB * yum-minimal : install selinux policy packages * yum-minimal: do not configure eth0 & eth1 for DHCP automatically * yum-minimal: leave behind dummy /etc/resolv.conf * Fix growroot device detection * Package installs defaults to tracing off * Don't print trace unless trace is on in pkg-map * Fix unmount/remove race in cleanup\_build\_dir * Make check for image-should-fail quiet * Document byte-to-inode ratio * Split vm and bootloader elements * Deprecated tox -downloadcache option removed * Add a new element hpdsa * Add dib-python element * Allow grub2 to build with opensuse 1.5.0 ----- * Add kmod to package-installs of ironic-agent * Load the 8021q kernel module in simple-init * Add openssh-server package-install to local-config * Fix grub-efi-amd64-signed install failure * Fix fedora-minimal on CentOS builds * Follow up patch for 25d3ee547176528e86d42eb026c99a134dff9452 * Updated from global requirements * Add centos7 test * Add DIB\_LOCAL\_CONFIG\_USERNAME to local-config * Use ironic-agent for source-repositories * Add dynamic-login element 1.4.0 ----- * Remove fedora-minimal/install.d/99-ramdisk * Remove cloud-initramfs-growroot package * Extend root device hints for different types of WWN * Move install-types doc to user guide 1.3.0 ----- * Fixup RPM db path when building Fedora on Ubuntu * Remove unused RELEASE\_RPMS variable * Fix diskimage-builder image size * Add proliant-tools element * Add missing six requirement for svc-map element * Fix fedora-minimal kernel-install on older platforms * Clarify what fedora-minimal/install.d/99-ramdisk is doing * Fix uniqueness check of initrd in fedora-minimal * Updated from global requirements * debian: cloud hostname ignored by Jessie * Selectively prune /root for ironic-agent ramdisk * Add a tox target to run functional tests locally * Create YUM\_CACHE\_DIR in yum-minimal * Use DIB\_EPEL\_MIRROR when finding the epel-release package 1.2.0 ----- * Add support for Xen PV disks * Add --force to grub-install * Preserve env when calling yum with sudo * Define a default for $YUM * Fix tests/test\_functions.bash * Fix devuser pubkey defaults * Reset yum/dnf cache to correct location * Remove extra install of release pkgs in fedora-minimal * Update default fedora-minimal to f22 * Add Fedora 22 support to yum-minimal * Enable decimal value for $DIB\_IMAGE\_SIZE * Update rhel7 element readme * Move yum-based install into function * Update apt-preferences element README from free text to table formatting * Update apt-conf elements README from free text to table formatting * Fix title of env vars section of fedora README to match template * Fix title of env vars section of redhat-common README to match template * Avoid transcending /proc with find * Reorder the script number of 'elements/dkms/post-install.d/99-dkms' * dib-lint: ignore blank lines in element ordering * Restrict search for python object files to ./usr * Add flake8 to requirements * agent: ensure vmlinuz file does not exist before hard-linking into it * Prevent overwriting of user modified blacklist.conf * Remove quotes from subshell call in bash script * Contains the directory name of /sys and /proc * Install 'gdisk' when building ramdisk with ironic-agent * Use --nodeps when installing fedora-release * Output failing lines when dib-lint finds wrong indents * Adds debian support to iso element * ironic-agent element to output a .kernel file * Add functional test for ironic-agent on Fedora * Updated from global requirements * Add option to set EPEL mirror * Remove dnf workaround in ironic-agent * ironic-agent: remove python object files * Install ironic-agent dependencies via package-installs * Fix variable misspelling error 1.1.2 ----- * Prettyfy source-repositories doc * Prettify 'Caches and offline mode' documentation * Download a compressed centos cloud images * Prettify 'Developing Elements' documentation * Add centos7 support for DIB\_DISTRIBUTION\_MIRROR * Don't create a centos yum repository * Add #!/bin/bash to library functions * Make README.rst a bit more generic * Deprecate the deploy-ironic element * dib-lint: validate json/yaml files * Make sure dnf won't autoremove packages that we explicitly installed * Handle install with pip -e * doc: migrate from README.rst to Sphinx * Update fedora elements README from free text to table formatting * Update redhat-common elements README from free text to table formatting * svc-map: do not specify user/group for install * Activate pep8 check that \_ is imported * Remove grub2 in redhat-common/pre-install.d/15-remove-grub * Remove old entries from MANIFEST.in * ironic-agent: ensure dmidecode and ipmitool are installed * [ironic-agent] Use svc-map for enabling agent * Update dpkg elements README from free text to table formatting * Fix ironic-image pkg-map 1.1.1 ----- * Run growroot after all filesystems are mounted * Updated from global requirements 1.1.0 ----- * Fix a typo in README.rst * create growroot element * Install-static depends on rsync * Fix init-scripts element path munging and deps * Pin the Fedora mirror for testing * Reduce the size of the ironic-agent ramdisk * Set and export DIB\_RELEASE for centos7 * Correct URL in ironic-agent README * Add curl to ironic-agent package installs * Handle modern sfdisk and correctly align image partition * Set DIB\_RELEASE for the Debian test-element * Add documentation of output formats for users * Remove docker doc from docs * Add ability to build ironic-python-agent ramdisk from packages * Adds Ubuntu and Debian to ironic-python-agent Support-list * Fix link in installation doc 1.0.0 ----- * debian: properly configure interfaces * typos on the document * Only warn about missing map files with debug * Fix test cleanup trap to cleanup tmpdir * Support building ACIs * Document what our stable interfaces are * Add element to disable cloud-init resizefs * Update default Fedora to 22 * Cleanup yum downloading * Add base element for using docker as image base * Add docker output support * Add init-scripts directory support * Document our supported distributions * Use official mirror name for debian-minimal * debian: install DHCP client and ifconfig packages * Removes hardcoded refrences for ethernet interface * Remove deprecated disk-image-get-kernel * opensuse: Update README * openSUSE: Fix link to the images download folder * Use the init scripts from the glean package 0.1.47 ------ * Have glean set hostname if a config drive exists * Add oat-client element * Allow source-repositories ref to be "\*" * Only chown tmp dirs when they are a tmpfs mount * Work around yum/dnf differences * Add YUM variable to for Fedora >= 22 * Optimize Python install in deploy-targetcli * Updated from global requirements * dib-lint: make it work on Mac OS X * Wait longer for root device to become available * Revert "Revert "Ensure DIB\_RELEASE is exported for fedora"" * Add test for centos 6 * Document only exectuables in phase dirs policy * Change simple-init to use a PATH variable * Add explicit f21 test * Dont fail if were missing setfiles * Revert "Remove unused map\_nbd function" * ramdisk: enable ppc64 support for symlink * Cleanup the build directories earlier 0.1.46 ------ * Revert "Ensure DIB\_RELEASE is exported for fedora" * CentOS-6 resize support * Follow symlink for elements * Add grub2 element * Don't log tmpfs message during cleanup * Support custom kernel cmdline args for deploy iso * Address follow-up comments * Add Ironic API version to passthru URL for deploy-ironic * Skip backups and other non-relevant files for dib-lint * Use tar -t instead of -l because centos 6 * Make it clear that tmpfs is optional * Ensure DIB\_RELEASE is exported for fedora * rhel-common element should not use attach with activation key * Make $DIB\_YUM\_REPO\_CONF accept a list of repo files * Pass glean output to the console log * Use environment setfiles * redhat-common: rename 01-clean-old-kernels.sh to drop .sh extension * Cleanup /tmp in the guest * Add debian build test case * Install debian locales * Add smoketest for fedora * Initial element tests * doc: small snippet about operating system elements * Use Centos 7 cloud image symlink * vm: use $DISTRO\_NAME instead of lsb\_release * rax-nova-agent: switch to $DISTRO\_NAME * ramdisk: switch from lsb\_release to $DISTRO\_NAME * Simple-init should disable cloud-init * Make managing hosts entries optional * Have simple-init regenerate ssh keys on boot 0.1.45 ------ * Remove install of vlan/vconfig from base * package-installs: fix error case for Python 2.6 * centos/centos7: switch to epel element * epel: support centos element * Address comments on virtual media device label commit * debootstrap: fix syntax issues * Fix disk image create errors behind proxy * force arch amd64 for EL7 elements * Add packages required for iscsi extension in agent * Package ldlinux.c32 along with isolinux.bin if it exists * Add install\_test\_deps script * Fix $DIB\_DEFAULT\_INSTALLTYPE export statement * Export DIB\_RELEASE in centos 0.1.44 ------ * debian-minimal: Remove -backport's restricted + universe 0.1.43 ------ * Actually set a sane PATH for inside chroot * Turn docs warnings into errors and fix issues * Generate locales in debian-based elements * Split the debootstrap functions into an element * Install glean from openstack source * Support arch-specific package-installs * Add functional smoke test for disk-image-create * Updated from global requirements * Mount with -o nouuid for XFS base images * Port centos-minimal to yum-minimal * Use shorter temporary file names for kpartx * Fix image size to fit filesystem journal * Use labels for virtual media dev in Ironic ramdisk * Append full path to img-functions:run\_in\_target * Updated from global requirements * Remove unused map\_nbd function * update the dib centos7 baseurl to use a mirrorlist * openSUSE update * Add a yum-minimal element that just uses yum * Add element to process config-drive network info * Break install-types out of base * Support VHD output format * Update packages earlier * Fix to load only signed kernel in UEFI secure boot * Add element ubuntu-signed to provide signed kernel * Update install docs to be more user friendly * Switch default Fedora image to F21 0.1.42 ------ * Clean up targetcli ramdisk installation * Make troubleshoot work with dracut ramdisks * Do not export REG\_HALT\_UNREGISTER between hook scripts * Add generic devuser element * Update cloud-init-datasources README * Improved apt-sources README * Don't trace RHEL Registration scripts * Try 5 times for rmdir command call after umount * Generate the default en\_US locale * No markdown docs for elements * Create the dracut directory if not existing already * Export image properties * Correctly handle raw type ordering * Create a user guide * Report status of boot loader installation to Ironic * Fix dhclient in Fedora ramdisks * Use find instead of ls * Reorder tox environments * Add py34 to tox * Run svc-map tests * Open MKFS\_OPTS for extension in disk-image-create * Short circuit qemu-img convert for raw images * Download of translations not properly disabled in APT * Split dib-init-system into its own element * Handle non-cloud-init installs * Dont try to unmount if were not using tmpfs * Run udevadm settle after kpartx -l * Refactor deploy ramdisk to allow use of targetcli * Allow elements to add drivers to dracut * Fedora: install redhat-rpm-config * Cleanup/restify components.rst * redhat-common: Fix MariaDB-Galera-server case * Flagging ubuntu-minimal as untested 0.1.41 ------ * Ironic: Deploy ramdisk to find the right root device * Ironic: uefi localboot support * Convert leftover unconditional set -x to DIB\_DEBUG\_TRACE * Fix check for installtype * Fix incorrect package name dmidecoded to dmidecode * ironic-agent: exclude content of /tmp from initramfs * UEFI secure boot support for iso element * Install Fedora kernel-modules pkg for iscsi\_tcp * Allow disabling apt-get clean * Set DIB\_RELEASE in ubuntu element * CentOS 6 Element * Fix race in svc-map * Use package-installs on dpkg-based elements * openSUSE update * package-installs: work with Python < 2.7 * Split out README into separate files * Add wget to package-installs.yaml for epel * Updated readme * Fix unbound variables in apt-{preferences,sources} * pkg-map: respect --missing-ok also on missing pkg-map file * update epel version number in epel element * Allow setting DIB\_PIP\_RETRIES * Add a link to the "Writing an element" section * Quote to handle empty DIB\_RELEASE * Namespace PYPI\_MIRROR\_URL vars with DIB * Fix memory detection in ironic-discoverd-ramdisk * Add documentation of DIB\_IMAGE\_CACHE variable * Simplify ironic-discoverd-ramdisk * Support assigning IPMI credentials in ironic-discoverd-ramdisk * Use oslosphinx for docs site * Standarise tracing for scripts * Bump to hacking 0.10 * Fix the bootloader on UEFI machines * Add \`tox -edocs\` capability * Create docs site containing element READMEs * Fix type in DIB\_DISTRIBUTION\_MIRROR use * Pass BOOTIF to ironic-discoverd from the ramdisk * Use package-installs for ubuntu and base elements * Add apt-get autoremove * Add install-static element * Enable vm element to create PowerPC image * Add no\_timer\_check to vm grub cmdline * Dont fail if we have no old-style package-installs * Use sudo -E when squashing package installs files 0.1.40 ------ * setfiles consistently * Ironic: Local boot * Corrected \`element-info\` usage * Add installtype support to package-installs * Fix issue with leaking /tmp/image.\* directories * ironic-discoverd-ramdisk element cleanup * Add support for using local PowerPC VM image * ramdisk-image-create: add support for vmlinux file 0.1.39 ------ * Switch manage\_etc\_hosts from True to localhost * Set http\_proxy to retrieve the signed Release file * Run Registration Once * Fix Satellite Repo * Use DIB\_IMAGE\_CACHE in dpkg element * Fix for RHEL6 * Allow for disabling rhel registration * dracut-ramdisk: fix support for elements with ramdisk-install.d * Don't trace RHEL registration scripts * Ignore stderr from pkg-map * Allow absolute path to image with ironic-agent * Add install section to Ironic agent systemd service file * Fail helpfully if uuidgen is missing * Continue past dependency ordering diffs * Add element for ubuntu-core * Add rax-nova-agent element * Add minimal ubuntu and centos base elements 0.1.38 ------ * Rework package-installs to collapse on build host * Fallback to a boot\_server kernel param if ip= not passed * Add some speedups to dpkg * Deprecates username and password from boot time registration * Use env python * Fix repo enablement for RHEL during registration * Allow injecting arbitrary yum repo configuration * Don't use lsb\_release * Fix rst rendering * Add Activation Key Support For Customer Portal * Migrate to new package-installs * Add new package-installs system * Improve --ramdisk-element docs * Unset requiretty if it exists in sudoers * Remove the grub2 install from redhat-common * Remove use of sudo from yum pre and post elements * Add element for hardware discovery ramdisk for ironic-discoverd 0.1.37 ------ * disk-image-create: fix test when no argument is given * Warning when using pypi element without a mirror * Make some pkg-map errors soft * Fail helpfully if no elements are specified * Check python with flake8 instead of dib-lint * Update RHEL Registration 0.1.36 ------ * Deprecate map-packages, replaced by pkg-map * Allow multiple identical sources * Add DIB\_DEBOOTSTRAP\_EXTRA\_ARGS environment variable * deploy-kexec depends on deploy * Remove duplicate binary-deps from dracut-ramdisk * Add element for building ramdisk with ironic-python-agent * Simplify Dracut cmdline script * Add deprecation warning when using map-services * Fix indent exclusion * Install PyYAML for the svc-map element * Install lsb\_release from package * Enable RHEL Registration * Support installing packages by default * Optimize speed of deletion in find command * package-installs assumes packages have a pkg-map * Updated from global requirements * Unset trap before dracut ramdisk build script exits * iso element to use 'search --label' for grub * Update Debian repo to retrieve signed Release file * export DIB\_ROOT\_LABEL to make it global 0.1.35 ------ * Use binary-deps.d for dracut ramdisks * Move busybox binary-dep to ramdisk element * svc-map requires PyYAML * iso element to build bootable ISO images * Handle extra spaces in merge-svc-map-files * Enable dracut deploy ramdisks * Revert "introduce $SYSTEMD\_SYSTEM\_UNIT\_DIR" * Avoid overwritting of hooks * Disable all interfaces on eni systems * Remove first-boot.d support * Force empty $TMPDIR inside the chroot * Allow source-repositories to be disabled completely 0.1.34 ------ * Move to final release of CentOS7 images * Consolidate lsb\_release source-repositories * Allow for multiple image outputs from raw source * Echo that qemu-img convert is running * Preserve exit value when leaving cleanup trap * Don't re-install cloud-init for centos7 images * Check for epel before installing it 0.1.33 ------ * Do not try to detach non-existant loopback devices * Move install bin from rpm-distro to yum * Use DIB\_IMAGE\_CACHE everywhere * Save extended attributes when creating tar * Ensure epel7 is installed only on rhel7/centos7 * Update EPEL release rpm * Fix $DISTRO\_NAME usage for centos7 element 0.1.32 ------ * Add unit test for cache-url * Use $((EXPRESSION)) instead of $[EXPRESSION] * Install openstack-selinux on RHEL * Updated from global requirements * Move dpkg manifest creation to finalise * Allow custom rootfs labels * Add svc-map element * Refactor ramdisk element to allow alternate implementations * Updated from global requirements * Adds EPEL repo, cleans up rhel7 repos * Update to newer Centos7 images * Provide ability to build images for other architectures * Handle non-existing \*generic kernel and initrd 0.1.31 ------ * Change order for yum-repos file in centos7 element * Make diskimage-builder work in Docker * Add ceilometer service mappings 0.1.30 ------ * Run environment.d hook for manifests earlier * Reset yum configuration in post-install.d * Add vmedia boot support for deploy-ironic element * opensuse: Support pkg removal in install-packages * Use package-installs in more elements * Replace backticks with $() * Fix openSUSE kernel/initrd detection * Correct statement about ramdisk and tmpfs * Fix for host env leak into grub 0.1.29 ------ * Fix openSUSE cloud image download and extraction * Add element-manifest * Changed serial console setup * Map dkms package for SUSE in base element * Fix capitalization of openSUSE * Fix ramdisk pkg-map for openSUSE * Truncate instead of deleting log files * Lock around extract-image downloads and extracts * Add support for flashing ILO BMC's from ramdisks * Remove docs about deprecated pypi-mirror tool * Use dib-run-parts from dib-utils 0.1.28 ------ * Make RHSM registration set -u safe * Add service mappings for ironic * Revert "Remove the temporary deploy element after rename" * Remove hardcoded version * Increase source-repositories support for tarballs * map-services: add openstack-nova-novncproxy * Allow to specify an empty package list in pkg\_map * Use package-installs in fedora * package-installs for pre-install.d/post-install.d * Formatting fixes for dhcp-all-interfaces * Remove disable\_interface from dhcp-all-interfaces 0.1.27 ------ * Relabel filesystem if SELinux is available * debian: exclude contents of /tmp from debootstrap tarballs * Centralize handling of /lost+found 0.1.26 ------ * Cleanup apt cache after grub install * Extend/fix support for extlinux bootloader * Create cache directory * Remove package mapping for mariadb-rdo-galera-server * Adds RHEL common element * Support for UBoot * Add dib-lint exclusions * Revert "Cleanup apt cache after grub install" * Fix sourcing of environment files * Add virtual media boot support in ramdisk element * Cleanup apt cache after grub install * Update RHEL7 element since release * Bump hacking to 0.9.x series * Lock around ubuntu tarball download * Avoid to install a blank list of packages * Don't try to install if packages is empty * Add a ramdisk-install.d hook path * Initial centos7 support 0.1.25 ------ * Update RHEL 6.5 Image name * Add dhcp support for ramdisk element * Handle non-script grub2-install * Use readlink to get script path * Detail 'other' directories in the README 0.1.24 ------ * Lock around source repositories setup * Really handle Ubuntu mirror cache skew, * Echo output when pkg-map fails * Optimizing directory creation * Revert "Don't match editor backup files in env.. * Allow overwriting old images * Correction: if then statement code style * Last ditch effort to correct a wrong shasum * Avoid to install a blank list of packages * Add global exclusions to dib-lint * Don't match editor backup files in environment * Remove fixfiles from rpm-distro finalize 0.1.23 ------ * Rename rhel element yum blacklist * Set LC\_ALL=C into dib-run-parts env * update opensuse element * Use $DISTRO\_NAME instead of local lsb\_release * Add RHEL7 to Red Hat family in pkg-map * Use common element select-boot-kernel-initrd * Always bind-mount pypi mirror if dir exists * Add select-boot-kernel-initrd element 0.1.22 ------ * Ignore manifest outputs more carefully * VM element: Enable serial console on Debian * Disk-image-create should allow sending compat flags to qemu-img * Ensure cache directory exists before use * update zypper element 0.1.21 ------ * Drop ending slash from DIB\_CLOUD\_IMAGES * Update base element to make use of pkg-map * opensuse: support pkg-map in bin/install-packages * dpkg: support pkg-map in bin/install-packages * Element to remove unwanted kernel/initrd * introduce $SYSTEMD\_SYSTEM\_UNIT\_DIR * Update README regarding Debian and OpenSUSE support * Do not use DatasourceNone for precise cloud-init * Explicitly name element enable-serial-console * avoid failure if /lib/firmware doesn't exist * Tidy base image by removing /var/log files * debian: fix network on Wheezy 0.1.20 ------ * Refactor code to select boot kernel * fail at startup with no operating-system element * Add test to ensure we don't duplicate filenames * Name deploy-ironic and deploy-baremetal files uniq * Name 10-rhel-cloud-image uniquely * Name 01-install-bin uniquely * Delete redhat-common 00-usr-local-bin-secure-path * Name 99-setup-first-boot uniquely * Yum: support pkg-map in bin/install-packages * Add tar as an output type * Correct source-repository comments * dpkg: local cache for .deb files * map-services: add openvswitch * Ensure dib-run-parts profiling works with py3 and py2 * Rename old image file instead of rewrite it * Add missing dollar * Replacing deploy to deploy-baremetal in README.md * Reinstate Trusty as default for Ubuntu * Only use Ec2 cloud-init data source for Ubuntu * Remove uneeded code from pkg-map * Correct the wrong rename in rhel element * Add manifests to .gitignore * Check return code of element-info * Add new cloud-init-datasources element 0.1.19 ------ * Set DISTRO\_NAME in OS environment.d 0.1.18 ------ * Add pkg-map element * Factor out error behavior in dib-lint * Fix package removal * Create an element to allow using a dpkg manifest * Check for set -o pipefail * Set -o pipefail new scripts * Add support for source-repos gerrit refs 0.1.17 ------ * Stop using bash arrays for whitelisting in yum * Tidy up SuSE kernel selection * Parameterise PXE kernel and initrd selection * Debian: Support additional debootstrap arguments * \`set -u\` doesn't permit bash arrays to test -n * Ensure we can read the kernel out * Export unbound variable DIB\_RHSM\_USER * indent: search for !=4 spaces indentation * 4 spaces indent * Updated from global requirements * Adding -x to set parameters for more output 0.1.16 ------ * Ensure scripts are set -u * set -u and -o pipefail everywhere * Fedora: Add support for configuring Yum mirrors * dib-lint: check for tab indent in files * dib-lint: ensure file finish with a new line * add some missing \n at end of file * Add map-services for debian distros * Make sure all scripts are set -e * Allow excluding tests from certain files * Eliminate 'tr' in favor of inline bash * Support declarative package installs/uninstalls * Build raw image in separate tmpfs * debian: properly deal with Debian stable/unstable 0.1.15 ------ * Permit cache-url to work with fifos * debian: add systemd support * debian: support upstart on Wheezy * Debian element should activate eth0 * Respect inmutable resolv.conf in the image * set -e all the things * Explicitly use bash * Remove All Rights Reserved 0.1.14 ------ * Add package uninstall support * Revert default Ubuntu release back to Saucy * Add a mapping for kernel headers * Map openjdk-7-jre-headless to RHEL+SUSE * Sort rhel/bin/map-packages * Add sysv support to elements/dhcp-all-interfaces * Place /usr/lib64/ccache in PATH * Small fixes for dhcp-all-interfaces * cleaning up 01-copy-manifests-dir * Remove the temporary deploy element after rename * Use provides to note an element provides deploy * Remove dependency on /etc/lsb-release * indent: replace tab by 4 spaces * Make "trusty" (Ubuntu 14.04) the default release * Add switch to turn on caching for debian element * Remove cloudy interfaces in dhcp-all-interfaces * debian: simplify the way debian element is called 0.1.13 ------ * Fix set -eu and pipefail failures * Move instead of copy the temporary git manifest * Add mapping for mariadb rdo package * map-services: add apache2 in the list * Remove map-services from fedora element * Use provides to note an element provides an OS * Standardise manifest creation and retrieval * Remove call to depmod in busybox * apt-conf: uninitialised variables fix 0.1.12 ------ * Iterate over provided elements first * Add ability to add extra apt keys * doc: indentation rules for element * Document a little the concerns for operators * debian: use sudo to create file in the chroot * Disable splashimage for legacy grub * Change refspec used to fetch all branches and tags * fix grub2 installation on Debian Wheezy * Fix Grub configurations for Fedora images built on a UEFI host 0.1.11 ------ * Fix dhcp-all-interfaces upstart job * Fix dhcp-all-interfaces on Ubuntu/Debian * Fix resource exhaustion with upstart * Write a dpkg manifest to list installed packages * Fix "(None)" seed hostname on Debian * dhcp-all-interfaces: correct ifquery return stmt 0.1.10 ------ * Make stable-interface-names its own element * Uses policy-rc.d to prevent dpkg starting daemons * Enforce alphabetical ordering of element-deps * Alphabetize all element-deps * Add dib-lint script * Adds package mapping for mariadb packages * Adding pypi-mirror dependencies for redhat * Revert "Only create a tmpfs big enough for DIB\_MIN\_TMPFS" * debian: install cloud-init on Wheezy * Remove an excess cp of disk images * Adds "element-provides" support to element dependencies * Add console kernel parameters to extlinux configuration * Permit use of wheel mirrors in pypi element * baremetal: correct the path of ifcfg-eth0 * Adds libmariadb-dev package mapping * rename udev.rules to dhcp-all-interfaces-udev * serial-console: Use udev rules to startup getty * Set +x on executable files 0.1.9 ----- * DHCP: make udev rules want dhcp-interface@.service * Add RHEL 7 image element * Use redhat-common in fedora element * Add redhat-common element * Correct README.md markdown errors * Support adding DHCP interfaces one at a time * Move install type enablement into base element * Remove hardcoded /tftpboot/ from token's tftp path * RHEL Package maps for build-essential, python-dev and libz-dev * Extract move cache logic to a function * Always export IMAGE\_NAME * baremetal element: Enable stable interface names * Fixup all occurrences of REPONAME for replacing '-' * Create a git manifest from source-repositories * Add apache2 mod\_wsgi pkg map for suse * Updated from global requirements * 98-source-repositories tries to return from script * Add libaio1 to libaio pkg map for fedora * Only create a tmpfs big enough for DIB\_MIN\_TMPFS * Additional swift storage service mappings * Update openSUSE package mapping for libffi-dev * Better apt-sources docs * Add nfs-common package mapping * Replace more then just "-" in REPONAME * Bash eval the lines in source-repository scripts * Fix spelling error in "vm" element README.md * Add $EXTRA\_ARGS back to yum call * Update the image name for RHEL Guest Image * Alphabetize openSUSE services dictionary * Alphabetize openSUSE packages dictionary * Alphabetize Fedora services dictionary * Alphabetize Fedora packages dictionary * Enable extlinux support for (non-Ubuntu) Debian platforms * Replace use of show-ref with name-rev 0.1.8 ----- * Fix syntax error in GRUB\_OPTS env var handling * Update README formatting and content * Improve local-config proxy handling * Enable custom apt.conf in apt-conf element * Add rsync to the package list used by debootstrap * Enable simple modification of git repo location * Add NFS package mapping * Improve usability of the source-repositories cache * Fix unbound variable in debian element 0.1.7 ----- * Replace security.ubuntu.com when setting mirror * Generalize install-packages for yum * Remove accidental merge marker * Add libvirt-bin -> libvirtd to map-services * Make max-online-resize an option * Correct DIB long option parsing * Add 00-fedora-fixup-vim * Update pypi element to suggest pypi-mirror * Permit using arbitrary PyPI urls * Pep8/Pyflakes fixing * Shift debian element to DIB\_DISTRIBUTION\_MIRROR * Revert "Add Fedora DHCP interfaces via udev rules." * Revert "Support adding DHCP interfaces one at a time. " * Teach cache-url to handle file:// URIs 0.1.6 ----- * Remove tox locale overrides * Add Fedora DHCP interfaces via udev rules * Support adding DHCP interfaces one at a time * Rename Openstack to OpenStack * Don't hardcode environment.d * Add more package name mappings for openSUSE * Add lsof package to all Fedora images * ifquery doesn't exist on Fedora * Remove unneeded service mapping for mysql on openSUSE * Fix misspellings in diskimage-builder * Fix kernel extraction on openSUSE * Adjust neutron package install for Fedora * Make the MIRROR\_TARGET directory if it didn't exist * Add tgt service mapping for Fedora * Update openSUSE package mappings for OpenStack * Updated from global requirements * Update map-services for Fedora * Add Fedora packages mappings for snmpd * Add mysql mapping for Fedora * Add package map for stunnel4 * Add ability to use local cloud image * Add a service mapping for openSUSE * Add bash as a dependency to the deploy ramdisk * Include /lib64 into the deploy ramdisk on openSUSE * Fix tftp mapping on openSUSE * Use /usr/bin/env, not /bin/env 0.1.5 ----- * Rename generate-interfaces-file.sh.. * Only configure DHCP for real interfaces * Add map-services * Skip relabel unless SELinux is enforcing * Mount root filesystem readonly during boot * Fix kernel/initrd extraction for SUSE based distros * Fix ramdisk element for openSUSE * Workaround broken udev update on openSUSE * Make copy\_required\_libs() more robust * Add Copyright and License header to debian element * Setup ccache symlinks on openSUSE * Add support for Red Hat Satellite * Support list of Red Hat channels and repos * Add support Red Hat Network (RHN) * Update default RHEL guest image * Create a new baremetal element * Fix mysql package mappings for opensuse * fedora/RHEL: use env from /usr/bin * Allow use of mirrors when building Ubuntu images * Update to Fedora 20 * Convert -dev to -devel in fedora/map-packages * Fix the curl command in the ironic-deploy element * Move Babel and argparse from test-requirements.txt * Symlink correct element install type * dib-run-parts should dereference symlinks * Add debian-upstart for experimenting with upstart * Allow adding packages to debootstrap * Add support for Debian * Wait for tgtd socket to be available 0.1.4 ----- * Add new modprobe-blacklist element * Install traceroute on Fedora * Retry link check up to 10 times * Implement serial-console for systemd * Removing the config-applier element * Add package support to source-repositories * Increase padding to allow for smaller images * Remove old versions of grub2 from the yum cache * Implement dhcp-all-interfaces for systemd * Install tcpdump on Fedora * Mark install-packages +x * Make sure a loop device exists before kpartx is called * Fixed command dib-init-system not found error * Refactor unmount\_image with unmount\_dir * Fixed device or resource busy issue in EXIT trap * Add a package mapping for libvirt-dev 0.1.3 ----- * Log unsupported source repository types * Improve source-repositories git caching * Add element to modify /etc/apt/sources.list in dib * Fix package-mappings for openSUSE * Update login.defs on openSUSE * Make sure sbin paths are in $PATH 0.1.2 ----- * Add -U to pip install command in tox.ini * Add zypper element * Increase the size heuristic for images * opensuse: Update README.md * Fix $TARGET\_ROOT usage in yum element * local-config: Configure proxy for zypper repos * Updates tox.ini to use new features * Quieten disk-image-get-kernel 0.1.1 ----- * Add support for building openSUSE images * Add examples for ramdisk-image-create * Fix no busybox symlinks issue on rhel * Log the repository fetches in source-repositories * Default name for ramdisks to image * Add deploy ramdisk element for Ironic 0.1.0 ----- * Modify /etc/selinux/config if it exists * Drop default distribution root element support * Remove dot after TMP\_HOOKS\_PATH * Store DIB\_\* only env variables * Remove the dot typo in extra-data script * Updates .gitignore * Switch Ubuntu element to installing saucy * Enhance dib-run-parts usage message * Add mapping for tgt to RHEL element * Update openssl for Fedora * Add option --image-size * Fix typo in source-repositories README 0.0.11 ------ * Detect udevd version and behave accordingly * Fix issue with Ubuntu grub pre-install step for ARM * Check existence of rhel rpm key * Fix troubleshooting override * Support building wheels (PEP-427) * Document ramdisk troubleshooting * Add troubleshooting override to deploy ramdisk * Add mapping for gearmand * Make pxe\_mac accurate in two common cases * /bin/bash all the things * Split network bringup out of base ramdisk init * Don't block the upstart daemon if it doesn't exist * Make sorting of ramdisk init elements explicit * Provide a way of determining init system used * Usage message enhancement 0.0.10 ------ * Add mapping for libffi-dev * Allow heat-admin to sudo without tty * Python code refactorings * Add \*.egg to .gitignore * Remove BUSYBOX variable from ramdisk-defaults * Replace assertEquals with assertEqual * Updated from global requirements 0.0.9 ----- * Check existence of directory 'lost+found' * Remove mapping of atftpd to tftpd-server * Remove dependency on dracut-network * Add redhat mapping from tftpd-hpa to tftp-server 0.0.8 ----- * Add apache and mod\_wsgi to Fedora's package map * Allow for bad Fedora image mirrors * exit 44 if http 404 is returned * Ignore basename failures * Dracut regenerate initrd w/ the right kernel * Fix disk-image-get-kernel for redhat * Remove framebuffer video drivers from ramdisks * Remove old-kernels for fedora 0.0.7 ----- * Conditionally add dhcp-all-interfaces 0.0.6 ----- * Remove \r chars from dhcp-all-interfaces * Make dhcp-all-interfaces block all interfaces * Fix ifquery call in dhcp-all-interfaces * Allow for redirects to ftp servers * Updated from global requirements * Specify distro release in fedora image name * Move /tmp/ccache setup to base element * Use --numeric-owner when extracting base image * Mount /dev/pts in chroot * Using python to run testr instead * Make RHEL subscription optional 0.0.5 ----- * Increase journal size to 64 M for ext4 file system * Fix mellanox module loading * Ignore empty files returned by curl * Generate interfaces file before cloud-init runs * Updated from global requirements * Fix typo in dhcp-all-interfaces * Set locale for the profiling printf command * Update from requirements 0.0.4 ----- * Deprecate first-boot.d * Add mapping for atftpd in fedora/rhel * Make RHEL subscriptions optional * Add RHEL mapping for openssh-client * Add RHEL mapping for augeas-tools * Add RHEL mapping for default-jre * Translations license statement correction 0.0.3 ----- * Do not prompt on removal of apt-xapian-index from ubuntu cloud images * Add DIB\_IMAGE\_CACHE 0.0.2 ----- * Remove apt-xapian-index from ubuntu cloud images * Use lazy umount to avoid race problems with dev * Remove github references * Move textmode forcer to vm element * Fix grub/linux text mode override * Add deploy-kexec element * Consolidate the checks for /etc/grub * Check cached file size when downloading an url * Fedora 19 has no grub2 conf file * Install fedora grub from cached rpm during finalise * Remove -r option from kpartx for successful build * Fixes files ordering when choosing newest image * Add package mapping for default-jre * Set raw image size to be multiple of 64k 0.0.1 ----- * Delete -new image once copied * Add --list support to dib-run-parts * On Fedora, use Linux Foundation bzr lsb\_release * Add support for file to source-repositories * Install patch for dracut patching * Add rhel installation element * Add option --min-tmpfs to disk-image-create * Add package mappings for MySQL-MariaDB * Combine compress and save image into one function * Extlinux fallback * Rename 51-grub to 51-bootloader * Add a pip-cache element * Fix URL to os-apply-config * qpid package mappings * Call sync before unmounting keeps the mount from being busy * Remove a device mapping, then let the loop device get removed * Extracting common functionality for rpm based distros * Use kpartx if partition device doesn't exist * Set file permission to be executable * Fixed a network setup issue for F19 * Update stackforge references to openstack * Package dib-run-parts * Add yum element * dkms is unavailable on RHEL and derivatives * Fix pypi element README.md errors * Allow using a pypi mirror to install via pip * Make $HOME in the chroot be reasonable * Cleanup mount points automatically * Change the rootfs label in F18 and F19 * Remove explicit sudoers requirement * Document the dangers of co-existing elements * Blacklist H803 * Capture the repositories from source-repositories * Improve caching documentation * Package with pbr * Add a new break on error * Ensure $TMP\_BUILD\_DIR is actually created * Modify relative paths of lib, elements for packaging * Add binaries for setuptools * Make Ubuntu 13.04 (raring) the default release * Ignore emacs autosave files in source-repositories * Provide hint for what package contains qemu-img * Fix hacking errors * Add downloadonly flag to fedora * Fixed up test-requirements * Add needed symlink for Fedora deployment ramdisk * Install which on Fedora * Only remove $TMP\_BUILD\_DIR on cleanup * Enable running disk-image-create on SUSE Linux * Update TripleO incubator URL reference * Support repo names with multiple '-'s * Set work-dir to cached repository * Move the getsources hook earlier * Cache repository-sources data * Update the Fedora element to honour --offline * Enable --offline support for Ubuntu root images * Fix the DIB\_OFFLINE setting to actually work * Document an interface for offline operation * Allow 'sudo kpartx -d' used in EACTION for Fedora * Move end user docs higher up in README.md * Remove excess whitespace in README.md * Fedora 19 GRUB * Fix for mounted readonly filesystem for Fedora 19 * EFI hosts * F19 GRUB configuration file * Add package mappings for augeas-tools and openssh-client * Build ramdisks in an image chroot * Make cloud-init-nocloud work cross-platform * Update Fedora cloud image to its latest version * Adding docs for the source-repositories element * Use ccache to cache all compiles between builds * Add environment.d hook to setup environment * Curl to redo the request (Found 302) * Fix loop0p2 does not exist on F19 * Add arping to the fedora map-packages * Fix 50-firmware.rules no such file on Fedora 19 * Add mysql-devel to fedora map-packages * Fix cache-url to use single '=' in test expression * Fix cloud-init routing issue on Fedora * Move functions to common-functions for reuse * Factor out element processing * Consolidate more ramdisk and disk-image code * Fix pyOpenSSL on Fedora * Improve debugging of missing elements * Fix unit tests to have accurate return code * Use the source-repository interface * Install git with source-repositories element * Use full path to dib-run-parts during firstboot * Enable Flake8 F\*\*\* checks * Switch from pep8 to flake8/hacking * Re-use cache\_url() in fedora element * Improve first time download of ubuntu images * Use dib-run-parts on dib-first-boot * Reduce duplication between ramdisk and disk image codepaths * Add mechanism to send error messages to helper * Make bash troubleshooting configurable * Make the finalise\_base function less Ubuntu-ish * Adding element to get source for elements * deploy element: Call find\_disk in loop w/ timeout * Add disable-selinux element * dib-run-parts was failing with empty targets * Add /usr/local/bin to the secure\_path variable * Fix cloud-init-nocloud to actually work * Stop apt-get installing qemu-img * Change the rootfs label in fedora's /etc/fstab * Add zlib-devel and qemu-img to fedora map-packages * Document some dependencies * Add RedHat support for disk-image-get-kernel * Add dracut-network element * Add fedora support for ramdisk-image-create * Remove obsolete Fedora rc-local install.d hook * Switch from losetup+partprobe to kpartx for Fedora image creation * Move package install of dkms to install.d * Fix fedora element to work with qcow2 images * Install dkms before using it * Build all dkms modules near the end of the image build * Set correct mode for .ssh/authorized\_keys files * Update sudoers rules for 1PB resizing * Increase the size heuristic for images * The ext4 resize fix was faulty - fix it * Basic wall clock profiling per element script * Move the ensure\_nbd function call * Ensure that the ext4 fs can be rebuilt up to 1PB in size * Force text mode console in base element * Refactor the first boot routine * Run fixfiles restore in chroot instead of firstboot * Trigger SELinux autorelabel on first boot * An element for putting SELinux in permissive mode * Fix for running /etc/rc.local on Fedora * Honor $DIB\_IMAGE\_SIZE * install redhat-lsb before pre-install.d baseline-tools * install redhat-lsb-core instead of redhat-lsb * Enable serial console for fedora * Fix fedora fstab so / is mounted rw properly * Add an element to configure a serial console * Retry losetup -d for up to 10 seconds * Force the inclusion of /usr/local/bin in PATH * Tweak the moved cleanup\_dirs to match the original * Remove img-functions from ramdisk-image-create * Ignore errors when ldd'ing static binaries * Extend mellanox support to disk images * Reinstate support for real hardware with Ubuntu * Remove tripleo PPA from base element * Only use tmpfs if build machine has 4GB+ RAM * Use conditional GET to fetch latest ubuntu image * Revert "Improve Fedora build host support." * Fix architecture filter * Unbreak grub for precise * Fix GRUB command quote escape for VM element * Fix GRUB for for precise * Fix missing export of $ARCH * Improve Fedora build host support * Use a different approach to solving the ramdisk-image-create failure * Source img-functions into common-functions * Build images using loopdev instead of qemu-nbd * Add few other packages to the map list for fedora * Fix up the conflict between audit and glibc packages * Improve Fedora build host support: architectures * Fix Ubuntu image fetching * Fix a small typo in fake init scripts * Adds support for post-install scripts * Grab the next available /dev/nbdX * Allow build dir to be changed from /tmp * Migrate cloud image URL/Release options to DIB\_ * Introduce the DIB\_ namespace for build-time config * Fedora element allows root to sudo without TTY * Generate ssh hostkeys on first-boot * Add armhf support * Always include the in-tree elements directory * Delete elements moved to tripleo-image-elements * Update README.md for build-time state capture * Fix mysql migration script to handle errors * Remove strict sql\_mode setting which breaks apps * Do not require arguments for os-svc-daemon * Store build-time settings * Disable tunneling in quantum-ovs * Migrate data into MySQL from bootstrap * Run os-config-applier using os-refresh-config * Bring os-svc-install element docs up-to-date * Enable use\_namespaces setting for quantum agents * Clearly mark unaudited config templates as such * Replace glance-api+glance-reg elements with glance: * Streamline upstart scripts in os-svc-daemon * Add a nova-baremetal element * Add a quantum element * Run all openstack services in virtualenvs: * Add element to run DHCP on all network interfaces * Create users in mysql server based on metadata * Set mysql server\_id based on instance-id * Refactor mysql element to do less in first-boot.d * Adding cfn-credentials file to heat-cfntools * remove unnecessary '/usr/local/bin' from install.d * Install os-config-applier from stackforge repo * Switch to using the incubator-bootstrap tree * Fix os-refresh-config failing without scripts * Remove duplicate file extensions * Correctly translate all branches/tags/shas: * Update keystone middleware in cinder api-paste: * Fix script that installs os-refresh-config scripts * local-config: Configure proxy for apt and/or yum * Fix issues causing Fedora images to fail * Seperate install of services and start scripts: * Update keystone element to use os-refresh-config * Make 99-install-config-templates executable: * Install os-refresh-config scripts automatically * local-config element adds authorized\_key for root: * Integrate os-refresh-config with heat-cfntools * Allow elements to include skeleton config * Add a cinder element * Namespace SHA256SUMS file to distro/release/arch * Fix heat-cfntools to work on Fedora * Verify Ubuntu Cloud Images using SHA256SUMS * Fix elements\_path default path * Use multiple locations for elements dir * Specify os-refresh-config path in README * Don't use sudo in base * Add an openstack all-openstack-db element: * Devstack element pulls from master * Fix ramdisk-image-create * Run alternatives pip -> pip-python * Install heat-cfntools from pypi * Support multiple outputs disk formats * Prevent silent failure of element-info: * Fix the sudo rules for unpacking fedora raw images * first-boot.d scripts log to a file: * Fedora needs to depend on dib-run-parts too * New element that uses a fedora cloud image as the base * Add dib-run-parts install command to sudoers.d * Use dib-run-parts for running scripts in target * Make populate\_libs() more generic * Work in progress run-parts replacement * Move the dpkg specific stuff to a dpkg element rather than being hardcoded * Change run-parts usage to be compatible with Fedora * Give stack user passwordless sudo: * Consolidate common OS installation into a script: * Bad code landed, causing ubuntu to be always landed * cloud-init-nocloud element for non-cloud image * Add cfn-hup configuration for os-refresh-config * Fix broken pep8 in setup.py * Add element to call os-refresh-config * Add default element selection * Correct misuse of return in ramdisk-image-create * Fix unnecessarily creating a temporary directory * ramdisk-image-create shows a failed binary dependency * The default ARCH was broken due to $ARCH not being exported * Add missing python-pip dependency in heat-jeos * Work around cfn API bug in HEAT w/ specific boto * Move initial root contents into a hook * Make it possible for openstack-CI to run tests * Export the ELEMENTS\_DIR so that dependencies work * Add os-config-applier element * Split stack user creation out of devstack element * Improve error message for missing element * Create install-packages as a binary * Add option to clear environment * Switch locale to C * Add sudoers rule to format and mount anykind of partitions in disks * Add openstack-all element * Add element to install config-applier * Enable 'ec2-user' in HEAT for quantal images * Add a simple implementation of element dependency * Disable Apt Recommends * add default gateway to deploy init script * Allow manual installation of packages * Include English locale in base * Install nova-api from github * Add Icinga elements * Add missing whitespace to local-config * Replace demo references with incubator * Add an element to install the HEAT JEOS tools * Install quantum-api from github * Clean up the MySQL element to make it suitable for generic use * Fix disk-image-create's getopt error handling: * Tidy up base element: * Add guidelines for composing elements * Copy both http and https proxy to local-config * Add a test framework for testing elements * Ignore .pyc files * Add a .testr.conf configuration and ignore .testrepository * Add the ability to break into a shell during builds * Add glance-api element * Move everything 'common' into base, making it avoidable for tests * Make it possible to not recompress the qcow2 image at the end * Added true to avoid exit on error * updating devstack element to reference incubator * Add keystone element * Add copyright to lib/ramdisk-\* * Generate apt.conf files with correct content, fixes bug 1088805 * Further fleshing out of hwdiscovery element * Move grub installation to the vm element * Rename flavour to element * Configure git proxy settings and prefer http(s) protocol * Use system resolv.conf file when available * Remove udev stuff from the source tree * Add .gitreview file * Jenkins image fixed * Reinstate /mnt redirection of jenkins - HPCS cloud images have a very restricted / * Untrap EXIT before run-parts * Update hwdiscovery flavour to have lots more structure that we can build on * fix crappy header * Updated jenkins flavour * Make a primitive jenkins image * be smarter about mounting qcow images * Use base in all examples * added br\* filter for interfaces * adding BASIC hardware discovery * adding dhclient support * adding dhclient * move misplaced salt-master install script * mount\_qcow\_image should mount p1 * removes AMQP install and adds hwinfo * added lsmod to default busybox links * add salt-master flavor * remove force-xtrace in disk-image-get-kernel * add some tooling that baremetal-devstack wants * move tgtd & tgtadm to bin-deps of deploy and remove from lib/ramdisk-functions * Adding python-AMQPLib install to HWdiscovery * Fix copyrights for HP work * Add a flavour for doing generic this-node-is-in-a-cloud stuff, like cloud-init tweaks * adding mysql flavor (untested) * Document more about the layers * Some cleanup on nova-vm flavour * Add support for flavours to ship udev rules.d files and port over the mellanox variant to use this * Fix mysql passwords * Default to 2G in size - 1G is just too small * Fix handling of parameters that are not set by any flavour for eval\_run\_d * Make it possible to set a size from within a flavour, and use that for devstack * Rename baremetal to deploy * Remove some whitespace * Update ramdisk building to support init hooks for flavours * Update docs for ramdisk building * Add readmes to the ramdisk flavours * Documented binary-deps feature * Port old baremetal-mkinitrd.sh to the new image creation standards * Land an extension of baremetal-mkinitrd.sh which can also build flavours, with a start at making hwdiscovery and hwburning flavours * Bring across disk image code * Ignore temporary files * Support KVM instances - allow /dev/vda to be detected as a disk * Turn off udev logging, it makes debugging too hard. Better would be to log to a file or something * change working directory name template * Rename to baremetal-mkinitrd.sh * initial commit diskimage-builder-2.35.0/lower-constraints.txt0000664000175000017500000000147313640271474021457 0ustar zuulzuul00000000000000alabaster==0.7.10 appdirs==1.3.0 astroid==1.6.2 Babel==2.3.4 coverage==4.0 decorator==3.4.0 docutils==0.11 dulwich==0.15.0 extras==1.0.0 fixtures==3.0.0 flake8==2.5.4 hacking==0.10.0 imagesize==0.7.1 iso8601==0.1.11 isort==4.3.4 Jinja2==2.10 keystoneauth1==3.4.0 lazy-object-proxy==1.3.1 linecache2==1.0.0 MarkupSafe==1.0 mccabe==0.2.1 mock==2.0.0 mox3==0.20.0 networkx==1.10 openstackdocstheme==1.18.1 os-client-config==1.28.0 oslotest==3.2.0 pbr==2.0.0 pep8==1.5.7 pyflakes==0.8.1 Pygments==2.2.0 pylint==1.7.1 python-mimeparse==1.6.0 python-subunit==1.0.0 pytz==2013.6 PyYAML==3.12 reno==2.5.0 requests==2.14.2 requestsexceptions==1.2.0 six==1.10.0 snowballstemmer==1.2.1 Sphinx==1.6.2 sphinxcontrib-websupport==1.0.1 stevedore==1.20.0 testrepository==0.0.18 testtools==2.2.0 traceback2==1.4.0 unittest2==1.1.0 wrapt==1.7.0 diskimage-builder-2.35.0/pylint.cfg0000664000175000017500000000014013640271474017207 0ustar zuulzuul00000000000000[MASTER] persistent=no [MESSAGES CONTROL] disable=all enable=bad-indentation, logging-not-lazy diskimage-builder-2.35.0/AUTHORS0000664000175000017500000002640713640271564016275 0ustar zuulzuul00000000000000Abel Lopez Adam Gandelman Adam Harwell Alex Schultz Alexander Gordeev Alexis Lee Alfredo Moralejo Amrith Kumar Ana Krivokapic Andreas Florath Andreas Florath Andreas Jaeger Andrei Nistor Andrey Shestakov Angel Noam Angus Salkeld Anshul Jain Antoine Musso Aparna Arata Notsu Arx Cruz Atsushi SAKAI Augustina Ragwitz AzherKhan Ben Kero Ben Nemec Ben Nemec Bernard Cafarelli Bob Ball Bob Fournier Bruno Cornec Cady_Chen Cao Xuan Hoang Carlos Goncalves Chandan Kumar (raukadah) Charalampos Kominos Chhavi Agarwal Chris Alfonso Chris Jones Chris Jones Chris Krelle Christian Berendt Chuck Short Cian O'Driscoll Clark Boylan Clint Adams Clint Byrum Cody A.W. Somerville Coleman Corrigan Colleen Murphy Colleen Murphy Corey O'Brien Corey O'Brien Cédric Ollivier Dan Prince Dan Radez Daniel Abad Darragh Bailey Darragh Bailey Dave Hill Dave Thomas David Hill Derek Higgins Devananda van der Veen Dirk Mueller Dmitriy Rabotyagov Dmitry Tantsur Dmitry Tantsur Dmitry Tantsur Doug Hellmann Doug Szumski Dougal Matthews Dustin J. Mitchell Emilien Macchi Endre Karlson Erno Kuvaja Erwan Velu Ethan Gafford Evgeny Antyshev Fatih Degirmenci Felipe Alencastro Frederic Lepied Gabriele Cerami Gary Duan Gaëtan Trellu Ghe Rivero Ghe Rivero Ghe Rivero Ghe Rivero Giulio Fidente Gloria Gonéri Le Bouder Gonéri Le Bouder Gregory Haynes Haomeng, Wang Harald JensÃ¥s Hervé Rousseau Hironori Shiina Hoang Trung Hieu Ian Wienand Igor Belikov Isaac Beckman Iury Gregory Melo Ferreira Ivan Berezovskiy IvanBerezovskiy JUN JIE NAN JUNJIE NAN James Arendt James E. Blair James E. Blair James Polley James Slagle Jamie Lennox Jan Grant Jan Provaznik Jane.zhang Jeff Peeler Jeffrey Zhang Jens Harbott Jeremy Stanley Jerry Zhao Jesse Keating Jesse Pretorius Jiri Stransky Joe Gordon Joey D John L. Villalovos John Trowbridge Jon-Paul Sullivan Jonas Sticha Jonathan Brownell Juan Antonio Osorio Robles Juerg Haefliger Julia Kreger Junya Akahira K Jonathan Harker Kashyap Chamarthy Kevin Carter Kevin TIBI Kiall Mac Innes Kui Shi Lee Yarwood Lennart Regebro Lenny Verkhovsky Lin Tan Liu Qing Logan V Lon Hohberger Luca Lorenzetto Lucas Alvares Gomes Luigi Toscano Luong Anh Tuan Madhuri Kumari Maksim Malchuk Manuel Torrinha Mark Goddard Mark Hamzy Mark McLoughlin Markos Chandras Martin André Martin André Mathieu GagneÌ Mathieu Mitchell Matthew Farrellee Matthew Thode Michael Johnson Michael Kerrin Michael McCune Michael Turek Michael Turek Michele Baldessari Mikhail S Medvedev Mohammed Naser Monty Taylor Moshe Levi NTTdocomo NTTdocomo-openstack Nam Nguyen Hoai Natal Ngétal Newell Jensen Nguyen Hung Phuong Nguyen Van Trung Nicholas Randon Nikhil Manchanda Nir Magnezi Nisha Agarwal NoBodyCam Noam Angel Oded Le'Sage Oliver Walsh Olivier Bourdon Om Kumar OndÅ™ej Nový Paul Belanger Pedro Alvarez Perry Myers Peter Stachowski Pierre Riteau Pierre Riteau Pino Toscano Quique Llorente Rafael Folco Rafael Folco Ralf Haferkamp Ramakrishnan G Ricardo Carrillo Cruz Riccardo Pittau Richard Su Ripal Nathuji Robert Collins Robert Collins Robert Li Robert Myers Roman Gorshunov Roman Podoliaka Russell Sim Ryan Brady Ryan Hallisey Sagi Shnaidman Sam Betts Sam Yaple SamYaple Sandhya Ganapathy Sascha Peilicke Saverio Proto Serena Ziviani Shane Wang Shivanand Tendulker Simon Leinen Sorin Sbarnea Spencer Krum Stanislav Makar Stephen Mulcahy Steve Baker Steve Kowalik Steven Dake Steven DuChene Stuart McLaren Sushil Kumar THOMAS J. COCOZZELLO Thom Leggett Thomas Bechtold Thomas Goirand Tim Flink Tim Miller Tim Potter Tim Serong Tobias Henkel Tomas Hancock Tomas Sedovic Tony Breeds Trent Geerdes Tristan Cacqueray Tristan Cacqueray Uwe Grawert Van Hung Pham Victor Lowther Vipul Sabhaya Vu Cong Tuan Waldemar Znoinski Wesley Hayutin Xiang Chen XiaojueGuan Xinliang Liu Yanis Guenane Yolanda Robla Yolanda Robla Yolanda Robla Mota YuikoTakada Yuriy Zveryanskyy Zhangfei Gao Zhao Lei Zhiguo Deng aweiteka caoyuan chengebj5238 chenxiangui chenxing chriskrelle d.marlin gecong1973 gengchc2 goldyfruit iberezovskiy inspurericzhang jacky06 janonymous jodewey justin-hopper kaiokassiano lifeless liyingjun liyuanzhen loki melissaml nishagbkar nizam pengyuesheng sayalilunkad sjing stephane tanlin vmud213 wangqi weiyj xhzhf yogananth subramanian zhang.lei zhangdebo zhangjian zhouxinyong zhufl diskimage-builder-2.35.0/diskimage_builder/0000775000175000017500000000000013640271564020657 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/version.py0000664000175000017500000000131413640271474022715 0ustar zuulzuul00000000000000# Copyright 2011 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import pbr.version version_info = pbr.version.VersionInfo('diskimage-builder') diskimage-builder-2.35.0/diskimage_builder/__init__.py0000664000175000017500000000000013640271474022756 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/tests/0000775000175000017500000000000013640271564022021 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/tests/__init__.py0000664000175000017500000000000013640271474024120 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/tests/test_no_dup_filenames.py0000664000175000017500000000314313640271474026742 0ustar zuulzuul00000000000000# Copyright 2014 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import glob import os import testtools class TestNoDupFilenames(testtools.TestCase): def test_no_dup_filenames(self): topdir = os.path.normpath(os.path.dirname(__file__) + '/../../') elements_glob = os.path.join(topdir, "elements", "*") filenames = [] dirs_to_check = ['block-device.d', 'cleanup.d', 'extra-data.d', 'finalise.d', 'install.d', 'post-install.d', 'pre-install.d', 'root.d'] for element_dir in glob.iglob(elements_glob): for dir_to_check in dirs_to_check: target_dir = os.path.join(element_dir, dir_to_check, "*") for target in glob.iglob(target_dir): short_path = target[len(element_dir) + 1:] if not os.path.isdir(target): err_msg = 'Duplicate file name found %s' % short_path self.assertFalse(short_path in filenames, err_msg) filenames.append(short_path) diskimage-builder-2.35.0/diskimage_builder/tests/test_loggingconfig.py0000664000175000017500000000372313640271474026253 0ustar zuulzuul00000000000000# Copyright 2016 Andreas Florath (andreas@florath.net) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import fixtures import logging import testtools from diskimage_builder import logging_config class TestLoggingConfig(testtools.TestCase): def test_defaults(self): self.out = self.useFixture(fixtures.StringStream('stdout')) self.useFixture( fixtures.MonkeyPatch('sys.stdout', self.out.stream)) self.err = self.useFixture(fixtures.StringStream('stderr')) self.useFixture( fixtures.MonkeyPatch('sys.stderr', self.err.stream)) self.useFixture(fixtures.EnvironmentVariable('DIB_DEBUG_TRACE', '1')) logging_config.setup() log = logging.getLogger(__name__) log.debug("Debug Message") self.assertIn("Debug Message", self.err._details["stderr"].as_text()) # The follow two are looking for the function name / file name # suffix we log only for debug messages self.assertIn("test_defaults", self.err._details["stderr"].as_text()) self.assertIn("test_loggingconfig.py", self.err._details["stderr"].as_text()) log.info("Info Message") self.assertIn("Info Message", self.err._details["stderr"].as_text()) log.warning("Warning Message") self.assertIn("Warning Message", self.err._details["stderr"].as_text()) log.error("Error Message") self.assertIn("Error Message", self.err._details["stderr"].as_text()) diskimage-builder-2.35.0/diskimage_builder/tests/test_elementdeps.py0000664000175000017500000002337713640271474025753 0ustar zuulzuul00000000000000# Copyright 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging import os import fixtures import testtools from diskimage_builder import element_dependencies logger = logging.getLogger(__name__) data_dir = os.path.abspath( os.path.join(os.path.dirname(__file__), 'test-elements')) def _populate_element(element_dir, element_name, element_deps=[], provides=[]): logger.debug("Populate %s <%s>", element_name, element_dir) element_home = os.path.join(element_dir, element_name) os.mkdir(element_home) deps_path = os.path.join(element_home, 'element-deps') with open(deps_path, 'w') as deps_file: deps_file.write("\n".join(element_deps)) provides_path = os.path.join(element_home, 'element-provides') with open(provides_path, 'w') as provides_file: provides_file.write("\n".join(provides)) class TestElementDeps(testtools.TestCase): def setUp(self): super(TestElementDeps, self).setUp() self.element_root_dir = self.useFixture(fixtures.TempDir()).path self.element_dir = os.path.join(self.element_root_dir, 'elements') self.element_override_dir = os.path.join(self.element_root_dir, 'element-override') os.mkdir(self.element_dir) os.mkdir(self.element_override_dir) self.log_fixture = self.useFixture( fixtures.FakeLogger(level=logging.DEBUG)) _populate_element(self.element_dir, 'requires-foo', ['foo']) _populate_element(self.element_dir, 'foo', [], ['operating-system']) _populate_element(self.element_dir, 'requires-requires-foo', ['requires-foo']) _populate_element(self.element_dir, 'self', ['self']) _populate_element(self.element_dir, 'provides_virtual', [], ['virtual']) _populate_element(self.element_dir, 'also_provides_virtual', [], ['virtual']) _populate_element(self.element_dir, 'requires_virtual', ['virtual'], ['operating-system']) _populate_element(self.element_dir, 'virtual', ['extra_dependency']) _populate_element(self.element_dir, 'extra_dependency', []) _populate_element(self.element_dir, 'circular1', ['circular2'], ['operating-system']) _populate_element(self.element_dir, 'circular2', ['circular1']) _populate_element(self.element_dir, 'provides_new_virtual', [], ['new_virtual', 'operating-system']) _populate_element(self.element_dir, 'requires_new_virtual', ['new_virtual']) # second element should override the first one here _populate_element(self.element_dir, 'override_element', []) _populate_element(self.element_override_dir, 'override_element', []) # This simulates $ELEMENTS_PATH self.element_dirs = "%s:%s" % (self.element_override_dir, self.element_dir) # helper to return an (element, path) tuple from the standard dir def _e(self, element): return (element, os.path.join(self.element_dir, element)) # helper to return an (element, path) tuple from the override dir def _eo(self, element): return (element, os.path.join(self.element_override_dir, element)) def test_non_transitive_deps(self): result = element_dependencies.get_elements(['requires-foo'], self.element_dirs) self.assertItemsEqual([self._e('foo'), self._e('requires-foo')], result) def test_missing_deps(self): e = self.assertRaises(element_dependencies.MissingElementException, element_dependencies.get_elements, ['fake'], self.element_dirs) self.assertIn("Element 'fake' not found", str(e)) def test_invalid_element_dir(self): e = self.assertRaises(element_dependencies.InvalidElementDir, element_dependencies.get_elements, ['fake'], self.element_dirs + ":/not/a/dir") self.assertIn("ELEMENTS_PATH entry '/not/a/dir' is not a directory", str(e)) def test_transitive_deps(self): result = element_dependencies.get_elements( ['requires-requires-foo'], self.element_dirs) self.assertItemsEqual([self._e('requires-requires-foo'), self._e('requires-foo'), self._e('foo')], result) def test_no_deps(self): result = element_dependencies.get_elements(['foo'], self.element_dirs) self.assertEqual([self._e('foo')], result) def test_self(self): result = element_dependencies.get_elements(['self', 'foo'], self.element_dirs) self.assertItemsEqual([self._e('self'), self._e('foo')], result) def test_circular(self): result = element_dependencies.get_elements(['circular1'], self.element_dirs) self.assertItemsEqual([self._e('circular1'), self._e('circular2')], result) def test_provide(self): result = element_dependencies.get_elements( ['provides_virtual', 'requires_virtual'], self.element_dirs) self.assertItemsEqual([self._e('requires_virtual'), self._e('provides_virtual')], result) def test_provide_conflict(self): self.assertRaises(element_dependencies.AlreadyProvidedException, element_dependencies.get_elements, ['virtual', 'provides_virtual'], self.element_dirs) def test_provide_virtual_ordering(self): result = element_dependencies.get_elements( ['requires_new_virtual', 'provides_new_virtual'], self.element_dirs) self.assertItemsEqual( [self._e('requires_new_virtual'), self._e('provides_new_virtual')], result) def test_elements_provide_same(self): msg = r"virtual: already provided by \['provides_virtual'\]" self.assertRaisesRegex(element_dependencies.AlreadyProvidedException, msg, element_dependencies.get_elements, ['provides_virtual', 'also_provides_virtual'], self.element_dirs) def test_no_os_element(self): self.assertRaises(element_dependencies.MissingOSException, element_dependencies.get_elements, ['provides_virtual'], self.element_dirs) def test_duplicated_os_passed_as_element(self): self.assertRaises( element_dependencies.AlreadyProvidedException, element_dependencies.get_elements, ['circular1', 'operating-system'], self.element_dirs) # ensure we get the error message about what's providing the # conflicting package self.assertIn("operating-system : already provided by ['circular1']", self.log_fixture.output) def test_element_override(self): # make sure we picked up "override_element" from the override dir, # not the base dir result = element_dependencies.get_elements(['override_element', 'foo'], self.element_dirs) self.assertItemsEqual([self._e('foo'), self._eo('override_element')], result) def test_expand_dependencies_deprecated(self): # test the deprecated expand_dependencies call result = element_dependencies.expand_dependencies( ['foo', 'requires-foo'], self.element_dirs) self.assertItemsEqual(['foo', 'requires-foo'], result) def test_output_sanity(self): # very basic output sanity test elements = element_dependencies._get_elements(['foo', 'requires-foo'], self.element_dirs) element_dependencies._output_env_vars(elements) class TestElements(testtools.TestCase): def test_depends_on_env(self): self.useFixture( fixtures.EnvironmentVariable('ELEMENTS_PATH', '/foo/bar')) self.assertEqual('/foo/bar', element_dependencies._get_elements_dir()) def test_env_not_set(self): self.useFixture(fixtures.EnvironmentVariable('ELEMENTS_PATH', '')) self.assertRaises(Exception, element_dependencies._get_elements_dir, ()) diskimage-builder-2.35.0/diskimage_builder/tests/functional/0000775000175000017500000000000013640271564024163 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/tests/functional/__init__.py0000664000175000017500000000000013640271474026262 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/tests/base.py0000664000175000017500000000402713640271474023310 0ustar zuulzuul00000000000000# Copyright 2014 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # TODO(bnemec): This whole file is a copy-paste of the one in # tripleo-image-elements. That duplication needs to be eliminated. import os import subprocess import sys import tempfile from oslotest import base class ScriptTestBase(base.BaseTestCase): def setUp(self): super(ScriptTestBase, self).setUp() self.tmpdir = tempfile.mkdtemp() self.env = os.environ.copy() self.env['PATH'] = self.tmpdir + ':' + self.env['PATH'] def _stub_script(self, name, contents): filename = os.path.join(self.tmpdir, name) with open(filename, 'w') as f: f.write('#!/bin/bash\n') f.write(contents) f.write('\n') os.chmod(filename, 0o700) def _run_command(self, cmd): try: # check_output doesn't exist in Python < 2.7 if sys.hexversion < 0x02070000: runner = subprocess.check_call else: runner = subprocess.check_output return runner(cmd, stderr=subprocess.STDOUT, env=self.env) # NOTE(bnemec): Handle the exception so we can extract as much # information as possible. except subprocess.CalledProcessError as e: # The check_call exception won't have any data in e.output if sys.hexversion < 0x02070000: self.fail(e) else: self.fail(e.output) diskimage-builder-2.35.0/diskimage_builder/lib/0000775000175000017500000000000013640271564021425 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/lib/img-defaults0000664000175000017500000000155213640271474023734 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2012 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. source $_LIB/common-defaults # options for create-baremetal-image.sh export FS_TYPE=${FS_TYPE:-ext4} # Used to set the file extension only at this stage. export IMAGE_TYPE=${IMAGE_TYPE:-qcow2} export IMAGE_NAME=${IMAGE_NAME:-image} diskimage-builder-2.35.0/diskimage_builder/lib/disk-image-create0000664000175000017500000006041613640271474024632 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2012 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. set -eE # Set/override locale. This ensures consistency in sorting etc. We # need to choose a lowest-common denominator locale, as this is # applied when running in the building chroot too (maybe a bug and we # should prune this?). Thus "C" --centOS 7 doesn't include C.utf-8 # (fedora does, centos 8 probably will). Note: LC_ALL to really # override this; it overrides LANG and all other LC_ vars export LC_ALL=C # Store our initial environment and command line args for later export DIB_ARGS="$@" export DIB_ENV=$(export | grep ' DIB_.*=') SCRIPTNAME=$(basename $0) if [ -z "$_LIB" ]; then echo "_LIB not set!" exit 1 fi _BASE_ELEMENT_DIR=$(${DIB_PYTHON_EXEC:-python} -c ' import diskimage_builder.paths diskimage_builder.paths.show_path("elements")') source $_LIB/die IS_RAMDISK=0 if [ "$SCRIPTNAME" == "ramdisk-image-create" ]; then IS_RAMDISK=1 fi function show_options () { echo "Usage: ${SCRIPTNAME} [OPTION]... [ELEMENT]..." echo echo "Options:" echo " -a i386|amd64|armhf|arm64 -- set the architecture of the image(default amd64)" echo " -o imagename -- set the imagename of the output image file(default image)" echo " -t qcow2,tar,tgz,squashfs,vhd,docker,aci,raw -- set the image types of the output image files (default qcow2)" echo " File types should be comma separated. VHD outputting requires the vhd-util" echo " executable be in your PATH. ACI outputting requires the ACI_MANIFEST " echo " environment variable be a path to a manifest file." echo " -x -- turn on tracing (use -x -x for very detailed tracing)." echo " -u -- uncompressed; do not compress the image - larger but faster" echo " -c -- clear environment before starting work" echo " --logfile -- save run output to given logfile (implies DIB_QUIET=1)" echo " --checksum -- generate MD5 and SHA256 checksum files for the created image" echo " --image-size size -- image size in GB for the created image" echo " --image-extra-size size -- extra image size in GB for the created image" echo " --image-cache directory -- location for cached images(default ~/.cache/image-create)" echo " --max-online-resize size -- max number of filesystem blocks to support when resizing." echo " Useful if you want a really large root partition when the image is deployed." echo " Using a very large value may run into a known bug in resize2fs." echo " Setting the value to 274877906944 will get you a 1PB root file system." echo " Making this value unnecessarily large will consume extra disk space " echo " on the root partition with extra file system inodes." echo " --min-tmpfs size -- minimum size in GB needed in tmpfs to build the image" echo " --mkfs-journal-size -- filesystem journal size in MB to pass to mkfs." echo " --mkfs-options -- option flags to be passed directly to mkfs." echo " Options should be passed as a single string value." echo " --no-tmpfs -- do not use tmpfs to speed image build" echo " --offline -- do not update cached resources" echo " --qemu-img-options -- option flags to be passed directly to qemu-img." echo " Options need to be comma separated, and follow the key=value pattern." echo " --root-label label -- label for the root filesystem. Defaults to 'cloudimg-rootfs'." echo " --ramdisk-element -- specify the main element to be used for building ramdisks." echo " Defaults to 'ramdisk'. Should be set to 'dracut-ramdisk' for platforms such" echo " as RHEL and CentOS that do not package busybox." echo " --install-type -- specify the default installation type. Defaults to 'source'. Set to 'package' to use package based installations by default." echo " --docker-target -- specify the repo and tag to use if the output type is docker. Defaults to the value of output imagename" if [ "$IS_RAMDISK" == "0" ]; then echo " -n skip the default inclusion of the 'base' element" echo " -p package[,p2...] [-p p3] -- extra packages to install in the image. Runs once, after 'install.d' phase. Can be specified multiple times" fi echo " -h|--help -- display this help and exit" echo " --version -- display version and exit" echo echo "Environment Variables:" echo " (this is not a complete list)" echo echo " * ELEMENTS_PATH: specify external locations for the elements. As for \$PATH" echo " * DIB_NO_TIMESTAMP: no timestamp prefix on output. Useful if capturing output" echo " * DIB_QUIET: 1=do not output log output to stdout; 0=always ouptut to stdout. See --logfile" echo echo "NOTE: At least one distribution root element must be specified." echo echo "NOTE: If using the VHD output format you need to have a patched version of vhd-util installed for the image" echo " to be bootable. The patch is available here: https://github.com/emonty/vhd-util/blob/master/debian/patches/citrix" echo " and a PPA with the patched tool is available here: https://launchpad.net/~openstack-ci-core/+archive/ubuntu/vhd-util" echo echo "Examples:" if [ "$IS_RAMDISK" == "0" ]; then echo " ${SCRIPTNAME} -a amd64 -o ubuntu-amd64 vm ubuntu" echo " export ELEMENTS_PATH=~/source/tripleo-image-elements/elements" echo " ${SCRIPTNAME} -a amd64 -o fedora-amd64-heat-cfntools vm fedora heat-cfntools" else echo " ${SCRIPTNAME} -a amd64 -o fedora-deploy deploy fedora" echo " ${SCRIPTNAME} -a amd64 -o ubuntu-ramdisk ramdisk ubuntu" fi } function show_version() { ${DIB_PYTHON_EXEC:-python} -c "from diskimage_builder import version; print(version.version_info.version_string())" } DIB_DEBUG_TRACE=${DIB_DEBUG_TRACE:-0} INSTALL_PACKAGES="" IMAGE_TYPES=("qcow2") COMPRESS_IMAGE="true" DIB_GZIP_BIN=${DIB_GZIP_BIN:-"gzip"} ROOT_LABEL="" DIB_DEFAULT_INSTALLTYPE=${DIB_DEFAULT_INSTALLTYPE:-"source"} MKFS_OPTS="" ACI_MANIFEST=${ACI_MANIFEST:-} DOCKER_TARGET="" LOGFILE="" TEMP=`getopt -o a:ho:t:xucnp: -l checksum,no-tmpfs,offline,help,version,min-tmpfs:,image-size:,image-cache:,max-online-resize:,mkfs-options:,qemu-img-options:,ramdisk-element:,root-label:,install-type:,docker-target:,logfile: -n $SCRIPTNAME -- "$@"` if [ $? -ne 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi # Note the quotes around `$TEMP': they are essential! eval set -- "$TEMP" while true ; do case "$1" in -a) export ARCH=$2; shift 2 ;; -o) export IMAGE_NAME=$2; shift 2 ;; -t) IFS="," read -a IMAGE_TYPES <<< "$2"; export IMAGE_TYPES ; shift 2 ;; -h|--help) show_options; exit 0;; --version) show_version; exit 0;; -x) shift; DIB_DEBUG_TRACE=$(( $DIB_DEBUG_TRACE + 1 ));; -u) shift; export COMPRESS_IMAGE="";; -c) shift ; export CLEAR_ENV=1;; -n) shift; export SKIP_BASE="1";; -p) IFS="," read -a _INSTALL_PACKAGES <<< "$2"; export INSTALL_PACKAGES=( ${INSTALL_PACKAGES[@]} ${_INSTALL_PACKAGES[@]} ) ; shift 2 ;; --checksum) shift; export DIB_CHECKSUM=1;; --image-size) export DIB_IMAGE_SIZE=$2; shift 2;; --image-extra-size) export DIB_IMAGE_EXTRA_SIZE=$2; shift 2;; --image-cache) export DIB_IMAGE_CACHE=$2; shift 2;; --max-online-resize) export MAX_ONLINE_RESIZE=$2; shift 2;; --mkfs-journal-size) export DIB_JOURNAL_SIZE=$2; shift 2;; --mkfs-options) MKFS_OPTS=$2; shift 2;; --min-tmpfs) export DIB_MIN_TMPFS=$2; shift 2;; --no-tmpfs) shift; export DIB_NO_TMPFS=1;; --offline) shift; export DIB_OFFLINE=1;; --qemu-img-options) QEMU_IMG_OPTIONS=$2; shift 2;; --root-label) ROOT_LABEL=$2; shift 2;; --ramdisk-element) RAMDISK_ELEMENT=$2; shift 2;; --install-type) DIB_DEFAULT_INSTALLTYPE=$2; shift 2;; --docker-target) export DOCKER_TARGET=$2; shift 2 ;; --logfile) export LOGFILE=$2; shift 2 ;; --) shift ; break ;; *) echo "Internal error!" ; exit 1 ;; esac done export DIB_DEBUG_TRACE # TODO: namespace this under ~/.cache/dib/ for consistency export DIB_IMAGE_CACHE=${DIB_IMAGE_CACHE:-~/.cache/image-create} mkdir -p $DIB_IMAGE_CACHE # Setup a symbolic link to the correct python exec so that element # scripts running outside the chroot using "#!/usr/bin/env python" get # the right python version. export DIB_ORIGINAL_PATH=$PATH export DIB_PYTHON_EXEC_TMP=$(mktemp -d -t --tmpdir=$HOME .DIB_PYTHON_TMP.XXXXXXXX) ln -s "$DIB_PYTHON_EXEC" "$DIB_PYTHON_EXEC_TMP/python" export PATH=$DIB_PYTHON_EXEC_TMP:$DIB_ORIGINAL_PATH # We have a couple of critical sections (touching parts of the host # system or download images to common cache) that we use flock around. # Use this directory for lockfiles. export DIB_LOCKFILES=${DIB_LOCKFILES:-~/.cache/dib/lockfiles} mkdir -p $DIB_LOCKFILES if [ "$CLEAR_ENV" = "1" -a "$HOME" != "" ]; then echo "Re-execing to clear environment." echo "(note this will prevent much of the local_config element from working)" exec -c $0 "$@" fi # We send stdout & stderr through "outfilter" which does timestamping, # basic filtering and log file output. _TS_FLAG="" if [[ "${DIB_NO_TIMESTAMP:-0}" -eq 1 ]]; then _TS_FLAG="--no-timestamp" fi # A logfile with *no* DIB_QUIET specified implies we just want output # to the logfile. Explicitly setting DIB_QUIET=0 will overide this # and log both. if [[ -n "${LOGFILE}" && -z "${DIB_QUIET}" ]]; then DIB_QUIET=1 fi _QUIET_FLAG="-v" if [[ "${DIB_QUIET:-0}" -eq 1 ]]; then _QUIET_FLAG="" fi _LOGFILE_FLAG="" if [[ -n "${LOGFILE}" ]]; then echo "Output logs going to: ${LOGFILE}" _LOGFILE_FLAG="-o ${LOGFILE}" fi # Save the existing stdout to fd3 exec 3>&1 exec 1> >( ${DIB_PYTHON_EXEC:-python} $_LIB/outfilter.py ${_TS_FLAG} ${_QUIET_FLAG} ${_LOGFILE_FLAG} ) 2>&1 # Display the current file/function/line in the debug output function _ps4 { IFS=" " called=($(caller 0)) local f=$(readlink -f ${called[2]}) # As we're being run out of the python package's lib/ dir (either # virtualenv or system), we can strip everything before # "site-packages" to significantly shorten the line without really f=${f##*site-packages/} printf "%-80s " "$f:${called[1]}:${called[0]}" } export -f _ps4 export PS4='+ $(_ps4): ' source $_LIB/img-defaults source $_LIB/common-functions source $_LIB/img-functions if [ "$IS_RAMDISK" == "1" ]; then source $_LIB/ramdisk-defaults source $_LIB/ramdisk-functions fi echo "diskimage-builder version $(show_version)" # If no elements are specified theres no way we can succeed if [ -z "$*" ]; then echo "ERROR: At least one distribution root element must be specified" exit 1 fi arg_to_elements "$@" # start tracing after most boilerplate if [ ${DIB_DEBUG_TRACE} -gt 0 ]; then set -x fi if [ "${#IMAGE_TYPES[@]}" = "1" ]; then export IMAGE_NAME=${IMAGE_NAME%%\.${IMAGE_TYPES[0]}} fi # Check for required tools early on for X in ${!IMAGE_TYPES[@]}; do case "${IMAGE_TYPES[$X]}" in qcow2) if ! type qemu-img > /dev/null 2>&1; then echo "qcow2 output format specified but qemu-img executable not found." exit 1 fi ;; tgz) # Force tar to be created. IMAGE_TYPES+=('tar') ;; vhd) if ! type vhd-util > /dev/null 2>&1; then echo "vhd output format specified but no vhd-util executable found." exit 1 fi ;; squashfs) if ! type mksquashfs > /dev/null 2>&1; then echo "squashfs output format specified but no mksquashfs executable found." exit 1 fi ;; docker) if ! type docker > /dev/null 2>&1; then echo "docker output format specified but no docker executable found." exit 1 fi if [ -z "$DOCKER_TARGET" ]; then echo "Please set --docker-target." exit 1 fi ;; esac done # NOTE: fstrim is on most all recent systems. It is provided by the util-linux # package. if ! type fstrim > /dev/null 2>&1; then echo "fstrim utility is not found. This is provided by util-linux package" echo "Please check your PATH variable is set correctly" exit 1 fi # xattr support cannot be relied upon with tmpfs builds # some kernels supoprt it, some don't if [[ -n "${GENTOO_PROFILE}" ]]; then if [[ "${GENTOO_PROFILE}" =~ "hardened" ]]; then echo 'disabling tmpfs for gentoo hardened build' export DIB_NO_TMPFS=1 fi fi mk_build_dir # Create the YAML file with the final and raw configuration for # the block device layer. mkdir -p ${TMP_BUILD_DIR}/block-device BLOCK_DEVICE_CONFIG_YAML=${TMP_BUILD_DIR}/block-device/config.yaml block_device_create_config_file "${BLOCK_DEVICE_CONFIG_YAML}" # Write out the parameter file DIB_BLOCK_DEVICE_PARAMS_YAML=${TMP_BUILD_DIR}/block-device/params.yaml export DIB_BLOCK_DEVICE_PARAMS_YAML cat >${DIB_BLOCK_DEVICE_PARAMS_YAML} < $TMP_HOOKS_PATH/environment.d/11-dib-install-type.bash run_d extra-data # Run pre-install scripts. These do things that prepare the chroot for package installs run_d_in_target pre-install # Call install scripts to pull in the software users want. run_d_in_target install do_extra_package_install run_d_in_target post-install run_d post-root # ensure we do not have a lost+found directory in the root folder # that could cause copy to fail (it will be created again later # when creating the file system, if it needs such directory) if [ -e "$TMP_BUILD_DIR/mnt/lost+found" ]; then sudo rm -rf "$TMP_BUILD_DIR/mnt/lost+found" fi # Free up /mnt unmount_image mv $TMP_BUILD_DIR/mnt $TMP_BUILD_DIR/built # save xtrace state, as we always want to turn it off to avoid # spamming the logs with du output below. xtrace=$(set +o | grep xtrace) # temp file for holding du output du_output=${TMP_BUILD_DIR}/du_output.tmp if [ -n "$DIB_IMAGE_SIZE" ]; then du_size=$(echo "$DIB_IMAGE_SIZE" | awk '{printf("%d\n",$1 * 1024 *1024)}') else set +o xtrace echo "Calculating image size (this may take a minute)..." sudo du -a -c -x ${TMP_BUILD_DIR}/built > ${du_output} # the last line is the total size from "-c". if [ -n "$DIB_IMAGE_EXTRA_SIZE" ]; then # add DIB_IMAGE_EXTRA_SIZE megabytes to create a bigger image as requested du_extra_size=$(echo "$DIB_IMAGE_EXTRA_SIZE" | awk '{printf("%d\n",$1 * 1024)}') du_size_tmp=$(tail -n1 ${du_output} | cut -f1) du_size=$(echo "$du_size_tmp $du_extra_size" | awk '{print int($1 + $2)}') else # scale this by 0.6 to create a slightly bigger image du_size=$(tail -n1 ${du_output} | cut -f1 | awk '{print int($1 / 0.6)}') fi $xtrace fi if [[ "${DIB_SHOW_IMAGE_USAGE:-0}" != 0 ]]; then set +o xtrace if [ ! -f "$du_output" ]; then sudo du -a -c -x ${TMP_BUILD_DIR}/built > ${du_output} fi du_output_show="sort -nr ${du_output} | numfmt --to=iec-i --padding=7 --suffix=B --field=1 --from-unit=1024" # by default show the 10MiB and greater files & directories -- a # dir with lots of little files will still show up, but this helps # signal:noise ratio if [[ ${DIB_SHOW_IMAGE_USAGE_FULL:-0} == 0 ]]; then # numfmt will start giving a decimal place when < 10MiB du_output_show+="| egrep 'MiB|GiB|TiB|PiB' | grep -v '\..MiB'" echo "=================================" echo "Image size report (files > 10MiB)" echo "=================================" else echo "=================" echo "Image size report" echo "=================" fi eval ${du_output_show} echo echo "===== end image size report =====" echo $xtrace fi rm -f ${du_output} if [ -n "$DIB_JOURNAL_SIZE" ]; then journal_size="$DIB_JOURNAL_SIZE" else journal_size=64 fi if [ "$DIB_ROOT_FSTYPE" = "ext4" ] ; then # Very conservative to handle images being resized a lot # We set journal size to 64M so our journal is large enough when we # perform an FS resize. MKFS_OPTS="-i 4096 -J size=$journal_size $MKFS_OPTS" # NOTE(ianw) 2019-12-11 : this is a terrible hack ... if building on # >=Bionic hosts, mkfs sets "metadata_csum" for ext4 filesystems, # which makes broken Trusty images as that era fsck doesn't # understand this flag. The image will stop in early boot # complaining: # # Serious errors were found while checking the disk drive for /. # # We do not really have any suitable hook points where one of the # ubuntu elements or block-device-* could set this override flag for # just Trusty. We probably should, but desire to implement more # code to support the out-of-date trusty at this point is # non-existant. So hack in disabling this here. if [[ ${DIB_RELEASE} == "trusty" ]]; then MKFS_OPTS="-O ^metadata_csum $MKFS_OPTS" fi # Grow the image size to account for the journal, only if the user # has not asked for a specific size. if [ -z "$DIB_IMAGE_SIZE" ]; then du_size=$(( $du_size + ($journal_size * 1024) )) fi fi # EFI system partitions default to be quite large at 512mb for maximum # compatability (see notes in # 7fd52ba84180b4e749ccf4c9db8c49eafff46ea8) . We need to increase the # total size to account for this, or we run out of space creating the # final image. See if we have included the block-device-efi element, # which implies we have a large EFI partition, and then pad the final # image size. if [[ ${IMAGE_ELEMENT} =~ "block-device-efi" ]]; then echo "Expanding disk for EFI partition" du_size=$(( $du_size + (525 * 1024) )) fi # Rounding down size so that is is a multiple of 64, works around a bug in # qemu-img that may occur when compressing raw images that aren't a multiple # of 64k. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1180021 export DIB_IMAGE_SIZE=$(echo "$du_size" | awk ' { if ($1 % 64 != 0) print $1 + 64 - ( $1 % 64); else print $1; } ') if [ -n "$MAX_ONLINE_RESIZE" ]; then MKFS_OPTS="-E resize=$MAX_ONLINE_RESIZE $MKFS_OPTS" fi export TMP_IMAGE_DIR # Try the 'old fashioned' way calling the block device # phase. If this gives no result, use the configuration based approach: eval_run_d block-device "IMAGE_BLOCK_DEVICE=" if [ -z ${IMAGE_BLOCK_DEVICE} ] ; then # For compatibily reasons in addition to the YAML configuration # there is the need to handle the old environment variables. echo "image-size: ${DIB_IMAGE_SIZE}KiB" >> ${DIB_BLOCK_DEVICE_PARAMS_YAML} if [ -n "${MKFS_OPTS}" ] ; then echo "root-fs-opts: '${MKFS_OPTS}'" >> ${DIB_BLOCK_DEVICE_PARAMS_YAML} fi # After changeing the parameters, there is the need to # re-run dib-block-device init because some value might # change based on the new set parameters. dib-block-device init # values to dib-block-device: using the YAML config and dib-block-device create # This is the device (/dev/loopX). It's where to install the # bootloader. IMAGE_BLOCK_DEVICE=$(dib-block-device getval image-block-device) export IMAGE_BLOCK_DEVICE # Similar to above, but all mounted devices. This is handy for # some bootloaders that have multi-partition layouts and want to # copy things to different places other than just # IMAGE_BLOCK_DEVICE. "eval" this into an array as needed IMAGE_BLOCK_DEVICES=$(dib-block-device getval image-block-devices) export IMAGE_BLOCK_DEVICES # Write the fstab dib-block-device writefstab fi # XXX: needed? LOOPDEV=${IMAGE_BLOCK_DEVICE} # At this point, dib-block-device has created the raw image file # (IMAGE_BLOCK_DEVICE) and mounted all the partitions under # $TMP_BUILD_DIR/mnt for us. We can now copy into the final image. # 'mv' is not usable here - especially when a top level directory # has the same name as a mount point of a partition. If so, 'mv' # will complain: # mv: inter-device move failed: '...' to '...'; \ # unable to remove target: Device or resource busy # therefore a 'cp' and 'rm' approach is used. sudo cp -ra ${TMP_BUILD_DIR}/built/* $TMP_BUILD_DIR/mnt sudo rm -fr ${TMP_BUILD_DIR}/built/* mount_proc_dev_sys run_d pre-finalise run_d_in_target finalise finalise_base for X in ${!IMAGE_TYPES[@]} ; do if [[ " tar aci " =~ "${IMAGE_TYPES[$X]}" ]]; then if [ "${IMAGE_TYPES[$X]}" = "aci" ]; then sudo tar -C ${TMP_BUILD_DIR}/mnt -cf $IMAGE_NAME.aci --exclude ./sys \ --exclude ./proc --xattrs --xattrs-include=\* \ --transform 's,^.,rootfs,S' . if [ -n "$ACI_MANIFEST" ]; then cp $ACI_MANIFEST ${TMP_BUILD_DIR}/manifest sudo tar -C ${TMP_BUILD_DIR} --append -f $IMAGE_NAME.aci manifest else echo "No ACI_MANIFEST specified. An ACI_MANIFEST must be specified for" echo " this image to be usable." fi else sudo tar -C ${TMP_BUILD_DIR}/mnt -cf $IMAGE_NAME.tar --exclude ./sys \ --exclude ./proc --xattrs --xattrs-include=\* . fi sudo chown $USER: $IMAGE_NAME.${IMAGE_TYPES[$X]} unset IMAGE_TYPES[$X] elif [ "${IMAGE_TYPES[$x]}" == "squashfs" ]; then sudo mksquashfs ${TMP_BUILD_DIR}/mnt $IMAGE_NAME.squash -comp xz \ -noappend -root-becomes ${TMP_BUILD_DIR}/mnt \ -wildcards -e "proc/*" -e "sys/*" -no-recovery elif [ "${IMAGE_TYPES[$X]}" == "docker" ]; then sudo tar -C ${TMP_BUILD_DIR}/mnt -cf - --exclude ./sys \ --exclude ./proc --xattrs --xattrs-include=\* . \ | sudo docker import - $DOCKER_TARGET unset IMAGE_TYPES[$X] fi done # Unmount and cleanup the /mnt and /build subdirectories, to save # space before converting the image to some other format. # XXX ? needed? export EXTRA_UNMOUNT="" unmount_image TMP_IMAGE_PATH=$(dib-block-device getval image-path) export TMP_IMAGE_PATH # remove all mounts dib-block-device umount dib-block-device cleanup cleanup_build_dir if [[ (! $IMAGE_ELEMENT =~ no-final-image) && "$IS_RAMDISK" == "0" ]]; then has_raw_type= for IMAGE_TYPE in ${IMAGE_TYPES[@]} ; do # We have to do raw last because it is destructive if [ "$IMAGE_TYPE" = "raw" ]; then has_raw_type=1 elif [ "$IMAGE_TYPE" != "squashfs" ]; then compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE fi done if [ -n "$has_raw_type" ]; then IMAGE_TYPE="raw" compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE fi fi # Remove the leftovers, i.e. the temporary image directory. cleanup_image_dir cleanup_temp_python_exec # Restore fd 1&2 from the outfilter.py redirect back to the original # saved fd. Note small hack that we can't really wait properly for # outfilter.py so put in a sleep (might be possible to use coproc for # this...?) # # TODO(ianw): probably better to cleanup the exit handler a bit for # this? We really want some helper functions that append to the exit # handler so we can register multiple things. set +o xtrace echo "Build completed successfully" exec 1>&3 2>&3 sleep 1 # All done! trap EXIT diskimage-builder-2.35.0/diskimage_builder/lib/ramdisk-functions0000664000175000017500000001724313640271474025017 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2012 Hewlett-Packard Development Company, L.P. # Copyright (c) 2012 NTT DOCOMO, INC. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. function fullpath() { local f=$1 if [ "${f#/}" = "$f" ]; then echo `pwd`/"$f" else echo "$f" fi } function create_ramdisk_base () { echo "Creating base system" mkdir -p "${TMP_MOUNT_PATH}/"{bin,lib/modules,etc/udev} ln -s bin "$TMP_MOUNT_PATH/sbin" # cjk adding for discovery support mkdir -p "${TMP_MOUNT_PATH}/"{lib/udev/rules.d,var/{lib/dhcp,run}} case "$DISTRO_NAME" in fedora|rhel|rhel7|opensuse) mkdir -p "$TMP_MOUNT_PATH/usr" ln -s ../lib "$TMP_MOUNT_PATH/usr/lib" if [[ "`uname -m`" =~ x86_64|ppc64 ]]; then ln -s lib "$TMP_MOUNT_PATH/lib64" fi ;; esac if [ -e $LIB_UDEV/rules.d/50-firmware.rules ]; then cp -a "$LIB_UDEV/rules.d/50-firmware.rules" "$TMP_MOUNT_PATH/lib/udev/rules.d" fi cp -a "$LIB_UDEV/rules.d/80-drivers.rules" "$TMP_MOUNT_PATH/lib/udev/rules.d" if [ -a $LIB_UDEV/firmware ]; then cp -a "$LIB_UDEV/firmware" "$TMP_MOUNT_PATH/lib/udev" fi # cjk adding dhclient for hwdiscovery support # dhclient scripts on some distros appear in different places, copy any we find for FILE in /sbin/dhclient-script /usr/sbin/dhclient-script /etc/sysconfig/network-scripts/* /etc/rc.d/init.d/functions /etc/init.d/functions ; do if [ -f $FILE ] ; then mkdir -p $(dirname $TMP_MOUNT_PATH/$FILE) cp $FILE $TMP_MOUNT_PATH/$FILE fi done # /var/lib/dhclient is a directory on Fedora if [ -d "/var/lib/dhclient" ] ; then mkdir -p "$TMP_MOUNT_PATH/var/lib/dhclient" fi mkdir -p "$TMP_MOUNT_PATH/etc/modprobe.d" # The directory may or may not exist in the image. If the directory exists in # the image, all the files under it should get copied to the ramdisk. if [ -d "/etc/modprobe.d/" ] ; then find /etc/modprobe.d -name '*.conf' -type f -exec cp -a {} "$TMP_MOUNT_PATH/etc/modprobe.d" \; fi echo "blacklist evbug" > "$TMP_MOUNT_PATH/etc/modprobe.d/blacklist-dib-ramdisk.conf" # cjk adding for hwdiscovery support touch "$TMP_MOUNT_PATH/etc/fstab" mkdir -p "$TMP_MOUNT_PATH/etc/udev" cat >"$TMP_MOUNT_PATH/etc/udev/udev.conf" < /lib/x86_64-linux-gnu/libc.so.6 (0x00007f095e784000) # 2. only path # /lib64/ld-linux-x86-64.so.2 (0x00007f095ef79000) # 3. path to path # /lib64/ld-linux-x86-64.so.2 => /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 (0x00007facff857000) # 4. name to empty (vdso) # linux-vdso.so.1 => (0x00007fff0c5ff000) # or, in some setups: # linux-vdso.so.1 (0x00007fff0c5ff000) for i in `echo "$ldd_out" | sed -e 's/^\t*//'`; do local ref=$( echo "$i" | awk -F '[ ]' '{print $1}') local real=$( echo "$i" | awk -F '[ ]' '$2 == "=>" {print $3} $2 != "=>" {print $1}') if [ -z "$real" ] || [[ "$real" != /* ]]; then continue fi if [ "$ref" = "${ref#/}" ]; then ref=/lib/$ref fi dest=/lib/`basename "$real"` cp -Ln "$real" "$TMP_MOUNT_PATH/$dest" # Create a symbolic link if the shared library is referred # by the different name if [ "$ref" != "$dest" ]; then local link_path=$TMP_MOUNT_PATH/$ref if ! [ -e "$link_path" -o -L "$link_path" ]; then mkdir -p $(dirname "$link_path") ln -s "$dest" "$link_path" fi fi done } function populate_lib () { echo "Populating /lib" # find udevd UDEVD= for f in /sbin/udevd /lib/udev/udevd /lib/systemd/systemd-udevd \ /usr/lib/systemd/systemd-udevd \ /usr/lib/udev/udevd; do if [ -x "$f" ]; then UDEVD="$f" break fi done UDEV_FIRMWARE= if [ -a $LIB_UDEV/firmware ]; then UDEV_FIRMWARE="$LIB_UDEV/firmware" fi for i in "$BUSYBOX" bash lsmod modprobe udevadm \ wget reboot shutdown $UDEVD $UDEV_FIRMWARE \ $(cat /etc/dib_binary_deps) ; do # Don't take the ip command from busybox, its missing some features if busybox_list | grep -v "^ip$" | grep "^$i\$" >/dev/null; then continue fi path=`type -p $i 2>/dev/null` || path=$i if ! [ -x "$path" ]; then echo "$i is not found in PATH" 2>&1 exit 1 fi cp -L "$path" "$TMP_MOUNT_PATH/bin/" copy_required_libs "$path" done if [ -f /dib-signed-kernel-version ] ; then . /dib-signed-kernel-version fi if [ -n "${DIB_SIGNED_KERNEL_VERSION:-}" ]; then # Secure kernel module directory does not have efi.signed suffix to # kernel version. if echo $KERNEL_VERSION | grep -q 'efi.signed'; then KERNEL_VERSION=`echo "$KERNEL_VERSION" |sed "s/\.efi\.signed//g"` fi fi cp -a "$MODULE_DIR" "$TMP_MOUNT_PATH/lib/modules/$KERNEL_VERSION" echo "Removing kernel framebuffer drivers to enforce text mode consoles..." find $TMP_MOUNT_PATH/lib/modules/$KERNEL_VERSION/kernel/drivers/video -name '*fb.ko' -exec rm -v {} + if [ -d $FIRMWARE_DIR ]; then cp -a "$FIRMWARE_DIR" "$TMP_MOUNT_PATH/lib/firmware" fi } function busybox_list () { # busybox supports --list option since version 1.18 "$BUSYBOX" --list 2> /dev/null && return # for busybox under 1.18 we parse command list from --help output scrlet='{ if (go) { print } } /Currently defined functions:/ { go=1 }' "$BUSYBOX" --help | awk "$scrlet" | tr ',' '\n' | xargs -n1 echo } function populate_busybox () { echo "Creating symlinks for busybox binaries" for i in $( busybox_list ); do if [ -f "$TMP_MOUNT_PATH/bin/$i" ]; then echo "skip $i" continue fi ln -s busybox "$TMP_MOUNT_PATH/bin/$i" done } function populate_init () { echo "Installing init" cp "$INIT" "$TMP_MOUNT_PATH/init" chmod +x $TMP_MOUNT_PATH/init for F in "$FUNCTIONS_D"/* ; do cp "$F" "$TMP_MOUNT_PATH" done # Append /init with any element fragments that are present TARGET_DIR="/tmp/in_target.d/" for _ELEMENT in $(ls $TARGET_DIR/init.d/) ; do _FILE="${TARGET_DIR}/init.d/${_ELEMENT}" if [ -a $_FILE ]; then cat >>$TMP_MOUNT_PATH/init <>$TMP_MOUNT_PATH/init fi done # Add our final steps to /init cat <${INIT}-end >>$TMP_MOUNT_PATH/init } function finalise_image () { echo "Finalising image" (cd "$TMP_MOUNT_PATH"; find . | cpio -o -H newc | gzip > "$TMP_IMAGE_PATH" ) } function populate_udev () { echo "Installing udev rules" TARGET_DIR="/tmp/in_target.d/" for _ELEMENT in $(ls $TARGET_DIR/udev.d/) ; do _FILE="${TARGET_DIR}/udev.d/${_ELEMENT}" if [ -a $_FILE ]; then cp ${_FILE} $TMP_MOUNT_PATH/lib/udev/rules.d/ fi done } function find_kernel_version () { _TMP=$(ls /boot/vmlinu* | sort | tail -1) if [ "$_TMP" == "" ]; then echo "Unable to find a suitable kernel" >>/dev/stderr exit 1 fi echo ${_TMP##/boot/vmlinu[zx]-} } diskimage-builder-2.35.0/diskimage_builder/lib/img-functions0000664000175000017500000002220613640271474024134 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2012 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. function unmount_image () { # Calling sync before helps ensure the mount isn't busy when you unmount it. # Previously observing having disk corruption issues; one possibility is # qemu-nbd not flushing dirty pages on disconnect? # https://bugs.launchpad.net/diskimage-builder/+bug/1214388 sync # unmount from the chroot # Don't use TMP_MOUNT_PATH here, it might not have been set. unmount_dir "$TMP_BUILD_DIR/mnt" if [ -n "$EXTRA_DETACH" ]; then $EXTRA_DETACH fi if [ -n "$EXTRA_UNMOUNT" ]; then $EXTRA_UNMOUNT fi } function trap_cleanup() { exitval=$? cleanup exit $exitval } function cleanup () { unmount_image dib-block-device umount cleanup_build_dir cleanup_image_dir cleanup_temp_python_exec } # Helper function to run a command inside the chroot function run_in_target () { cmd="$@" # -E to preserve http_proxy ORIG_HOME=$HOME export HOME=/root # Force an empty TMPDIR inside the chroot. There is no need to use an user # defined tmp dir which may not exist in the chroot. # Bug: #1330290 # Force the inclusion of a typical set of dirs in PATH, this is needed for guest # distros that have path elements not in the host PATH. sudo -E chroot $TMP_MOUNT_PATH env -u TMPDIR -u VIRTUAL_ENV PATH="\$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" sh -c "$cmd" export HOME=$ORIG_HOME } # Helper function to run a directory of scripts inside the chroot function run_d_in_target () { check_element # If we can find a directory of hooks to run in the target filesystem, bind # mount it into the target and then execute run-parts in a chroot if [ -d ${TMP_HOOKS_PATH}/$1.d ] ; then sudo mkdir $TMP_MOUNT_PATH/tmp/in_target.d # Copy dib-run-parts to be visible inside chroot. Note we leave # this here because in the future we might like to use a # different in-chroot runner that doesn't rely on the chroot # having bash/glibc/etc (containers, micro-images, etc). sudo cp ${DIB_RUN_PARTS} ${TMP_HOOKS_PATH} # Note that bind mounting R/O is a two step process, and it # wasn't until later util-linux that "bind,ro" worked as a # single step, see # https://git.kernel.org/cgit/utils/util-linux/util-linux.git/commit/?id=9ac77b8a78452eab0612523d27fee52159f5016a sudo mount --bind ${TMP_HOOKS_PATH} $TMP_MOUNT_PATH/tmp/in_target.d sudo mount -o remount,ro,bind ${TMP_HOOKS_PATH} $TMP_MOUNT_PATH/tmp/in_target.d check_break before-$1 run_in_target bash [ -z "$break_outside_target" ] && in_target_arg="run_in_target" || in_target_arg= trap "check_break after-error $in_target_arg ${break_cmd:-bash}" ERR run_in_target /tmp/in_target.d/dib-run-parts /tmp/in_target.d/$1.d trap - ERR check_break after-$1 run_in_target bash sudo umount -f $TMP_MOUNT_PATH/tmp/in_target.d if ! timeout 10 sh -c " while ! sudo rmdir $TMP_MOUNT_PATH/tmp/in_target.d; do sleep 1; done"; then echo "ERROR: unable to cleanly remove $TMP_MOUNT_PATH/tmp/in_target.d" exit 1 fi fi } function finalise_base () { TARGET_ROOT=$TMP_MOUNT_PATH run_d cleanup # Finalise resolv.conf # # NOTE(ianw): the /etc/resolv.conf.ORIG file is an # external interface; elements might put a resolv.conf they # want in the final image into this file. # # In create_base() we replaced/created the initial resolv.conf # inside the image with a copy of the "outside" version so that # resolving during the build will work. # # If that file has been replace with a symlink (resolvconf package # can do this), or marked immutable, then don't restore the # original version, just leave it alone. if [ -L $TMP_MOUNT_PATH/etc/resolv.conf ] || \ lsattr $TMP_MOUNT_PATH/etc/resolv.conf | grep '^....i' >/dev/null ; then # We're keeping the contents of resolv.conf set in the elements, # so remove the old saved file sudo rm -f $TMP_MOUNT_PATH/etc/resolv.conf.ORIG else # Remove the resolv.conf we created and put the original (or # perhaps modified) version back. sudo rm -f $TMP_MOUNT_PATH/etc/resolv.conf # Note that we use -L and -f to test here as test (and bash [[) # return false with -e if the link target does not exist. if [ -L $TMP_MOUNT_PATH/etc/resolv.conf.ORIG ] || [ -f $TMP_MOUNT_PATH/etc/resolv.conf.ORIG ] ; then sudo mv $TMP_MOUNT_PATH/etc/resolv.conf.ORIG $TMP_MOUNT_PATH/etc/resolv.conf fi fi # Cleanup /tmp in the guest, so there is less cruft left there unmount_dir $TMP_MOUNT_PATH/tmp find $TMP_MOUNT_PATH/tmp -maxdepth 1 -mindepth 1 | xargs sudo rm -rf --one-file-system # Truncate /var/log files in preparation for first boot sudo find ${TMP_MOUNT_PATH}/var/log -type f -exec cp /dev/null '{}' \; # also /root logs sudo find ${TMP_MOUNT_PATH}/root -name \*.log -type f -delete } function compress_and_save_image () { # Recreate our image to throw away unnecessary data test $IMAGE_TYPE != qcow2 && COMPRESS_IMAGE="" if [ -n "$QEMU_IMG_OPTIONS" ]; then EXTRA_OPTIONS="-o $QEMU_IMG_OPTIONS" else EXTRA_OPTIONS="" fi if [ "$IMAGE_TYPE" = "raw" ]; then mv $TMP_IMAGE_PATH $1-new elif [ "$IMAGE_TYPE" == "tgz" ]; then $DIB_GZIP_BIN -9 < $IMAGE_NAME.tar > $1-new rm $IMAGE_NAME.tar elif [ "$IMAGE_TYPE" == "vhd" ]; then cp $TMP_IMAGE_PATH $1-intermediate vhd-util convert -s 0 -t 1 -i $1-intermediate -o $1-intermediate vhd-util convert -s 1 -t 2 -i $1-intermediate -o $1-new # The previous command creates a .bak file rm $1-intermediate.bak OUT_IMAGE_PATH=$1-new else echo "Converting image using qemu-img convert" qemu-img convert ${COMPRESS_IMAGE:+-c} -f raw -O $IMAGE_TYPE $EXTRA_OPTIONS $TMP_IMAGE_PATH $1-new fi OUT_IMAGE_PATH=$1-new finish_image $1 } function do_extra_package_install () { # Install any packages that were requested with the -p command line option if [ "$INSTALL_PACKAGES" != "" ]; then run_in_target install-packages ${INSTALL_PACKAGES[@]} fi } function copy_elements_lib () { sudo mkdir -p $TMP_MOUNT_PATH/lib/diskimage-builder sudo cp -t $TMP_MOUNT_PATH/lib/diskimage-builder $_LIB/elements-functions } # Dig up the initrd and kernel. function select_boot_kernel_initrd () { TARGET_ROOT=$1 BOOTDIR=$TARGET_ROOT/boot if [ -n "${DIB_BAREMETAL_KERNEL_PATTERN:-}" -a -n "${DIB_BAREMETAL_INITRD_PATTERN:-}" ]; then KERNEL=$(basename $(eval ls -1rv "$BOOTDIR/${DIB_BAREMETAL_KERNEL_PATTERN}" | head -1)) RAMDISK=$(basename $(eval ls -1rv "$BOOTDIR/${DIB_BAREMETAL_INITRD_PATTERN}" | head -1)) elif [ -f $TARGET_ROOT/etc/redhat-release ]; then # Prioritize PAE if present KERNEL=$(ls -1rv $BOOTDIR/vmlinuz* | grep PAE | grep -v debug | head -1 || echo "") KERNEL=${KERNEL:-$(ls -1rv $BOOTDIR/vmlinuz* | grep -v debug | head -1 || echo "")} if [ ! $KERNEL ]; then echo "No suitable kernel found." exit 1 fi KERNEL=$(basename $KERNEL) KERNEL_VERSION=${KERNEL#vmlinuz-} RAMDISK=$(basename $(ls $BOOTDIR/initramfs-$KERNEL_VERSION.img) || echo "") if [ ! $RAMDISK ]; then echo "Can't find an initramfs for the $KERNEL_VERSION version of the kernel." exit 1 fi elif [ -f $TARGET_ROOT/etc/debian_version ]; then KERNEL=$(basename $(ls -1rv $BOOTDIR/vmlinu*generic 2>/dev/null || ls -1rv $BOOTDIR/vmlinu* | head -1)) RAMDISK=$(basename $(ls -1rv $BOOTDIR/initrd*generic 2>/dev/null || ls -1rv $BOOTDIR/initrd* | head -1)) if [ -f $TARGET_ROOT/dib-signed-kernel-version ] ; then . $TARGET_ROOT/dib-signed-kernel-version fi if [ -n "${DIB_SIGNED_KERNEL_VERSION:-}" ]; then echo "Using signed kernel $DIB_SIGNED_KERNEL_VERSION" KERNEL=$(basename $(ls -1rv $BOOTDIR/vmlinu*generic.efi.signed 2>/dev/null)) fi elif [ -f $TARGET_ROOT/etc/SuSE-release ]; then KERNEL=$(basename $(readlink -e $BOOTDIR/vmlinuz)) RAMDISK=$(basename $(readlink -e $BOOTDIR/initrd)) elif [[ -f "${TARGET_ROOT}"/etc/gentoo-release ]]; then KERNEL="$(basename $(ls -1rv $BOOTDIR/kernel-*-openstack | head -n 1))" RAMDISK="$(basename $(ls -1rv $BOOTDIR/initramfs-*-openstack | head -n 1))" else echo "ERROR: Unable to detect operating system" exit 1 fi } diskimage-builder-2.35.0/diskimage_builder/lib/dib-run-parts0000775000175000017500000001100613640271474024040 0ustar zuulzuul00000000000000#!/bin/bash # Inspired by Debian and RedHat run-parts but portable and specific to di-b. # # Copyright 2012 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. allowed_regex=${RUN_PARTS_REGEX:-"^[0-9A-Za-z_-]+$"} show_list= set -ue set -o pipefail name=$(basename $0) usage() { echo "Usage: $name [OPTION] scripts_directory" echo "Option:" echo " --list print names of all valid files" echo echo "Examples:" echo " dib-run-parts --list /opt/stack/os-config-refresh/configure.d/" echo " dib-run-parts /opt/stack/os-config-refresh/configure.d/" exit 1 } >&2 output_prefix() { printf "%s " "${name}" >&2 } output () { output_prefix echo $* >&2 } output_printf () { local FORMAT="$1" shift output_prefix printf "${FORMAT}" $@ >&2 } # source the environment files from environment.d # arg : target_dir source_environment() { local dir=$target_dir/../environment.d local env_files local xtrace if [ -d ${dir} ] ; then env_files=$(find ${dir} -maxdepth 1 -xtype f | \ grep -E "/[0-9A-Za-z_\.-]+$" | \ LANG=C sort -n) for env_file in $env_files ; do output "Sourcing environment file ${env_file}" # Set tracing as we import these environment files; it's # nice to see the definitions in the logs xtrace=$(set +o | grep xtrace) set -o xtrace source $env_file $xtrace done fi } if [ $# -lt 1 ] ; then usage fi if [ "$1" == "--list" ] ; then show_list="1" shift fi target_dir="${1:-}" if ! [ -d "$target_dir" ] ; then output "Scripts directory [$target_dir] must exist and be a directory" usage fi # We specifically only want to sort *by the numbers*. # Lexical sorting is not guaranteed, and identical numbers may be # parallelized later # Note: -maxdepth 1 ensures only files in the target directory (but not # subdirectories) are run, which is the way run-parts behaves. targets=$(find $target_dir -maxdepth 1 -xtype f -executable -printf '%f\n' | grep -E "$allowed_regex" | LANG=C sort -n || echo "") if [ "$show_list" == "1" ] ; then for target in $targets ; do echo "${target_dir}/${target}" done exit 0 fi DIB_DEBUG_TRACE=${DIB_DEBUG_TRACE:-0} if [ ${DIB_DEBUG_TRACE} -gt 0 ]; then non_exec=$(find $target_dir -maxdepth 1 -xtype f \! -executable -printf '%f\n') if [ ! -z "$non_exec" ]; then output "Ignoring non-executable files: $non_exec" fi bad_filename=$(find $target_dir -maxdepth 1 -xtype f -executable -printf '%f\n' | grep -v -E "$allowed_regex" || echo "") if [ ! -z "$bad_filename" ]; then output "Ignoring non-conforming filenames: $bad_filename" fi fi PROFILE_DIR=$(mktemp -d --tmpdir profiledir.XXXXXX) # note, run this in a sub-shell so we don't pollute our # own environment with source_environment ( source_environment for target in $targets ; do output "Running $target_dir/$target" target_tag=${target//\//_} date +%s.%N > $PROFILE_DIR/start_$target_tag $target_dir/$target target_tag=${target//\//_} date +%s.%N > $PROFILE_DIR/stop_$target_tag output "$target completed" done ) output "----------------------- PROFILING -----------------------" output "" output "Target: $(basename $target_dir)" output "" output_printf "%-40s %9s\n" Script Seconds output_printf "%-40s %9s\n" --------------------------------------- ---------- output "" pushd $PROFILE_DIR > /dev/null for target in $(find . -name 'start_*' -printf '%f\n' | env LC_ALL=C sort -n) ; do stop_file=stop_${target##start_} start_seconds=$(cat $target) stop_seconds=$(cat $stop_file) duration=$(echo - | awk "{ print $stop_seconds - $start_seconds }") LC_NUMERIC=C LC_ALL=C output_printf "%-40s %10.3f\n" ${target##start_} $duration done popd > /dev/null rm -rf $PROFILE_DIR output "" output "--------------------- END PROFILING ---------------------" diskimage-builder-2.35.0/diskimage_builder/lib/common-functions0000664000175000017500000004246113640271474024655 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2012 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # This is the "internal" verison of dib-run-parts. If you modify # this, be aware that it needs to run both inside and outside the # chroot environment, so it needs to be very generic. DIB_RUN_PARTS=${_LIB}/dib-run-parts function tmpfs_check() { local echo_message=${1:-1} [ "$DIB_NO_TMPFS" == "0" ] || return 1 [ -r /proc/meminfo ] || return 1 total_kB=$(awk '/^MemTotal/ { print $2 }' /proc/meminfo) # tmpfs uses by default 50% of the available RAM, so the RAM should be at least # the double of the minimum tmpfs size required RAM_NEEDED=$(($DIB_MIN_TMPFS * 2)) [ $total_kB -lt $(($RAM_NEEDED*1024*1024)) ] || return 0 if [ $echo_message == '1' ]; then echo "WARNING: Not enough RAM to use tmpfs for build. Using ${TMP_DIR:-/tmp}. ($total_kB < ${RAM_NEEDED}G)" fi return 1 } function mk_build_dir () { TMP_BUILD_DIR=$(mktemp -t -d --tmpdir=${TMP_DIR:-/tmp} dib_build.XXXXXXXX) TMP_IMAGE_DIR=$(mktemp -t -d --tmpdir=${TMP_DIR:-/tmp} dib_image.XXXXXXXX) [ $? -eq 0 ] || die "Failed to create tmp directory" export TMP_BUILD_DIR if tmpfs_check ; then sudo mount -t tmpfs tmpfs $TMP_BUILD_DIR sudo mount -t tmpfs tmpfs $TMP_IMAGE_DIR sudo chown $(id -u):$(id -g) $TMP_BUILD_DIR $TMP_IMAGE_DIR fi trap trap_cleanup EXIT echo Building in $TMP_BUILD_DIR export TMP_IMAGE_DIR export OUT_IMAGE_PATH=$TMP_IMAGE_PATH export TMP_HOOKS_PATH=$TMP_BUILD_DIR/hooks } function finish_image () { if [ -f $1 -a ${OVERWRITE_OLD_IMAGE:-0} -eq 0 ]; then old_image="${1%.*}"-$(date +%Y.%m.%d-%H.%M.%S).${1##*.} echo "Old image found. Renaming it to $old_image" mv "$1" "$old_image" if [ -f "$1.md5" ]; then mv "$1.md5" "$old_image.md5" fi if [ -f "$1.sha256" ]; then mv "$1.sha256" "$old_image.sha256" fi fi mv $OUT_IMAGE_PATH $1 if [ "$DIB_CHECKSUM" == "1" ]; then # NOTE(pabelanger): Read image into memory once and generate # both checksum files. # NOTE(ianw): we've seen issues with this waiting for # our outfilter.py wrapper when containerised (probably due to # no tty). Waiting for just these processes is a bit of hacky # workaround ... declare -a wait_for md5sum $1 > $1.md5 & wait_for+=($!) sha256sum $1 > $1.sha256 & wait_for+=($!) wait "${wait_for[@]}" fi echo "Image file $1 created..." } function save_image () { finish_image $1 } function copy_hooks_not_overwrite () { _DIR=$(basename $1) test -d $TMP_HOOKS_PATH/$_DIR || mkdir $TMP_HOOKS_PATH/$_DIR for _HOOK in $(ls $1); do if [ ! -f $TMP_HOOKS_PATH/$_DIR/$_HOOK ]; then echo "Copying hooks $1/$_HOOK" cp -t $TMP_HOOKS_PATH/$_DIR -a $1/$_HOOK else echo "There is a duplicated hook in your elements: $_ELEMENT/$_DIR/$_HOOK" exit 1 fi done } function generate_hooks () { local xtrace xtrace=$(set +o | grep xtrace) set +o xtrace local dir local file eval declare -A image_elements=($(get_image_element_array)) mkdir -p $TMP_HOOKS_PATH for i in "${!image_elements[@]}"; do local element=$i local element_dir=${image_elements[$i]} echo "Copying hooks for ${element}" for dir in $(find $element_dir \ -follow -mindepth 1 -maxdepth 1 \ -type d \ -not -name tests \ -not -name __pycache__); do copy_hooks_not_overwrite $dir done for file in $(find $element_dir \ -follow -maxdepth 1 \ -type f \ -not -name '*.pyc'); do cp -t $TMP_HOOKS_PATH -a $file done done $xtrace } # Call the supplied break-in routine if the named point is listed in the break # list. # $1 the break point. # $2.. what to call if a break is needed function check_break () { if echo "${break:-}" | egrep -e "(,|^)$1(,|$)" -q; then echo "Starting debug shell. Exit to resume building." >&2 echo At stage $1 >&2 shift "$@" echo "Resuming" >&2 fi } # Check that a real element has been chosen (prevents foot-guns) function check_element () { [ -d $TMP_HOOKS_PATH ] || generate_hooks } # Run a hook, looking for a regex in its stdout, and eval the matched lines. # $1 is the hook to run # $2 is the regex to look for function eval_run_d () { local run_output=$(mktemp) trap "rm -f $run_output; check_break after-error ${break_cmd:-bash}" ERR run_d $1 $run_output if grep -q "$2" $run_output; then local temp=$(grep "$2" $run_output) eval "$temp" fi rm $run_output trap - ERR } # Get any process that appears to be running in $TMP_BUILD_DIR function _get_chroot_processes () { # Deselect kernel threads, and use a python script to avoid # forking lots and lots of readlink / grep processes on a busy # system. ps --ppid 2 -p 2 --deselect -o pid= | xargs ${DIB_PYTHON_EXEC:-python} -c ' import os import sys for pid in sys.argv[2:]: try: root = os.readlink("/proc/%s/root" % pid) except: continue if sys.argv[1] in root: print("%s" % pid) ' $TMP_BUILD_DIR } function kill_chroot_processes () { local xtrace xtrace=$(set +o | grep xtrace) set +o xtrace local pidname if [ -z "${1}" ]; then echo "ERROR: no chroot directory specified" exit 1 fi for pid in $(_get_chroot_processes); do # If there are open files from the chroot, just kill the process using # these files. This is racy, but good enough pidname=$(cat $piddir/comm 2>/dev/null || echo "unknown") echo "Killing chroot process: '${pidname}($pid)'" sudo kill $pid done $xtrace } function cleanup_build_dir () { if ! timeout 10 sh -c " while ! sudo rm -rf $TMP_BUILD_DIR/built; do sleep 1; done"; then echo "ERROR: unable to cleanly remove $TMP_BUILD_DIR/built" exit 1 fi sudo rm -rf $TMP_BUILD_DIR/mnt kill_chroot_processes $TMP_BUILD_DIR if tmpfs_check 0; then # If kill_chroot_processes did not succeed then we have to wait for # init to reap the orphaned chroot processes if ! timeout 120 sh -c "while ! sudo umount -f $TMP_BUILD_DIR; do sleep 1; done"; then echo "ERROR: failed to umount the $TMP_BUILD_DIR tmpfs mount point" exit 1 fi fi rm -rf --one-file-system $TMP_BUILD_DIR } function cleanup_image_dir () { kill_chroot_processes $TMP_IMAGE_DIR if tmpfs_check 0; then if ! timeout 120 sh -c "while ! sudo umount -f $TMP_IMAGE_DIR; do sleep 1; done"; then echo "ERROR: failed to umount the $TMP_IMAGE_DIR tmpfs mount point" exit 1 fi fi rm -rf --one-file-system $TMP_IMAGE_DIR } function cleanup_temp_python_exec () { if [ ! -z "$DIB_ORIGINAL_PATH" ]; then export PATH=$DIB_ORIGINAL_PATH fi rm "$DIB_PYTHON_EXEC_TMP/python" || true rmdir "$DIB_PYTHON_EXEC_TMP" || true } # Run a directory of hooks outside the target (that is, no chrooting). function run_d() { check_element check_break before-$1 ${break_cmd:-bash} if [ -d ${TMP_HOOKS_PATH}/$1.d ] ; then echo "Running hooks from ${TMP_HOOKS_PATH}/$1.d" if [ -n "$2" ]; then ${DIB_RUN_PARTS} ${TMP_HOOKS_PATH}/$1.d | tee $2 if [[ ${PIPESTATUS[0]} != 0 ]]; then return 1 fi else ${DIB_RUN_PARTS} ${TMP_HOOKS_PATH}/$1.d fi fi check_break after-$1 bash } function _arg_defaults_hack() { # The block-device configuration looks in all elements for a # "block-device-default.yaml" file. The "vm" element used to # provide the default block-device, which was fine when there was # only one option; but now we have mbr, gpt & efi versions. # # So now the vm element has a dependency on the block-device # element, which several different elements can provide. However, # for backwards compatability we need to ensure you can still # build without specifying it. Thus if we see the vm element, but # no block-device-* element, we will automatically add the old # default MBR. # # Note that you can still override this by setting # DIB_BLOCK_DEVICE_CONFIG; any value there will be taken over the # element defaults. In this case you'd have "block-device-mbr" as # an element, but it wouldn't actually be used for configuration. # # XXX: if this is becoming a common problem, we could have some # sort of "element-defaults" that maps a "element-deps" entry to a # default. local vm_seen local blockdev_seen local elements for arg do if [[ "$arg" =~ "vm" ]]; then vm_seen=1 elif [[ "$arg" =~ "block-device-" ]]; then blockdev_seen=1 fi elements="$elements $arg" done if [[ -n "${vm_seen}" && -z "${blockdev_seen}" ]]; then elements="$elements block-device-mbr" fi echo $elements } function arg_to_elements() { for arg do IMAGE_ELEMENT="$IMAGE_ELEMENT $arg" ; done IMAGE_ELEMENT="$(_arg_defaults_hack $IMAGE_ELEMENT)" if [ "$SKIP_BASE" != "1" ]; then IMAGE_ELEMENT="base $IMAGE_ELEMENT" fi if [ "$IS_RAMDISK" == "1" ]; then IMAGE_ELEMENT="$RAMDISK_ELEMENT $IMAGE_ELEMENT" fi echo "Building elements: $IMAGE_ELEMENT" export IMAGE_ELEMENT # element-info will output bash code to create # * IMAGE_ELEMENT # legacy list of elements # # * IMAGE_ELEMENT_YAML # YAML dictionary with key=element, value=path # # import os # import yaml # yaml.load(os.getenv('IMAGE_ELEMENT_YAML') # # * function get_image_element_array # Function to create Bash associative-array. Since bash can not # export array variables, we provide a function to populate the # variables. # # # we need the eval, it expands the string for the array create # eval declare -A image_elements=($(get_image_element_array)) # for i in ${!image_elements[@]}; do # element=$i # path=${image_elements[$i] # done elinfo_out="$(element-info --env $IMAGE_ELEMENT)" if [ $? -ne 0 ]; then echo "ERROR: element-info failed to expand elements." exit 1 fi eval "$elinfo_out" echo "Expanded element dependencies to: $IMAGE_ELEMENT" } function create_base () { mkdir $TMP_BUILD_DIR/mnt # Make sure the / inside the chroot is owned by root # If it is not owned by root, some Ubuntu bionic packages will fail # path validation at install time. sudo chown root.root $TMP_BUILD_DIR/mnt export TMP_MOUNT_PATH=$TMP_BUILD_DIR/mnt # Copy data in to the root. TARGET_ROOT=$TMP_MOUNT_PATH run_d root if [ -z "$(ls $TMP_MOUNT_PATH | grep -v '^lost+found\|tmp$')" ] ; then # No root element copied in. Note the test above allows # root.d elements to put things in /tmp echo "Failed to deploy the root element." exit 1 fi # Configure Image # Save resolv.conf as created by the initial install. Note the # .ORIG file is an exported interface -- it may be modified and we # will copy it back in during finalisation of the image. # Note that we use -L and -f to test here as test (and bash [[) # return false with -e if the link target does not exist. if [ -L $TMP_MOUNT_PATH/etc/resolv.conf ] || [ -f $TMP_MOUNT_PATH/etc/resolv.conf ] ; then sudo mv $TMP_MOUNT_PATH/etc/resolv.conf $TMP_MOUNT_PATH/etc/resolv.conf.ORIG fi # Recreate resolv.conf sudo touch $TMP_MOUNT_PATH/etc/resolv.conf sudo chmod 777 $TMP_MOUNT_PATH/etc/resolv.conf # use system configured resolv.conf if available to support internal proxy resolving if [ -e /etc/resolv.conf ]; then cat /etc/resolv.conf > $TMP_MOUNT_PATH/etc/resolv.conf else echo nameserver 8.8.8.8 > $TMP_MOUNT_PATH/etc/resolv.conf fi mount_proc_dev_sys } # Get mount options for mounting /dev/pts # Kernel commit https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eedf265aa003b4781de24cfed40a655a664457e6 # introduced in v4.7 allows multiple instances of devpts. However, # some distributions are running older kernels so we need to take # care on what options we use to mount a new instance of devpts # filesystem since it's not completely independent. The best thing # to do is to simply use the existing mount options. function mount_dev_pts_options() { echo "-o $(findmnt --first-only /dev/pts --noheadings --output OPTIONS)" } function mount_proc_dev_sys () { # supporting kernel file systems sudo mount -t proc none $TMP_MOUNT_PATH/proc sudo mount --bind /dev $TMP_MOUNT_PATH/dev sudo mount -t devpts $(mount_dev_pts_options) devpts $TMP_MOUNT_PATH/dev/pts sudo mount -t sysfs none $TMP_MOUNT_PATH/sys } # Recursively unmount directories under a given directory DIR # usage: # unmount_dir DIR function unmount_dir { local dir="$1" local real_dir local mnts local split_mounts local found_mountpoint if [ ! -d $dir ]; then echo "*** $dir is not a directory" return 0 fi # get rid of any symlink elements in the incoming path, because # /proc/mounts is the real path real_dir=$(readlink -e $dir) # populate the exported mountpoints IFS='|' read -ra split_mounts <<< "$DIB_MOUNTPOINTS" # note the "/" on real_dir ... we are just looking for things # mounted *underneath* this directory. mnts=$(awk '{print $2}' < /proc/mounts | grep "^$real_dir/" | sort -r) for m in $mnts; do # check if suffix is in array found_mountpoint=false for mountpoint in "${split_mounts[@]}"; do if [[ "$mountpoint" != "/" ]]; then if [[ "$m" == *$mountpoint ]]; then echo "Mountpoint $m managed by block device; skipping" found_mountpoint=true break fi fi done if [ $found_mountpoint == false ]; then # unmount the directory as it is not managed by block device echo "Unmount $m" sudo umount -fl $m || true fi done } # Create YAML config file for the block device layer # The order here is: use the one the user provides - if there is # none provided, fall back to the possible one element which # defines a fallback configuration. # Parameters: # - name of the to be created config file function block_device_create_config_file { # nosiy; we manually trace local xtrace xtrace=$(set +o | grep xtrace) set +o xtrace local config_yaml="$1" if [[ ${DIB_BLOCK_DEVICE_CONFIG:-} == file://* ]]; then cp $(echo ${DIB_BLOCK_DEVICE_CONFIG} | cut -c 8-) ${config_yaml} echo "Using file-based block-device config: ${DIB_BLOCK_DEVICE_CONFIG}" $xtrace return fi if [ -n "${DIB_BLOCK_DEVICE_CONFIG:-}" ]; then printf "%s" "${DIB_BLOCK_DEVICE_CONFIG}" >${config_yaml} echo "User specified block-device config from DIB_BLOCK_DEVICE_CONFIG" $xtrace return fi # Search the elements for a matching block-device config. # XXX: first match wins? echo "Searching elements for block-device[-${ARCH}].yaml ..." eval declare -A image_elements=($(get_image_element_array)) for i in ${!image_elements[@]}; do local cfg # look for arch specific version first, then default if [[ "ppc64le ppc64el" =~ $ARCH ]] ; then # NOTE(tonyb): ppc64el and ppc64le are the same archttechture, it's # just different distro's have different names. So if we're either # of them pick the block-device-ppc64el.yaml file cfg=${image_elements[$i]}/block-device-ppc64el.yaml else cfg=${image_elements[$i]}/block-device-${ARCH}.yaml fi if [ -e ${cfg} ]; then cp ${cfg} ${config_yaml} echo "Using block-device config: ${cfg}" $xtrace return else cfg=${image_elements[$i]}/block-device-default.yaml if [ -e ${cfg} ]; then cp ${cfg} ${config_yaml} echo "Using block-device config: ${cfg}" $xtrace return fi fi done echo "... done" # how did this get here? if [ -e ${config_yaml} ]; then die "${config_yaml} exists?" fi echo "Using default block-device fallback config" # If no config is there (until now) use the default config cat >${config_yaml} <&2 ; exit 1 ; fi # Note the quotes around `$TEMP': they are essential! eval set -- "$TEMP" while true ; do case "$1" in -a) export ARCH=$2; shift 2 ;; -o) export IMAGE_NAME=$2; shift 2 ;; -t) IFS="," read -a IMAGE_TYPES <<< "$2"; export IMAGE_TYPES ; shift 2 ;; -h|--help) show_options; exit 0;; --version) show_version; exit 0;; -x) shift; DIB_DEBUG_TRACE=$(( $DIB_DEBUG_TRACE + 1 ));; -u) shift; export COMPRESS_IMAGE="";; -c) shift ; export CLEAR_ENV=1;; -n) shift; export SKIP_BASE="1";; -p) IFS="," read -a _INSTALL_PACKAGES <<< "$2"; export INSTALL_PACKAGES=( ${INSTALL_PACKAGES[@]} ${_INSTALL_PACKAGES[@]} ) ; shift 2 ;; --checksum) shift; export DIB_CHECKSUM=1;; --image-size) export DIB_IMAGE_SIZE=$2; shift 2;; --image-extra-size) export DIB_IMAGE_EXTRA_SIZE=$2; shift 2;; --image-cache) export DIB_IMAGE_CACHE=$2; shift 2;; --max-online-resize) export MAX_ONLINE_RESIZE=$2; shift 2;; --mkfs-journal-size) export DIB_JOURNAL_SIZE=$2; shift 2;; --mkfs-options) MKFS_OPTS=$2; shift 2;; --min-tmpfs) export DIB_MIN_TMPFS=$2; shift 2;; --no-tmpfs) shift; export DIB_NO_TMPFS=1;; --offline) shift; export DIB_OFFLINE=1;; --qemu-img-options) QEMU_IMG_OPTIONS=$2; shift 2;; --root-label) ROOT_LABEL=$2; shift 2;; --ramdisk-element) RAMDISK_ELEMENT=$2; shift 2;; --install-type) DIB_DEFAULT_INSTALLTYPE=$2; shift 2;; --docker-target) export DOCKER_TARGET=$2; shift 2 ;; --logfile) export LOGFILE=$2; shift 2 ;; --) shift ; break ;; *) echo "Internal error!" ; exit 1 ;; esac done export DIB_DEBUG_TRACE # TODO: namespace this under ~/.cache/dib/ for consistency export DIB_IMAGE_CACHE=${DIB_IMAGE_CACHE:-~/.cache/image-create} mkdir -p $DIB_IMAGE_CACHE # Setup a symbolic link to the correct python exec so that element # scripts running outside the chroot using "#!/usr/bin/env python" get # the right python version. export DIB_ORIGINAL_PATH=$PATH export DIB_PYTHON_EXEC_TMP=$(mktemp -d -t --tmpdir=$HOME .DIB_PYTHON_TMP.XXXXXXXX) ln -s "$DIB_PYTHON_EXEC" "$DIB_PYTHON_EXEC_TMP/python" export PATH=$DIB_PYTHON_EXEC_TMP:$DIB_ORIGINAL_PATH # We have a couple of critical sections (touching parts of the host # system or download images to common cache) that we use flock around. # Use this directory for lockfiles. export DIB_LOCKFILES=${DIB_LOCKFILES:-~/.cache/dib/lockfiles} mkdir -p $DIB_LOCKFILES if [ "$CLEAR_ENV" = "1" -a "$HOME" != "" ]; then echo "Re-execing to clear environment." echo "(note this will prevent much of the local_config element from working)" exec -c $0 "$@" fi # We send stdout & stderr through "outfilter" which does timestamping, # basic filtering and log file output. _TS_FLAG="" if [[ "${DIB_NO_TIMESTAMP:-0}" -eq 1 ]]; then _TS_FLAG="--no-timestamp" fi # A logfile with *no* DIB_QUIET specified implies we just want output # to the logfile. Explicitly setting DIB_QUIET=0 will overide this # and log both. if [[ -n "${LOGFILE}" && -z "${DIB_QUIET}" ]]; then DIB_QUIET=1 fi _QUIET_FLAG="-v" if [[ "${DIB_QUIET:-0}" -eq 1 ]]; then _QUIET_FLAG="" fi _LOGFILE_FLAG="" if [[ -n "${LOGFILE}" ]]; then echo "Output logs going to: ${LOGFILE}" _LOGFILE_FLAG="-o ${LOGFILE}" fi # Save the existing stdout to fd3 exec 3>&1 exec 1> >( ${DIB_PYTHON_EXEC:-python} $_LIB/outfilter.py ${_TS_FLAG} ${_QUIET_FLAG} ${_LOGFILE_FLAG} ) 2>&1 # Display the current file/function/line in the debug output function _ps4 { IFS=" " called=($(caller 0)) local f=$(readlink -f ${called[2]}) # As we're being run out of the python package's lib/ dir (either # virtualenv or system), we can strip everything before # "site-packages" to significantly shorten the line without really f=${f##*site-packages/} printf "%-80s " "$f:${called[1]}:${called[0]}" } export -f _ps4 export PS4='+ $(_ps4): ' source $_LIB/img-defaults source $_LIB/common-functions source $_LIB/img-functions if [ "$IS_RAMDISK" == "1" ]; then source $_LIB/ramdisk-defaults source $_LIB/ramdisk-functions fi echo "diskimage-builder version $(show_version)" # If no elements are specified theres no way we can succeed if [ -z "$*" ]; then echo "ERROR: At least one distribution root element must be specified" exit 1 fi arg_to_elements "$@" # start tracing after most boilerplate if [ ${DIB_DEBUG_TRACE} -gt 0 ]; then set -x fi if [ "${#IMAGE_TYPES[@]}" = "1" ]; then export IMAGE_NAME=${IMAGE_NAME%%\.${IMAGE_TYPES[0]}} fi # Check for required tools early on for X in ${!IMAGE_TYPES[@]}; do case "${IMAGE_TYPES[$X]}" in qcow2) if ! type qemu-img > /dev/null 2>&1; then echo "qcow2 output format specified but qemu-img executable not found." exit 1 fi ;; tgz) # Force tar to be created. IMAGE_TYPES+=('tar') ;; vhd) if ! type vhd-util > /dev/null 2>&1; then echo "vhd output format specified but no vhd-util executable found." exit 1 fi ;; squashfs) if ! type mksquashfs > /dev/null 2>&1; then echo "squashfs output format specified but no mksquashfs executable found." exit 1 fi ;; docker) if ! type docker > /dev/null 2>&1; then echo "docker output format specified but no docker executable found." exit 1 fi if [ -z "$DOCKER_TARGET" ]; then echo "Please set --docker-target." exit 1 fi ;; esac done # NOTE: fstrim is on most all recent systems. It is provided by the util-linux # package. if ! type fstrim > /dev/null 2>&1; then echo "fstrim utility is not found. This is provided by util-linux package" echo "Please check your PATH variable is set correctly" exit 1 fi # xattr support cannot be relied upon with tmpfs builds # some kernels supoprt it, some don't if [[ -n "${GENTOO_PROFILE}" ]]; then if [[ "${GENTOO_PROFILE}" =~ "hardened" ]]; then echo 'disabling tmpfs for gentoo hardened build' export DIB_NO_TMPFS=1 fi fi mk_build_dir # Create the YAML file with the final and raw configuration for # the block device layer. mkdir -p ${TMP_BUILD_DIR}/block-device BLOCK_DEVICE_CONFIG_YAML=${TMP_BUILD_DIR}/block-device/config.yaml block_device_create_config_file "${BLOCK_DEVICE_CONFIG_YAML}" # Write out the parameter file DIB_BLOCK_DEVICE_PARAMS_YAML=${TMP_BUILD_DIR}/block-device/params.yaml export DIB_BLOCK_DEVICE_PARAMS_YAML cat >${DIB_BLOCK_DEVICE_PARAMS_YAML} < $TMP_HOOKS_PATH/environment.d/11-dib-install-type.bash run_d extra-data # Run pre-install scripts. These do things that prepare the chroot for package installs run_d_in_target pre-install # Call install scripts to pull in the software users want. run_d_in_target install do_extra_package_install run_d_in_target post-install run_d post-root # ensure we do not have a lost+found directory in the root folder # that could cause copy to fail (it will be created again later # when creating the file system, if it needs such directory) if [ -e "$TMP_BUILD_DIR/mnt/lost+found" ]; then sudo rm -rf "$TMP_BUILD_DIR/mnt/lost+found" fi # Free up /mnt unmount_image mv $TMP_BUILD_DIR/mnt $TMP_BUILD_DIR/built # save xtrace state, as we always want to turn it off to avoid # spamming the logs with du output below. xtrace=$(set +o | grep xtrace) # temp file for holding du output du_output=${TMP_BUILD_DIR}/du_output.tmp if [ -n "$DIB_IMAGE_SIZE" ]; then du_size=$(echo "$DIB_IMAGE_SIZE" | awk '{printf("%d\n",$1 * 1024 *1024)}') else set +o xtrace echo "Calculating image size (this may take a minute)..." sudo du -a -c -x ${TMP_BUILD_DIR}/built > ${du_output} # the last line is the total size from "-c". if [ -n "$DIB_IMAGE_EXTRA_SIZE" ]; then # add DIB_IMAGE_EXTRA_SIZE megabytes to create a bigger image as requested du_extra_size=$(echo "$DIB_IMAGE_EXTRA_SIZE" | awk '{printf("%d\n",$1 * 1024)}') du_size_tmp=$(tail -n1 ${du_output} | cut -f1) du_size=$(echo "$du_size_tmp $du_extra_size" | awk '{print int($1 + $2)}') else # scale this by 0.6 to create a slightly bigger image du_size=$(tail -n1 ${du_output} | cut -f1 | awk '{print int($1 / 0.6)}') fi $xtrace fi if [[ "${DIB_SHOW_IMAGE_USAGE:-0}" != 0 ]]; then set +o xtrace if [ ! -f "$du_output" ]; then sudo du -a -c -x ${TMP_BUILD_DIR}/built > ${du_output} fi du_output_show="sort -nr ${du_output} | numfmt --to=iec-i --padding=7 --suffix=B --field=1 --from-unit=1024" # by default show the 10MiB and greater files & directories -- a # dir with lots of little files will still show up, but this helps # signal:noise ratio if [[ ${DIB_SHOW_IMAGE_USAGE_FULL:-0} == 0 ]]; then # numfmt will start giving a decimal place when < 10MiB du_output_show+="| egrep 'MiB|GiB|TiB|PiB' | grep -v '\..MiB'" echo "=================================" echo "Image size report (files > 10MiB)" echo "=================================" else echo "=================" echo "Image size report" echo "=================" fi eval ${du_output_show} echo echo "===== end image size report =====" echo $xtrace fi rm -f ${du_output} if [ -n "$DIB_JOURNAL_SIZE" ]; then journal_size="$DIB_JOURNAL_SIZE" else journal_size=64 fi if [ "$DIB_ROOT_FSTYPE" = "ext4" ] ; then # Very conservative to handle images being resized a lot # We set journal size to 64M so our journal is large enough when we # perform an FS resize. MKFS_OPTS="-i 4096 -J size=$journal_size $MKFS_OPTS" # NOTE(ianw) 2019-12-11 : this is a terrible hack ... if building on # >=Bionic hosts, mkfs sets "metadata_csum" for ext4 filesystems, # which makes broken Trusty images as that era fsck doesn't # understand this flag. The image will stop in early boot # complaining: # # Serious errors were found while checking the disk drive for /. # # We do not really have any suitable hook points where one of the # ubuntu elements or block-device-* could set this override flag for # just Trusty. We probably should, but desire to implement more # code to support the out-of-date trusty at this point is # non-existant. So hack in disabling this here. if [[ ${DIB_RELEASE} == "trusty" ]]; then MKFS_OPTS="-O ^metadata_csum $MKFS_OPTS" fi # Grow the image size to account for the journal, only if the user # has not asked for a specific size. if [ -z "$DIB_IMAGE_SIZE" ]; then du_size=$(( $du_size + ($journal_size * 1024) )) fi fi # EFI system partitions default to be quite large at 512mb for maximum # compatability (see notes in # 7fd52ba84180b4e749ccf4c9db8c49eafff46ea8) . We need to increase the # total size to account for this, or we run out of space creating the # final image. See if we have included the block-device-efi element, # which implies we have a large EFI partition, and then pad the final # image size. if [[ ${IMAGE_ELEMENT} =~ "block-device-efi" ]]; then echo "Expanding disk for EFI partition" du_size=$(( $du_size + (525 * 1024) )) fi # Rounding down size so that is is a multiple of 64, works around a bug in # qemu-img that may occur when compressing raw images that aren't a multiple # of 64k. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1180021 export DIB_IMAGE_SIZE=$(echo "$du_size" | awk ' { if ($1 % 64 != 0) print $1 + 64 - ( $1 % 64); else print $1; } ') if [ -n "$MAX_ONLINE_RESIZE" ]; then MKFS_OPTS="-E resize=$MAX_ONLINE_RESIZE $MKFS_OPTS" fi export TMP_IMAGE_DIR # Try the 'old fashioned' way calling the block device # phase. If this gives no result, use the configuration based approach: eval_run_d block-device "IMAGE_BLOCK_DEVICE=" if [ -z ${IMAGE_BLOCK_DEVICE} ] ; then # For compatibily reasons in addition to the YAML configuration # there is the need to handle the old environment variables. echo "image-size: ${DIB_IMAGE_SIZE}KiB" >> ${DIB_BLOCK_DEVICE_PARAMS_YAML} if [ -n "${MKFS_OPTS}" ] ; then echo "root-fs-opts: '${MKFS_OPTS}'" >> ${DIB_BLOCK_DEVICE_PARAMS_YAML} fi # After changeing the parameters, there is the need to # re-run dib-block-device init because some value might # change based on the new set parameters. dib-block-device init # values to dib-block-device: using the YAML config and dib-block-device create # This is the device (/dev/loopX). It's where to install the # bootloader. IMAGE_BLOCK_DEVICE=$(dib-block-device getval image-block-device) export IMAGE_BLOCK_DEVICE # Similar to above, but all mounted devices. This is handy for # some bootloaders that have multi-partition layouts and want to # copy things to different places other than just # IMAGE_BLOCK_DEVICE. "eval" this into an array as needed IMAGE_BLOCK_DEVICES=$(dib-block-device getval image-block-devices) export IMAGE_BLOCK_DEVICES # Write the fstab dib-block-device writefstab fi # XXX: needed? LOOPDEV=${IMAGE_BLOCK_DEVICE} # At this point, dib-block-device has created the raw image file # (IMAGE_BLOCK_DEVICE) and mounted all the partitions under # $TMP_BUILD_DIR/mnt for us. We can now copy into the final image. # 'mv' is not usable here - especially when a top level directory # has the same name as a mount point of a partition. If so, 'mv' # will complain: # mv: inter-device move failed: '...' to '...'; \ # unable to remove target: Device or resource busy # therefore a 'cp' and 'rm' approach is used. sudo cp -ra ${TMP_BUILD_DIR}/built/* $TMP_BUILD_DIR/mnt sudo rm -fr ${TMP_BUILD_DIR}/built/* mount_proc_dev_sys run_d pre-finalise run_d_in_target finalise finalise_base for X in ${!IMAGE_TYPES[@]} ; do if [[ " tar aci " =~ "${IMAGE_TYPES[$X]}" ]]; then if [ "${IMAGE_TYPES[$X]}" = "aci" ]; then sudo tar -C ${TMP_BUILD_DIR}/mnt -cf $IMAGE_NAME.aci --exclude ./sys \ --exclude ./proc --xattrs --xattrs-include=\* \ --transform 's,^.,rootfs,S' . if [ -n "$ACI_MANIFEST" ]; then cp $ACI_MANIFEST ${TMP_BUILD_DIR}/manifest sudo tar -C ${TMP_BUILD_DIR} --append -f $IMAGE_NAME.aci manifest else echo "No ACI_MANIFEST specified. An ACI_MANIFEST must be specified for" echo " this image to be usable." fi else sudo tar -C ${TMP_BUILD_DIR}/mnt -cf $IMAGE_NAME.tar --exclude ./sys \ --exclude ./proc --xattrs --xattrs-include=\* . fi sudo chown $USER: $IMAGE_NAME.${IMAGE_TYPES[$X]} unset IMAGE_TYPES[$X] elif [ "${IMAGE_TYPES[$x]}" == "squashfs" ]; then sudo mksquashfs ${TMP_BUILD_DIR}/mnt $IMAGE_NAME.squash -comp xz \ -noappend -root-becomes ${TMP_BUILD_DIR}/mnt \ -wildcards -e "proc/*" -e "sys/*" -no-recovery elif [ "${IMAGE_TYPES[$X]}" == "docker" ]; then sudo tar -C ${TMP_BUILD_DIR}/mnt -cf - --exclude ./sys \ --exclude ./proc --xattrs --xattrs-include=\* . \ | sudo docker import - $DOCKER_TARGET unset IMAGE_TYPES[$X] fi done # Unmount and cleanup the /mnt and /build subdirectories, to save # space before converting the image to some other format. # XXX ? needed? export EXTRA_UNMOUNT="" unmount_image TMP_IMAGE_PATH=$(dib-block-device getval image-path) export TMP_IMAGE_PATH # remove all mounts dib-block-device umount dib-block-device cleanup cleanup_build_dir if [[ (! $IMAGE_ELEMENT =~ no-final-image) && "$IS_RAMDISK" == "0" ]]; then has_raw_type= for IMAGE_TYPE in ${IMAGE_TYPES[@]} ; do # We have to do raw last because it is destructive if [ "$IMAGE_TYPE" = "raw" ]; then has_raw_type=1 elif [ "$IMAGE_TYPE" != "squashfs" ]; then compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE fi done if [ -n "$has_raw_type" ]; then IMAGE_TYPE="raw" compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE fi fi # Remove the leftovers, i.e. the temporary image directory. cleanup_image_dir cleanup_temp_python_exec # Restore fd 1&2 from the outfilter.py redirect back to the original # saved fd. Note small hack that we can't really wait properly for # outfilter.py so put in a sleep (might be possible to use coproc for # this...?) # # TODO(ianw): probably better to cleanup the exit handler a bit for # this? We really want some helper functions that append to the exit # handler so we can register multiple things. set +o xtrace echo "Build completed successfully" exec 1>&3 2>&3 sleep 1 # All done! trap EXIT diskimage-builder-2.35.0/diskimage_builder/paths.py0000664000175000017500000000201713640271474022350 0ustar zuulzuul00000000000000# Copyright 2016 Ian Wienand (iwienand@redhat.com) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """Export paths""" import os import pkg_resources import sys def get_path(var): if var == "lib": return os.path.abspath( pkg_resources.resource_filename(__name__, "lib")) elif var == "elements": return os.path.abspath( pkg_resources.resource_filename(__name__, "elements")) else: print("Unknown path request!") sys.exit(1) def show_path(var): print(get_path(var)) diskimage-builder-2.35.0/diskimage_builder/disk_image_create.py0000664000175000017500000000532713640271474024657 0ustar zuulzuul00000000000000# Copyright 2016 Ian Wienand (iwienand@redhat.com) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os import os.path import runpy import sys import diskimage_builder.paths # borrowed from pip:locations.py def running_under_virtualenv(): """Return True if we're running inside a virtualenv, False otherwise.""" if hasattr(sys, 'real_prefix'): return True elif sys.prefix != getattr(sys, "base_prefix", sys.prefix): return True return False def activate_venv(): if running_under_virtualenv(): activate_this = os.path.join(sys.prefix, "bin", "activate_this.py") globs = runpy.run_path(activate_this, globals()) globals().update(globs) del globs def main(): # If we are called directly from a venv install # (/path/venv/bin/disk-image-create) then nothing has added the # virtualenv bin/ dir to $PATH. the exec'd script below will be # unable to find call other dib tools like dib-run-parts. # # One solution is to say that you should only ever run # disk-image-create in a shell that has already sourced # bin/activate.sh (all this really does is add /path/venv/bin to # $PATH). That's not a great interface as resulting errors will # be very non-obvious. # # We can detect if we are running in a virtualenv and use # virtualenv's "activate_this.py" script to activate it ourselves # before we call the script. This ensures we have the path setting activate_venv() environ = os.environ # pre-seed some paths for the shell script environ['_LIB'] = diskimage_builder.paths.get_path('lib') # export the path to the current python if not os.environ.get('DIB_PYTHON_EXEC'): os.environ['DIB_PYTHON_EXEC'] = sys.executable # we have to handle being called as "disk-image-create" or # "ramdisk-image-create". ramdisk-iamge-create is just a symlink # to disk-image-create # XXX: we could simplify things by removing the symlink, and # just setting IS_RAMDISK in environ here depending on sys.argv[1] script = "%s/%s" % (diskimage_builder.paths.get_path('lib'), os.path.basename(sys.argv[0])) os.execve("/bin/bash", ['bash', script] + sys.argv[1:], environ) diskimage-builder-2.35.0/diskimage_builder/block_device/0000775000175000017500000000000013640271564023270 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/level3/0000775000175000017500000000000013640271564024462 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/level3/__init__.py0000664000175000017500000000000013640271474026561 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/level3/mount.py0000664000175000017500000001514013640271474026177 0ustar zuulzuul00000000000000# Copyright 2017 Andreas Florath (andreas@florath.net) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import functools import logging import os from diskimage_builder.block_device.exception \ import BlockDeviceSetupException from diskimage_builder.block_device.plugin import NodeBase from diskimage_builder.block_device.plugin import PluginBase from diskimage_builder.block_device.utils import exec_sudo logger = logging.getLogger(__name__) class MountPointNode(NodeBase): def __init__(self, mount_base, config, state): super(MountPointNode, self).__init__(config['name'], state) # Parameter check self.mount_base = mount_base for pname in ['base', 'mount_point']: if pname not in config: raise BlockDeviceSetupException( "MountPoint config needs [%s]" % pname) setattr(self, pname, config[pname]) logger.debug("MountPoint created [%s]", self) def get_edges(self): """Insert all edges The dependency edge is created in all cases from the base element (typically a mkfs) and, if this is not the 'first' mount-point, an edge is created from the mount-point before in "sorted order" (see :func:`sort_mount_points`). This ensures that during mounting (and umounting) the globally correct order is used. """ edge_from = [] edge_to = [] # should have been added by __init__... assert 'sorted_mount_points' in self.state sorted_mount_points = self.state['sorted_mount_points'] # If we are not first, add our parent in the global dependency # list. sorted_mount_points is tuples (mount_point, node_name). # find ourselves in the mount_points, and our parent node # is one before us in node_name list. mount_points = [x[0] for x in sorted_mount_points] node_name = [x[1] for x in sorted_mount_points] mpi = mount_points.index(self.mount_point) if mpi > 0: dep = node_name[mpi - 1] edge_from.append(dep) edge_from.append(self.base) return (edge_from, edge_to) def create(self): logger.debug("mount called [%s]", self.mount_point) rel_mp = self.mount_point if self.mount_point[0] != '/' \ else self.mount_point[1:] mount_point = os.path.join(self.mount_base, rel_mp) if not os.path.exists(mount_point): # Need to sudo this because of permissions in the new # file system tree. exec_sudo(['mkdir', '-p', mount_point]) logger.info("Mounting [%s] to [%s]", self.name, mount_point) exec_sudo(["mount", self.state['filesys'][self.base]['device'], mount_point]) if 'mount' not in self.state: self.state['mount'] = {} self.state['mount'][self.mount_point] \ = {'name': self.name, 'base': self.base, 'path': mount_point} if 'mount_order' not in self.state: self.state['mount_order'] = [] self.state['mount_order'].append(self.mount_point) def umount(self): logger.info("Called for [%s]", self.name) # Before calling umount, call 'fstrim' on suitable mounted # file systems. This discards unused blocks from the mounted # file system and therefore decreases the resulting image # size. # # A race condition can occur when trying to fstrim immediately # after deleting a file resulting in that free space not being # reclaimed. Calling sync before fstrim is a workaround for # this behaviour. # https://lists.gnu.org/archive/html/qemu-devel/2014-03/msg02978.html exec_sudo(["sync"]) if self.state['filesys'][self.base]['fstype'] != 'vfat': exec_sudo(["fstrim", "--verbose", self.state['mount'][self.mount_point]['path']]) exec_sudo(["umount", self.state['mount'][self.mount_point]['path']]) def delete(self): self.umount() def cmp_mount_order(this, other): """Sort comparision function for mount-point sorting See if ``this`` comes before ``other`` in mount-order list. In words: if the other mount-point has us as it's parent, we come before it (are less than it). e.g. ``/var < /var/log < /var/log/foo`` :param this: tuple of mount_point, node name :param other: tuple of mount_point, node name :returns int: cmp value """ # sort is only based on the mount_point. this, _ = this other, _ = other if this == other: return 0 if other.startswith(this): return -1 else: return 1 class Mount(PluginBase): def __init__(self, config, defaults, state): super(Mount, self).__init__() if 'mount-base' not in defaults: raise BlockDeviceSetupException( "Mount default config needs 'mount-base'") self.node = MountPointNode(defaults['mount-base'], config, state) # save this new node to the global mount-point list and # re-order it to keep it in mount-order. Used in get_edges() # to ensure we build the mount graph in order # # note we can't just put the MountPointNode into the state, # because it's not json serialisable and we still dump the # state to json. that's why we have this (mount_point, name) # tuples and sorting trickery sorted_mount_points = state.get('sorted_mount_points', []) mount_points = [mp for mp, name in sorted_mount_points] if self.node.mount_point in mount_points: raise BlockDeviceSetupException( "Mount point [%s] specified more than once" % self.node.mount_point) sorted_mount_points.append((self.node.mount_point, self.node.name)) sorted_mount_points.sort(key=functools.cmp_to_key(cmp_mount_order)) # Save the state if it's new (otherwise this is idempotent update) state['sorted_mount_points'] = sorted_mount_points logger.debug("Ordered mounts now: %s", sorted_mount_points) def get_nodes(self): return [self.node] diskimage-builder-2.35.0/diskimage_builder/block_device/level4/0000775000175000017500000000000013640271564024463 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/level4/fstab.py0000664000175000017500000000345113640271474026137 0ustar zuulzuul00000000000000# Copyright 2017 Andreas Florath (andreas@florath.net) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging from diskimage_builder.block_device.plugin import NodeBase from diskimage_builder.block_device.plugin import PluginBase logger = logging.getLogger(__name__) class FstabNode(NodeBase): def __init__(self, config, state): super(FstabNode, self).__init__(config['name'], state) self.base = config['base'] self.options = config.get('options', 'defaults') self.dump_freq = config.get('dump-freq', 0) self.fsck_passno = config.get('fsck-passno', 2) def get_edges(self): edge_from = [self.base] edge_to = [] return (edge_from, edge_to) def create(self): logger.debug("fstab create called [%s]", self.name) if 'fstab' not in self.state: self.state['fstab'] = {} self.state['fstab'][self.base] = { 'name': self.name, 'base': self.base, 'options': self.options, 'dump-freq': self.dump_freq, 'fsck-passno': self.fsck_passno } class Fstab(PluginBase): def __init__(self, config, defaults, state): super(Fstab, self).__init__() self.node = FstabNode(config, state) def get_nodes(self): return [self.node] diskimage-builder-2.35.0/diskimage_builder/block_device/level4/__init__.py0000664000175000017500000000000013640271474026562 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/exception.py0000664000175000017500000000116413640271474025642 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. class BlockDeviceSetupException(Exception): """Generic exception""" diskimage-builder-2.35.0/diskimage_builder/block_device/__init__.py0000664000175000017500000000000013640271474025367 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/config.py0000664000175000017500000002234413640271474025114 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging import networkx as nx import os from stevedore import extension from diskimage_builder.block_device.exception import \ BlockDeviceSetupException from diskimage_builder.block_device.plugin import NodeBase from diskimage_builder.block_device.plugin import PluginBase logger = logging.getLogger(__name__) _extensions = extension.ExtensionManager( namespace='diskimage_builder.block_device.plugin', invoke_on_load=False) # check if a given name is registered as a plugin def is_a_plugin(name): return any( _extensions.map(lambda x: x.name == name)) def recurse_config(config, parent_base=None): """Convert a config "tree" to it's canonical name/base graph version This is a recursive function to convert a YAML layout "tree" config into a "flat" graph-based config. Arguments: :param config: the incoming config dictionary :param parent_base: the name of the parent node, if any :return: a list of expanded, graph-based config items """ output = [] this = {} # We should only have one key, with multiple values, being the # config entries. e.g. (this was checked by config_tree_to_graph) # # mkfs: # # type: ext4 # # label: 1234 assert len(config.items()) == 1 for k, v in config.items(): key = k values = v # If we don't have a base, we take the parent base; first element # can have no base, however. if 'base' not in values: if parent_base is not None: this['base'] = parent_base else: this['base'] = values['base'] # If we don't have a name, it is made up as "key_base" if 'name' not in values: this['name'] = "%s_%s" % (key, this['base']) else: this['name'] = values['name'] # Go through the values dictionary. Either this is a "plugin" # key that needs to be recursed, or it is a value that is part of # this config entry. for nk, nv in values.items(): if nk == "partitions": # "partitions" is a special key of the "partitioning" # object. It is a list. Each list-entry gets treated # as a top-level entry, so we need to recurse it's # keys. But instead of becoming its own entry in the # graph, it gets attached to the .partitions attribute # of the parent. (see end for example) this['partitions'] = [] for partition in nv: new_part = {} for pk, pv in partition.items(): if is_a_plugin(pk): output.extend( recurse_config({pk: pv}, partition['name'])) else: new_part[pk] = pv new_part['base'] = this['base'] this['partitions'].append(new_part) elif is_a_plugin(nk): # is this key a plugin directive? If so, we recurse # into it. output.extend(recurse_config({nk: nv}, this['name'])) else: # A value entry; just save as part of this entry this[nk] = nv output.append({k: this}) return output def config_tree_to_graph(config): """Turn a YAML config into a graph config Our YAML config is a list of entries. Each Arguments: :parm config: YAML config; either graph or tree :return: graph-based result """ output = [] for entry in config: # Top-level entries should be a dictionary and have a plugin # registered for it if not isinstance(entry, dict): raise BlockDeviceSetupException( "Config entry not a dict: %s" % entry) keys = list(entry.keys()) if len(keys) != 1: raise BlockDeviceSetupException( "Config entry top-level should be a single dict: %s" % entry) if not is_a_plugin(keys[0]): raise BlockDeviceSetupException( "Config entry is not a plugin value: %s" % entry) output.extend(recurse_config(entry)) return output def create_graph(config, default_config, state): """Generate configuration digraph Generate the configuration digraph from the config :param config: graph configuration file :param default_config: default parameters (from --params) :param state: reference to global state dictionary. Passed to :func:`PluginBase.__init__` :return: tuple with the graph object (a :class:`nx.Digraph`), ordered list of :class:`NodeBase` objects """ # This is the directed graph of nodes: each parse method must # add the appropriate nodes and edges. dg = nx.DiGraph() # check about dg.nodes, to support different networkx versions if hasattr(dg.nodes, '__iter__'): dg_nodes = dg.nodes else: dg_nodes = dg.node for config_entry in config: # this should have been checked by generate_config assert len(config_entry) == 1 logger.debug("Config entry [%s]", config_entry) cfg_obj_name = list(config_entry.keys())[0] cfg_obj_val = config_entry[cfg_obj_name] # Instantiate a "plugin" object, passing it the # configuration entry # XXX : would a "factory" pattern for plugins, where we # make a method call on an object stevedore has instantiated # be better here? if not is_a_plugin(cfg_obj_name): raise BlockDeviceSetupException( ("Config element [%s] is not implemented" % cfg_obj_name)) plugin = _extensions[cfg_obj_name].plugin assert issubclass(plugin, PluginBase) cfg_obj = plugin(cfg_obj_val, default_config, state) # Ask the plugin for the nodes it would like to insert # into the graph. Some plugins, such as partitioning, # return multiple nodes from one config entry. nodes = cfg_obj.get_nodes() assert isinstance(nodes, list) for node in nodes: # plugins should return nodes... assert isinstance(node, NodeBase) # ensure node names are unique. networkx by default # just appends the attribute to the node dict for # existing nodes, which is not what we want. if node.name in dg_nodes: raise BlockDeviceSetupException( "Duplicate node name: %s" % (node.name)) logger.debug("Adding %s : %s", node.name, node) dg.add_node(node.name, obj=node) # Now find edges for name, attr in dg.nodes(data=True): obj = attr['obj'] # Unfortunately, we can not determine node edges just from # the configuration file. It's not always simply the # "base:" pointer. So ask nodes for a list of nodes they # want to point to. *mostly* it's just base: ... but # mounting is different. # edges_from are the nodes that point to us # edges_to are the nodes we point to edges_from, edges_to = obj.get_edges() logger.debug("Edges for %s: f:%s t:%s", name, edges_from, edges_to) for edge_from in edges_from: if edge_from not in dg_nodes: raise BlockDeviceSetupException( "Edge not defined: %s->%s" % (edge_from, name)) dg.add_edge(edge_from, name) for edge_to in edges_to: if edge_to not in dg_nodes: raise BlockDeviceSetupException( "Edge not defined: %s->%s" % (name, edge_to)) dg.add_edge(name, edge_to) # this can be quite helpful debugging but needs pydotplus which # isn't in requirements. for debugging, do # .tox/py27/bin/pip install pydotplus # DUMP_CONFIG_GRAPH=1 tox -e py27 -- specific_test # dotty /tmp/graph_dump.dot # to see helpful output if 'DUMP_CONFIG_GRAPH' in os.environ: nx.nx_pydot.write_dot(dg, '/tmp/graph_dump.dot') # Topological sort (i.e. create a linear array that satisfies # dependencies) and return the object list call_order_nodes = list(nx.topological_sort(dg)) logger.debug("Call order: %s", call_order_nodes) call_order = [dg_nodes[n]['obj'] for n in call_order_nodes] return dg, call_order # # On partitioning: objects # # To be concrete -- # # # partitioning: # # base: loop0 # # name: mbr # # partitions: # # - name: partition1 # # foo: bar # # mkfs: # # type: xfs # # mount: # # mount_point: / # # gets turned into the following graph: # # # partitioning: # # partitions: # # - name: partition1 # # base: image0 # # foo: bar # # # mkfs: # # base: partition1 # # name: mkfs_partition1 # # type: xfs # # # mount: # # base: mkfs_partition1 # # name: mount_mkfs_partition1 # # mount_point: / diskimage-builder-2.35.0/diskimage_builder/block_device/tests/0000775000175000017500000000000013640271564024432 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/0000775000175000017500000000000013640271564025677 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/lvm_tree_partition_ordering.yamldiskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/lvm_tree_partition_ordering.yam0000664000175000017500000000175713640271474034220 0ustar zuulzuul00000000000000- local_loop: name: image0 size: 5G - partitioning: base: image0 label: mbr partitions: - name: boot flags: [ boot,primary ] size: 1G - name: root flags: [ primary ] size: 3G - lvm: name: lvm base: [root] pvs: - name: pv base: root vgs: - name: vg base: ["pv"] lvs: - name: lv_root base: vg size: 2000M - name: lv_var base: vg size: 500M - mkfs: base: boot type: ext3 mount: mount_point: /boot fstab: options: "nodev,nosuid" fsck-passno: 2 - mkfs: name: mkfs_root base: lv_root label: "img-rootfs" type: "ext4" mount: mount_point: / fstab: options: "noacl,errors=remount-ro" fsck-passno: 1 - mkfs: name: mkfs_var base: lv_var type: "ext4" mount: mount_point: /var fstab: options: "noacl" fsck-passno: 2 diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/bad_plugin.yaml0000664000175000017500000000006613640271474030671 0ustar zuulzuul00000000000000- this_is_not_a_plugin_name: foo: bar baz: moodiskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/lvm_tree.yaml0000664000175000017500000000320513640271474030400 0ustar zuulzuul00000000000000- local_loop: name: image0 - partitioning: base: image0 name: mbr label: mbr partitions: - name: root base: image0 flags: [ boot,primary ] size: 3G - lvm: base: mbr pvs: - name: pv options: ["--force"] base: root vgs: - name: vg base: ["pv"] options: ["--force"] lvs: - name: lv_root base: vg size: 1800M - name: lv_tmp base: vg size: 100M - name: lv_var base: vg size: 500M - name: lv_log base: vg size: 100M - name: lv_audit base: vg size: 100M - name: lv_home base: vg size: 200M - mkfs: name: fs_root base: lv_root label: "img-rootfs" type: "xfs" mount: mount_point: / fstab: options: "rw,relatime" fsck-passno: 1 - mkfs: name: fs_var base: lv_var type: "xfs" mount: mount_point: /var fstab: options: "rw,relatime" - mkfs: name: fs_log base: lv_log type: "xfs" mount: mount_point: /var/log fstab: options: "rw,relatime" - mkfs: name: fs_audit base: lv_audit type: "xfs" mount: mount_point: /var/log/audit fstab: options: "rw,relatime" - mkfs: name: fs_tmp base: lv_tmp type: "xfs" mount: mount_point: /tmp fstab: options: "rw,nosuid,nodev,noexec,relatime" - mkfs: name: fs_home base: lv_home type: "xfs" mount: mount_point: /home fstab: options: "rw,nodev,relatime" diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/bad_edge_graph.yaml0000664000175000017500000000071113640271474031455 0ustar zuulzuul00000000000000- local_loop: name: image0 - partitioning: base: image0 name: mbr label: mbr partitions: - flags: [boot, primary] name: root base: image0 size: 100% - mount: base: mkfs_root name: mount_mkfs_root mount_point: / - fstab: base: mount_mkfs_root name: fstab_mount_mkfs_root fsck-passno: 1 options: defaults - mkfs: base: this_is_not_a_node name: mkfs_root type: ext4 ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/lvm_tree_multiple_partitions.yamldiskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/lvm_tree_multiple_partitions.ya0000664000175000017500000000374013640271474034242 0ustar zuulzuul00000000000000- local_loop: name: image0 - partitioning: base: image0 label: mbr partitions: - name: root flags: [ boot ] size: 3G - name: ESP type: 'EF00' size: 8MiB mkfs: type: vfat mount: mount_point: /boot/efi fstab: options: "defaults" fsck-passno: 1 - name: BSP type: 'EF02' size: 8MiB - lvm: name: lvm base: [ root ] pvs: - name: pv base: root options: [ "--force" ] vgs: - name: vg base: [ "pv" ] options: [ "--force" ] lvs: - name: lv_root base: vg extents: 28%VG - name: lv_tmp base: vg extents: 4%VG - name: lv_var base: vg extents: 40%VG - name: lv_log base: vg extents: 23%VG - name: lv_audit base: vg extents: 4%VG - name: lv_home base: vg extents: 1%VG - mkfs: name: fs_root base: lv_root type: xfs label: "img-rootfs" mount: mount_point: / fstab: options: "rw,relatime" fck-passno: 1 - mkfs: name: fs_tmp base: lv_tmp type: xfs mount: mount_point: /tmp fstab: options: "rw,nosuid,nodev,noexec,relatime" - mkfs: name: fs_var base: lv_var type: xfs mount: mount_point: /var fstab: options: "rw,relatime" - mkfs: name: fs_log base: lv_log type: xfs mount: mount_point: /var/log fstab: options: "rw,relatime" - mkfs: name: fs_audit base: lv_audit type: xfs mount: mount_point: /var/log/audit fstab: options: "rw,relatime" - mkfs: name: fs_home base: lv_home type: xfs mount: mount_point: /home fstab: options: "rw,nodev,relatime" diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/rollback.yaml0000664000175000017500000000105013640271474030350 0ustar zuulzuul00000000000000- test_a: name: test_node_a rollback_one_arg: down rollback_two_arg: you - test_b: base: test_node_a name: test_node_b rollback_one_arg: let rollback_two_arg: gonna - test_a: base: test_node_b name: test_node_aa rollback_one_arg: never rollback_two_arg: up - test_b: base: test_node_aa name: test_node_bb rollback_one_arg: you rollback_two_arg: give - test_a: base: test_node_bb name: test_node_aaa rollback_one_arg: gonna rollback_two_arg: never trigger_rollback: yesdiskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/simple_tree.yaml0000664000175000017500000000013313640271474031070 0ustar zuulzuul00000000000000- mkfs: name: root_fs base: root_part type: xfs mount: mount_point: /diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/deep_graph.yaml0000664000175000017500000000067213640271474030666 0ustar zuulzuul00000000000000- local_loop: name: image0 - partitioning: base: image0 name: mbr label: mbr partitions: - flags: [boot, primary] name: root base: image0 size: 100% - mount: base: mkfs_root name: mount_mkfs_root mount_point: / - fstab: base: mount_mkfs_root name: fstab_mount_mkfs_root fsck-passno: 1 options: defaults - mkfs: base: root name: mkfs_root type: ext4diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/too_long_fs_label.yaml0000664000175000017500000000015413640271474032232 0ustar zuulzuul00000000000000- mkfs: base: fake name: mkfs_root label: this_label_is_too_long_to_work_with_xfs type: xfs diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/lvm_tree_multiple_pv.yaml0000664000175000017500000000335213640271474033023 0ustar zuulzuul00000000000000- local_loop: name: image0 - partitioning: base: image0 label: mbr partitions: - name: root flags: [ boot,primary ] size: 3G - name: data flags: [ primary ] size: 1G - lvm: name: lvm pvs: - name: pv options: ["--force"] base: root - name: pv1 options: ["--force"] base: data vgs: - name: vg base: ["pv", "pv1"] options: ["--force"] lvs: - name: lv_root base: vg size: 1800M - name: lv_tmp base: vg size: 100M - name: lv_var base: vg size: 500M - name: lv_log base: vg size: 100M - name: lv_audit base: vg size: 100M - name: lv_home base: vg size: 200M - mkfs: name: fs_root base: lv_root label: "img-rootfs" type: "xfs" mount: mount_point: / fstab: options: "rw,relatime" fsck-passno: 1 - mkfs: name: fs_var base: lv_var type: "xfs" mount: mount_point: /var fstab: options: "rw,relatime" - mkfs: name: fs_log base: lv_log type: "xfs" mount: mount_point: /var/log fstab: options: "rw,relatime" - mkfs: name: fs_audit base: lv_audit type: "xfs" mount: mount_point: /var/log/audit fstab: options: "rw,relatime" - mkfs: name: fs_tmp base: lv_tmp type: "xfs" mount: mount_point: /tmp fstab: options: "rw,nosuid,nodev,noexec,relatime" - mkfs: name: fs_home base: lv_home type: "xfs" mount: mount_point: /home fstab: options: "rw,nodev,relatime" diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/lvm_tree_spanned_vg.yaml0000664000175000017500000000234513640271474032610 0ustar zuulzuul00000000000000# testing config for a LVM data volume group that spans two partitions - local_loop: name: image0 - partitioning: base: image0 label: mbr partitions: - name: root flags: [ boot,primary ] size: 3G - name: data1 flags: [ primary ] size: 1G - name: data2 flags: [ primary ] size: 1G - lvm: name: lvm pvs: - name: pv_root options: ["--force"] base: root - name: pv_data1 options: ["--force"] base: data1 - name: pv_data2 options: ["--force"] base: data2 vgs: - name: vg_root base: ["pv_root"] options: ["--force"] - name: vg_data base: ["pv_data1", "pv_data2"] options: ["--force"] lvs: - name: lv_root base: vg_root size: 1800M - name: lv_data base: vg_data size: 2G - mkfs: name: fs_root base: lv_root label: "img-rootfs" type: "xfs" mount: mount_point: / fstab: options: "rw,relatime" fsck-passno: 1 - mkfs: name: fs_data base: lv_data type: "xfs" mount: mount_point: /opt fstab: options: "rw,relatime" diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/lvm_tree_multiple_pv_vg.yaml0000664000175000017500000000346013640271474033517 0ustar zuulzuul00000000000000- local_loop: name: image0 - partitioning: base: image0 label: mbr partitions: - name: root flags: [ boot,primary ] size: 3G - name: data flags: [ primary ] size: 1G - lvm: name: lvm pvs: - name: pv options: ["--force"] base: root - name: pv1 options: ["--force"] base: data vgs: - name: vg1 base: ["pv"] options: ["--force"] - name: vg2 base: ["pv1"] options: ["--force"] lvs: - name: lv_root base: vg1 size: 1800M - name: lv_tmp base: vg1 size: 100M - name: lv_var base: vg2 size: 500M - name: lv_log base: vg2 size: 100M - name: lv_audit base: vg2 size: 100M - name: lv_home base: vg2 size: 200M - mkfs: name: fs_root base: lv_root label: "img-rootfs" type: "xfs" mount: mount_point: / fstab: options: "rw,relatime" fsck-passno: 1 - mkfs: name: fs_var base: lv_var type: "xfs" mount: mount_point: /var fstab: options: "rw,relatime" - mkfs: name: fs_log base: lv_log type: "xfs" mount: mount_point: /var/log fstab: options: "rw,relatime" - mkfs: name: fs_audit base: lv_audit type: "xfs" mount: mount_point: /var/log/audit fstab: options: "rw,relatime" - mkfs: name: fs_tmp base: lv_tmp type: "xfs" mount: mount_point: /tmp fstab: options: "rw,nosuid,nodev,noexec,relatime" - mkfs: name: fs_home base: lv_home type: "xfs" mount: mount_point: /home fstab: options: "rw,nodev,relatime" diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/cmd_create.yaml0000664000175000017500000000012613640271474030650 0ustar zuulzuul00000000000000- test_a: name: test_node_a - test_b: name: test_node_b base: test_node_adiskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/duplicate_fs_labels.yaml0000664000175000017500000000216013640271474032546 0ustar zuulzuul00000000000000- local_loop: name: image0 - partitioning: base: image0 name: mbr label: mbr partitions: - name: root base: image0 flags: [ boot, primary ] size: 55% - name: var base: image0 size: 40% - name: var_log base: image0 size: 5% - mkfs: base: root name: mkfs_root label: duplicate type: xfs - mount: base: mkfs_root name: mount_mkfs_root mount_point: / - fstab: base: mount_mkfs_root name: fstab_mount_mkfs_root fsck-passno: 1 options: defaults - mkfs: base: var name: mkfs_var label: duplicate type: xfs - mount: base: mkfs_var name: mount_mkfs_var mount_point: /var - fstab: base: mount_mkfs_var name: fstab_mount_mkfs_var fsck-passno: 1 options: defaults - mkfs: base: var_log name: mkfs_var_log type: xfs - mount: base: mkfs_var_log name: mount_mkfs_var_log mount_point: /var/log - fstab: base: mount_mkfs_var_log name: fstab_mount_mkfs_var_log fsck-passno: 1 options: defaults diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/deep_tree.yaml0000664000175000017500000000052613640271474030522 0ustar zuulzuul00000000000000- local_loop: name: image0 - partitioning: name: mbr base: image0 label: mbr partitions: - name: root flags: [ boot, primary ] size: 100% mkfs: type: ext4 mount: mount_point: / fstab: options: "defaults" fsck-passno: 1 diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/gpt_efi.yaml0000664000175000017500000000141413640271474030200 0ustar zuulzuul00000000000000# A sample config that has GPT/bios and EFI boot partitions - local_loop: name: image0 - partitioning: base: image0 label: gpt partitions: - name: ESP type: 'EF00' size: 8MiB mkfs: type: vfat mount: mount_point: /boot/efi fstab: options: "defaults" fsck-passno: 1 - name: BSP type: 'EF02' size: 8MiB # spaces are probably a bad idea for max compatability, but # we're deliberatly testing it here. - name: Root Part type: '8300' size: 100% mkfs: type: ext4 mount: mount_point: / fstab: options: "defaults" fsck-passno: 1 diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/duplicate_name.yaml0000664000175000017500000000073213640271474031537 0ustar zuulzuul00000000000000- local_loop: name: this_is_a_duplicate - partitioning: base: this_is_a_duplicate name: root label: mbr partitions: - flags: [boot, primary] name: root base: image0 size: 100% - mount: base: mkfs_root name: this_is_a_duplicate mount_point: / - fstab: base: mount_mkfs_root name: fstab_mount_mkfs_root fsck-passno: 1 options: defaults - mkfs: base: root name: mkfs_root type: ext4 diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/multiple_partitions_graph.yaml0000664000175000017500000000221213640271474034050 0ustar zuulzuul00000000000000- local_loop: name: image0 - partitioning: base: image0 name: mbr label: mbr partitions: - name: root base: image0 flags: [ boot, primary ] size: 55% - name: var base: image0 size: 40% - name: var_log base: image0 size: 5% - mkfs: base: root name: mkfs_root type: xfs uuid: root-uuid-1234 - mount: base: mkfs_root name: mount_mkfs_root mount_point: / - fstab: base: mount_mkfs_root name: fstab_mount_mkfs_root fsck-passno: 1 options: defaults - mkfs: base: var name: mkfs_var type: xfs uuid: var-uuid-1234 - mount: base: mkfs_var name: mount_mkfs_var mount_point: /var - fstab: base: mount_mkfs_var name: fstab_mount_mkfs_var fsck-passno: 1 options: defaults - mkfs: base: var_log name: mkfs_var_log type: vfat label: varlog - mount: base: mkfs_var_log name: mount_mkfs_var_log mount_point: /var/log - fstab: base: mount_mkfs_var_log name: fstab_mount_mkfs_var_log fsck-passno: 1 options: defaults diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/lvm_graph.yaml0000664000175000017500000000420113640271474030537 0ustar zuulzuul00000000000000- local_loop: name: image0 - partitioning: base: image0 name: mbr label: mbr partitions: - name: root base: image0 flags: [ boot,primary ] size: 3G - lvm: base: mbr name: lvm_mbr pvs: - name: pv options: ["--force"] base: root vgs: - name: vg base: ["pv"] options: ["--force"] lvs: - name: lv_root base: vg size: 1800M - name: lv_tmp base: vg size: 100M - name: lv_var base: vg size: 500M - name: lv_log base: vg size: 100M - name: lv_audit base: vg size: 100M - name: lv_home base: vg size: 200M - mkfs: name: fs_root base: lv_root label: "img-rootfs" type: "xfs" - mount: name: mount_fs_root base: fs_root mount_point: / - fstab: name: fstab_mount_fs_root base: mount_fs_root options: "rw,relatime" fsck-passno: 1 - mkfs: name: fs_var base: lv_var type: "xfs" - mount: name: mount_fs_var base: fs_var mount_point: /var - fstab: name: fstab_mount_fs_var base: mount_fs_var options: "rw,relatime" - mkfs: name: fs_log base: lv_log type: "xfs" - mount: name: mount_fs_log base: fs_log mount_point: /var/log - fstab: name: fstab_mount_fs_log base: mount_fs_log options: "rw,relatime" - mkfs: name: fs_audit base: lv_audit type: "xfs" - mount: name: mount_fs_audit base: fs_audit mount_point: /var/log/audit - fstab: name: fstab_mount_fs_audit base: mount_fs_audit options: "rw,relatime" - mkfs: name: fs_tmp base: lv_tmp type: "xfs" - mount: name: mount_fs_tmp base: fs_tmp mount_point: /tmp - fstab: name: fstab_mount_fs_tmp base: mount_fs_tmp options: "rw,nosuid,nodev,noexec,relatime" - mkfs: name: fs_home base: lv_home type: "xfs" - mount: name: mount_fs_home base: fs_home mount_point: /home - fstab: name: fstab_mount_fs_home base: mount_fs_home options: "rw,nodev,relatime" diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/multiple_partitions_tree.yaml0000664000175000017500000000160613640271474033714 0ustar zuulzuul00000000000000- local_loop: name: image0 - partitioning: base: image0 name: mbr label: mbr partitions: - name: root flags: [ boot, primary ] size: 55% mkfs: type: xfs uuid: root-uuid-1234 mount: mount_point: / fstab: options: "defaults" fsck-passno: 1 - name: var size: 40% mkfs: type: xfs uuid: var-uuid-1234 mount: mount_point: /var fstab: options: "defaults" fsck-passno: 1 - name: var_log size: 5% mkfs: type: vfat label: varlog mount: mount_point: /var/log fstab: options: "defaults" fsck-passno: 1 diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/simple_graph.yaml0000664000175000017500000000020213640271474031227 0ustar zuulzuul00000000000000- mkfs: name: root_fs base: root_part type: xfs - mount: name: mount_root_fs base: root_fs mount_point: /diskimage-builder-2.35.0/diskimage_builder/block_device/tests/config/multi_key_node.yaml0000664000175000017500000000020113640271474031563 0ustar zuulzuul00000000000000- mkfs: name: root_fs base: root_part type: xfs mount: name: mount_root_fs base: root_fs mount_point: /diskimage-builder-2.35.0/diskimage_builder/block_device/tests/test_base.py0000664000175000017500000000254213640271474026760 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import fixtures import logging import os import testtools import yaml logger = logging.getLogger(__name__) class TestBase(testtools.TestCase): """Base for all test cases""" def setUp(self): super(TestBase, self).setUp() fs = '%(asctime)s %(levelname)s [%(name)s] %(message)s' self.log_fixture = self.useFixture( fixtures.FakeLogger(level=logging.DEBUG, format=fs)) def get_config_file(self, f): """Get the full path to sample config file f """ logger.debug(os.path.dirname(__file__)) return os.path.join(os.path.dirname(__file__), 'config', f) def load_config_file(self, f): """Load f and return it after yaml parsing""" path = self.get_config_file(f) with open(path, 'r') as config: return yaml.safe_load(config) diskimage-builder-2.35.0/diskimage_builder/block_device/tests/test_lvm.py0000664000175000017500000005764213640271474026657 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import copy import logging import mock import diskimage_builder.block_device.tests.test_config as tc from diskimage_builder.block_device.blockdevice import BlockDeviceState from diskimage_builder.block_device.config import config_tree_to_graph from diskimage_builder.block_device.config import create_graph from diskimage_builder.block_device.exception import \ BlockDeviceSetupException from diskimage_builder.block_device.level0.localloop import LocalLoopNode from diskimage_builder.block_device.level1.lvm import LVMNode from diskimage_builder.block_device.level1.lvm import LVMPlugin from diskimage_builder.block_device.level1.lvm import LvsNode from diskimage_builder.block_device.level1.lvm import PvsNode from diskimage_builder.block_device.level1.lvm import VgsNode from diskimage_builder.block_device.level1.partitioning import PartitionNode logger = logging.getLogger(__name__) class TestLVM(tc.TestGraphGeneration): def test_lvm_tree_to_graph(self): # equivalence of tree-based to graph-based config tree = self.load_config_file('lvm_tree.yaml') graph = self.load_config_file('lvm_graph.yaml') parsed_graph = config_tree_to_graph(tree) self.assertItemsEqual(parsed_graph, graph) def test_lvm_invalid_config(self): # test some invalid config paths config = self.load_config_file('lvm_graph.yaml') lvm_config = config[2]['lvm'] bad_config = copy.deepcopy(lvm_config) bad_config['vgs'][0]['base'] = ['invalid_pv'] self.assertRaisesRegex(BlockDeviceSetupException, "base:invalid_pv in vgs does not match " "a valid pvs", LVMPlugin, bad_config, {}, {}) bad_config = copy.deepcopy(lvm_config) bad_config['lvs'][0]['base'] = ['invalid_vg'] self.assertRaisesRegex(BlockDeviceSetupException, r"base:\['invalid_vg'\] in lvs does not match " r"a valid vg", LVMPlugin, bad_config, {}, {}) bad_config = copy.deepcopy(lvm_config) del(bad_config['lvs'][0]['size']) self.assertRaisesRegex(BlockDeviceSetupException, "Missing 'size' or 'extents' in lvs config", LVMPlugin, bad_config, {}, {}) @mock.patch('diskimage_builder.block_device.level1.lvm.exec_sudo') def test_lvm_multi_pv(self, mock_exec_sudo): # Test the command-sequence for a more complicated LVM setup tree = self.load_config_file('lvm_tree_multiple_pv.yaml') config = config_tree_to_graph(tree) state = BlockDeviceState() graph, call_order = create_graph(config, self.fake_default_config, state) # XXX: todo; test call_order. Make sure PV's come before, VG; # VG before LV, and that mounts/etc happen afterwards. # Fake state for the two PV's specified by this config state['blockdev'] = {} state['blockdev']['root'] = {} state['blockdev']['root']['device'] = '/dev/fake/root' state['blockdev']['data'] = {} state['blockdev']['data']['device'] = '/dev/fake/data' for node in call_order: # XXX: This has not mocked out the "lower" layers of # creating the devices, which we're assuming works OK, nor # the upper layers. if isinstance(node, (LVMNode, PvsNode, VgsNode, LvsNode)): # only the LVMNode actually does anything here... node.create() # ensure the sequence of calls correctly setup the devices cmd_sequence = [ # create the pv's on the faked out block devices mock.call(['pvcreate', '/dev/fake/root', '--force']), mock.call(['pvcreate', '/dev/fake/data', '--force']), # create a volume called "vg" out of these two pv's mock.call(['vgcreate', 'vg', '/dev/fake/root', '/dev/fake/data', '--force']), # create a bunch of lv's on vg mock.call(['lvcreate', '--name', 'lv_root', '-L', '1800M', 'vg']), mock.call(['lvcreate', '--name', 'lv_tmp', '-L', '100M', 'vg']), mock.call(['lvcreate', '--name', 'lv_var', '-L', '500M', 'vg']), mock.call(['lvcreate', '--name', 'lv_log', '-L', '100M', 'vg']), mock.call(['lvcreate', '--name', 'lv_audit', '-L', '100M', 'vg']), mock.call(['lvcreate', '--name', 'lv_home', '-L', '200M', 'vg'])] self.assertEqual(mock_exec_sudo.call_count, len(cmd_sequence)) mock_exec_sudo.assert_has_calls(cmd_sequence) # Ensure the correct LVM state was preserved blockdev_state = { 'data': {'device': '/dev/fake/data'}, 'root': {'device': '/dev/fake/root'}, 'lv_audit': { 'device': '/dev/mapper/vg-lv_audit', 'extents': None, 'opts': None, 'size': '100M', 'vgs': 'vg' }, 'lv_home': { 'device': '/dev/mapper/vg-lv_home', 'extents': None, 'opts': None, 'size': '200M', 'vgs': 'vg' }, 'lv_log': { 'device': '/dev/mapper/vg-lv_log', 'extents': None, 'opts': None, 'size': '100M', 'vgs': 'vg' }, 'lv_root': { 'device': '/dev/mapper/vg-lv_root', 'extents': None, 'opts': None, 'size': '1800M', 'vgs': 'vg' }, 'lv_tmp': { 'device': '/dev/mapper/vg-lv_tmp', 'extents': None, 'opts': None, 'size': '100M', 'vgs': 'vg' }, 'lv_var': { 'device': '/dev/mapper/vg-lv_var', 'extents': None, 'opts': None, 'size': '500M', 'vgs': 'vg' }, } # state.debug_dump() self.assertDictEqual(state['blockdev'], blockdev_state) # XXX: mount ordering? fs creation? def test_lvm_multi_pv_vg(self): # Test the command-sequence for a more complicated LVM setup tree = self.load_config_file('lvm_tree_multiple_pv_vg.yaml') config = config_tree_to_graph(tree) state = BlockDeviceState() graph, call_order = create_graph(config, self.fake_default_config, state) # XXX: todo; test call_order. Make sure PV's come before, VG; # VG before LV, and that mounts/etc happen afterwards. # Fake state for the two PV's specified by this config state['blockdev'] = {} state['blockdev']['root'] = {} state['blockdev']['root']['device'] = '/dev/fake/root' state['blockdev']['data'] = {} state['blockdev']['data']['device'] = '/dev/fake/data' # We mock patch this ... it's just a little long! exec_sudo = 'diskimage_builder.block_device.level1.lvm.exec_sudo' # # Creation test # with mock.patch(exec_sudo) as mock_exec_sudo: for node in call_order: # XXX: This has not mocked out the "lower" layers of # creating the devices, which we're assuming works OK, nor # the upper layers. if isinstance(node, (LVMNode, PvsNode, VgsNode, LvsNode)): # only the PvsNode actually does anything here... node.create() # ensure the sequence of calls correctly setup the devices cmd_sequence = [ # create the pv's on the faked out block devices mock.call(['pvcreate', '/dev/fake/root', '--force']), mock.call(['pvcreate', '/dev/fake/data', '--force']), # create a volume called "vg" out of these two pv's mock.call(['vgcreate', 'vg1', '/dev/fake/root', '--force']), mock.call(['vgcreate', 'vg2', '/dev/fake/data', '--force']), # create a bunch of lv's on vg mock.call(['lvcreate', '--name', 'lv_root', '-L', '1800M', 'vg1']), mock.call(['lvcreate', '--name', 'lv_tmp', '-L', '100M', 'vg1']), mock.call(['lvcreate', '--name', 'lv_var', '-L', '500M', 'vg2']), mock.call(['lvcreate', '--name', 'lv_log', '-L', '100M', 'vg2']), mock.call(['lvcreate', '--name', 'lv_audit', '-L', '100M', 'vg2']), mock.call(['lvcreate', '--name', 'lv_home', '-L', '200M', 'vg2'])] self.assertListEqual(mock_exec_sudo.call_args_list, cmd_sequence) # Ensure the correct LVM state was preserved blockdev_state = { 'data': {'device': '/dev/fake/data'}, 'root': {'device': '/dev/fake/root'}, 'lv_audit': { 'device': '/dev/mapper/vg2-lv_audit', 'extents': None, 'opts': None, 'size': '100M', 'vgs': 'vg2' }, 'lv_home': { 'device': '/dev/mapper/vg2-lv_home', 'extents': None, 'opts': None, 'size': '200M', 'vgs': 'vg2' }, 'lv_log': { 'device': '/dev/mapper/vg2-lv_log', 'extents': None, 'opts': None, 'size': '100M', 'vgs': 'vg2' }, 'lv_root': { 'device': '/dev/mapper/vg1-lv_root', 'extents': None, 'opts': None, 'size': '1800M', 'vgs': 'vg1' }, 'lv_tmp': { 'device': '/dev/mapper/vg1-lv_tmp', 'extents': None, 'opts': None, 'size': '100M', 'vgs': 'vg1' }, 'lv_var': { 'device': '/dev/mapper/vg2-lv_var', 'extents': None, 'opts': None, 'size': '500M', 'vgs': 'vg2' }, } # state.debug_dump() self.assertDictEqual(state['blockdev'], blockdev_state) # # Umount test # with mock.patch(exec_sudo) as mock_exec_sudo, \ mock.patch('tempfile.NamedTemporaryFile') as mock_temp, \ mock.patch('os.unlink'): # each call to tempfile.NamedTemporaryFile will return a # new mock with a unique filename, which we store in # tempfiles tempfiles = [] def new_tempfile(*args, **kwargs): n = '/tmp/files%s' % len(tempfiles) # trap! note mock.Mock(name = n) doesn't work like you # think it would, since mock has a name attribute. # That's why we override it with the configure_mock # (this is mentioned in mock documentation if you read # it :) r = mock.Mock() r.configure_mock(name=n) tempfiles.append(n) return r mock_temp.side_effect = new_tempfile def run_it(phase): reverse_order = reversed(call_order) for node in reverse_order: if isinstance(node, (LVMNode, PvsNode, VgsNode, LvsNode)): getattr(node, phase)() else: logger.debug("Skipping node for test: %s", node) run_it('umount') run_it('cleanup') cmd_sequence = [ # delete the lv's mock.call(['lvchange', '-an', '/dev/vg1/lv_root']), mock.call(['lvchange', '-an', '/dev/vg1/lv_tmp']), mock.call(['lvchange', '-an', '/dev/vg2/lv_var']), mock.call(['lvchange', '-an', '/dev/vg2/lv_log']), mock.call(['lvchange', '-an', '/dev/vg2/lv_audit']), mock.call(['lvchange', '-an', '/dev/vg2/lv_home']), # delete the vg's mock.call(['vgchange', '-an', 'vg1']), mock.call(['vgchange', '-an', 'vg2']), mock.call(['udevadm', 'settle']), mock.call(['pvscan', '--cache']), ] self.assertListEqual(mock_exec_sudo.call_args_list, cmd_sequence) def test_lvm_spanned_vg(self): # Test when a volume group spans some partitions tree = self.load_config_file('lvm_tree_spanned_vg.yaml') config = config_tree_to_graph(tree) state = BlockDeviceState() graph, call_order = create_graph(config, self.fake_default_config, state) # XXX: todo; test call_order. Make sure PV's come before, VG; # VG before LV, and that mounts/etc happen afterwards. # Fake state for the two PV's specified by this config state['blockdev'] = {} state['blockdev']['root'] = {} state['blockdev']['root']['device'] = '/dev/fake/root' state['blockdev']['data1'] = {} state['blockdev']['data1']['device'] = '/dev/fake/data1' state['blockdev']['data2'] = {} state['blockdev']['data2']['device'] = '/dev/fake/data2' # We mock patch this ... it's just a little long! exec_sudo = 'diskimage_builder.block_device.level1.lvm.exec_sudo' # # Creation test # with mock.patch(exec_sudo) as mock_exec_sudo: for node in call_order: # XXX: This has not mocked out the "lower" layers of # creating the devices, which we're assuming works OK, nor # the upper layers. if isinstance(node, (LVMNode, PvsNode, VgsNode, LvsNode)): # only the LVMNode actually does anything here... node.create() # ensure the sequence of calls correctly setup the devices cmd_sequence = [ # create the pv's on the faked out block devices mock.call(['pvcreate', '/dev/fake/root', '--force']), mock.call(['pvcreate', '/dev/fake/data1', '--force']), mock.call(['pvcreate', '/dev/fake/data2', '--force']), # create a root and a data volume, with the data volume # spanning data1 & data2 mock.call(['vgcreate', 'vg_root', '/dev/fake/root', '--force']), mock.call(['vgcreate', 'vg_data', '/dev/fake/data1', '/dev/fake/data2', '--force']), # create root and data volume mock.call(['lvcreate', '--name', 'lv_root', '-L', '1800M', 'vg_root']), mock.call(['lvcreate', '--name', 'lv_data', '-L', '2G', 'vg_data']) ] self.assertListEqual(mock_exec_sudo.call_args_list, cmd_sequence) with mock.patch(exec_sudo) as mock_exec_sudo, \ mock.patch('tempfile.NamedTemporaryFile') as mock_temp, \ mock.patch('os.unlink'): # see above ... tempfiles = [] def new_tempfile(*args, **kwargs): n = '/tmp/files%s' % len(tempfiles) r = mock.Mock() r.configure_mock(name=n) tempfiles.append(n) return r mock_temp.side_effect = new_tempfile def run_it(phase): reverse_order = reversed(call_order) for node in reverse_order: if isinstance(node, (LVMNode, PvsNode, VgsNode, LvsNode)): getattr(node, phase)() else: logger.debug("Skipping node for test: %s", node) run_it('umount') run_it('cleanup') cmd_sequence = [ # deactivate lv's mock.call(['lvchange', '-an', '/dev/vg_root/lv_root']), mock.call(['lvchange', '-an', '/dev/vg_data/lv_data']), # deactivate vg's mock.call(['vgchange', '-an', 'vg_root']), mock.call(['vgchange', '-an', 'vg_data']), mock.call(['udevadm', 'settle']), mock.call(['pvscan', '--cache']), ] self.assertListEqual(mock_exec_sudo.call_args_list, cmd_sequence) def test_lvm_multiple_partitions(self): # Test the command-sequence for several partitions, one containing # volumes on it tree = self.load_config_file('lvm_tree_multiple_partitions.yaml') config = config_tree_to_graph(tree) state = BlockDeviceState() graph, call_order = create_graph(config, self.fake_default_config, state) # Fake state for the partitions on this config state['blockdev'] = {} state['blockdev']['image0'] = {} state['blockdev']['image0']['device'] = '/dev/fake/image0' state['blockdev']['image0']['image'] = 'image' state['blockdev']['root'] = {} state['blockdev']['root']['device'] = '/dev/fake/root' state['blockdev']['ESP'] = {} state['blockdev']['ESP']['device'] = '/dev/fake/ESP' state['blockdev']['BSP'] = {} state['blockdev']['BSP']['device'] = '/dev/fake/BSP' # # Creation test # # We mock out the following exec_sudo and other related calls # calls for the layers we are testing. exec_sudo_lvm = 'diskimage_builder.block_device.level1.lvm.exec_sudo' exec_sudo_part = ('diskimage_builder.block_device.' 'level1.partitioning.exec_sudo') exec_sudo_loop = ('diskimage_builder.block_device.' 'level0.localloop.exec_sudo') image_create = ('diskimage_builder.block_device.level0.' 'localloop.LocalLoopNode.create') size_of_block = ('diskimage_builder.block_device.level1.' 'partitioning.Partitioning._size_of_block_dev') create_mbr = ('diskimage_builder.block_device.level1.' 'partitioning.Partitioning._create_mbr') manager = mock.MagicMock() with mock.patch(exec_sudo_lvm) as mock_sudo_lvm, \ mock.patch(exec_sudo_part) as mock_sudo_part, \ mock.patch(exec_sudo_loop) as mock_sudo_loop, \ mock.patch(image_create) as mock_image_create, \ mock.patch(size_of_block) as mock_size_of_block, \ mock.patch(create_mbr) as mock_create_mbr: manager.attach_mock(mock_sudo_lvm, 'sudo_lvm') manager.attach_mock(mock_sudo_part, 'sudo_part') manager.attach_mock(mock_sudo_loop, 'sudo_loop') manager.attach_mock(mock_image_create, 'image_create') manager.attach_mock(mock_size_of_block, 'size_of_block') manager.attach_mock(mock_create_mbr, 'create_mbr') for node in call_order: # We're just keeping this to the partition setup and # LVM creation; i.e. skipping mounting, mkfs, etc. if isinstance(node, (LVMNode, PvsNode, VgsNode, LvsNode, LocalLoopNode, PartitionNode)): node.create() else: logger.debug("Skipping node for test: %s", node) cmd_sequence = [ # create the underlying block device mock.call.image_create(), mock.call.size_of_block('image'), # write out partition table mock.call.create_mbr(), # now mount partitions mock.call.sudo_part(['sync']), mock.call.sudo_part(['kpartx', '-avs', '/dev/fake/image0']), # now create lvm environment mock.call.sudo_lvm(['pvcreate', '/dev/fake/root', '--force']), mock.call.sudo_lvm( ['vgcreate', 'vg', '/dev/fake/root', '--force']), mock.call.sudo_lvm( ['lvcreate', '--name', 'lv_root', '-l', '28%VG', 'vg']), mock.call.sudo_lvm( ['lvcreate', '--name', 'lv_tmp', '-l', '4%VG', 'vg']), mock.call.sudo_lvm( ['lvcreate', '--name', 'lv_var', '-l', '40%VG', 'vg']), mock.call.sudo_lvm( ['lvcreate', '--name', 'lv_log', '-l', '23%VG', 'vg']), mock.call.sudo_lvm( ['lvcreate', '--name', 'lv_audit', '-l', '4%VG', 'vg']), mock.call.sudo_lvm( ['lvcreate', '--name', 'lv_home', '-l', '1%VG', 'vg']), ] manager.assert_has_calls(cmd_sequence) # # Umount/cleanup test # manager = mock.MagicMock() with mock.patch(exec_sudo_lvm) as mock_sudo_lvm, \ mock.patch(exec_sudo_part) as mock_sudo_part, \ mock.patch(exec_sudo_loop) as mock_sudo_loop: manager.attach_mock(mock_sudo_lvm, 'sudo_lvm') manager.attach_mock(mock_sudo_part, 'sudo_part') manager.attach_mock(mock_sudo_loop, 'sudo_loop') def run_it(phase): reverse_order = reversed(call_order) for node in reverse_order: if isinstance(node, (LVMNode, PvsNode, VgsNode, LvsNode, LocalLoopNode, PartitionNode)): getattr(node, phase)() else: logger.debug("Skipping node for test: %s", node) run_it('umount') run_it('cleanup') cmd_sequence = [ # deactivate LVM first mock.call.sudo_lvm(['lvchange', '-an', '/dev/vg/lv_root']), mock.call.sudo_lvm(['lvchange', '-an', '/dev/vg/lv_tmp']), mock.call.sudo_lvm(['lvchange', '-an', '/dev/vg/lv_var']), mock.call.sudo_lvm(['lvchange', '-an', '/dev/vg/lv_log']), mock.call.sudo_lvm(['lvchange', '-an', '/dev/vg/lv_audit']), mock.call.sudo_lvm(['lvchange', '-an', '/dev/vg/lv_home']), mock.call.sudo_lvm(['vgchange', '-an', 'vg']), mock.call.sudo_lvm(['udevadm', 'settle']), # now remove partitions (note has to happen after lvm removal) mock.call.sudo_part(['kpartx', '-d', '/dev/fake/image0']), # now remove loopback device mock.call.sudo_loop(['losetup', '-d', '/dev/fake/image0']), # now final LVM cleanup call mock.call.sudo_lvm(['pvscan', '--cache']), ] manager.assert_has_calls(cmd_sequence) diskimage-builder-2.35.0/diskimage_builder/block_device/tests/test_utils.py0000664000175000017500000000424713640271474027212 0ustar zuulzuul00000000000000# Copyright 2016 Andreas Florath (andreas@florath.net) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging import diskimage_builder.block_device.tests.test_base as tb from diskimage_builder.block_device.utils import parse_abs_size_spec from diskimage_builder.block_device.utils import parse_rel_size_spec logger = logging.getLogger(__name__) class TestBlockDeviceUtils(tb.TestBase): """Tests for the utils.py This tests mostly the error and failure cases - because the good cases are tested implicitly with the higher level unit tests. """ def test_parse_rel_size_with_abs(self): """Calls parse_rel_size_spec with an absolute number""" is_rel, size = parse_rel_size_spec("154MiB", 0) self.assertFalse(is_rel) self.assertEqual(154 * 1024 * 1024, size) def test_parse_abs_size_without_spec(self): """Call parse_abs_size_spec without spec""" size = parse_abs_size_spec("198") self.assertEqual(198, size) def test_invalid_unit_spec(self): """Call parse_abs_size_spec with invalid unit spec""" self.assertRaises(RuntimeError, parse_abs_size_spec, "747InVaLiDUnIt") def test_broken_unit_spec(self): """Call parse_abs_size_spec with a completely broken unit spec""" self.assertRaises(RuntimeError, parse_abs_size_spec, "_+!HuHi+-=") def test_parse_size_spec(self): map(lambda tspec: self.assertEqual(parse_abs_size_spec(tspec[0]), tspec[1]), [["20TiB", 20 * 1024**4], ["1024KiB", 1024 * 1024], ["1.2TB", 1.2 * 1000**4], ["2.4T", 2.4 * 1000**4], ["512B", 512], ["364", 364]]) diskimage-builder-2.35.0/diskimage_builder/block_device/tests/__init__.py0000664000175000017500000000000013640271474026531 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/tests/test_mbr.py0000664000175000017500000001475213640271474026634 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import fixtures import logging import mock import os import subprocess import diskimage_builder.block_device.tests.test_base as tb from diskimage_builder.block_device.level0.localloop import image_create from diskimage_builder.block_device.level1.mbr import MBR logger = logging.getLogger(__name__) class TestMBR(tb.TestBase): disk_size_10M = 10 * 1024 * 1024 disk_size_1G = 1024 * 1024 * 1024 def _get_path_for_partx(self): """Searches and sets the path for partx Because different distributions store the partx binary at different places, there is the need to look for it. """ dirs = ["/bin", "/usr/bin", "/sbin", "/usr/sbin"] for d in dirs: if os.path.exists(os.path.join(d, "partx")): return os.path.join(d, "partx") return # If not found, try without path. return "partx" def setUp(self): super(TestMBR, self).setUp() self.tmp_dir = fixtures.TempDir() self.useFixture(self.tmp_dir) self.image_path = os.path.join(self.tmp_dir.path, "image.raw") image_create(self.image_path, TestMBR.disk_size_1G) logger.debug("Temp image is %s", self.image_path) self.partx_args = [self._get_path_for_partx(), "--raw", "--output", "NR,START,END,TYPE,FLAGS,SCHEME", "-g", "-b", "-", self.image_path] def _run_partx(self, image_path): logger.info("Running command: %s", self.partx_args) return subprocess.check_output(self.partx_args).decode("ascii") @mock.patch('os.fsync', wraps=os.fsync) def test_one_ext_partition(self, mock_os_fsync): """Creates one partition and check correctness with partx.""" with MBR(self.image_path, TestMBR.disk_size_1G, 1024 * 1024) as mbr: mbr.add_partition(False, False, TestMBR.disk_size_10M, 0x83) # the exit handler of MBR should have synced the raw device # before exit mock_os_fsync.assert_called() output = self._run_partx(self.image_path) self.assertEqual( "1 2048 2097151 0xf 0x0 dos\n" "5 4096 24575 0x83 0x0 dos\n", output) def test_zero_partitions(self): """Creates no partition and check correctness with partx.""" with MBR(self.image_path, TestMBR.disk_size_1G, 1024 * 1024): pass output = self._run_partx(self.image_path) self.assertEqual("", output) def test_many_ext_partitions(self): """Creates many partition and check correctness with partx.""" with MBR(self.image_path, TestMBR.disk_size_1G, 1024 * 1024) as mbr: for nr in range(0, 64): mbr.add_partition(False, False, TestMBR.disk_size_10M, 0x83) output = self._run_partx(self.image_path) lines = output.split("\n") self.assertEqual(66, len(lines)) self.assertEqual( "1 2048 2097151 0xf 0x0 dos", lines[0]) start_block = 4096 end_block = start_block + TestMBR.disk_size_10M / 512 - 1 for nr in range(1, 65): fields = lines[nr].split(" ") self.assertEqual(6, len(fields)) self.assertEqual(nr + 4, int(fields[0])) self.assertEqual(start_block, int(fields[1])) self.assertEqual(end_block, int(fields[2])) self.assertEqual("0x83", fields[3]) self.assertEqual("0x0", fields[4]) self.assertEqual("dos", fields[5]) start_block += 22528 end_block = start_block + TestMBR.disk_size_10M / 512 - 1 def test_one_pri_partition(self): """Creates one primary partition and check correctness with partx.""" with MBR(self.image_path, TestMBR.disk_size_1G, 1024 * 1024) as mbr: mbr.add_partition(True, False, TestMBR.disk_size_10M, 0x83) output = self._run_partx(self.image_path) self.assertEqual( "1 2048 22527 0x83 0x0 dos\n", output) def test_three_pri_partition(self): """Creates three primary partition and check correctness with partx.""" with MBR(self.image_path, TestMBR.disk_size_1G, 1024 * 1024) as mbr: for _ in range(3): mbr.add_partition(True, False, TestMBR.disk_size_10M, 0x83) output = self._run_partx(self.image_path) self.assertEqual( "1 2048 22527 0x83 0x0 dos\n" "2 22528 43007 0x83 0x0 dos\n" "3 43008 63487 0x83 0x0 dos\n", output) def test_many_pri_and_ext_partition(self): """Creates many primary and extended partitions.""" with MBR(self.image_path, TestMBR.disk_size_1G, 1024 * 1024) as mbr: # Create three primary partitions for _ in range(3): mbr.add_partition(True, False, TestMBR.disk_size_10M, 0x83) for _ in range(7): mbr.add_partition(False, False, TestMBR.disk_size_10M, 0x83) output = self._run_partx(self.image_path) self.assertEqual( "1 2048 22527 0x83 0x0 dos\n" # Primary 1 "2 22528 43007 0x83 0x0 dos\n" # Primary 2 "3 43008 63487 0x83 0x0 dos\n" # Primary 3 "4 63488 2097151 0xf 0x0 dos\n" # Extended "5 65536 86015 0x83 0x0 dos\n" # Extended Partition 1 "6 88064 108543 0x83 0x0 dos\n" # Extended Partition 2 "7 110592 131071 0x83 0x0 dos\n" # ... "8 133120 153599 0x83 0x0 dos\n" "9 155648 176127 0x83 0x0 dos\n" "10 178176 198655 0x83 0x0 dos\n" "11 200704 221183 0x83 0x0 dos\n", output) def test_pri_fat32_lba_partition(self): """Creates a partition with a non-default 'type' and verifies.""" with MBR(self.image_path, TestMBR.disk_size_1G, 1024 * 1024) as mbr: mbr.add_partition(True, False, TestMBR.disk_size_10M, 0x0c) output = self._run_partx(self.image_path) self.assertEqual( "1 2048 22527 0xc 0x0 dos\n", output) diskimage-builder-2.35.0/diskimage_builder/block_device/tests/test_config.py0000664000175000017500000001374713640271474027324 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging from diskimage_builder.block_device.config import config_tree_to_graph from diskimage_builder.block_device.config import create_graph from diskimage_builder.block_device.exception import \ BlockDeviceSetupException from diskimage_builder.block_device.tests.test_base import TestBase logger = logging.getLogger(__name__) class TestConfig(TestBase): """Helper for setting up and reading a config""" def setUp(self): super(TestConfig, self).setUp() # previously we mocked some globals here ... class TestGraphGeneration(TestConfig): """Extra helper class for testing graph generation""" def setUp(self): super(TestGraphGeneration, self).setUp() self.fake_default_config = { 'build-dir': '/fake', 'image-size': '1000', 'image-dir': '/fake', 'mount-base': '/fake', } class TestConfigParsing(TestConfig): """Test parsing config file into a graph""" # test an entry in the config not being a valid plugin def test_config_bad_plugin(self): config = self.load_config_file('bad_plugin.yaml') self.assertRaises(BlockDeviceSetupException, config_tree_to_graph, config) # test a config that has multiple keys for a top-level entry def test_config_multikey_node(self): config = self.load_config_file('multi_key_node.yaml') self.assertRaisesRegex(BlockDeviceSetupException, "Config entry top-level should be a single " "dict:", config_tree_to_graph, config) # a graph should remain the same def test_graph(self): graph = self.load_config_file('simple_graph.yaml') parsed_graph = config_tree_to_graph(graph) self.assertItemsEqual(parsed_graph, graph) # equivalence of simple tree to graph def test_simple_tree(self): tree = self.load_config_file('simple_tree.yaml') graph = self.load_config_file('simple_graph.yaml') parsed_graph = config_tree_to_graph(tree) self.assertItemsEqual(parsed_graph, graph) # equivalence of a deeper tree to graph def test_deep_tree(self): tree = self.load_config_file('deep_tree.yaml') graph = self.load_config_file('deep_graph.yaml') parsed_graph = config_tree_to_graph(tree) self.assertItemsEqual(parsed_graph, graph) # equivalence of a complicated multi-partition tree to graph def test_multipart_tree(self): tree = self.load_config_file('multiple_partitions_tree.yaml') graph = self.load_config_file('multiple_partitions_graph.yaml') parsed_graph = config_tree_to_graph(tree) logger.debug(parsed_graph) self.assertItemsEqual(parsed_graph, graph) class TestCreateGraph(TestGraphGeneration): # Test a graph with bad edge pointing to an invalid node def test_invalid_missing(self): config = self.load_config_file('bad_edge_graph.yaml') self.assertRaisesRegex(BlockDeviceSetupException, "Edge not defined: this_is_not_a_node", create_graph, config, self.fake_default_config, {}) # Test a graph with bad edge pointing to an invalid node def test_duplicate_name(self): config = self.load_config_file('duplicate_name.yaml') self.assertRaisesRegex(BlockDeviceSetupException, "Duplicate node name: " "this_is_a_duplicate", create_graph, config, self.fake_default_config, {}) # Test digraph generation from deep_graph config file def test_deep_graph_generator(self): config = self.load_config_file('deep_graph.yaml') graph, call_order = create_graph(config, self.fake_default_config, {}) call_order_list = [n.name for n in call_order] # manually created from deep_graph.yaml # Note unlike below, the sort here is stable because the graph # doesn't have multiple paths with only one partition call_order_names = ['image0', 'root', 'mkfs_root', 'mount_mkfs_root', 'fstab_mount_mkfs_root'] self.assertListEqual(call_order_list, call_order_names) # Test multiple partition digraph generation def test_multiple_partitions_graph_generator(self): config = self.load_config_file('multiple_partitions_graph.yaml') graph, call_order = create_graph(config, self.fake_default_config, {}) call_order_list = [n.name for n in call_order] # The sort creating call_order_list is unstable. # We want to ensure we see the "partitions" object in # root->var->var_log order root_pos = call_order_list.index('root') var_pos = call_order_list.index('var') var_log_pos = call_order_list.index('var_log') self.assertGreater(var_pos, root_pos) self.assertGreater(var_log_pos, var_pos) # Ensure mkfs happens after partition mkfs_root_pos = call_order_list.index('mkfs_root') self.assertLess(root_pos, mkfs_root_pos) mkfs_var_pos = call_order_list.index('mkfs_var') self.assertLess(var_pos, mkfs_var_pos) mkfs_var_log_pos = call_order_list.index('mkfs_var_log') self.assertLess(var_log_pos, mkfs_var_log_pos) diskimage-builder-2.35.0/diskimage_builder/block_device/tests/test_mount_order.py0000664000175000017500000001714213640271474030405 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import functools import logging import mock import os import diskimage_builder.block_device.tests.test_config as tc from diskimage_builder.block_device.config import config_tree_to_graph from diskimage_builder.block_device.config import create_graph from diskimage_builder.block_device.level2.mkfs import FilesystemNode from diskimage_builder.block_device.level3.mount import cmp_mount_order from diskimage_builder.block_device.level3.mount import MountPointNode from diskimage_builder.block_device.tests.test_base import TestBase logger = logging.getLogger(__name__) class TestMountComparator(TestBase): def test_mount_comparator(self): # This tests cmp_mount_order to ensure it sorts in the # expected order. The comparator takes a tuple of # (mount_point, node_name) but we can ignore the name partitions = [ ('/var/log', 'fake_log'), ('/boot', 'fake_boot'), ('/', 'fake_name'), ('/var', 'fake_name')] partitions.sort(key=functools.cmp_to_key(cmp_mount_order)) res = list(x[0] for x in partitions) # "/" must be first self.assertEqual(res[0], '/') # /var before /var/log var_pos = res.index('/var') var_log_pos = res.index('/var/log') self.assertGreater(var_log_pos, var_pos) class TestMountOrder(tc.TestGraphGeneration): def _exec_sudo_log(*args, **kwargs): # Used as a side-effect from exec_sudo mocking so we can see # the call in-place in logs logger.debug("exec_sudo: %s", " ".join(args[0])) @mock.patch('diskimage_builder.block_device.level3.mount.exec_sudo', side_effect=_exec_sudo_log) @mock.patch('diskimage_builder.block_device.level2.mkfs.exec_sudo', side_effect=_exec_sudo_log) def test_mfks_and_mount_order(self, mock_exec_sudo_mkfs, mock_exec_sudo_mount): # XXX: better mocking for the os.path.exists calls to avoid # failing if this exists. self.assertFalse(os.path.exists('/fake/')) # This is probably in order after graph creation, so ensure it # remains stable. We test the mount and umount call sequences config = self.load_config_file('multiple_partitions_graph.yaml') state = {} graph, call_order = create_graph(config, self.fake_default_config, state) # Mocked block device state state['blockdev'] = {} state['blockdev']['root'] = {'device': '/dev/loopXp1/root'} state['blockdev']['var'] = {'device': '/dev/loopXp2/var'} state['blockdev']['var_log'] = {'device': '/dev/loopXp3/var_log'} for node in call_order: if isinstance(node, (FilesystemNode, MountPointNode)): node.create() for node in reversed(call_order): if isinstance(node, (FilesystemNode, MountPointNode)): node.umount() # ensure that partitions were mounted in order root->var->var/log self.assertListEqual(state['mount_order'], ['/', '/var', '/var/log']) # fs creation sequence (note we don't care about order of this # as they're all independent) cmd_sequence = [ mock.call(['mkfs', '-t', 'xfs', '-L', 'mkfs_root', '-m', 'uuid=root-uuid-1234', '-q', '/dev/loopXp1/root']), mock.call(['mkfs', '-t', 'xfs', '-L', 'mkfs_var', '-m', 'uuid=var-uuid-1234', '-q', '/dev/loopXp2/var']), mock.call(['mkfs', '-t', 'vfat', '-n', 'VARLOG', '/dev/loopXp3/var_log']) ] self.assertEqual(mock_exec_sudo_mkfs.call_count, len(cmd_sequence)) mock_exec_sudo_mkfs.assert_has_calls(cmd_sequence, any_order=True) # Check mount sequence cmd_sequence = [ # mount sequence mock.call(['mkdir', '-p', '/fake/']), mock.call(['mount', '/dev/loopXp1/root', '/fake/']), mock.call(['mkdir', '-p', '/fake/var']), mock.call(['mount', '/dev/loopXp2/var', '/fake/var']), mock.call(['mkdir', '-p', '/fake/var/log']), mock.call(['mount', '/dev/loopXp3/var_log', '/fake/var/log']), # umount sequence mock.call(['sync']), # note /fake/var/log is a vfs partition to make sure # we don't try to fstrim it mock.call(['umount', '/fake/var/log']), mock.call(['sync']), mock.call(['fstrim', '--verbose', '/fake/var']), mock.call(['umount', '/fake/var']), mock.call(['sync']), mock.call(['fstrim', '--verbose', '/fake/']), mock.call(['umount', '/fake/']) ] self.assertListEqual(mock_exec_sudo_mount.call_args_list, cmd_sequence) @mock.patch('diskimage_builder.block_device.level3.mount.exec_sudo', side_effect=_exec_sudo_log) def test_mount_order_unsorted(self, mock_exec_sudo): # As above, but this is out of order and gets sorted # so that root is mounted first (and skips the mkfs testing). config = self.load_config_file('lvm_tree_partition_ordering.yaml') parsed_graph = config_tree_to_graph(config) state = {} graph, call_order = create_graph(parsed_graph, self.fake_default_config, state) state['filesys'] = { 'mkfs_root': { 'device': '/dev/loopXp1', 'fstype': 'xfs' }, 'mkfs_var': { 'device': '/dev/loopXp2', 'fstype': 'xfs', }, 'mkfs_boot': { 'device': '/dev/loopXp3', 'fstype': 'vfat', }, } for node in call_order: if isinstance(node, MountPointNode): node.create() for node in reversed(call_order): if isinstance(node, MountPointNode): node.umount() # ensure that partitions are mounted in order / -> /boot -> /var self.assertListEqual(state['mount_order'], ['/', '/boot', '/var']) cmd_sequence = [ # mount sequence mock.call(['mkdir', '-p', '/fake/']), mock.call(['mount', '/dev/loopXp1', '/fake/']), mock.call(['mkdir', '-p', '/fake/boot']), mock.call(['mount', '/dev/loopXp3', '/fake/boot']), mock.call(['mkdir', '-p', '/fake/var']), mock.call(['mount', '/dev/loopXp2', '/fake/var']), # umount sequence mock.call(['sync']), mock.call(['fstrim', '--verbose', '/fake/var']), mock.call(['umount', '/fake/var']), mock.call(['sync']), # no trim on vfat /fake/boot mock.call(['umount', '/fake/boot']), mock.call(['sync']), mock.call(['fstrim', '--verbose', '/fake/']), mock.call(['umount', '/fake/']) ] self.assertListEqual(mock_exec_sudo.call_args_list, cmd_sequence) diskimage-builder-2.35.0/diskimage_builder/block_device/tests/test_state.py0000664000175000017500000001262713640271474027173 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import codecs import fixtures import json import logging import os from stevedore import extension from testtools.matchers import FileExists import diskimage_builder.block_device.blockdevice as bd import diskimage_builder.block_device.tests.test_base as tb from diskimage_builder.block_device.exception import \ BlockDeviceSetupException logger = logging.getLogger(__name__) class TestStateBase(tb.TestBase): def setUp(self): super(TestStateBase, self).setUp() # override the extensions to the test extensions test_extensions = extension.ExtensionManager( namespace='diskimage_builder.block_device.plugin_test', invoke_on_load=False) extensions_fixture = fixtures.MonkeyPatch( 'diskimage_builder.block_device.config._extensions', test_extensions) self.useFixture(extensions_fixture) # status and other bits saved here self.build_dir = fixtures.TempDir() self.useFixture(self.build_dir) class TestState(TestStateBase): # The the state generation & saving methods def test_state_create(self): params = { 'build-dir': self.build_dir.path, 'config': self.get_config_file('cmd_create.yaml') } bd_obj = bd.BlockDevice(params) bd_obj.cmd_init() bd_obj.cmd_create() # cmd_create should have persisted this to disk state_file = bd_obj.state_json_file_name self.assertThat(state_file, FileExists()) # ensure we see the values put in by the test extensions # persisted with codecs.open(state_file, encoding='utf-8', mode='r') as fd: state = json.load(fd) self.assertDictEqual(state, {'test_a': {'value': 'foo', 'value2': 'bar'}, 'test_b': {'value': 'baz'}, 'test_init_state': 'here'}) pickle_file = bd_obj.node_pickle_file_name self.assertThat(pickle_file, FileExists()) # run umount, which should load the picked nodes and run in # reverse. This will create some state in "test_b" that it # added to by "test_a" ... ensuring it was run backwards. It # also checks the state was persisted through the pickling # process. bd_obj.cmd_umount() # Test state going missing between phases def test_missing_state(self): params = { 'build-dir': self.build_dir.path, 'config': self.get_config_file('cmd_create.yaml') } bd_obj = bd.BlockDevice(params) bd_obj.cmd_init() bd_obj.cmd_create() # cmd_create should have persisted this to disk state_file = bd_obj.state_json_file_name self.assertThat(state_file, FileExists()) pickle_file = bd_obj.node_pickle_file_name self.assertThat(pickle_file, FileExists()) # simulate the state somehow going missing, and ensure that # later calls notice os.unlink(state_file) os.unlink(pickle_file) # This reads from the state dump json file self.assertRaisesRegex(BlockDeviceSetupException, "State dump not found", bd_obj.cmd_getval, 'image-path') self.assertRaisesRegex(BlockDeviceSetupException, "State dump not found", bd_obj.cmd_writefstab) # this uses the pickled nodes self.assertRaisesRegex(BlockDeviceSetupException, "Pickle file not found", bd_obj.cmd_delete) self.assertRaisesRegex(BlockDeviceSetupException, "Pickle file not found", bd_obj.cmd_cleanup) # XXX: figure out unit test for umount # Test ordering of rollback calls if create() fails def test_rollback(self): params = { 'build-dir': self.build_dir.path, 'config': self.get_config_file('rollback.yaml'), 'test_rollback': True } bd_obj = bd.BlockDevice(params) bd_obj.cmd_init() # The config file has flags in that tell the last node to # fail, which will trigger the rollback. self.assertRaises(RuntimeError, bd_obj.cmd_create) # cmd_create should have persisted this to disk even after the # failure state_file = bd_obj.state_json_file_name self.assertThat(state_file, FileExists()) with codecs.open(state_file, encoding='utf-8', mode='r') as fd: state = json.load(fd) # ensure the rollback was called in order self.assertListEqual(state['rollback_test'], ['never', 'gonna', 'give', 'you', 'up', 'never', 'gonna', 'let', 'you', 'down']) diskimage-builder-2.35.0/diskimage_builder/block_device/tests/test_gpt.py0000664000175000017500000000676613640271474026654 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import fixtures import logging import mock import os import diskimage_builder.block_device.tests.test_config as tc from diskimage_builder.block_device.blockdevice import BlockDeviceState from diskimage_builder.block_device.config import config_tree_to_graph from diskimage_builder.block_device.config import create_graph from diskimage_builder.block_device.level0.localloop import image_create from diskimage_builder.block_device.level1.partition import PartitionNode logger = logging.getLogger(__name__) class TestGPT(tc.TestGraphGeneration): @mock.patch('diskimage_builder.block_device.level1.partitioning.exec_sudo') def test_gpt_efi(self, mock_exec_sudo): # Test the command-sequence for a GPT/EFI partition setup tree = self.load_config_file('gpt_efi.yaml') config = config_tree_to_graph(tree) state = BlockDeviceState() graph, call_order = create_graph(config, self.fake_default_config, state) # Create a fake temp backing file (we check the size of it, # etc). # TODO(ianw): exec_sudo is generically mocked out, thus the # actual creation is mocked out ... but we could do this # without root and use parted to create the partitions on this # for slightly better testing. An exercise for another day... self.tmp_dir = fixtures.TempDir() self.useFixture(self.tmp_dir) self.image_path = os.path.join(self.tmp_dir.path, "image.raw") # should be sparse... image_create(self.image_path, 1024 * 1024 * 1024) logger.debug("Temp image in %s", self.image_path) # Fake state for the loopback device state['blockdev'] = {} state['blockdev']['image0'] = {} state['blockdev']['image0']['image'] = self.image_path state['blockdev']['image0']['device'] = "/dev/loopX" for node in call_order: if isinstance(node, PartitionNode): node.create() # check the parted call looks right parted_cmd = ['sgdisk', self.image_path, '-n', '1:0:+8M', '-t', '1:EF00', '-c', '1:ESP', '-n', '2:0:+8M', '-t', '2:EF02', '-c', '2:BSP', '-n', '3:0:+1006M', '-t', '3:8300', '-c', '3:Root Part'] cmd_sequence = [ mock.call(parted_cmd), mock.call(['sync']), mock.call(['kpartx', '-avs', '/dev/loopX']) ] self.assertEqual(mock_exec_sudo.call_count, len(cmd_sequence)) mock_exec_sudo.assert_has_calls(cmd_sequence) # Check two new partitions appear in state correctly self.assertDictEqual(state['blockdev']['ESP'], {'device': '/dev/mapper/loopXp1'}) self.assertDictEqual(state['blockdev']['BSP'], {'device': '/dev/mapper/loopXp2'}) self.assertDictEqual(state['blockdev']['Root Part'], {'device': '/dev/mapper/loopXp3'}) diskimage-builder-2.35.0/diskimage_builder/block_device/tests/plugin/0000775000175000017500000000000013640271564025730 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/tests/plugin/__init__.py0000664000175000017500000000000013640271474030027 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/tests/plugin/test_b.py0000664000175000017500000000446413640271474027572 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # plugin test case import logging from diskimage_builder.block_device.plugin import NodeBase from diskimage_builder.block_device.plugin import PluginBase logger = logging.getLogger(__name__) class TestBNode(NodeBase): def __init__(self, config, state, test_rollback): logger.debug("Create test 1") super(TestBNode, self).__init__(config['name'], state) self.base = config['base'] # If we're doing rollback testing the config has some strings # set for us. if test_rollback: self.add_rollback(self.do_rollback, config['rollback_one_arg']) self.add_rollback(self.do_rollback, config['rollback_two_arg']) def get_edges(self): # this should have been inserted by test_a before # we are called assert self.state['test_init_state'] == 'here' return ([self.base], []) def do_rollback(self, string): # We will check this after all rollbacks to make sure they ran # in the right order self.state['rollback_test'].append(string) def create(self): self.state['test_b'] = {} self.state['test_b']['value'] = 'baz' return def umount(self): # these values should have persisteted from create() assert self.state['test_b']['value'] == 'baz' # umount run in reverse. this should run before test_a assert 'umount' not in self.state self.state['umount'] = [] self.state['umount'].append('test_b') class TestB(PluginBase): def __init__(self, config, defaults, state): super(TestB, self).__init__() test_rollback = True if 'test_rollback' in defaults else False self.node = TestBNode(config, state, test_rollback) def get_nodes(self): return [self.node] diskimage-builder-2.35.0/diskimage_builder/block_device/tests/plugin/test_a.py0000664000175000017500000000537313640271474027571 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # plugin test case import logging from diskimage_builder.block_device.plugin import NodeBase from diskimage_builder.block_device.plugin import PluginBase logger = logging.getLogger(__name__) class TestANode(NodeBase): def __init__(self, config, state, test_rollback): logger.debug("Create test 1") super(TestANode, self).__init__(config['name'], state) # might be a root node, so possibly no base if 'base' in config: self.base = config['base'] # put something in the state for test_b to check for state['test_init_state'] = 'here' # If we're doing rollback testing the config has some strings # set for us if test_rollback: self.add_rollback(self.do_rollback, config['rollback_one_arg']) self.add_rollback(self.do_rollback, config['rollback_two_arg']) # see if we're the node who is going to fail self.trigger_rollback = True if 'trigger_rollback' in config else False def get_edges(self): # may not have a base, if used as root node to = [self.base] if hasattr(self, 'base') else [] return (to, []) def do_rollback(self, string): # We will check this after all rollbacks to make sure they ran # in the right order self.state['rollback_test'].append(string) def create(self): # put some fake entries into state self.state['test_a'] = {} self.state['test_a']['value'] = 'foo' self.state['test_a']['value2'] = 'bar' if self.trigger_rollback: # The rollback test will append the strings to this as # it unrolls, and we'll check it's value at the end self.state['rollback_test'] = [] raise RuntimeError("Rollback triggered") return def umount(self): # Umount is run in reverse. This key should exist from test_b self.state['umount'].append('test_a') class TestA(PluginBase): def __init__(self, config, defaults, state): super(TestA, self).__init__() test_rollback = True if 'test_rollback' in defaults else False self.node = TestANode(config, state, test_rollback) def get_nodes(self): return [self.node] diskimage-builder-2.35.0/diskimage_builder/block_device/tests/test_mkfs.py0000664000175000017500000000276013640271474027010 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging import diskimage_builder.block_device.tests.test_config as tc from diskimage_builder.block_device.config import create_graph from diskimage_builder.block_device.exception import \ BlockDeviceSetupException logger = logging.getLogger(__name__) class TestMkfs(tc.TestGraphGeneration): def test_duplicate_labels(self): config = self.load_config_file('duplicate_fs_labels.yaml') self.assertRaisesRegex(BlockDeviceSetupException, "used more than once", create_graph, config, self.fake_default_config, {}) def test_too_long_labels(self): config = self.load_config_file('too_long_fs_label.yaml') self.assertRaisesRegex(BlockDeviceSetupException, "too long for filesystem", create_graph, config, self.fake_default_config, {}) diskimage-builder-2.35.0/diskimage_builder/block_device/level2/0000775000175000017500000000000013640271564024461 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/level2/__init__.py0000664000175000017500000000000013640271474026560 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/level2/mkfs.py0000664000175000017500000001245413640271474026001 0ustar zuulzuul00000000000000# Copyright 2017 Andreas Florath (andreas@florath.net) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging import uuid from diskimage_builder.block_device.exception \ import BlockDeviceSetupException from diskimage_builder.block_device.plugin import NodeBase from diskimage_builder.block_device.plugin import PluginBase from diskimage_builder.block_device.utils import exec_sudo logger = logging.getLogger(__name__) # There is the need to check the length of the label of # the filesystem. The maximum length depends on the used filesystem. # This map provides information about the maximum label length. file_system_max_label_length = { "ext2": 16, "ext3": 16, "ext4": 16, "xfs": 12, "vfat": 11 } class FilesystemNode(NodeBase): def __init__(self, config, state): logger.debug("Create filesystem object; config [%s]", config) super(FilesystemNode, self).__init__(config['name'], state) # Parameter check (mandatory) for pname in ['base', 'type']: if pname not in config: raise BlockDeviceSetupException( "Mkfs config needs [%s]" % pname) setattr(self, pname, config[pname]) # Parameter check (optional) for pname in ['label', 'opts', 'uuid']: setattr(self, pname, config[pname] if pname in config else None) if self.label is None: self.label = self.name # for fat/vfat, we use the label as an identifier for the disk # so we need that the label is converted to upper case if self.type in ('vfat', 'fat'): self.label = self.label.upper() # ensure we don't already have a fs with this label ... they # all must be unique. if 'fs_labels' in self.state: if self.label in self.state['fs_labels']: raise BlockDeviceSetupException( "File system label [%s] used more than once" % self.label) self.state['fs_labels'].append(self.label) else: self.state['fs_labels'] = [self.label] if self.type in file_system_max_label_length: if file_system_max_label_length[self.type] < len(self.label): raise BlockDeviceSetupException( "Label [{label}] too long for filesystem [{type}]: " "{len} > {max_len}".format(**{ 'label': self.label, 'type': self.type, 'len': len(self.label), 'max_len': file_system_max_label_length[self.type]})) else: logger.warning("Length of label [%s] cannot be checked for " "filesystem [%s]: unknown max length", self.label, self.type) logger.warning("Continue - but this might lead to an error") if self.opts is not None: self.opts = self.opts.strip().split(' ') if self.uuid is None: self.uuid = str(uuid.uuid4()) logger.debug("Filesystem created [%s]", self) def get_edges(self): edge_from = [self.base] edge_to = [] return (edge_from, edge_to) def create(self): cmd = ["mkfs"] cmd.extend(['-t', self.type]) if self.opts: cmd.extend(self.opts) if self.type in ('vfat', 'fat'): cmd.extend(["-n", self.label]) else: cmd.extend(["-L", self.label]) if self.type in ('ext2', 'ext3', 'ext4'): cmd.extend(['-U', self.uuid]) elif self.type == 'xfs': cmd.extend(['-m', "uuid=%s" % self.uuid]) else: logger.warning("UUID will not be written for fs type [%s]", self.type) if self.type in ('ext2', 'ext3', 'ext4', 'xfs'): cmd.append('-q') if 'blockdev' not in self.state: self.state['blockdev'] = {} device = self.state['blockdev'][self.base]['device'] cmd.append(device) logger.debug("Creating fs command [%s]", cmd) exec_sudo(cmd) if 'filesys' not in self.state: self.state['filesys'] = {} self.state['filesys'][self.name] \ = {'uuid': self.uuid, 'label': self.label, 'fstype': self.type, 'opts': self.opts, 'device': device} class Mkfs(PluginBase): """Create a file system This block device module handles creating different file systems. """ def __init__(self, config, defaults, state): super(Mkfs, self).__init__() self.filesystems = {} fs = FilesystemNode(config, state) self.filesystems[fs.get_name()] = fs def get_nodes(self): nodes = [] for _, fs in self.filesystems.items(): nodes.append(fs) return nodes diskimage-builder-2.35.0/diskimage_builder/block_device/level1/0000775000175000017500000000000013640271564024460 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/level1/partitioning.py0000664000175000017500000002236113640271474027545 0ustar zuulzuul00000000000000# Copyright 2016 Andreas Florath (andreas@florath.net) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging import os from diskimage_builder.block_device.exception import \ BlockDeviceSetupException from diskimage_builder.block_device.level1.mbr import MBR from diskimage_builder.block_device.level1.partition import PartitionNode from diskimage_builder.block_device.plugin import PluginBase from diskimage_builder.block_device.utils import exec_sudo from diskimage_builder.block_device.utils import parse_abs_size_spec from diskimage_builder.block_device.utils import parse_rel_size_spec logger = logging.getLogger(__name__) class Partitioning(PluginBase): def __init__(self, config, default_config, state): logger.debug("Creating Partitioning object; config [%s]", config) super(Partitioning, self).__init__() # Unlike other PluginBase we are somewhat persistent, as the # partition nodes call back to us (see create() below). We # need to keep this reference. self.state = state # Because using multiple partitions of one base is done # within one object, there is the need to store a flag if the # creation of the partitions was already done. self.number_of_partitions = 0 # Parameter check if 'base' not in config: raise BlockDeviceSetupException("Partitioning config needs 'base'") self.base = config['base'] if 'partitions' not in config: raise BlockDeviceSetupException( "Partitioning config needs 'partitions'") if 'label' not in config: raise BlockDeviceSetupException( "Partitioning config needs 'label'") self.label = config['label'] if self.label not in ("mbr", "gpt"): raise BlockDeviceSetupException("Label must be 'mbr' or 'gpt'") # It is VERY important to get the alignment correct. If this # is not correct, the disk performance might be very poor. # Example: In some tests a 'off by one' leads to a write # performance of 30% compared to a correctly aligned # partition. # The problem for DIB is, that it cannot assume that the host # system uses the same IO sizes as the target system, # therefore here a fixed approach (as used in all modern # systems with large disks) is used. The partitions are # aligned to 1MiB (which are about 2048 times 512 bytes # blocks) self.align = 1024 * 1024 # 1MiB as default if 'align' in config: self.align = parse_abs_size_spec(config['align']) self.partitions = [] prev_partition = None for part_cfg in config['partitions']: np = PartitionNode(part_cfg, state, self, prev_partition) self.partitions.append(np) prev_partition = np def get_nodes(self): # return the list of partitions return self.partitions def _size_of_block_dev(self, dev): with open(dev, "r") as fd: fd.seek(0, 2) return fd.tell() def _create_mbr(self): """Create partitions with MBR""" with MBR(self.image_path, self.disk_size, self.align) as part_impl: for part_cfg in self.partitions: part_name = part_cfg.get_name() part_bootflag = PartitionNode.flag_boot \ in part_cfg.get_flags() part_primary = PartitionNode.flag_primary \ in part_cfg.get_flags() part_size = part_cfg.get_size() part_free = part_impl.free() part_type = part_cfg.get_type() logger.debug("Not partitioned space [%d]", part_free) part_size = parse_rel_size_spec(part_size, part_free)[1] part_no \ = part_impl.add_partition(part_primary, part_bootflag, part_size, part_type) logger.debug("Create partition [%s] [%d]", part_name, part_no) # We're going to mount all partitions with kpartx # below once we're done. So the device this partition # will be seen at becomes "/dev/mapper/loop0pX" assert self.device_path[:5] == "/dev/" partition_device_name = "/dev/mapper/%sp%d" % \ (self.device_path[5:], part_no) self.state['blockdev'][part_name] \ = {'device': partition_device_name} def _create_gpt(self): """Create partitions with GPT""" cmd = ['sgdisk', self.image_path] # This padding gives us a little room for rounding so we don't # go over the end of the disk disk_free = self.disk_size - (2048 * 1024) pnum = 1 for p in self.partitions: args = {} args['pnum'] = pnum args['name'] = '%s' % p.get_name() args['type'] = '%s' % p.get_type() # convert from a relative/string size to bytes size = parse_rel_size_spec(p.get_size(), disk_free)[1] # We keep track in bytes, but specify things to sgdisk in # megabytes so it can align on sensible boundaries. And # create partitions right after previous so no need to # calculate start/end - just size. assert size <= disk_free args['size'] = size // (1024 * 1024) new_cmd = ("-n", "{pnum}:0:+{size}M".format(**args), "-t", "{pnum}:{type}".format(**args), # Careful with this one, as {name} could have spaces "-c", "{pnum}:{name}".format(**args)) cmd.extend(new_cmd) # Fill the state; we mount all partitions with kpartx # below once we're done. So the device this partition # will be seen at becomes "/dev/mapper/loop0pX" assert self.device_path[:5] == "/dev/" device_name = "/dev/mapper/%sp%d" % (self.device_path[5:], pnum) self.state['blockdev'][p.get_name()] \ = {'device': device_name} disk_free = disk_free - size pnum = pnum + 1 logger.debug("Partition %s added, %s remaining in disk", pnum, disk_free) logger.debug("cmd: %s", ' '.join(cmd)) exec_sudo(cmd) # not this is NOT a node and this is not called directly! The # create() calls in the partition nodes this plugin has # created are calling back into this. def create(self): # This is a bit of a hack. Each of the partitions is actually # in the graph, so for every partition we get a create() call # as the walk happens. But we only need to create the # partition table once... self.number_of_partitions += 1 if self.number_of_partitions > 1: logger.info("Not creating the partitions a second time.") return # the raw file on disk self.image_path = self.state['blockdev'][self.base]['image'] # the /dev/loopX device of the parent self.device_path = self.state['blockdev'][self.base]['device'] # underlying size self.disk_size = self._size_of_block_dev(self.image_path) logger.info("Creating partition on [%s] [%s]", self.base, self.image_path) assert self.label in ('mbr', 'gpt') if self.label == 'mbr': self._create_mbr() elif self.label == 'gpt': self._create_gpt() # "saftey sync" to make sure the partitions are written exec_sudo(["sync"]) # now all the partitions are created, get device-mapper to # mount them if not os.path.exists("/.dockerenv"): exec_sudo(["kpartx", "-avs", self.device_path]) else: # If running inside Docker, make our nodes manually, # because udev will not be working. kpartx cannot run in # sync mode in docker. exec_sudo(["kpartx", "-av", self.device_path]) exec_sudo(["dmsetup", "--noudevsync", "mknodes"]) return def umount(self): # Remove the partition mappings made for the parent # block-device by create() above. This is called from the # child PartitionNode umount. Thus every # partition calls it, but we only want to do it once when # we know this is the very last partition self.number_of_partitions -= 1 if self.number_of_partitions == 0: exec_sudo(["kpartx", "-d", self.state['blockdev'][self.base]['device']]) def cleanup(self): pass diskimage-builder-2.35.0/diskimage_builder/block_device/level1/__init__.py0000664000175000017500000000000013640271474026557 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/level1/mbr.py0000664000175000017500000003612413640271474025620 0ustar zuulzuul00000000000000# Copyright 2016 Andreas Florath (andreas@florath.net) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging import os import random from struct import pack logger = logging.getLogger(__name__) # Details of the MBR object itself can be found in the inline # documentation. # # General design and implementation remarks: # o Because the whole GNU parted and co. (e.g. the python-parted that # is based on GNU parted) cannot be used because of the license: # everything falls under GPL2 (not LGPL2!) and therefore does not # fit into the Apache License here. # o It looks that there is no real alternative available (2016-06). # o The interface of python-parted is not that simple to handle - and # the initial try to use GNU (python-)parted was not that much # easier and shorter than this approach. # o When using tools (like fdisk or parted) they try to optimize the # alignment of partitions based on the data found on the host # system. These might be misleading and might lead to (very) poor # performance. # o These ready-to-use tools typically also change the CHS layout # based on the disk size. In case that the disk is enlarged (which # is a normal use case for golden images), the CHS layout of the # disk changes for those tools (and is not longer correct). # In the DIB implementation the CHS are chosen that way, that also # for very small disks the maximum heads/cylinder and sectors/track # is used: even if the disk size in increased, the CHS numbers will # not change. # o In the easy and straight forward way when only using one # partition, exactly 40 bytes (!) must be written - and the biggest # part of this data is fixed (same in all cases). # # Limitations and Incompatibilities # o With the help of this class it is possible to create an # arbitrarily number of extended partitions (tested with over 1000). # o There are limitations and shortcomings in the OS and in tools # handling these partitions. # o Under Linux the loop device is able to handle a limited number of # partitions. The module parameter max_loop can be set - the maximum # number might vary depending on the distribution and kernel build. # o Under Linux fdisk is able to handle 'only' 60 partitions. Only # those are listed, can be changed or written. # o Under Linux GNU parted can handle about 60 partitions. # # Be sure only to pass in the number of partitions that the host OS # and target OS are able to handle. class MBR(object): """MBR Disk / Partition Table Layout Primary partitions are created first - and must also be passed in first. The extended partition layout is done in the way, that there is one entry in the MBR (the last) that uses the whole disk. EBR (extended boot records) are used to describe the partitions themselves. This has the advantage, that the same procedure can be used for all partitions and arbitrarily many partitions can be created in the same way (the EBR is placed as block 0 in each partition itself). In conjunction with a fixed and 'fits all' partition alignment the major design focus is maximum performance for the installed image (vs. minimal size). Because of the chosen default alignment of 1MiB there will be (1MiB - 512B) unused disk space for the MBR and also the same size unused in every partition. Assuming that 512 byte blocks are used, the resulting layout for extended partitions looks like (blocks offset in extended partition given): ======== ============================================== Offset Description ======== ============================================== 0 MBR - 2047 blocks unused 2048 EBR for partition 1 - 2047 blocks unused 4096 Start of data for partition 1 ... ... X EBR for partition N - 2047 blocks unused X+2048 Start of data for partition N ======== ============================================== Direct (native) writing of MBR, EBR (partition table) is implemented - no other partitioning library or tools is used - to be sure to get the correct CHS and alignment for a wide range of host systems. """ # Design & Implementation details: # o A 'block' is a storage unit on disk. It is similar (equal) to a # sector - but with LBA addressing. # o It is assumed that a disk block has that number of bytes bytes_per_sector = 512 # o CHS is the 'good and very old way' specifying blocks. # When passing around these numbers, they are also ordered like 'CHS': # (cylinder, head, sector). # o The computation from LBA to CHS is not unique (it is based # on the 'real' (or assumed) number of heads/cylinder and # sectors/track), these are the assumed numbers. Please note # that these are also the maximum numbers: heads_per_cylinder = 254 sectors_per_track = 63 max_cylinders = 1023 # o There is the need for some offsets that are defined in the # MBR/EBR domain. MBR_offset_disk_id = 440 MBR_offset_signature = 510 MBR_offset_first_partition_table_entry = 446 MBR_partition_type_extended_chs = 0x5 MBR_partition_type_extended_lba = 0xF MBR_signature = 0xAA55 def __init__(self, name, disk_size, alignment): """Initialize a disk partitioning MBR object. The name is the (existing) name of the disk. The disk_size is the (used) size of the disk. It must be a proper multiple of the disk bytes per sector (currently 512) """ logger.info("Create MBR disk partitioning object") assert disk_size % MBR.bytes_per_sector == 0 self.disk_size = disk_size self.disk_size_in_blocks \ = self.disk_size // MBR.bytes_per_sector self.alignment_blocks = alignment // MBR.bytes_per_sector # Because the extended partitions are a chain of blocks, when # creating a new partition, the reference in the already # existing EBR must be updated. This holds a reference to the # latest EBR. (A special case is the first: when it points to # 0 (MBR) there is no need to update the reference.) self.disk_block_last_ref = 0 self.name = name self.partition_abs_start = None self.partition_abs_next_free = None # Start of partition number self.partition_number = 0 self.primary_partitions_created = 0 self.extended_partitions_created = 0 def __enter__(self): # Open existing file for writing (r+) self.image_fd = open(self.name, "r+b") self.write_mbr() self.write_mbr_signature(0) self.partition_abs_start = self.align(1) self.partition_abs_next_free \ = self.partition_abs_start return self def __exit__(self, exc_type, exc_value, traceback): self.image_fd.flush() os.fsync(self.image_fd.fileno()) self.image_fd.close() def lba2chs(self, lba): """Converts a LBA block number to CHS If the LBA block number is bigger than the max (1023, 63, 254) the maximum is returned. """ if lba > MBR.heads_per_cylinder * MBR.sectors_per_track \ * MBR.max_cylinders: return MBR.max_cylinders, MBR.heads_per_cylinder, \ MBR.sectors_per_track cylinder = lba // (MBR.heads_per_cylinder * MBR.sectors_per_track) head = (lba // MBR.sectors_per_track) % MBR.heads_per_cylinder sector = (lba % MBR.sectors_per_track) + 1 logger.debug("Convert LBA to CHS [%d] -> [%d, %d, %d]", lba, cylinder, head, sector) return cylinder, head, sector def encode_chs(self, cylinders, heads, sectors): """Encodes a CHS triple into disk format""" # Head - nothing to convert assert heads <= MBR.heads_per_cylinder eh = heads # Sector assert sectors <= MBR.sectors_per_track es = sectors # top two bits are set in cylinder conversion # Cylinder assert cylinders <= MBR.max_cylinders ec = cylinders % 256 # lower part hc = cylinders // 4 # extract top two bits and es = es | hc # pass them into the top two bits of the sector logger.debug("Encode CHS to disk format [%d %d %d] " "-> [%02x %02x %02x]", cylinders, heads, sectors, eh, es, ec) return eh, es, ec def write_mbr(self): """Write MBR This method writes the MBR to disk. It creates a random disk id as well that it creates the extended partition (as first partition) which uses the whole disk. """ disk_id = random.randint(0, 0xFFFFFFFF) self.image_fd.seek(MBR.MBR_offset_disk_id) self.image_fd.write(pack(" 0: raise RuntimeError("All primary partitions must be " "given first") if primaryflag: return self.add_primary_partition(bootflag, size, ptype) if self.extended_partitions_created == 0: # When this is the first extended partition, the extended # partition entry has to be written. self.partition_abs_start = self.partition_abs_next_free self.write_partition_entry( False, 0, self.partition_number, MBR.MBR_partition_type_extended_lba, self.partition_abs_next_free, self.disk_size_in_blocks - self.partition_abs_next_free) self.partition_number = 4 return self.add_extended_partition(bootflag, size, ptype) def free(self): """Returns the free (not yet partitioned) size""" return self.disk_size \ - (self.partition_abs_next_free + self.align(1)) \ * MBR.bytes_per_sector diskimage-builder-2.35.0/diskimage_builder/block_device/level1/partition.py0000664000175000017500000000572113640271474027050 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging from diskimage_builder.block_device.exception import \ BlockDeviceSetupException from diskimage_builder.block_device.plugin import NodeBase logger = logging.getLogger(__name__) class PartitionNode(NodeBase): flag_boot = 1 flag_primary = 2 def __init__(self, config, state, parent, prev_partition): super(PartitionNode, self).__init__(config['name'], state) self.base = config['base'] self.partitioning = parent self.prev_partition = prev_partition # filter out some MBR only options for clarity if self.partitioning.label == 'gpt': if 'flags' in config and 'primary' in config['flags']: raise BlockDeviceSetupException( "Primary flag not supported for GPT partitions") self.flags = set() if 'flags' in config: for f in config['flags']: if f == 'boot': self.flags.add(self.flag_boot) elif f == 'primary': self.flags.add(self.flag_primary) else: raise BlockDeviceSetupException("Unknown flag: %s" % f) if 'size' not in config: raise BlockDeviceSetupException("No size in partition" % self.name) self.size = config['size'] if self.partitioning.label == 'gpt': self.ptype = str(config['type']) if 'type' in config else '8300' elif self.partitioning.label == 'mbr': self.ptype = int(config['type'], 16) if 'type' in config else 0x83 def get_flags(self): return self.flags def get_size(self): return self.size def get_type(self): return self.ptype def get_edges(self): edge_from = [self.base] edge_to = [] if self.prev_partition is not None: edge_from.append(self.prev_partition.name) return (edge_from, edge_to) # These all call back to the parent "partitioning" object to do # the real work. Every node calls it, but only one will succeed; # see the gating we do in the parent function. # # XXX: A better model here would be for the parent object to a # real node in the config graph, so it's create() gets called. # These can then just be stubs. def create(self): self.partitioning.create() def umount(self): self.partitioning.umount() def cleanup(self): self.partitioning.cleanup() diskimage-builder-2.35.0/diskimage_builder/block_device/level1/lvm.py0000664000175000017500000003222513640271474025634 0ustar zuulzuul00000000000000# Copyright 2017 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import logging from diskimage_builder.block_device.exception \ import BlockDeviceSetupException from diskimage_builder.block_device.plugin import NodeBase from diskimage_builder.block_device.plugin import PluginBase from diskimage_builder.block_device.utils import exec_sudo logger = logging.getLogger(__name__) # # LVM # --- # # The LVM config has three required keys; pvs, vgs and lvs # # lvm: -> LVSNode # pvs: -> PvsNode # lvs: -> LvsNode # vgs: -> VgsNode # # The LVMPlugin will verify this and build nodes into the # configuration graph. # # As described below, a LVSNode is created for synchronisation # purposes. Thus if you had something like two partitions that became # two physical-volumes (pv1 & pv2), that you then combine into a # single volume group (vg) and then create several logical volumes # (lv1, lv2, lv3) your graph would end up looking like: # # partition1 partition2 # | | # ---> LVSNode <--+ # | # +------+------+ # v v # pv1 pv2 # | | # +--> vg <---+ # | # +-----+-----+ # v v v # lv1 lv2 lv3 # # After the create() call on the LVSNode object, the entire LVM setup # would actually be complete. The other nodes are all just # place-holders, and are used for further ordering (for example, the # fs creation & mounting should depend on the logical volume nodes). # For this reason, their create() calls are blank. However, for code # organisational purposes they have a private _create() and _cleanup() # call that is driven by the LVSNode object. class PvsNode(NodeBase): def __init__(self, name, state, base, options): """Physical volume This is a placeholder node for the LVM physical volumes. Arguments: :param name: Name of this node :param state: global state pointer :param base: Parent partition :param options: config options """ super(PvsNode, self).__init__(name, state) self.base = base self.options = options def _create(self): # the underlying device path of our parent was previously # recorded into the state during blockdev creation; look it # up. phys_dev = self.state['blockdev'][self.base]['device'] cmd = ["pvcreate"] cmd.append(phys_dev) if self.options: cmd.extend(self.options) logger.debug("Creating pv command [%s]", cmd) exec_sudo(cmd) # save state if 'pvs' not in self.state: self.state['pvs'] = {} self.state['pvs'][self.name] = { 'opts': self.options, 'device': phys_dev } def get_edges(self): # See LVMNode.get_edges() for how this gets connected return ([], []) def create(self): # see notes in LVMNode object pass class VgsNode(NodeBase): def __init__(self, name, state, base, options): """Volume Group This is a placeholder node for a volume group Arguments: :param name: Name of this node :param state: global state pointer :param base: Parent :class:`PvsNodes` this volume group exists on :param options: extra options passed to the `vgcreate` command """ super(VgsNode, self).__init__(name, state) self.base = base self.options = options def _create(self): # The PV's have saved their actual device name into the state # during their _create(). Look at our base elements and thus # find the underlying device paths in the state. pvs_devs = [] for pv in self.base: pvs_dev = self.state['pvs'][pv]['device'] pvs_devs.append(pvs_dev) cmd = ["vgcreate", ] cmd.append(self.name) cmd.extend(pvs_devs) if self.options: cmd.extend(self.options) logger.debug("Creating vg command [%s]", cmd) exec_sudo(cmd) # save state if 'vgs' not in self.state: self.state['vgs'] = {} self.state['vgs'][self.name] = { 'opts': self.options, 'devices': self.base, } def _umount(self): exec_sudo(['vgchange', '-an', self.name]) def get_edges(self): # self.base is already a list, per the config. There might be # multiple pv parents here. edge_from = self.base edge_to = [] return (edge_from, edge_to) def create(self): # see notes in LVMNode object pass class LvsNode(NodeBase): def __init__(self, name, state, base, options, size, extents): """Logical Volume This is a placeholder node for a logical volume Arguments: :param name: Name of this node :param state: global state pointer :param base: the parent volume group :param options: options passed to lvcreate :param size: size of the LV, in MB (this or extents must be provided) :param extents: size of the LV in extents """ super(LvsNode, self).__init__(name, state) self.base = base self.options = options self.size = size self.extents = extents def _create(self): cmd = ["lvcreate", ] cmd.extend(['--name', self.name]) if self.size: cmd.extend(['-L', self.size]) elif self.extents: cmd.extend(['-l', self.extents]) if self.options: cmd.extend(self.options) cmd.append(self.base) logger.debug("Creating lv command [%s]", cmd) exec_sudo(cmd) # save state self.state['blockdev'][self.name] = { 'vgs': self.base, 'size': self.size, 'extents': self.extents, 'opts': self.options, 'device': '/dev/mapper/%s-%s' % (self.base, self.name) } def _umount(self): exec_sudo(['lvchange', '-an', '/dev/%s/%s' % (self.base, self.name)]) def get_edges(self): edge_from = [self.base] edge_to = [] return (edge_from, edge_to) def create(self): # see notes in LVMNode object pass class LVMNode(NodeBase): def __init__(self, name, state, pvs, lvs, vgs): """LVM Driver Node This is the "global" node where all LVM operations are driven from. In the node graph, the LVM physical-volumes depend on this node. This node then depends on the devices that the PV's require. This node incorporates *all* LVM setup; i.e. after the create() call here we have created all pv's, lv's and vg. The Node objects in the graph are therefore just dependency place holders whose create() call does nothing. Arguments: :param name: name of this node :param state: global state pointer :param pvs: A list of :class:`PvsNode` objects :param lvs: A list of :class:`LvsNode` objects :param vgs: A list of :class:`VgsNode` objects """ super(LVMNode, self).__init__(name, state) self.pvs = pvs self.lvs = lvs self.vgs = vgs def get_edges(self): # This node requires the physical device(s), which is # recorded in the "base" argument of the PV nodes. pvs = [] for pv in self.pvs: pvs.append(pv.base) edge_from = set(pvs) # The PV nodes should then depend on us. i.e., we just made # this node a synchronisation point edge_to = [pv.name for pv in self.pvs] return (edge_from, edge_to) def create(self): # Run through pvs->vgs->lvs and create them # XXX: we could theoretically get this same info from walking # the graph of our children nodes? Would that be helpful in # any way? for pvs in self.pvs: pvs._create() for vgs in self.vgs: vgs._create() for lvs in self.lvs: lvs._create() def umount(self): for lvs in self.lvs: lvs._umount() for vgs in self.vgs: vgs._umount() exec_sudo(['udevadm', 'settle']) def cleanup(self): # Information about the PV, VG and LV is typically # cached in lvmetad. Even after removing PV device and # partitions this data is not automatically updated # which leads to a couple of problems. # the 'pvscan --cache' scans the available disks # and updates the cache. # This is in cleanup because it must be called after the # umount of the containing block device is done, (which should # all be done in umount phase). try: exec_sudo(['pvscan', '--cache']) except BlockDeviceSetupException as e: logger.info("pvscan call failed [%s]", e.returncode) class LVMPlugin(PluginBase): def _config_error(self, msg): raise BlockDeviceSetupException(msg) def __init__(self, config, defaults, state): """Build LVM nodes This reads the "lvm:" config stanza, validates it and produces the PV, VG and LV nodes. These are all synchronised via a LVMNode as described above. Arguments: :param config: "lvm" configuration dictionary :param defaults: global defaults dictionary :param state: global state reference """ super(LVMPlugin, self).__init__() # note lvm: doesn't require a base ... the base is the # physical devices the "pvs" nodes are made on. if 'name' not in config: self._config_error("Lvm config requires 'name'") if 'pvs' not in config: self._config_error("Lvm config requires a 'pvs'") if 'vgs' not in config: self._config_error("Lvm config needs 'vgs'") if 'lvs' not in config: self._config_error("Lvm config needs 'lvs'") # create physical volume nodes self.pvs = [] self.pvs_keys = [] for pvs_cfg in config['pvs']: if 'name' not in pvs_cfg: self._config_error("Missing 'name' in pvs config") if 'base' not in pvs_cfg: self._config_error("Missing 'base' in pvs_config") pvs_item = PvsNode(pvs_cfg['name'], state, pvs_cfg['base'], pvs_cfg.get('options')) self.pvs.append(pvs_item) # create volume group nodes self.vgs = [] self.vgs_keys = [] for vgs_cfg in config['vgs']: if 'name' not in vgs_cfg: self._config_error("Missing 'name' in vgs config") if 'base' not in vgs_cfg: self._config_error("Missing 'base' in vgs config") # Ensure we have a valid PVs backing this VG for pvs in vgs_cfg['base']: if not any(pv.name == pvs for pv in self.pvs): self._config_error("base:%s in vgs does not " "match a valid pvs" % pvs) vgs_item = VgsNode(vgs_cfg['name'], state, vgs_cfg['base'], vgs_cfg.get('options', None)) self.vgs.append(vgs_item) # create logical volume nodes self.lvs = [] for lvs_cfg in config['lvs']: if 'name' not in lvs_cfg: self._config_error("Missing 'name' in lvs config") if 'base' not in lvs_cfg: self._config_error("Missing 'base' in lvs config") if 'size' not in lvs_cfg and 'extents' not in lvs_cfg: self._config_error("Missing 'size' or 'extents' in lvs config") # ensure this logical volume has a valid volume group base if not any(vg.name == lvs_cfg['base'] for vg in self.vgs): self._config_error("base:%s in lvs does not match a valid vg" % lvs_cfg['base']) lvs_item = LvsNode(lvs_cfg['name'], state, lvs_cfg['base'], lvs_cfg.get('options', None), lvs_cfg.get('size', None), lvs_cfg.get('extents', None)) self.lvs.append(lvs_item) # create the "driver" node self.lvm_node = LVMNode(config['name'], state, self.pvs, self.lvs, self.vgs) def get_nodes(self): # the nodes for insertion into the graph are all of the pvs, # vgs and lvs nodes we have created above and the root node and # the cleanup node. return self.pvs + self.vgs + self.lvs \ + [self.lvm_node] diskimage-builder-2.35.0/diskimage_builder/block_device/utils.py0000664000175000017500000001063313640271474025005 0ustar zuulzuul00000000000000# Copyright 2016 Andreas Florath (andreas@florath.net) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import locale import logging import re import subprocess from diskimage_builder.block_device.exception import \ BlockDeviceSetupException logger = logging.getLogger(__name__) SIZE_UNIT_SPECS = [ ["TiB", 1024**4], ["GiB", 1024**3], ["MiB", 1024**2], ["KiB", 1024**1], ["TB", 1000**4], ["GB", 1000**3], ["MB", 1000**2], ["KB", 1000**1], ["T", 1000**4], ["G", 1000**3], ["M", 1000**2], ["K", 1000**1], ["B", 1], ["", 1], # No unit -> size is given in bytes ] # Basic RE to check and split floats (without exponent) # and a given unit specification (which must be non-numerical). size_unit_spec_re = re.compile(r"^([\d\.]*) ?([a-zA-Z0-9_]*)$") def _split_size_unit_spec(size_unit_spec): """Helper function to split unit specification into parts. The first part is the numeric part - the second one is the unit. """ match = size_unit_spec_re.match(size_unit_spec) if match is None: raise RuntimeError("Invalid size unit spec [%s]" % size_unit_spec) return match.group(1), match.group(2) def _get_unit_factor(unit_str): """Helper function to get the unit factor. The given unit_str needs to be a string of the SIZE_UNIT_SPECS table. If the unit is not found, a runtime error is raised. """ for spec_key, spec_value in SIZE_UNIT_SPECS: if unit_str == spec_key: return spec_value raise RuntimeError("unit_str [%s] not known" % unit_str) def parse_abs_size_spec(size_spec): size_cnt_str, size_unit_str = _split_size_unit_spec(size_spec) unit_factor = _get_unit_factor(size_unit_str) return int(unit_factor * ( float(size_cnt_str) if len(size_cnt_str) > 0 else 1)) def parse_rel_size_spec(size_spec, abs_size): """Parses size specifications - can be relative like 50% In addition to the absolute parsing also a relative parsing is done. If the size specification ends in '%', then the relative size of the given 'abs_size' is returned. """ if size_spec[-1] == '%': percent = float(size_spec[:-1]) return True, int(abs_size * percent / 100.0) return False, parse_abs_size_spec(size_spec) def exec_sudo(cmd): """Run a command under sudo Run command under sudo, with debug trace of output. This is like subprocess.check_call() but sudo wrapped and with output tracing at debug levels. Arguments: :param cmd: str command list; for Popen() :return: the stdout+stderror of the called command :raises BlockDeviceSetupException: if return code != 0. Exception values similar to ``subprocess.CalledProcessError`` * ``returncode`` : returncode of child * ``cmd`` : the command run * ``output`` : stdout+stderr output """ assert isinstance(cmd, list) sudo_cmd = ["sudo"] sudo_cmd.extend(cmd) try: logger.info("Calling [%s]", " ".join(sudo_cmd)) except TypeError: # Popen actually doesn't care, but we've managed to get mixed # str and bytes in argument lists which causes errors logging # commands. Give a clue as to what's going on. logger.exception("Ensure all arguments are str type!") raise proc = subprocess.Popen(sudo_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) out = "" with proc.stdout: for line in iter(proc.stdout.readline, b''): line = line.decode(encoding=locale.getpreferredencoding(False), errors='backslashreplace') out += line logger.debug("exec_sudo: %s", line.rstrip()) proc.wait() if proc.returncode: e = BlockDeviceSetupException("exec_sudo failed") e.returncode = proc.returncode e.cmd = ' '.join(sudo_cmd) e.output = out raise e return out diskimage-builder-2.35.0/diskimage_builder/block_device/level0/0000775000175000017500000000000013640271564024457 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/level0/__init__.py0000664000175000017500000000000013640271474026556 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/block_device/level0/localloop.py0000664000175000017500000001051513640271474027017 0ustar zuulzuul00000000000000# Copyright 2016 Andreas Florath (andreas@florath.net) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging import os from diskimage_builder.block_device.exception import \ BlockDeviceSetupException from diskimage_builder.block_device.plugin import NodeBase from diskimage_builder.block_device.plugin import PluginBase from diskimage_builder.block_device.utils import exec_sudo from diskimage_builder.block_device.utils import parse_abs_size_spec logger = logging.getLogger(__name__) def image_create(filename, size): logger.info("Create image file [%s]", filename) with open(filename, "w") as fd: fd.seek(size - 1) fd.write("\0") def image_delete(filename): logger.info("Remove image file [%s]", filename) os.remove(filename) def loopdev_attach(filename): logger.info("loopdev attach") logger.debug("Calling [sudo losetup --show -f %s]", filename) block_device = exec_sudo(["losetup", "--show", "-f", filename]) # [:-1]: Cut of the newline block_device = block_device[:-1] logger.info("New block device [%s]", block_device) return block_device def loopdev_detach(loopdev): logger.info("loopdev detach") # loopback dev may be tied up a bit by udev events triggered # by partition events for try_cnt in range(10, 1, -1): try: exec_sudo(["losetup", "-d", loopdev]) return except BlockDeviceSetupException as e: # Do not raise an error - maybe other cleanup methods # can at least do some more work. logger.error("loopdev detach failed (%s)", e.returncode) logger.debug("Gave up trying to detach [%s]", loopdev) return 1 class LocalLoopNode(NodeBase): """Level0: Local loop image device handling. This class handles local loop devices that can be used for VM image installation. """ def __init__(self, config, default_config, state): logger.debug("Creating LocalLoop object; config [%s] " "default_config [%s]", config, default_config) super(LocalLoopNode, self).__init__(config['name'], state) if 'size' in config: self.size = parse_abs_size_spec(config['size']) logger.debug("Image size [%s]", self.size) else: self.size = parse_abs_size_spec(default_config['image-size']) logger.debug("Using default image size [%s]", self.size) if 'directory' in config: self.image_dir = config['directory'] else: self.image_dir = default_config['image-dir'] self.filename = os.path.join(self.image_dir, self.name + ".raw") def get_edges(self): """Because this is created without base, there are no edges.""" return ([], []) def create(self): logger.debug("[%s] Creating loop on [%s] with size [%d]", self.name, self.filename, self.size) self.add_rollback(image_delete, self.filename) image_create(self.filename, self.size) block_device = loopdev_attach(self.filename) self.add_rollback(loopdev_detach, block_device) if 'blockdev' not in self.state: self.state['blockdev'] = {} self.state['blockdev'][self.name] = {"device": block_device, "image": self.filename} logger.debug("Created loop name [%s] device [%s] image [%s]", self.name, block_device, self.filename) return def umount(self): loopdev_detach(self.state['blockdev'][self.name]['device']) def delete(self): image_delete(self.state['blockdev'][self.name]['image']) class LocalLoop(PluginBase): def __init__(self, config, defaults, state): super(LocalLoop, self).__init__() self.node = LocalLoopNode(config, defaults, state) def get_nodes(self): return [self.node] diskimage-builder-2.35.0/diskimage_builder/block_device/cmd.py0000664000175000017500000001021013640271474024377 0ustar zuulzuul00000000000000# Copyright 2016-2017 Andreas Florath (andreas@florath.net) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import argparse import logging import os import sys import yaml from diskimage_builder.block_device.blockdevice import BlockDevice from diskimage_builder import logging_config logger = logging.getLogger(__name__) class BlockDeviceCmd(object): def cmd_init(self): self.bd.cmd_init() def cmd_getval(self): self.bd.cmd_getval(self.args.symbol) def cmd_create(self): self.bd.cmd_create() def cmd_umount(self): self.bd.cmd_umount() def cmd_cleanup(self): self.bd.cmd_cleanup() def cmd_delete(self): self.bd.cmd_delete() def cmd_writefstab(self): self.bd.cmd_writefstab() def main(self): logging_config.setup() parser = argparse.ArgumentParser(description="DIB Block Device helper") parser.add_argument('--params', required=False, help="YAML file containing parameters for " "block-device handling. Default is " "DIB_BLOCK_DEVICE_PARAMS_YAML") subparsers = parser.add_subparsers(title='commands', description='valid commands', dest='command', help='additional help') cmd_init = subparsers.add_parser('init', help='Initialize configuration') cmd_init.set_defaults(func=self.cmd_init) cmd_getval = subparsers.add_parser('getval', help='Retrieve information about ' 'internal state') cmd_getval.set_defaults(func=self.cmd_getval) cmd_getval.add_argument('symbol', help='symbol to print') cmd_create = subparsers.add_parser('create', help='Create the block device') cmd_create.set_defaults(func=self.cmd_create) cmd_umount = subparsers.add_parser('umount', help='Unmount blockdevice and ' 'cleanup resources') cmd_umount.set_defaults(func=self.cmd_umount) cmd_cleanup = subparsers.add_parser('cleanup', help='Final cleanup') cmd_cleanup.set_defaults(func=self.cmd_cleanup) cmd_delete = subparsers.add_parser('delete', help='Error cleanup') cmd_delete.set_defaults(func=self.cmd_delete) cmd_writefstab = subparsers.add_parser('writefstab', help='Create fstab for system') cmd_writefstab.set_defaults(func=self.cmd_writefstab) self.args = parser.parse_args() # Find, open and parse the parameters file if not self.args.params: if 'DIB_BLOCK_DEVICE_PARAMS_YAML' in os.environ: param_file = os.environ['DIB_BLOCK_DEVICE_PARAMS_YAML'] else: parser.error( "DIB_BLOCK_DEVICE_PARAMS_YAML or --params not set") else: param_file = self.args.params logger.info("params [%s]", param_file) try: with open(param_file) as f: self.params = yaml.safe_load(f) except Exception: logger.exception("Failed to open parameter YAML") sys.exit(1) # Setup main BlockDevice object from args self.bd = BlockDevice(self.params) self.args.func() def main(): bdc = BlockDeviceCmd() return bdc.main() if __name__ == "__main__": sys.exit(main()) diskimage-builder-2.35.0/diskimage_builder/block_device/blockdevice.py0000664000175000017500000004262413640271474026124 0ustar zuulzuul00000000000000# Copyright 2016-2017 Andreas Florath (andreas@florath.net) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import codecs import collections import json import logging import os import pickle import pprint import shutil import yaml from diskimage_builder.block_device.config import config_tree_to_graph from diskimage_builder.block_device.config import create_graph from diskimage_builder.block_device.exception import \ BlockDeviceSetupException from diskimage_builder.block_device.utils import exec_sudo logger = logging.getLogger(__name__) def _load_json(file_name): """Load file from .json file on disk, return None if not existing""" if os.path.exists(file_name): with codecs.open(file_name, encoding="utf-8", mode="r") as fd: return json.load(fd) return None class BlockDeviceState(collections.MutableMapping): """The global state singleton An reference to an instance of this object is saved into nodes as a global repository. It wraps a single dictionary "state" and provides a few helper functions. The state ends up used in two contexts: - The node list (including this state) is pickled and dumped between cmd_create() and later cmd_* calls that need to call the nodes. - Some other cmd_* calls, such as cmd_writefstab, only need access to values inside the state and not the whole node list, and load it from the json dump created after cmd_create() """ # XXX: # - we could implement getters/setters such that if loaded from # disk, the state is read-only? or make it append-only # (i.e. you can't overwrite existing keys) def __init__(self, filename=None): """Initialise state :param filename: if :param:`filename` is passed and exists, it will be loaded as the state. If it does not exist an exception is raised. If :param:`filename` is not passed, state will be initalised to a blank dictionary. """ if filename: if not os.path.exists(filename): raise BlockDeviceSetupException("State dump not found") else: self.state = _load_json(filename) assert self.state is not None else: self.state = {} def __delitem__(self, key): del self.state[key] def __getitem__(self, key): return self.state[key] def __setitem__(self, key, value): self.state[key] = value def __iter__(self): return iter(self.state) def __len__(self): return len(self.state) def save_state(self, filename): """Persist the state to disk :param filename: The file to persist state to """ logger.debug("Writing state to: %s", filename) self.debug_dump() with open(filename, "w") as fd: json.dump(self.state, fd) def debug_dump(self): """Log state to debug""" # This is pretty good for human consumption, but maybe a bit # verbose. nice_output = pprint.pformat(self.state, width=40) for l in nice_output.split('\n'): logger.debug('{0:{fill}{align}50}'.format(l, fill=' ', align='<')) class BlockDevice(object): """Handles block devices. This class handles the complete setup and deletion of all aspects of the block device level. A typical call sequence: cmd_init: initialize the block device level config. After this call it is possible to e.g. query information from the (partially automatic generated) internal state like root-label. cmd_getval: retrieve information about the (internal) block device state like the block image device (for bootloader) or the root-label (for writing fstab). cmd_create: creates all the different aspects of the block device. When this call is successful, the complete block level device is set up, filesystems are created and are mounted at the correct position. After this call it is possible to copy / install all the needed files into the appropriate directories. cmd_writefstab: creates the (complete) fstab for the system. cmd_umount: unmount and detaches all directories and used many resources. After this call the used (e.g.) images are still available for further handling, e.g. converting from raw in some other format. cmd_cleanup: removes everything that was created with the 'cmd_create' call, i.e. all images files themselves and internal temporary configuration. cmd_delete: unmounts and removes everything that was created during the 'cmd_create' all. This call should be used in error conditions when there is the need to remove all allocated resources immediately and as good as possible. From the functional point of view this is mostly the same as a call to 'cmd_umount' and 'cmd_cleanup' - but is typically more error tolerance. In a script this should be called in the following way: dib-block-device init ... # From that point the database can be queried, like ROOT_LABEL=$(dib-block-device getval root-label) Please note that currently the dib-block-device executable can only be used outside the chroot. dib-block-device create ... trap "dib-block-device delete ..." EXIT # copy / install files dib-block-device umount ... # convert image(s) dib-block-device cleanup ... trap - EXIT """ def _merge_rootfs_params(self): """Merge rootfs related parameters into configuration To maintain compatability with some old block-device environment variables from before we had a specific block-device config, disk-image-create provides a "parameters" file that translates the old bash-environment variables into a YAML based configuration file (``self.params``). Here we merge the values in this parameters file that relate to the root file-system into the final configuration. We look for the ``mkfs_root`` node in the new config, and pull the relevant settings from the parameters into it. """ for entry in self.config: for k, v in entry.items(): if k == 'mkfs': if 'name' not in v: continue if v['name'] != 'mkfs_root': continue if 'type' not in v \ and 'root-fs-type' in self.params: v['type'] = self.params['root-fs-type'] if 'opts' not in v \ and 'root-fs-opts' in self.params: v['opts'] = self.params['root-fs-opts'] if 'label' not in v \ and 'root-label' in self.params: if self.params['root-label'] is not None: v['label'] = self.params['root-label'] else: # The default label is "cloudimg-rootfs" # for historical reasons (upstream # images/EC2 defaults/cloud-init etc). We # want to remain backwards compatible, but # unfortunately that's too long for XFS so # we've decided on 'img-rootfs' in that # case. Note there's separate checks if # the label is specified explicitly. if v.get('type') == 'xfs': v['label'] = 'img-rootfs' else: v['label'] = 'cloudimg-rootfs' def __init__(self, params): """Create BlockDevice object Arguments: :param params: YAML file from --params """ logger.debug("Creating BlockDevice object") self.params = params logger.debug("Params [%s]", self.params) self.state_dir = os.path.join( self.params['build-dir'], "states/block-device") self.state_json_file_name \ = os.path.join(self.state_dir, "state.json") self.config_json_file_name \ = os.path.join(self.state_dir, "config.json") self.node_pickle_file_name \ = os.path.join(self.state_dir, "nodes.pickle") self.config = _load_json(self.config_json_file_name) # This needs to exists for the state and config files try: os.makedirs(self.state_dir) except OSError: pass def cmd_init(self): """Initialize block device setup This initializes the block device setup layer. One major task is to parse and check the configuration, write it down for later examiniation and execution. """ with open(self.params['config'], "rt") as config_fd: self.config = yaml.safe_load(config_fd) logger.debug("Config before merge [%s]", self.config) self.config = config_tree_to_graph(self.config) logger.debug("Config before merge [%s]", self.config) self._merge_rootfs_params() logger.debug("Final config [%s]", self.config) # Write the final config with open(self.config_json_file_name, "wt") as fd: json.dump(self.config, fd) logger.info("Wrote final block device config to [%s]", self.config_json_file_name) def _config_get_mount(self, path): for entry in self.config: for k, v in entry.items(): if k == 'mount' and v['mount_point'] == path: return v assert False def _config_get_all_mount_points(self): rvec = [] for entry in self.config: for k, v in entry.items(): if k == 'mount': rvec.append(v['mount_point']) return rvec def _config_get_mkfs(self, name): for entry in self.config: for k, v in entry.items(): if k == 'mkfs' and v['name'] == name: return v assert False def cmd_getval(self, symbol): """Retrieve value from block device level The value of SYMBOL is printed to stdout. This is intended to be captured into bash-variables for backward compatibility (non python) access to internal configuration. Arguments: :param symbol: the symbol to get """ logger.info("Getting value for [%s]", symbol) if symbol == "root-label": root_mount = self._config_get_mount("/") root_fs = self._config_get_mkfs(root_mount['base']) logger.debug("root-label [%s]", root_fs['label']) print("%s" % root_fs['label']) return 0 if symbol == "root-fstype": root_mount = self._config_get_mount("/") root_fs = self._config_get_mkfs(root_mount['base']) logger.debug("root-fstype [%s]", root_fs['type']) print("%s" % root_fs['type']) return 0 if symbol == 'mount-points': mount_points = self._config_get_all_mount_points() # we return the mountpoints joined by a pipe, because it is not # a valid char in directories, so it is a safe separator for the # mountpoints list print("%s" % "|".join(mount_points)) return 0 # the following symbols all come from the global state # dictionary. They can only be accessed after the state has # been dumped; i.e. after cmd_create() called. state = BlockDeviceState(self.state_json_file_name) # The path to the .raw file for conversion if symbol == 'image-path': print("%s" % state['blockdev']['image0']['image']) return 0 # This is the loopback device where the above image is setup if symbol == 'image-block-device': print("%s" % state['blockdev']['image0']['device']) return 0 # Full list of created devices by name. Some bootloaders, for # example, want to be able to see their boot partitions to # copy things in. Intended to be read into a bash array if symbol == 'image-block-devices': out = "" for k, v in state['blockdev'].items(): out += " [%s]=%s " % (k, v['device']) print(out) return 0 logger.error("Invalid symbol [%s] for getval", symbol) return 1 def cmd_writefstab(self): """Creates the fstab""" logger.info("Creating fstab") # State should have been created by prior calls; we only need # the dict state = BlockDeviceState(self.state_json_file_name) tmp_fstab = os.path.join(self.state_dir, "fstab") with open(tmp_fstab, "wt") as fstab_fd: # This gives the order in which this must be mounted for mp in state['mount_order']: logger.debug("Writing fstab entry for [%s]", mp) fs_base = state['mount'][mp]['base'] fs_name = state['mount'][mp]['name'] fs_val = state['filesys'][fs_base] if 'label' in fs_val: diskid = "LABEL=%s" % fs_val['label'] else: diskid = "UUID=%s" % fs_val['uuid'] # If there is no fstab entry - do not write anything if 'fstab' not in state: continue if fs_name not in state['fstab']: continue options = state['fstab'][fs_name]['options'] dump_freq = state['fstab'][fs_name]['dump-freq'] fsck_passno = state['fstab'][fs_name]['fsck-passno'] fstab_fd.write("%s %s %s %s %s %s\n" % (diskid, mp, fs_val['fstype'], options, dump_freq, fsck_passno)) target_etc_dir = os.path.join(self.params['build-dir'], 'built', 'etc') exec_sudo(['mkdir', '-p', target_etc_dir]) exec_sudo(['cp', tmp_fstab, os.path.join(target_etc_dir, "fstab")]) return 0 def cmd_create(self): """Creates the block device""" logger.info("create() called") logger.debug("Using config [%s]", self.config) # Create a new, empty state state = BlockDeviceState() try: dg, call_order = create_graph(self.config, self.params, state) for node in call_order: node.create() except Exception: logger.exception("Create failed; rollback initiated") reverse_order = reversed(call_order) for node in reverse_order: node.rollback() # save the state for debugging state.save_state(self.state_json_file_name) logger.error("Rollback complete, exiting") raise # dump state and nodes, in order # XXX: we only dump the call_order (i.e. nodes) not the whole # graph here, because later calls do not need the graph # at this stage. might they? state.save_state(self.state_json_file_name) pickle.dump(call_order, open(self.node_pickle_file_name, 'wb')) logger.info("create() finished") return 0 def cmd_umount(self): """Unmounts the blockdevice and cleanup resources""" # If the state is not here, cmd_cleanup removed it? Nothing # more to do? # XXX: better understand this... if not os.path.exists(self.node_pickle_file_name): logger.info("State already cleaned - no way to do anything here") return 0 call_order = pickle.load(open(self.node_pickle_file_name, 'rb')) reverse_order = reversed(call_order) for node in reverse_order: node.umount() return 0 def cmd_cleanup(self): """Cleanup all remaining relicts - in good case""" # Cleanup must be done in reverse order try: call_order = pickle.load(open(self.node_pickle_file_name, 'rb')) except IOError: raise BlockDeviceSetupException("Pickle file not found") reverse_order = reversed(call_order) for node in reverse_order: node.cleanup() logger.info("Removing temporary state dir [%s]", self.state_dir) shutil.rmtree(self.state_dir) return 0 def cmd_delete(self): """Cleanup all remaining relicts - in case of an error""" # Deleting must be done in reverse order try: call_order = pickle.load(open(self.node_pickle_file_name, 'rb')) except IOError: raise BlockDeviceSetupException("Pickle file not found") reverse_order = reversed(call_order) for node in reverse_order: node.delete() logger.info("Removing temporary state dir [%s]", self.state_dir) shutil.rmtree(self.state_dir) return 0 diskimage-builder-2.35.0/diskimage_builder/block_device/plugin.py0000664000175000017500000001475113640271474025150 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc import logging import six # # Plugins convert configuration entries into graph nodes ready for # processing. This defines the abstract classes for both. # logger = logging.getLogger(__name__) @six.add_metaclass(abc.ABCMeta) class NodeBase(object): """A configuration node entry This is the main driver class for dib-block-device operation. The final operations graph is composed of instantiations of this class. The graph undergoes a topological sort (i.e. is linearised in dependency order) and each node has :func:`create` called in order to perform its operations. Every node has a unique string ``name``. This is its key in the graph and used for edge relationships. Implementations must ensure they initalize it; e.g. .. code-block:: python class FooNode(NodeBase): def __init__(name, arg1, ...): super(FooNode, self).__init__(name) """ def __init__(self, name, state): self.name = name self.state = state self.rollbacks = [] def get_name(self): return self.name def add_rollback(self, func, *args, **kwargs): """Add a call for rollback Functions registered with this method will be called in reverse-order in the case of failures during :func:`Nodebase.create`. :param func: function to call :param args: arguments :param kwargs: keyword arguments :return: None """ self.rollbacks.append((func, args, kwargs)) def rollback(self): """Initiate rollback Call registered rollback in reverse order. This method is called by the driver in the case of failures during :func:`Nodebase.create`. :return None: """ # XXX: maybe ignore SystemExit so we always continue? logger.debug("Calling rollback for %s", self.name) for func, args, kwargs in reversed(self.rollbacks): func(*args, **kwargs) @abc.abstractmethod def get_edges(self): """Return the dependencies/edges for this node This function will be called after all nodes are created (this is because some plugins need to know the global state of all nodes to decide their dependencies). This function returns a tuple with two lists * ``edges_from`` : a list of node names that point to us * ``edges_to`` : a list of node names we point to In most cases, node creation will have saved a single parent that was given in the ``base`` parameter of the configuration. A usual return might look like: .. code-block:: python def get_edges(self): return ( [self.base], [] ) Some nodes (``level0``) don't have a base, however """ return @abc.abstractmethod def create(self): """Main creation driver This is the main driver function. After the graph is linearised, each node has it's :func:`create` function called. :raises Exception: A failure should raise an exception. This will initiate a rollback. See :func:`Nodebase.add_rollback`. :return: None """ return def umount(self): """Umount actions Actions to taken when ``dib-block-device umount`` is called. The nodes are called in the reverse order to :func:`create` :return: None """ return def cleanup(self): """Cleanup actions Actions to taken when ``dib-block-device cleanup`` is called. This is the cleanup path in the *success* case. The nodes are called in the reverse order to :func:`create` :return: None """ return def delete(self): """Cleanup actions Actions to taken when ``dib-block-device delete`` is called. This is the cleanup path in case of a reported external *failure*. The nodes are called in the reverse order to :func:`create` :return: None """ return @six.add_metaclass(abc.ABCMeta) class PluginBase(object): """The base plugin object This is the base plugin object. Plugins are an instantiation of this class. There should be an entry-point (see setup.cfg) defined under ``diskimage_builder.block_device.plugin`` for each plugin, e.g. foo = diskimage_builder.block_device.levelX.foo:Foo A configuration entry in the graph config that matches this entry point will create an instance of this class, e.g. .. code-block:: yaml foo: name: foo_node base: parent_node argument_a: bar argument_b: baz The ``__init__`` function will be passed three arguments: ``config`` The full configuration dictionary for the entry. A unique ``name`` entry can be assumed. In most cases a ``base`` entry will be present giving the parent node (see :func:`NodeBase.get_edges`). ``state`` A reference to the gobal state dictionary. This should be passed to :func:`NodeBase.__init__` on node creation ``defaults`` The global defaults dictionary (see ``--params``) ``get_nodes()`` should return the node object(s) created by the config for insertion into the final configuration graph. In the simplest case, this is probably a single node created during instantiation. e.g. .. code-block:: python class Foo(PluginBase): def __init__(self, config, defaults, state): super(Foo, self).__init__() self.node = FooNode(config.name, state, ...) def get_nodes(self): return [self.node] Some plugins require more, however. """ def __init__(self): pass @abc.abstractmethod def get_nodes(self): """Return nodes created by the plugin :returns: a list of :class:`.NodeBase` objects for insertion into the graph """ return diskimage-builder-2.35.0/diskimage_builder/logging_config.py0000664000175000017500000000622513640271474024211 0ustar zuulzuul00000000000000# Copyright 2016 Andreas Florath (andreas@florath.net) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # Python Logging Configuration for DIB # Usage: # In the main (application) file, do an # import logging_config # ... # logging_config.setup() # It is then possible to use the normal python logging interface, like # logger = logging.getLogger(__name__) # logger.info("Info Message") import json import logging import logging.config import os import sys # A simple formatter to more or less copy oslo.log's ContextFormatter class DibFormatter(logging.Formatter): def __init__(self, *args, **kwargs): self.fmt = kwargs['fmt'] self.debug_suffix = kwargs.pop('debug_suffix') logging.Formatter.__init__(self, *args, **kwargs) def format(self, record): if record.levelno == logging.DEBUG: fmt = self.fmt + self.debug_suffix else: fmt = self.fmt if sys.version_info < (3, 2): self._fmt = fmt else: self._style = logging.PercentStyle(fmt) self._fmt = self._style._fmt return logging.Formatter.format(self, record) def setup(): # Check for the DIB_DEBUG_TRACE environment variable # If it is set to something greater then 0, use debug # logging. LOG_LEVEL = "DEBUG" if 'DIB_DEBUG_TRACE' in os.environ \ and int(os.environ['DIB_DEBUG_TRACE']) > 0 else "INFO" # Default logging configuration which can be overwritten # by a config file passed in by a user. PYTHON_LOGGING_CONFIG = { 'version': 1, 'disable_existing_loggers': False, # note that disk-image-create runs stdout through # outfilter.py, which adds the timestamp. this doesn't have a # timestamp to avoid double logging 'formatters': { 'standard': { '()': 'diskimage_builder.logging_config.DibFormatter', 'fmt': '%(levelname)s ' '%(name)s [-] %(message)s', 'debug_suffix': ' %(funcName)s %(pathname)s:%(lineno)d' } }, 'handlers': { 'default': { 'level': LOG_LEVEL, 'class': 'logging.StreamHandler', 'formatter': 'standard', } }, 'loggers': { '': { 'handlers': ['default'], 'level': LOG_LEVEL, 'propagate': True } } } if 'DIB_PYTHON_LOGGING_CONFIG_FILE' in os.environ: with open(os.environ['DIB_PYTHON_LOGGING_CONFIG_FILE']) as fd: PYTHON_LOGGING_CONFIG = json.load(fd) logging.config.dictConfig(PYTHON_LOGGING_CONFIG) diskimage-builder-2.35.0/diskimage_builder/element_dependencies.py0000664000175000017500000002744713640271474025406 0ustar zuulzuul00000000000000# Copyright 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from __future__ import print_function import argparse import collections import errno import logging import os import sys import yaml import diskimage_builder.logging_config logger = logging.getLogger(__name__) class MissingElementException(Exception): pass class AlreadyProvidedException(Exception): pass class MissingOSException(Exception): pass class InvalidElementDir(Exception): pass class Element(object): """An element""" def _get_element_set(self, path): """Get element set from element-[deps|provides] file Arguments: :param path: path to element description :return: the set of elements in the file, or a blank set if the file is not found. """ try: with open(path) as f: lines = (line.strip() for line in f) # Strip blanks, but do we want to strip comment lines # too? No use case at the moment, and comments might # break other things that poke at the element-* files. lines = (line for line in lines if line) return set(lines) except IOError as e: if e.errno == errno.ENOENT: return set([]) else: raise def _make_rdeps(self, all_elements): """Make a list of reverse dependencies (who depends on us). Only valid after _find_all_elements() Arguments: :param all_elements: dict as returned by _find_all_elements() :return: nothing, but elements will have r_depends var """ # note; deliberatly left out of __init__ so that accidental # access without init raises error self.r_depends = [] for name, element in all_elements.items(): if self.name in element.depends: self.r_depends.append(element.name) def __init__(self, name, path): """A new element :param name: The element name :param path: Full path to element. element-deps and element-provides files will be parsed """ self.name = name self.path = path # read the provides & depends files for this element into a # set; if the element has them. self.provides = self._get_element_set( os.path.join(path, 'element-provides')) self.depends = self._get_element_set( os.path.join(path, 'element-deps')) # Uncomment to see all elements and deps listed as they're found # logger.debug("New element : %s", str(self)) def __eq__(self, other): return self.name == other.name def __repr__(self): return self.name def __str__(self): return '%s p:<%s> d:<%s>' % (self.name, ','.join(self.provides), ','.join(self.depends)) def _get_elements_dir(): if not os.environ.get('ELEMENTS_PATH'): raise Exception("$ELEMENTS_PATH must be set.") return os.environ['ELEMENTS_PATH'] def _expand_element_dependencies(user_elements, all_elements): """Expand user requested elements using element-deps files. Arguments: :param user_elements: iterable enumerating the elements a user requested :param all_elements: Element object dictionary from find_all_elements :return: a set containing the names of user_elements and all dependent elements including any transitive dependencies. """ final_elements = set(user_elements) check_queue = collections.deque(user_elements) provided = set() provided_by = collections.defaultdict(list) while check_queue: # bug #1303911 - run through the provided elements first to avoid # adding unwanted dependencies and looking for virtual elements element = check_queue.popleft() if element in provided: continue elif element not in all_elements: raise MissingElementException("Element '%s' not found" % element) element_obj = all_elements[element] element_deps = element_obj.depends element_provides = element_obj.provides # Check that we are not providing an element which has already # been provided by someone else, and additionally save which # elements provide another element for provide in element_provides: if provide in provided: raise AlreadyProvidedException( "%s: already provided by %s" % (provide, provided_by[provide])) provided_by[provide].append(element) provided.update(element_provides) check_queue.extend(element_deps - (final_elements | provided)) final_elements.update(element_deps) conflicts = set(user_elements) & provided if conflicts: logger.error( "The following elements are already provided by another element") for element in conflicts: logger.error("%s : already provided by %s", element, provided_by[element]) raise AlreadyProvidedException() if "operating-system" not in provided: raise MissingOSException("Please include an operating system element") out = final_elements - provided return([all_elements[element] for element in out]) def _find_all_elements(paths=None): """Build a dictionary Element() objects Walk ELEMENTS_PATH and find all elements. Make an Element object for each element we wish to consider. Note we process overrides such that elements specified earlier in the ELEMENTS_PATH override those seen later. :param paths: A list of paths to find elements in. If None will use ELEMENTS_PATH from environment :return: a dictionary of all elements """ all_elements = {} # note we process the later entries *first*, so that earlier # entries will override later ones. i.e. with # ELEMENTS_PATH=path1:path2:path3 # we want the elements in "path1" to override "path3" if not paths: paths = list(reversed(_get_elements_dir().split(':'))) else: paths = list(reversed(paths.split(':'))) logger.debug("ELEMENTS_PATH is: %s", ":".join(paths)) for path in paths: if not os.path.isdir(path): raise InvalidElementDir("ELEMENTS_PATH entry '%s' " "is not a directory " % path) # In words : make a list of directories in "path". Since an # element is a directory, this is our list of elements. elements = [os.path.realpath(os.path.join(path, f)) for f in os.listdir(path) if os.path.isdir(os.path.join(path, f))] for element in elements: # the element name is the last part of the full path in # element (these are all directories, we know that from # above) name = os.path.basename(element) new_element = Element(name, element) if name in all_elements: logger.warning("Element <%s> overrides <%s>", new_element.path, all_elements[name].path) all_elements[name] = new_element # Now we have all the elements, make a call on each element to # store it's reverse dependencies for name, element in all_elements.items(): element._make_rdeps(all_elements) return all_elements def _get_elements(elements, paths=None): """Return the canonical list of Element objects This function returns Element objects. For exernal calls, use get_elements which returns a simple tuple & list. :param elements: user specified list of elements :param paths: element paths, default to environment """ all_elements = _find_all_elements(paths) return _expand_element_dependencies(elements, all_elements) def get_elements(elements, paths=None): """Return the canonical list of elements with their dependencies .. note:: You probably do not want to use this! Elements that require access to the list of all other elements should generally use the environment variables exported by disk-image-create below. :param elements: user specified elements :param paths: Alternative ELEMENTS_PATH; default is to use from env :return: A de-duplicated list of tuples [(element, path), (element, path) ...] with all elements and their dependents, including any transitive dependencies. """ elements = _get_elements(elements, paths) return [(element.name, element.path) for element in elements] def expand_dependencies(user_elements, element_dirs): """Deprecated method for expanding element dependencies. .. warning:: DO NOT USE THIS FUNCTION. For compatibility reasons, this function does not provide paths to the returned elements. This means the caller must process override rules if two elements with the same name appear in element_dirs :param user_elements: iterable enumerating the elements a user requested :param element_dirs: The ELEMENTS_PATH to process :return: a set containing user_elements and all dependent elements including any transitive dependencies. """ logger.warning("expand_dependencies() deprecated, use get_elements") elements = _get_elements(user_elements, element_dirs) return set([element.name for element in elements]) def _output_env_vars(elements): """Output eval-able bash strings for IMAGE_ELEMENT vars :param elements: list of Element objects to represent """ # first the "legacy" environment variable that just lists the # elements print("export IMAGE_ELEMENT='%s'" % ' '.join([element.name for element in elements])) # Then YAML output = {} for element in elements: output[element.name] = element.path print("export IMAGE_ELEMENT_YAML='%s'" % yaml.safe_dump(output)) # Then bash array. Unfortunately, bash can't export array # variables. So we take a compromise and produce an exported # function that outputs the string to re-create the array. # You can then simply do # eval declare -A element_array=$(get_image_element_array) # and you have it. output = "" for element in elements: output += '[%s]=%s ' % (element.name, element.path) print("function get_image_element_array {\n" " echo \"%s\"\n" "};\n" "export -f get_image_element_array;" % output) def main(): diskimage_builder.logging_config.setup() parser = argparse.ArgumentParser() parser.add_argument('elements', nargs='+', help='display dependencies of the given elements') parser.add_argument('--env', '-e', action='store_true', default=False, help=('Output eval-able bash strings for ' 'IMAGE_ELEMENT variables')) args = parser.parse_args(sys.argv[1:]) elements = _get_elements(args.elements) if args.env: _output_env_vars(elements) else: # deprecated compatibility output; doesn't include paths. print(' '.join([element.name for element in elements])) return 0 if __name__ == "__main__": main() diskimage-builder-2.35.0/diskimage_builder/elements/0000775000175000017500000000000013640271564022473 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init/0000775000175000017500000000000013640271564024542 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init/post-install.d/0000775000175000017500000000000013640271564027415 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016000000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init/post-install.d/21-cloud-init-allow-password-authdiskimage-builder-2.35.0/diskimage_builder/elements/cloud-init/post-install.d/21-cloud-init-allow-pa0000775000175000017500000000142213640271474033343 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # Set cloud-init to allow password authentication if [ -n "${DIB_CLOUD_INIT_ALLOW_SSH_PWAUTH:-}" ]; then if [ -f "/etc/cloud/cloud.cfg" ]; then if [ -z "$(cat /etc/cloud/cloud.cfg | grep ssh_pwauth)" ]; then echo "ssh_pwauth not exist. append to EOF" sudo sh -c 'echo "ssh_pwauth: 1" >> /etc/cloud/cloud.cfg' else echo "ssh_pwauth exist. make sure ssh_pwauth enabled" sed -i -e 's/ssh_pwauth: *0/ssh_pwauth: 1/g' /etc/cloud/cloud.cfg sed -i -e 's/ssh_pwauth: *False/ssh_pwauth: True/g' /etc/cloud/cloud.cfg sed -i -e 's/ssh_pwauth: *false/ssh_pwauth: true/g' /etc/cloud/cloud.cfg fi fi fi diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init/post-install.d/20-enable-cloud-init0000775000175000017500000000045713640271474033063 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # gentoo if [[ "${DISTRO_NAME}" == "gentoo" ]]; then rc-update add cloud-config default rc-update add cloud-final default rc-update add cloud-init-local boot rc-update add cloud-init default fi diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init/package-installs.yaml0000664000175000017500000000001413640271474030643 0ustar zuulzuul00000000000000cloud-init: diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init/README.rst0000664000175000017500000000061213640271474026230 0ustar zuulzuul00000000000000========== cloud-init ========== Install's and enables cloud-init for systems that don't come with it pre-installed Currently only supports Gentoo. Environment Variables --------------------- DIB_CLOUD_INIT_ALLOW_SSH_PWAUTH :Required: No :Default: password authentication disabled when cloud-init installed :Description: customize cloud-init to allow ssh password authentication. diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init/element-deps0000664000175000017500000000002113640271474027040 0ustar zuulzuul00000000000000package-installs diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init/pkg-map0000664000175000017500000000013313640271474026016 0ustar zuulzuul00000000000000{ "family": { "gentoo": { "cloud-init": "app-emulation/cloud-init" } } } diskimage-builder-2.35.0/diskimage_builder/elements/install-static/0000775000175000017500000000000013640271564025426 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/install-static/package-installs.yaml0000664000175000017500000000000713640271474031531 0ustar zuulzuul00000000000000rsync: diskimage-builder-2.35.0/diskimage_builder/elements/install-static/install.d/0000775000175000017500000000000013640271564027316 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/install-static/install.d/10-install-static-files0000775000175000017500000000064613640271474033523 0ustar zuulzuul00000000000000#!/bin/bash # Note that this relies on the detail that all elements share one dir inside # the chroot. This will copy all the files that elements have added to # element/static into the image. Mode, symlinks etc will be respected. if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail STATIC_SOURCE="$(dirname $0)/../static" [ -d "${STATIC_SOURCE}" ] || exit 0 rsync -lCr "${STATIC_SOURCE}"/ / diskimage-builder-2.35.0/diskimage_builder/elements/install-static/README.rst0000664000175000017500000000053613640271474027121 0ustar zuulzuul00000000000000============== install-static ============== Copy static files into the built image. The contents of any ``static/`` subdirs of elements will be installed into these images at build time using ``rsync -lCr``. So to install a file ``/etc/boo``, include ``static/etc/boo`` in your element. Note: This installs all files with owner and group of root. diskimage-builder-2.35.0/diskimage_builder/elements/install-static/element-deps0000664000175000017500000000002113640271474027724 0ustar zuulzuul00000000000000package-installs diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/0000775000175000017500000000000013640271564025052 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/extra-data.d/0000775000175000017500000000000013640271564027326 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/extra-data.d/15-ssl-ca-copy0000775000175000017500000000027713640271474031637 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ -n "${DIB_IPA_CERT:=}" ]; then cp $DIB_IPA_CERT $TMP_HOOKS_PATH/ipa-trusted-cert.pem fi diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/post-install.d/0000775000175000017500000000000013640271564027725 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/post-install.d/80-ironic-agent0000775000175000017500000000154713640271474032466 0ustar zuulzuul00000000000000#!/bin/bash if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail install-packages -e cloud-init rm -rf /tmp/ironic-python-agent case "$DIB_INIT_SYSTEM" in upstart) if [ -f /etc/init/ufw.conf ]; then mv /etc/init/ufw.conf /etc/init/ufw.conf.disabled fi if [ -f /etc/init/tgt.conf ]; then mv /etc/init/tgt.conf /etc/init/tgt.conf.disabled fi ;; systemd) if [[ $(systemctl --no-pager list-unit-files iptables) =~ 'enabled' ]]; then systemctl disable iptables.service fi systemctl enable $(svc-map ironic-python-agent).service systemctl enable ironic-agent-create-rescue-user.path ;; sysv) update-rc.d iptables disable ;; *) echo "Unsupported init system" exit 1 ;; esac diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/cleanup.d/0000775000175000017500000000000013640271564026723 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/cleanup.d/99-ramdisk-create0000775000175000017500000000353213640271474032006 0ustar zuulzuul00000000000000#!/bin/bash # dib-lint: disable=safe_sudo if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail [ -n "$TARGET_ROOT" ] USER=${USER:-$(whoami)} source $_LIB/img-functions IMAGE_PATH=$(readlink -f $IMAGE_NAME) cd $TARGET_ROOT DIB_IPA_COMPRESS_CMD="${DIB_IPA_COMPRESS_CMD:-gzip}" echo "#disabled" > ./tmp/fstab.new sudo mv ./tmp/fstab.new ./etc/fstab sudo ln -s ./sbin/init ./ # Note: The pci.ids, which is used by lshw, locate on Ubuntu # in /usr/share/misc. Therefore we are removing only the # ./usr/share/misc/m* (will remove the magic and magic.mgc files). # on RHEL pci.ids is locate on /usr/share/hwdata/pci.ids. sudo find . -xdev \ -path './sys/*' -prune -o \ -path './tmp/*' -prune -o \ -path './boot/*' -prune -o \ -path './root/.cache' -prune -o \ -path './usr/include/*' -prune -o \ -path './usr/lib/locale/*' -prune -o \ -path './usr/share/doc/*' -prune -o \ -path './usr/share/man/*' -prune -o \ -path './usr/share/info/*' -prune -o \ -path './usr/share/licenses/*' -prune -o \ -path './usr/share/misc/m*' -prune -o \ -path './usr/src/kernels/*' -prune -o \ -path './var/cache/*' -prune -o \ -name '*.pyc' -prune -o \ -name '*.pyo' -prune -o \ -print | sudo cpio -o -H newc | ${DIB_IPA_COMPRESS_CMD} > ${IMAGE_PATH}.initramfs select_boot_kernel_initrd $TARGET_ROOT sudo cp $BOOTDIR/$KERNEL ${IMAGE_PATH}.kernel sudo chown $USER: ${IMAGE_PATH}.kernel # TODO(lucasagomes): Create a hard link for the .vmlinuz file to keep # it backward compatible. Remove it after it has been consistent and # documented in both places for at least one full OpenStack release cycle echo "WARNING: The kernel extension .vmlinuz has been deprecated. Please rely on the file with the extension .kernel instead." sudo rm -f ${IMAGE_PATH}.vmlinuz ln ${IMAGE_PATH}.kernel ${IMAGE_PATH}.vmlinuz diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/svc-map0000664000175000017500000000020313640271474026336 0ustar zuulzuul00000000000000ironic-python-agent: default: openstack-ironic-python-agent redhat: openstack-ironic-python-agent debian: ironic-python-agentdiskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/test-elements/0000775000175000017500000000000013640271564027643 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/test-elements/build-succeeds-fedora/diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/test-elements/build-succeeds-fedora0000775000175000017500000000000013640271564033715 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016200000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/test-elements/build-succeeds-fedora/element-depsdiskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/test-elements/build-succeeds-fedora0000664000175000017500000000004413640271474033715 0ustar zuulzuul00000000000000fedora-minimal openstack-ci-mirrors ././@LongLink0000000000000000000000000000016200000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/test-elements/build-succeeds-fedora/element-typediskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/test-elements/build-succeeds-fedora0000664000175000017500000000001013640271474033706 0ustar zuulzuul00000000000000ramdisk diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/package-installs.yaml0000664000175000017500000000060613640271474031162 0ustar zuulzuul00000000000000tgt: curl: # dmidecode does not exist for ppc* arches so we use lshw dmidecode: not-arch: ppc64,ppc64el,ppc64le iptables: lshw: ipmitool: qemu-utils: gcc: python-dev: parted: hdparm: util-linux: genisoimage: gdisk: kmod: psmisc: dosfstools: mdadm: # efibootmgr and efivar do not exist for ppc* efibootmgr: not-arch: ppc64,ppc64el,ppc64le efivar: not-arch: ppc64,ppc64el,ppc64le diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/install.d/0000775000175000017500000000000013640271564026742 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/install.d/ironic-agent-source-install/diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/install.d/ironic-agent-source-insta0000775000175000017500000000000013640271564033654 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000020300000000000011210 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.servicediskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/install.d/ironic-agent-source-insta0000664000175000017500000000034113640271474033654 0ustar zuulzuul00000000000000[Unit] Description=Ironic Python Agent After=network-online.target [Service] ExecStartPre=/sbin/modprobe vfat ExecStart=/usr/local/bin/ironic-python-agent Restart=always RestartSec=30s [Install] WantedBy=multi-user.target ././@LongLink0000000000000000000000000000017700000000000011222 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/install.d/ironic-agent-source-install/60-ironic-agent-installdiskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/install.d/ironic-agent-source-insta0000775000175000017500000000324413640271474033664 0ustar zuulzuul00000000000000#!/bin/bash if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail SCRIPTDIR=$(dirname $0) IPADIR=/usr/share/ironic-python-agent # Generate upper-constraints $IPADIR/imagebuild/common/generate_upper_constraints.sh $IPADIR/upper-constraints.txt # create the virtual environment virtualenv $IPADIR/venv # pip might be an older version which does not support the -c option, therefore upgrade first $IPADIR/venv/bin/pip install pip --upgrade # install IPA inside the virtual environment $IPADIR/venv/bin/pip install -c $IPADIR/upper-constraints.txt $IPADIR # FIXME(lucasagomes): Figure out how we can use the "--install-option" # parameter for pip install so we don't have to manually create a symlink # create the launcher link so services can use it ln -s $IPADIR/venv/bin/ironic-python-agent /usr/local/bin/ironic-python-agent case "$DIB_INIT_SYSTEM" in upstart) install -D -g root -o root -m 0755 ${SCRIPTDIR}/ironic-python-agent.conf /etc/init/ironic-python-agent.conf ;; systemd) install -D -g root -o root -m 0755 ${SCRIPTDIR}/ironic-python-agent.service /usr/lib/systemd/system/ironic-python-agent.service ;; sysv) install -D -g root -o root -m 0755 ${SCRIPTDIR}/ironic-python-agent.init /etc/init.d/ironic-python-agent.init update-rc.d ironic-python-agent.init defaults ;; *) echo "Unsupported init system" exit 1 ;; esac # Copying the self signed certificate for request library if [ -f /tmp/in_target.d/ipa-trusted-cert.pem ]; then cat /tmp/in_target.d/ipa-trusted-cert.pem >> $($IPADIR/venv/bin/python -c "import requests; print requests.certs.where()") fi ././@LongLink0000000000000000000000000000020000000000000011205 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.initdiskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/install.d/ironic-agent-source-insta0000775000175000017500000000117413640271474033664 0ustar zuulzuul00000000000000#!/bin/sh -e ### BEGIN INIT INFO # Provides: ironic-python-agent # Required-Start: $local_fs networking # Required-Stop: $local_fs # Default-Start: S # Default-Stop: 0 6 # X-Start-Before: # Short-Description: Ironic Python Agent # Description: Starts Ironic Python Agent for instance deployment ### END INIT INFO NAME=ironic-python-agent INIT_NAME=/etc/init.d/${NAME} SCRIPT_NAME=/usr/local/bin/${NAME} [ -x $SCRIPT_NAME ] || exit 0 case "$1" in start) $SCRIPT_NAME ;; stop) ;; *) echo "Usage: $INIT_NAME {start|stop}" exit 1 ;; esac exit 0 ././@LongLink0000000000000000000000000000020000000000000011205 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.confdiskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/install.d/ironic-agent-source-insta0000664000175000017500000000060013640271474033652 0ustar zuulzuul00000000000000# ironic-python-agent - OpenStack Ironic Python Agent # # The ironic-python-agent helps ironic in deploying instances. description "Ironic Python Agnet" start on runlevel [2345] stop on runlevel [!2345] respawn respawn limit 10 5 umask 022 expect stop console output pre-start script echo Starting Ironic Python Agent end script exec /usr/local/bin/ironic-python-agent ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/install.d/ironic-agent-package-install/diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/install.d/ironic-agent-package-inst0000775000175000017500000000000013640271564033606 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000020600000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/install.d/ironic-agent-package-install/package-installs-ironic-agentdiskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/install.d/ironic-agent-package-inst0000664000175000017500000000002413640271474033604 0ustar zuulzuul00000000000000ironic-python-agent diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/README.rst0000664000175000017500000000434713640271474026551 0ustar zuulzuul00000000000000============ ironic-agent ============ warning:: This element is deprecated and copied to ironic-python-agent-builder and can be found at: https://opendev.org/openstack/ironic-python-agent-builder/src/branch/master/dib/ironic-python-agent-ramdisk The ramdisk can be build from the ironic-python-agent-builder and the "ironic-element" in diskimage-builder is deprecated. Builds a ramdisk with ironic-python-agent. More information can be found at: https://opendev.org/openstack/ironic-python-agent/ Beyond installing the ironic-python-agent, this element does the following: * Installs the ``dhcp-all-interfaces`` so the node, upon booting, attempts to obtain an IP address on all available network interfaces. * Disables the ``iptables`` service on SysV and systemd based systems. * Disables the ``ufw`` service on Upstart based systems. * Installs packages required for the operation of the ironic-python-agent:: ``qemu-utils`` ``parted`` ``hdparm`` ``util-linux`` ``genisoimage`` * When installing from source, ``python-dev`` and ``gcc`` are also installed in order to support source based installation of ironic-python-agent and its dependencies. * Install the certificate if any, which is set to the environment variable ``DIB_IPA_CERT`` for validating the authenticity by ironic-python-agent. The certificate can be self-signed certificate or CA certificate. * Compresses initramfs with command specified in environment variable ``DIB_IPA_COMPRESS_CMD``, which is 'gzip' by default. This command should listen for raw data from stdin and write compressed data to stdout. Command can be with arguments. This element outputs three files: - ``$IMAGE-NAME.initramfs``: The deploy ramdisk file containing the ironic-python-agent (IPA) service. - ``$IMAGE-NAME.kernel``: The kernel binary file. - ``$IMAGE-NAME.vmlinuz``: A hard link pointing to the ``$IMAGE-NAME.kernel`` file; this is just a backward compatibility layer, please do not rely on this file. .. note:: The package based install currently only enables the service when using the systemd init system. This can easily be changed if there is an agent package which includes upstart or sysv packaging. .. note:: Using the ramdisk will require at least 1.5GB of ram diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/element-provides0000664000175000017500000000002413640271474030253 0ustar zuulzuul00000000000000ironic-python-agent diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/element-deps0000664000175000017500000000024013640271474027353 0ustar zuulzuul00000000000000dhcp-all-interfaces ibft-interfaces install-static no-final-image package-installs pip-and-virtualenv pkg-map runtime-ssh-host-keys source-repositories svc-map diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/source-repository-ironic-agent0000664000175000017500000000014213640271474033064 0ustar zuulzuul00000000000000ironic-agent git /usr/share/ironic-python-agent https://opendev.org/openstack/ironic-python-agent diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/environment.d/0000775000175000017500000000000013640271564027640 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/environment.d/01-ironic-agent.sh0000664000175000017500000000046713640271474033000 0ustar zuulzuul00000000000000# backwards compatibility with the previous environment # variable for the ironic-agent source repository if [ -n "${DIB_REPOREF_agent:-}" ]; then echo "WARNING: DIB_REPOREF_agent is deprecated. Please update to use DIB_REPOREF_ironic_agent instead." export DIB_REPOREF_ironic_agent=${DIB_REPOREF_agent} fi diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/pkg-map0000664000175000017500000000170613640271474026335 0ustar zuulzuul00000000000000{ "release": { "rhel": { "8": { "tgt": "target-restore", "curl": "curl", "ironic-python-agent": "openstack-ironic-python-agent", "qemu-utils": "qemu-img", "python-dev": "python3-devel" } }, "centos": { "8": { "tgt": "target-restore", "curl": "curl", "ironic-python-agent": "openstack-ironic-python-agent", "qemu-utils": "qemu-img", "python-dev": "python3-devel" } } }, "family": { "redhat": { "tgt": "scsi-target-utils", "curl": "curl", "ironic-python-agent": "openstack-ironic-python-agent", "qemu-utils": "qemu-img", "python-dev": "python2-devel" }, "debian": { "tgt": "tgt", "curl": "curl" } }, "default": { "tgt": "tgt", "curl": "curl", "ironic-python-agent": "openstack-ironic-python-agent", "qemu-utils": "qemu-utils", "python-dev": "python-dev" } } diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/finalise.d/0000775000175000017500000000000013640271564027066 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/finalise.d/99-remove-extra-packages0000775000175000017500000000136313640271474033450 0ustar zuulzuul00000000000000#!/bin/bash if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail # TODO(lucasagomes): optimize the ramdisk for other OSs if [ $DISTRO_NAME = 'fedora' ] ; then _remove_yum='' if [ $DIB_RELEASE -ge 22 ]; then # if we are on F22, we can remove yum if there, because it has # been superseeded by dnf _remove_yum='yum' fi install-packages -e kernel-debug-devel gcc fedora-logos \ rsync pykickstart \ genisoimage tcpdump \ man-db kbd-misc \ plymouth cronie ${_remove_yum} ${YUM:-yum} clean all # Rebuilding the rpm database after removing packages will reduce # its size rpm --rebuilddb fi diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/static/0000775000175000017500000000000013640271564026341 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/static/etc/0000775000175000017500000000000013640271564027114 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/static/etc/systemd/0000775000175000017500000000000013640271564030604 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/static/etc/systemd/system/0000775000175000017500000000000013640271564032130 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000020000000000000011205 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/static/etc/systemd/system/ironic-agent-create-rescue-user.pathdiskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/static/etc/systemd/system/ironic-ag0000664000175000017500000000024213640271474033721 0ustar zuulzuul00000000000000[Unit] Description=Ironic user rescue - notify path existence [Path] PathExists=/etc/ipa-rescue-config/ipa-rescue-password [Install] WantedBy=multi-user.target ././@LongLink0000000000000000000000000000020300000000000011210 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/static/etc/systemd/system/ironic-agent-create-rescue-user.servicediskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/static/etc/systemd/system/ironic-ag0000664000175000017500000000032413640271474033722 0ustar zuulzuul00000000000000[Unit] Description=Ironic agent rescue user creation [Service] ExecStart=/bin/bash /usr/local/bin/ironic-python-agent-create-rescue-user.sh Type=oneshot RemainAfterExit=yes [Install] WantedBy=multi-user.target diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/static/usr/0000775000175000017500000000000013640271564027152 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/static/usr/local/0000775000175000017500000000000013640271564030244 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/static/usr/local/bin/0000775000175000017500000000000013640271564031014 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000020000000000000011205 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/static/usr/local/bin/ironic-python-agent-create-rescue-user.shdiskimage-builder-2.35.0/diskimage_builder/elements/ironic-agent/static/usr/local/bin/ironic-python-0000775000175000017500000000046713640271474033630 0ustar zuulzuul00000000000000#!/bin/bash if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail echo "Adding rescue user with root privileges..." crypted_pass=$( /etc/sudoers.d/rescue diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/0000775000175000017500000000000013640271564026675 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/post-install.d/0000775000175000017500000000000013640271564031550 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/post-install.d/80-ssh-keygendiskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/post-install.d/80-ssh-keyg0000775000175000017500000000144113640271474033455 0ustar zuulzuul00000000000000#!/bin/bash if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail case "$DIB_INIT_SYSTEM" in upstart) # nothing to do exit 0 ;; systemd) if [[ $DISTRO_NAME = "ubuntu" || $DISTRO_NAME = "debian" ]]; then # NOTE(pabelanger): Only support ubuntu / debian today. systemctl enable ssh-keygen.service else # Since we are not enabling it, delete it. rm /usr/lib/systemd/system/ssh-keygen.service fi ;; openrc) # let dib-init-system's postinstall handle enabling init scripts exit 0 ;; sysv) # nothing to do exit 0 ;; *) echo "Unsupported init system $DIB_INIT_SYSTEM" exit 1 ;; esac diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/cleanup.d/0000775000175000017500000000000013640271564030546 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/cleanup.d/90-remove-ssh-host-keysdiskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/cleanup.d/90-remove-ssh-ho0000775000175000017500000000050013640271474033411 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # Cloud images shouldn't have ssh host keys baked # in so that they are regenerated on first boot and # are unique. if [ -d $TARGET_ROOT/etc/ssh ] ; then sudo find $TARGET_ROOT/etc/ssh -name 'ssh_host*' -type f -delete fi diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/package-installs.yaml0000664000175000017500000000002013640271474032773 0ustar zuulzuul00000000000000openssh-client: diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/README.rst0000664000175000017500000000063413640271474030367 0ustar zuulzuul00000000000000===================== runtime-ssh-host-keys ===================== An element to generate SSH host keys on first boot. Since ssh key generation is not yet common to all operating systems, we need to create a DIB element to manage this. We force the removal of the SSH host keys, then add init scripts to generate them on first boot. This element currently supports Debian and Ubuntu (both systemd and upstart). diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/element-deps0000664000175000017500000000003713640271474031202 0ustar zuulzuul00000000000000dib-init-system install-static diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/pkg-map0000664000175000017500000000026713640271474030161 0ustar zuulzuul00000000000000{ "family": { "redhat": { "openssh-client": "openssh" }, "gentoo": { "openssh-client": "" }, "suse": { "openssh-client": "openssh" } } } diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/init-scripts/0000775000175000017500000000000013640271564031325 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/init-scripts/systemd/0000775000175000017500000000000013640271564033015 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016200000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/init-scripts/systemd/ssh-keygen.servicediskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/init-scripts/systemd/ssh-k0000664000175000017500000000031113640271474033760 0ustar zuulzuul00000000000000[Unit] Description=OpenSSH Server Key Generation Before=ssh.service [Service] ExecStart=/usr/local/sbin/runtime-ssh-host-keys.sh Type=oneshot RemainAfterExit=yes [Install] WantedBy=multi-user.target diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/init-scripts/upstart/0000775000175000017500000000000013640271564033027 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/init-scripts/upstart/ssh-keygen.confdiskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/init-scripts/upstart/ssh-k0000664000175000017500000000020713640271474033776 0ustar zuulzuul00000000000000description "OpenSSH Server Key Generation" start on starting ssh console output task exec /usr/local/sbin/runtime-ssh-host-keys.sh diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/static/0000775000175000017500000000000013640271564030164 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/static/usr/0000775000175000017500000000000013640271564030775 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/static/usr/local/0000775000175000017500000000000013640271564032067 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/static/usr/local/sbin/0000775000175000017500000000000013640271564033022 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000017100000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/static/usr/local/sbin/runtime-ssh-host-keys.shdiskimage-builder-2.35.0/diskimage_builder/elements/runtime-ssh-host-keys/static/usr/local/sbin/runt0000775000175000017500000000202313640271474033735 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2016 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # dib-lint: disable=dibdebugtrace setpipefail set -exu # We are running into race conditions with glean, which ssh-keygen -A is # not handling properly. So, create a new script to first check if the # file exists, then use 'yes' to disable overwriting of existing files. for key in dsa ecdsa ed25519 rsa; do FILE=/etc/ssh/ssh_host_${key}_key if ! [ -f $FILE ]; then /usr/bin/yes n | /usr/bin/ssh-keygen -f $FILE -N '' -t $key fi done diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/0000775000175000017500000000000013640271564025715 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/extra-data.d/0000775000175000017500000000000013640271564030171 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/extra-data.d/99-squash-package-installdiskimage-builder-2.35.0/diskimage_builder/elements/package-installs/extra-data.d/99-squash-package-0000775000175000017500000000037613640271474033336 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail sudo -E $DIB_PYTHON_EXEC $(dirname $0)/../bin/package-installs-squash --elements="$IMAGE_ELEMENT" --path=$ELEMENTS_PATH $TMP_MOUNT_PATH/tmp/package-installs.json diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/bin/0000775000175000017500000000000013640271564026465 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/bin/package-installs0000775000175000017500000000301413640271474031633 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail SCRIPTNAME=$(basename $0) function show_options () { echo "Usage: $SCRIPTNAME -d " echo echo "Options:" echo " -d -- directory to search for package-installs-* files" exit 1 } TEMP=$(getopt -o hd: -n $SCRIPTNAME -- "$@") if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi eval set -- "$TEMP" WORKDIR= while true ; do case "$1" in -d) WORKDIR=$2; shift 2;; -h) show_options;; --) shift ; break ;; *) echo "Error: unsupported option $1."; exit 1;; esac done if [ -z "$WORKDIR" ]; then show_options fi PACKAGES= for PACKAGEFILE in $(find $WORKDIR -maxdepth 1 -name "package-installs-*" ); do basefile=$(basename $PACKAGEFILE) element_name=${basefile#"package-installs-"} while read pkg; do if [ -z "$pkg" ]; then continue fi # Ignore comments if [ ${pkg:0:1} = "#" ]; then continue fi if [ ${pkg:0:1} = "-" ]; then pkg=${pkg:1} fi if [ -e /usr/share/pkg-map/$element_name ]; then # map the package to its true name set +e map_pkg=$(pkg-map --element $element_name $pkg) if [ $? -eq 0 ]; then pkg=$map_pkg fi set -e fi PACKAGES="$PACKAGES $pkg" done < $PACKAGEFILE done if [ -n "$PACKAGES" ]; then install-packages $PACKAGES fi diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/bin/package-installs-v20000775000175000017500000001154113640271474032164 0ustar zuulzuul00000000000000#!/usr/local/bin/dib-python # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from __future__ import print_function import argparse import json import locale import os import subprocess import sys from collections import defaultdict # run a command, return output # if follow is set, output will be echoed to stdout def process_output(cmdline, follow=False): proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) if follow: print("Running command: %s" % cmdline) out = "" with proc.stdout: for line in iter(proc.stdout.readline, b''): line = line.decode(encoding=locale.getpreferredencoding(False), errors='backslashreplace') out += line print("> %s" % line, end="") proc.wait() print("returncode: %d" % proc.returncode) else: out = proc.communicate()[0].decode(errors='backslashreplace') if proc.returncode: e = subprocess.CalledProcessError(proc.returncode, cmdline) e.output = out raise e return out def main(): dbg_level = int(os.getenv('DIB_DEBUG_TRACE', '0')) parser = argparse.ArgumentParser( description="Install or uninstall packages for a specific phase based" " on package-installs files.") parser.add_argument('--phase', required=True, help="Install phase to filter on. Valid options are" " 'install.d' or pre-install.d") parser.add_argument('--uninstall', action="store_true", help="Only show packages to uninstall. By default only" " packages to install are shown") parser.add_argument('-n', '--noop', action="store_true", help="Don't actually install, just print the command") parser.add_argument('infile', help="File to process") args = parser.parse_args() packages = json.load(open(args.infile)) if args.uninstall: install = "uninstall" else: install = "install" pkgs = list() if args.phase in packages and install in packages[args.phase]: install_packages = packages[args.phase][install] else: print("Nothing to %s" % install) sys.exit(0) # sort the list by element, this way we only do one pkg-map call # per element by_element = defaultdict(list) for (pkg, element) in install_packages: by_element[element].append(pkg) for element, packages in by_element.items(): print("Map %s for %s: %s" % (install, element, ', '.join(packages))) # Only trace pkg-map for higher levels of debugging. Note # that pkg-map debug output comes out on stderr, which is # captured into the output by process_output. We filter by # "prefix" so we don't think the debug lines are packages! pkg_map_args = ['pkg-map', '--prefix', '-', '--missing-ok', '--element', element] if dbg_level > 1: pkg_map_args.append('--debug') pkg_map_args.extend(packages) try: follow = True if dbg_level > 1 else False map_output = process_output(pkg_map_args, follow=follow) map_output = map_output.strip().split('\n') map_output = [m[1:] for m in map_output if m.startswith('-')] pkgs.extend(map_output) except subprocess.CalledProcessError as e: if e.returncode == 1: if args.noop: pkgs.append(pkg) continue else: print("pkg-map failed") sys.exit(1) elif e.returncode == 2: pkgs.append(pkg) continue install_args = ["install-packages"] if args.uninstall: install_args.append("-e") install_args.extend(list(set(pkgs))) if args.noop: print(" ".join(install_args)) else: try: process_output(install_args, follow=True) except subprocess.CalledProcessError as e: print("install-packages failed with returncode %d" % e.returncode) sys.exit(1) if __name__ == '__main__': main() # Tell emacs to use python-mode # Local variables: # mode: python # End: diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/bin/package-installs-squash0000775000175000017500000001477113640271474033151 0ustar zuulzuul00000000000000#!/usr/bin/env python # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import argparse import collections import functools import json import logging import os import re import sys import yaml from diskimage_builder import logging_config logger = logging.getLogger(__name__) def get_element_installtype(element_name): default = os.environ.get("DIB_DEFAULT_INSTALLTYPE", "source") return os.environ.get( "DIB_INSTALLTYPE_%s" % element_name.replace('-', '_'), default) def _is_arch_in_list(strlist): """Checks if os.environ['ARCH'] is in comma separated strlist""" strlist = strlist.split(',') map(str.strip, strlist) return os.environ['ARCH'] in strlist def _valid_for_arch(pkg_name, arch, not_arch): """Filter out incorrect ARCH versions""" if arch is None and not_arch is None: # nothing specified; always OK return True if arch and not_arch: print("package-installs configuration error: arch and not_arch " "given for package [%s]" % pkg_name) sys.exit(1) # if we have an arch list, our current arch must be in it # to install. if arch: return _is_arch_in_list(arch) # if we don't have an explicit arch list, we should # install unless we are in the not-arch list. return not _is_arch_in_list(not_arch) def _when(statement): '''evaulate a when: statement Evaluate statements of the form when: ENVIRONMENT_VARIABLE[!]=value Returns True if the package should be installed, False otherwise If the ENVIRONMENT_VARIABLE is unset, raises an error ''' # No statement means install if statement is None: return True # FOO = BAR # var op val match = re.match( r"(?P[\w]+)(\s*)(?P=|!=)(\s*)(?P.*)", statement) if not match: print("Malformed when line: <%s>" % statement) sys.exit(1) match = match.groupdict() var = match['var'] op = match['op'] val = match['val'] if var not in os.environ: raise RuntimeError("The variable <%s> is not set" % var) logger.debug("when eval %s%s%s against <%s>" % (var, op, val, os.environ[var])) if op == '=': if val == os.environ[var]: return True elif op == '!=': if val != os.environ[var]: return True else: print("Malformed when op: %s" % op) sys.exit(1) return False def collect_data(data, objs, element_name): for pkg_name, params in objs.items(): if not params: params = {} phase = params.get('phase', 'install.d') installs = ["install"] if 'uninstall' in params: installs = ["uninstall"] if 'build-only' in params: installs = ["install", "uninstall"] # Filter out incorrect installtypes installtype = params.get('installtype', None) elem_installtype = get_element_installtype(element_name) valid_installtype = (installtype is None or installtype == elem_installtype) valid_arch = _valid_for_arch(pkg_name, params.get('arch', None), params.get('not-arch', None)) dib_py_version = str(params.get('dib_python_version', '')) dib_py_version_env = os.environ.get('DIB_PYTHON_VERSION', '') valid_dib_python_version = (dib_py_version == '' or dib_py_version == dib_py_version_env) # True means install, false skip if _when(params.get('when', None)) is False: logger.debug("Skipped due to when: %s/%s" % (element_name, pkg_name)) continue if valid_installtype and valid_arch and valid_dib_python_version: for install in installs: data[phase][install].append((pkg_name, element_name)) return data def main(): parser = argparse.ArgumentParser( description="Produce a single packages-installs file from all of" " the available package-installs files") parser.add_argument('--elements', required=True, help="Which elements to squash") parser.add_argument('--path', required=True, help="Elements path to search for elements") parser.add_argument('outfile', help="Location of the output file") args = parser.parse_args() logging_config.setup() # Replicate the logic of finding the first element, because we can't # operate on the post-copied hooks dir, since we lose element context element_dirs = list() for element_name in args.elements.split(): for elements_dir in args.path.split(':'): potential_path = os.path.join(elements_dir, element_name) if os.path.exists(potential_path): element_dirs.append((elements_dir, element_name)) logger.debug("element_dirs -> %s" % element_dirs) # Collect the merge of all of the existing install files in the elements # that are the first on the ELEMENT_PATH final_dict = collections.defaultdict( functools.partial(collections.defaultdict, list)) for (elements_dir, element_name) in element_dirs: for file_type in ('json', 'yaml'): target_file = os.path.join( elements_dir, element_name, "package-installs.%s" % file_type) if not os.path.exists(target_file): continue logger.info("Squashing install file: %s" % target_file) try: objs = json.load(open(target_file)) except ValueError: objs = yaml.safe_load(open(target_file)) final_dict = collect_data(final_dict, objs, element_name) logger.debug("final_dict -> %s" % final_dict) # Write the resulting file with open(args.outfile, 'w') as outfile: json.dump( final_dict, outfile, indent=True, separators=(',', ': '), sort_keys=False) if __name__ == '__main__': main() diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/bin/package-uninstalls0000775000175000017500000000261113640271474032200 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail SCRIPTNAME=$(basename $0) function show_options () { echo "Usage: $SCRIPTNAME -d " echo echo "Options:" echo " -d -- directory to search for package-uninstalls-* files" exit 1 } TEMP=$(getopt -o hd: -n $SCRIPTNAME -- "$@") if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi eval set -- "$TEMP" WORKDIR= while true ; do case "$1" in -d) WORKDIR=$2; shift 2;; -h) show_options;; --) shift ; break ;; *) echo "Error: unsupported option $1."; exit 1;; esac done if [ -z "$WORKDIR" ]; then show_options fi PACKAGES= for PACKAGEFILE in $(find $WORKDIR -maxdepth 1 -name "package-installs-*" ); do basefile=$(basename $PACKAGEFILE) element_name=${basefile#"package-installs-"} while read pkg; do if [ -z "$pkg" ]; then continue fi # Ignore comments if [ ${pkg:0:1} = "#" ]; then continue fi if [ ! ${pkg:0:1} = "-" ]; then continue fi if [ -e /usr/share/pkg-map/$element_name ]; then # map the package to its true name pkg=$(pkg-map --element $element_name $pkg) fi pkg=${pkg:1} PACKAGES="$PACKAGES $pkg" done < $PACKAGEFILE done install-packages -e $PACKAGES diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/post-install.d/0000775000175000017500000000000013640271564030570 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/post-install.d/00-package-installsdiskimage-builder-2.35.0/diskimage_builder/elements/package-installs/post-install.d/00-package-insta0000775000175000017500000000030513640271474033440 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail package-installs -d $(dirname $0) package-installs-v2 --phase post-install.d /tmp/package-installs.json ././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/post-install.d/95-package-uninstallsdiskimage-builder-2.35.0/diskimage_builder/elements/package-installs/post-install.d/95-package-unins0000775000175000017500000000032313640271474033474 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail package-uninstalls -d $(dirname $0) package-installs-v2 --phase post-install.d --uninstall /tmp/package-installs.json diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/pre-install.d/0000775000175000017500000000000013640271564030371 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/pre-install.d/02-package-installsdiskimage-builder-2.35.0/diskimage_builder/elements/package-installs/pre-install.d/02-package-instal0000775000175000017500000000030413640271474033416 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail package-installs -d $(dirname $0) package-installs-v2 --phase pre-install.d /tmp/package-installs.json ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/pre-install.d/99-package-uninstallsdiskimage-builder-2.35.0/diskimage_builder/elements/package-installs/pre-install.d/99-package-uninst0000775000175000017500000000032213640271474033464 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail package-uninstalls -d $(dirname $0) package-installs-v2 --phase pre-install.d --uninstall /tmp/package-installs.json diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/__init__.py0000664000175000017500000000000013640271474030014 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/install.d/0000775000175000017500000000000013640271564027605 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/install.d/01-package-installs0000775000175000017500000000030013640271474033164 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail package-installs -d $(dirname $0) package-installs-v2 --phase install.d /tmp/package-installs.json diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/install.d/99-package-uninstalls0000775000175000017500000000031613640271474033557 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail package-uninstalls -d $(dirname $0) package-installs-v2 --phase install.d --uninstall /tmp/package-installs.json diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/README.rst0000664000175000017500000000713313640271474027410 0ustar zuulzuul00000000000000================ package-installs ================ The package-installs element allows for a declarative method of installing and uninstalling packages for an image build. This is done by creating a package-installs.yaml or package-installs.json file in the element directory. In order to work on Gentoo hosts you will need to manually install `dev-python/pyyaml`. example ``package-installs.yaml`` .. code-block:: YAML libxml2: grub2: phase: pre-install.d networkmanager: uninstall: True os-collect-config: installtype: source linux-image-amd64: arch: amd64 dmidecode: not-arch: ppc64, ppc64le lshw: arch: ppc64, ppc64le python-dev: dib_python_version: 2 python3-dev: dib_python_version: 3 libssl-dev: build-only: True package-a: when: DIB_USE_PACKAGE_A = 1 package-b: when: DIB_USE_PACKAGE_A != 1 example package-installs.json .. code-block:: json { "libxml2": null, "grub2": {"phase": "pre-install.d"}, "networkmanager": {"uninstall": true} "os-collect-config": {"installtype": "source"} } Setting phase, uninstall, or installtype properties for a package overrides the following default values:: phase: install.d uninstall: False installtype: * (Install package for all installtypes) arch: * (Install package for all architectures) dib_python_version: (2 or 3 depending on DIB_PYTHON_VERSION, see dib-python) Setting the installtype property causes the package only to be installed if the specified installtype would be used for the element. See the diskimage-builder docs for more information on installtypes. Setting ``build-only`` will cause the package to be added both to the list of packages to be installed and to the list of packages to be uninstalled. This allows expressing build-time dependencies that should not end up in the final image. The ``arch`` property is a comma-separated list of architectures to install for. The ``not-arch`` is a comma-separated list of architectures the package should be excluded from. Either ``arch`` or ``not-arch`` can be given for one package - not both. See documentation about the ARCH variable for more information. The ``when`` property is a simple ``=`` or ``!=`` match on a value in an environment variable. If the given environment variable matches the operation and value, the package is installed. If the variable is not available in the environment, an exception is raised (thus defaults will likely need to be provided in ``environment.d`` files or similar for flags used here). For example, to install an extra package when a feature is enabled:: package: when: DIB_FEATURE_FLAG=1 To install ``package`` when ``DIB_FEATURE_FLAG=0`` but ``other_package`` when ``DIB_FEATURE_FLAG=1`` (i.e. toggle between two packages), you can use something like:: package: when: DIB_FEATURE_FLAG=0 other_package: when: DIB_FEATURE_FLAG!=0 DEPRECATED: Adding a file under your elements pre-install.d, install.d, or post-install.d directories called package-installs- will cause the list of packages in that file to be installed at the beginning of the respective phase. If the package name in the file starts with a "-", then that package will be removed at the end of the install.d phase. Using post-install.d for cleanup ================================ Package removal is done in post-install.d at level 95. If you a running cleanup functions before this, you need to be careful not to clean out any temporary files relied upon by this element. For this reason, generally post-install cleanup functions should occupy the higher levels between 96 and 99. diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/element-deps0000664000175000017500000000003713640271474030222 0ustar zuulzuul00000000000000dib-python install-bin pkg-map diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/tests/0000775000175000017500000000000013640271564027057 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/tests/__init__.py0000664000175000017500000000000013640271474031156 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/package-installs/tests/test_package_squash.py0000664000175000017500000001105613640271474033452 0ustar zuulzuul00000000000000# Copyright 2018 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import collections import functools import imp import mock import os from oslotest import base from testtools.matchers import Mismatch installs_squash_src = (os.path.dirname(os.path.realpath(__file__)) + '/../bin/package-installs-squash') installs_squash = imp.load_source('installs_squash', installs_squash_src) class IsMatchingInstallList(object): def __init__(self, expected): self.expected = expected def match(self, actual): for phase, ops in self.expected.items(): if phase not in actual: # missing the phase return Mismatch( "Phase %d does not exist in %s" % (phase, actual)) for op, pkgs in ops.items(): if op not in actual[phase]: # missing op (install/uninstall) return Mismatch( "Operation %s does not exist in %s" % (op, ops)) # on py2 these can be out of order, we just want a match expected_phase_ops = sorted(self.expected[phase][op]) actual_phase_ops = sorted(actual[phase][op]) if expected_phase_ops != actual_phase_ops: return Mismatch( "Operation list %s does not match expected %s" % (actual[phase][op], self.expected[phase][op])) class TestPackageInstall(base.BaseTestCase): def setUp(self): super(TestPackageInstall, self).setUp() self.final_dict = collections.defaultdict( functools.partial(collections.defaultdict, list)) def test_simple(self): '''Test a basic package install''' objs = { 'test_package': '' } result = installs_squash.collect_data( self.final_dict, objs, 'test_element') expected = { 'install.d': { 'install': [('test_package', 'test_element')] } } self.assertThat(result, IsMatchingInstallList(expected)) @mock.patch.object(os, 'environ', dict(ARCH='arm64', **os.environ)) def test_arch(self): '''Exercise the arch and not-arch flags''' objs = { 'test_package': '', 'test_arm64_package': { 'arch': 'arm64' }, 'do_not_install': { 'not-arch': 'arm64' } } result = installs_squash.collect_data( self.final_dict, objs, 'test_element') expected = { 'install.d': { 'install': [('test_package', 'test_element'), ('test_arm64_package', 'test_element')] } } self.assertThat(result, IsMatchingInstallList(expected)) @mock.patch.object(os, 'environ', dict(DIB_FEATURE='1', **os.environ)) def test_skip_when(self): '''Exercise the when flag''' objs = { 'skipped_package': { 'when': 'DIB_FEATURE=0' }, 'not_skipped_package': { 'when': 'DIB_FEATURE=1' }, 'not_equal_package': { 'when': 'DIB_FEATURE!=0' }, 'not_equal_skipped_package': { 'when': 'DIB_FEATURE!=1' }, } result = installs_squash.collect_data( self.final_dict, objs, 'test_element') expected = { 'install.d': { 'install': [('not_skipped_package', 'test_element'), ('not_equal_package', 'test_element')] } } self.assertThat(result, IsMatchingInstallList(expected)) def test_skip_no_var(self): '''Exercise the skip_when missing variable failure case''' objs = { 'package': { 'when': 'MISSING_VAR=1' }, } self.assertRaises(RuntimeError, installs_squash.collect_data, self.final_dict, objs, 'test_element') diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/0000775000175000017500000000000013640271564024740 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/extra-data.d/0000775000175000017500000000000013640271564027214 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/extra-data.d/99-override-default-apt-sourcesdiskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/extra-data.d/99-override-default-apt0000775000175000017500000000137513640271474033432 0ustar zuulzuul00000000000000#!/bin/bash # Override the default /etc/apt/sources.list with $DIB_APT_SOURCES if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # exit directly if DIB_APT_SOURCES is not defined properly if [ -z "${DIB_APT_SOURCES:-}" ] ; then echo "DIB_APT_SOURCES must be set to the location of a sources.list file you wish to use" exit 0 elif [ ! -f "$DIB_APT_SOURCES" -o ! -s "$DIB_APT_SOURCES" ] ; then echo "$DIB_APT_SOURCES is not a valid sources.list file." echo "You should assign proper sources.list file in DIB_APT_SOURCES" exit 1 fi DIB_APT_SOURCES=`readlink -f $DIB_APT_SOURCES` # copy the sources.list to cloudimg pushd $TMP_MOUNT_PATH/etc/apt/ sudo cp -f $DIB_APT_SOURCES sources.list # dib-lint: safe_sudo popd diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/0000775000175000017500000000000013640271564027531 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/test-sources/0000775000175000017500000000000013640271564032171 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/test-sources/extra-data.d/diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/test-sources/extra-dat0000775000175000017500000000000013640271564034003 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000017500000000000011220 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/test-sources/extra-data.d/00-write-apt-sourcesdiskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/test-sources/extra-dat0000775000175000017500000000020013640271474034000 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail echo "testdata" > $DIB_APT_SOURCES ././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/test-sources/pre-install.d/diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/test-sources/pre-insta0000775000175000017500000000000013640271564034014 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000017500000000000011220 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/test-sources/pre-install.d/00-test-apt-sourcesdiskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/test-sources/pre-insta0000775000175000017500000000040013640271474034013 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eux set -o pipefail echo "Verifying apt sources.list content" [ -f /etc/apt/sources.list ] [ "$(cat /etc/apt/sources.list)" = "testdata" ] touch /tmp/dib-test-should-fail && exit 1 ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/test-sources/element-depsdiskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/test-sources/element-d0000664000175000017500000000005113640271474033762 0ustar zuulzuul00000000000000base openstack-ci-mirrors ubuntu-minimal ././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/test-sources/environment.d/diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/test-sources/environme0000775000175000017500000000000013640271564034114 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000017400000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/test-sources/environment.d/00-set-apt-sourcesdiskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/test-elements/test-sources/environme0000664000175000017500000000006113640271474034113 0ustar zuulzuul00000000000000DIB_APT_SOURCES=$(mktemp) export DIB_APT_SOURCES diskimage-builder-2.35.0/diskimage_builder/elements/apt-sources/README.rst0000664000175000017500000000076113640271474026433 0ustar zuulzuul00000000000000=========== apt-sources =========== Specify an apt sources.list file which is used during image building and then remains on the image when it is run. Environment Variables --------------------- DIB_APT_SOURCES :Required: No :Default: None (Does not replace sources.list file) :Description: Path to a file on the build host which is used in place of ``/etc/apt/sources.list`` :Example: ``DIB_APT_SOURCES=/etc/apt/sources.list`` will use the same sources.list as the build host. diskimage-builder-2.35.0/diskimage_builder/elements/rax-nova-agent/0000775000175000017500000000000013640271564025322 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rax-nova-agent/package-installs.yaml0000664000175000017500000000004313640271474031425 0ustar zuulzuul00000000000000cloud-init: phase: pre-install.d diskimage-builder-2.35.0/diskimage_builder/elements/rax-nova-agent/install.d/0000775000175000017500000000000013640271564027212 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rax-nova-agent/install.d/05-xen-tools0000775000175000017500000000214713640271474031316 0ustar zuulzuul00000000000000#!/bin/bash # Copyright (c) 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail XS_TOOLS_DIR=$(mktemp -d) mount -o loop /tmp/xs-tools.iso $XS_TOOLS_DIR pushd $XS_TOOLS_DIR/Linux case "$DISTRO_NAME" in 'ubuntu'|'debian') # Seriously source versions.deb dpkg -i $XE_GUEST_UTILITIES_PKG_FILE_amd64 ;; 'fedora'|'centos'|'centos7'|'opensuse') source versions.rpm rpm -Uvh $XE_GUEST_UTILITIES_PKG_FILE_x86_64 ;; esac popd umount $XS_TOOLS_DIR diskimage-builder-2.35.0/diskimage_builder/elements/rax-nova-agent/install.d/10-nova-agent0000775000175000017500000000626513640271474031426 0ustar zuulzuul00000000000000#!/bin/bash # Copyright (c) 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail cd /tmp/nova-agent ./installer.sh cat > /etc/cloud/cloud.cfg.d/80_restart_network.cfg <<'EOF' # Restart networking if it's got no IP. This is to catch if we're on RAX # and the baked in dhcp config didn't work, but is now probably reconfigured # by nova-agent runcmd: - ip addr show eth0 | grep inet || ( ifdown -a ; ifup -a ) EOF case "$DISTRO_NAME" in 'ubuntu'|'debian') # cloud-init / nova-agent sad panda hacks cat > /etc/init/nova-agent.conf <<'EOF' # nova-agent - start before cloud-init and hup network interfaces start on starting cloud-init-local task console output script /etc/init.d/nova-agent start sleep 13 ifdown -a ifup -a end script EOF cat > /etc/init/xe-linux-distribution.conf <<'EOF' # xe-linux-distribution - start the xentools before nova-agent runs start on starting nova-agent task console output script /etc/init.d/xe-linux-distribution start sleep 2 end script EOF # stop nova-agent from starting twice since we start it from upstart now update-rc.d -f nova-agent remove update-rc.d -f xe-linux-distribution remove # console fix for PV Ubuntus cat > /etc/init/hvc0.conf <<'EOF' # hvc0 - getty # # This service maintains a getty on hvc0 from the point the system is # started until it is shut down again. start on stopped rc RUNLEVEL=[2345] stop on runlevel [!2345] respawn exec /sbin/getty -L 115200 hvc0 vt102 EOF ;; 'fedora'|'centos'|'centos7'|'opensuse') cat > /usr/local/bin/run-nova-agent.sh <<'EOF' #!/bin/bash /etc/init.d/nova-agent start sleep 13 ifdown -a ifup -a EOF chmod 0755 /usr/local/bin/run-nova-agent.sh cat > /usr/local/bin/run-xe-linux-distribution.sh <<'EOF' #!/bin/bash /etc/init.d/xe-linux-distribution start sleep 2 EOF chmod 0755 /usr/local/bin/run-xe-linux-distribution.sh cat > /etc/systemd/system/nova-agent.service < /etc/systemd/system/xe-linux-distribution.service <<'EOF' [Unit] Description=xentools agent Before=nova-agent Wants=nova-agent [Service] ExecStart=/usr/local/bin/run-xe-linux-distribution.sh [Install] WantedBy=multi-user.target EOF # stop nova-agent from starting twice since we start it from systemd now chkconfig nova-agent off chkconfig xe-linux-distribution off systemctl enable nova-agent systemctl enable xe-linux-distribution ;; esac diskimage-builder-2.35.0/diskimage_builder/elements/rax-nova-agent/README.rst0000664000175000017500000000042013640271474027005 0ustar zuulzuul00000000000000============== rax-nova-agent ============== Images for Rackspace Cloud currently require nova-agent to get networking information. Many of the things here are adapted from: https://developer.rackspace.com/blog/bootstrap-your-qcow-images-for-the-rackspace-public-cloud/ diskimage-builder-2.35.0/diskimage_builder/elements/rax-nova-agent/source-repository-xen-tools0000664000175000017500000000022513640271474032707 0ustar zuulzuul00000000000000xen-tools file /tmp/xs-tools.iso https://f97f271e9fde8f434e2a-fa73b8821af96cee574a861a54d04230.ssl.cf3.rackcdn.com/files/xentools/xs-tools-6.2.0.iso diskimage-builder-2.35.0/diskimage_builder/elements/rax-nova-agent/element-deps0000664000175000017500000000002413640271474027623 0ustar zuulzuul00000000000000source-repositories diskimage-builder-2.35.0/diskimage_builder/elements/rax-nova-agent/source-repository-nova-agent0000664000175000017500000000025213640271474033016 0ustar zuulzuul00000000000000nova-agent tar /tmp/nova-agent https://f97f271e9fde8f434e2a-fa73b8821af96cee574a861a54d04230.ssl.cf3.rackcdn.com/files/nova-agent/nova-agent-Linux-x86_64-1.39.0.tar.gz . diskimage-builder-2.35.0/diskimage_builder/elements/block-device-mbr/0000775000175000017500000000000013640271564025600 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/block-device-mbr/block-device-ppc64el.yaml0000664000175000017500000000170213640271474032266 0ustar zuulzuul00000000000000# Default block device setup for PPC # ---------------------------------- # # Details (extracted from [1]) # # Power Firmware (OFW) scans chosen (nvram value boot-device) device, # for either PReP* partition or vfat. # # PReP is raw and small (8M max) partition which caries only stage1 # binary. # msdos partition table: # - PReP partition have 0x41 type (must be active) # - PReP partition must have boot flag set # # [1] https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/W51a7ffcf4dfd_4b40_9d82_446ebc23c550/page/PowerLinux%20Boot%20howto - local_loop: name: image0 - partitioning: base: image0 label: mbr partitions: - name: boot flags: [ boot, primary ] type: '0x41' size: 8MiB - name: root flags: [ primary ] size: 100% mkfs: mount: mount_point: / fstab: options: "defaults" fsck-passno: 1 diskimage-builder-2.35.0/diskimage_builder/elements/block-device-mbr/block-device-default.yaml0000664000175000017500000000053013640271474032433 0ustar zuulzuul00000000000000# Default single partition loopback - local_loop: name: image0 - partitioning: base: image0 label: mbr partitions: - name: root flags: [ boot, primary ] size: 100% mkfs: mount: mount_point: / fstab: options: "defaults" fsck-passno: 1 diskimage-builder-2.35.0/diskimage_builder/elements/block-device-mbr/README.rst0000664000175000017500000000032613640271474027270 0ustar zuulzuul00000000000000================ Block Device MBR ================ This provides the default legacy block-device configuration for the "vm" element. This configures a single partition and is suitable for a MBR based bootloader. diskimage-builder-2.35.0/diskimage_builder/elements/block-device-mbr/element-provides0000664000175000017500000000001413640271474031000 0ustar zuulzuul00000000000000block-devicediskimage-builder-2.35.0/diskimage_builder/elements/block-device-mbr/environment.d/0000775000175000017500000000000013640271564030366 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/block-device-mbr/environment.d/15-block-device.bashdiskimage-builder-2.35.0/diskimage_builder/elements/block-device-mbr/environment.d/15-block-device.b0000664000175000017500000000026213640271474033303 0ustar zuulzuul00000000000000# # Arch gate # if [[ "arm64 aarch64" =~ $ARCH ]]; then echo "block-device-mbr is not supported on AARCH64; use block-device-efi" exit 1 fi export DIB_BLOCK_DEVICE=mbr diskimage-builder-2.35.0/diskimage_builder/elements/rhel/0000775000175000017500000000000013640271564023425 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rhel/pre-install.d/0000775000175000017500000000000013640271564026101 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rhel/pre-install.d/02-set-machine-id0000775000175000017500000000140713640271474031037 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # Set a machine-id. The .qcow2 image doesn't have one, and sometimes # one will get made (if systemd is upgraded as part of the build # process) and sometimes not. The problem is that certain kernel # install scripts bail silently without it; kernel packages end up # being installed but the initramfs etc isn't copied into place. # # Note this is cleared out in the sysprep role. # # See also: # 768c5e188c1b4bff01da14a49b96b51301db4c03 : similar thing for fedora # https://bugzilla.redhat.com/show_bug.cgi?id=1737355 : upstream bug # https://bugzilla.redhat.com/show_bug.cgi?id=1486124 : unresolved # bug about kernel install requiring machine-id systemd-machine-id-setup diskimage-builder-2.35.0/diskimage_builder/elements/rhel/README.rst0000664000175000017500000000236213640271474025117 0ustar zuulzuul00000000000000==== rhel ==== Use RHEL cloud images as the baseline for built disk images. Because RHEL base images are not publicly available, it is necessary to first download the RHEL cloud image from the Red Hat Customer Portal and pass the path to the resulting file to disk-image-create as the ``DIB_LOCAL_IMAGE`` environment variable. The cloud image can be found at (login required): RHEL8: https://access.redhat.com/downloads/content/479/ver=/rhel---8/8.0/x86_64/product-software RHEL7: https://access.redhat.com/downloads/content/69/ver=/rhel---7/7.1/x86_64/product-downloads Then before running the image build, define DIB_LOCAL_IMAGE (replace the file name with the one downloaded, if it differs from the example): .. code-block:: bash export DIB_LOCAL_IMAGE=rhel-8.0-x86_64-kvm.qcow2 The downloaded file will then be used as the basis for any subsequent image builds. For further details about building RHEL images, see the rhel-common and redhat-common element README files. Environment Variables --------------------- DIB_LOCAL_IMAGE :Required: Yes :Default: None :Description: The RHEL 8 base image you have downloaded. See the element description above for more details. :Example: ``DIB_LOCAL_IMAGE=/tmp/rhel8-cloud.qcow2`` diskimage-builder-2.35.0/diskimage_builder/elements/rhel/element-provides0000664000175000017500000000002113640271474026623 0ustar zuulzuul00000000000000operating-system diskimage-builder-2.35.0/diskimage_builder/elements/rhel/element-deps0000664000175000017500000000010713640271474025730 0ustar zuulzuul00000000000000cache-url redhat-common rhel-common rpm-distro source-repositories yum diskimage-builder-2.35.0/diskimage_builder/elements/rhel/environment.d/0000775000175000017500000000000013640271564026213 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rhel/environment.d/10-rhel-distro-name.bash0000664000175000017500000000007513640271474032444 0ustar zuulzuul00000000000000export DISTRO_NAME=rhel export DIB_RELEASE=${DIB_RELEASE:-8} diskimage-builder-2.35.0/diskimage_builder/elements/rhel/environment.d/11-yum-dnf.bash0000664000175000017500000000024113640271474030645 0ustar zuulzuul00000000000000# since RHEL8, dnf is the yum replacement. if [[ ${DIB_RELEASE} == '8' ]]; then export YUM=dnf elif [[ ${DIB_RELEASE} == '7' ]]; then export YUM=yum fi diskimage-builder-2.35.0/diskimage_builder/elements/rhel/root.d/0000775000175000017500000000000013640271564024632 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rhel/root.d/10-rhel-cloud-image0000775000175000017500000000244413640271474030120 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail [ -n "$ARCH" ] [ -n "$TARGET_ROOT" ] if [[ "amd64 x86_64" =~ "$ARCH" ]]; then ARCH="x86_64" elif [[ "ppc64le" =~ "$ARCH" ]]; then # We don't need to do anything here other than avoid the else clause : else echo 'rhel root element only supports x86_64 and ppc64le values for $ARCH' exit 1 fi DIB_LOCAL_IMAGE=${DIB_LOCAL_IMAGE:-""} if [ -n "$DIB_LOCAL_IMAGE" ]; then IMAGE_LOCATION=$DIB_LOCAL_IMAGE # No need to copy a local image into the cache directory, so just specify # the cached path as the original path. CACHED_IMAGE=$IMAGE_LOCATION BASE_IMAGE_FILE=`basename $DIB_LOCAL_IMAGE` BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz else if [ -z "${BASE_IMAGE_FILE:-}" -o -z "${DIB_CLOUD_IMAGES:-}" ]; then echo "No source for a base image file configured." echo "See rhel element readme for details on how to obtain and use a base image." exit 1 fi DIB_RELEASE=${DIB_RELEASE:-latest} BASE_IMAGE_TAR=$DIB_RELEASE-rhel-server-$ARCH-latest.tgz IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE fi $TMP_HOOKS_PATH/bin/extract-image $BASE_IMAGE_FILE $BASE_IMAGE_TAR $IMAGE_LOCATION $CACHED_IMAGE diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-common/0000775000175000017500000000000013640271564025303 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-common/install.d/0000775000175000017500000000000013640271564027173 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-common/install.d/80-disable-rfc30410000775000175000017500000000257113640271474032036 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2016, Rackspace US, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. # dib-lint: disable=set setu setpipefail indent if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -e # This will disable the privacy extensions for IPv6 (RFC4941) # (RFC4941 obsoletes RFC3041) # # Note that depending on the implementation of how the sysctl # settings are applied there is a race condition: there might be # a small time-frame where the original Ubuntu settings from # /etc/sysctl.d/10-ipv6-privacy.conf are already applied but the # new settings from /etc/sysctl.d/99-cloudimg-ipv6.conf # not yet. # If during this time all started network interfaces will # use the privacy extension. cat > /etc/sysctl.d/99-cloudimg-ipv6.conf <$TARGET_ROOT/etc/apt/sources.list deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE ${DIB_DEBIAN_COMPONENTS//,/ } deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE-updates ${DIB_DEBIAN_COMPONENTS//,/ } deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE-backports ${DIB_DEBIAN_COMPONENTS//,/ } deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE-security ${DIB_DEBIAN_COMPONENTS//,/ } EOF" sudo mount -t proc none $TARGET_ROOT/proc sudo mount -t sysfs none $TARGET_ROOT/sys trap "sudo umount $TARGET_ROOT/proc; sudo umount $TARGET_ROOT/sys" EXIT apt_get="sudo chroot $TARGET_ROOT /usr/bin/apt-get" # dib-lint: safe_sudo # Need to update to retrieve the signed Release file $apt_get update $apt_get clean $apt_get dist-upgrade -y to_install="" # pre-bionic (18.04) brought this in via debootstrap, but init # dependencies have narrowed in the container world, so now we add it # explicitly here so it's brought in early. if [ $DIB_RELEASE != "trusty" ] && [ $DIB_RELEASE != "xenial" ]; then to_install+="systemd-sysv " fi # default required to_install+="busybox sudo " # dib-lint: safe_sudo if [ "$DIB_PYTHON_VERSION" == "2" ]; then to_install+="python " elif [ "$DIB_PYTHON_VERSION" == "3" ]; then to_install+="python3 " else echo "ERROR: DIB_PYTHON_VERSION is '$DIB_PYTHON_VERSION' but needs to be 2 or 3" exit 1 fi $apt_get install -y $to_install diskimage-builder-2.35.0/diskimage_builder/elements/journal-to-console/0000775000175000017500000000000013640271564026225 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/journal-to-console/post-install.d/0000775000175000017500000000000013640271564031100 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/journal-to-console/post-install.d/30-journal-to-consolediskimage-builder-2.35.0/diskimage_builder/elements/journal-to-console/post-install.d/30-journal-to-0000775000175000017500000000145113640271474033416 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2019 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail mkdir -p /etc/systemd/journald.conf.d cat > /etc/systemd/journald.conf.d/log-to-console.conf << EOF [Journal] ForwardToConsole=true EOF diskimage-builder-2.35.0/diskimage_builder/elements/journal-to-console/README.rst0000664000175000017500000000052013640271474027711 0ustar zuulzuul00000000000000================== journal-to-console ================== Configure systemd's journal to send all logs to console. Useful for debugging issues before you can log into a host, such as network or authentication issues. The console can be retrieved from an OpenStack cloud with a command such as ``openstack console log show ``. diskimage-builder-2.35.0/diskimage_builder/elements/install-bin/0000775000175000017500000000000013640271564024707 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/install-bin/pre-install.d/0000775000175000017500000000000013640271564027363 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/install-bin/pre-install.d/01-install-bin0000775000175000017500000000024313640271474031742 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail install -m 0755 -o root -g root $(dirname $0)/../bin/* /usr/local/bin diskimage-builder-2.35.0/diskimage_builder/elements/install-bin/README.rst0000664000175000017500000000021713640271474026376 0ustar zuulzuul00000000000000=========== install-bin =========== Add any files in an element's bin directory to /usr/local/bin in the created image with permissions 0755. diskimage-builder-2.35.0/diskimage_builder/elements/stable-interface-names/0000775000175000017500000000000013640271564027004 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/stable-interface-names/package-installs.yaml0000664000175000017500000000001513640271474033106 0ustar zuulzuul00000000000000biosdevname: diskimage-builder-2.35.0/diskimage_builder/elements/stable-interface-names/install.d/0000775000175000017500000000000013640271564030674 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/stable-interface-names/install.d/02-stable-interface-namesdiskimage-builder-2.35.0/diskimage_builder/elements/stable-interface-names/install.d/02-stable-inter0000775000175000017500000000042713640271474033435 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # remove softlink to /dev/null which disables these rules NET_NAME_SLOT_FILE="/etc/udev/rules.d/80-net-name-slot.rules" if [ -h $NET_NAME_SLOT_FILE ]; then rm $NET_NAME_SLOT_FILE fi diskimage-builder-2.35.0/diskimage_builder/elements/stable-interface-names/README.rst0000664000175000017500000000036513640271474030477 0ustar zuulzuul00000000000000====================== stable-interface-names ====================== Does the following: * Enables stable network interface naming (em1, em2, etc) by installing the biosdevname and removes any symlinks which may disable udev rules, etc. diskimage-builder-2.35.0/diskimage_builder/elements/stable-interface-names/element-deps0000664000175000017500000000002113640271474031302 0ustar zuulzuul00000000000000package-installs diskimage-builder-2.35.0/diskimage_builder/elements/oat-client/0000775000175000017500000000000013640271564024532 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/oat-client/package-installs.yaml0000664000175000017500000000003513640271474030636 0ustar zuulzuul00000000000000oat-client: oat-commandtool: diskimage-builder-2.35.0/diskimage_builder/elements/oat-client/README.rst0000664000175000017500000000113413640271474026220 0ustar zuulzuul00000000000000========== oat-client ========== This element installs oat-client on the image, that's necessary for trusted boot feature in Ironic to work. Intel TXT will measure BIOS, Option Rom and Kernel/Ramdisk during trusted boot, the oat-client will securely fetch the hash values from TPM. .. note:: This element only works on Fedora. Put `fedora-oat.repo` into `/etc/yum.repos.d/`:: export DIB_YUM_REPO_CONF=/etc/yum.repos.d/fedora-oat.repo .. note:: OAT Repo is lack of a GPG signature check on packages, which can be tracked on: https://github.com/OpenAttestation/OpenAttestation/issues/26 diskimage-builder-2.35.0/diskimage_builder/elements/oat-client/element-deps0000664000175000017500000000002113640271474027030 0ustar zuulzuul00000000000000package-installs diskimage-builder-2.35.0/diskimage_builder/elements/oat-client/yum.repos.d/0000775000175000017500000000000013640271564026715 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/oat-client/yum.repos.d/fedora-oat.repo0000664000175000017500000000034313640271474031625 0ustar zuulzuul00000000000000# Place this file in your /etc/yum.repos.d/ directory [oat] name=oat 2.2 packages and dependencies baseurl=http://repos.fedorapeople.org/repos/gwei3/oat/fedora-$releasever/$basearch/ enabled=1 skip_if_unavailable=1 gpgcheck=0 diskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/0000775000175000017500000000000013640271564025760 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/test-elements/0000775000175000017500000000000013640271564030551 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015600000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/test-elements/opensuse15-build-succeeds/diskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/test-elements/opensuse15-build-0000775000175000017500000000000013640271564033653 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000017000000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/test-elements/opensuse15-build-succeeds/README.rstdiskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/test-elements/opensuse15-build-0000664000175000017500000000006113640271474033652 0ustar zuulzuul00000000000000Verify we can build an openSUSE Leap 15.1 image. ././@LongLink0000000000000000000000000000017200000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/test-elements/opensuse15-build-succeeds/element-depsdiskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/test-elements/opensuse15-build-0000664000175000017500000000002513640271474033652 0ustar zuulzuul00000000000000openstack-ci-mirrors ././@LongLink0000000000000000000000000000017400000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/test-elements/opensuse15-build-succeeds/environment.d/diskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/test-elements/opensuse15-build-0000775000175000017500000000000013640271564033653 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000021600000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/test-elements/opensuse15-build-succeeds/environment.d/10-set-distro.bashdiskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/test-elements/opensuse15-build-0000664000175000017500000000003013640271474033646 0ustar zuulzuul00000000000000export DIB_RELEASE=15.1 diskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/README.rst0000664000175000017500000000057613640271474027457 0ustar zuulzuul00000000000000================ opensuse-minimal ================ This element will build a minimal openSUSE image. It requires 'zypper' to be installed on the host. These images should be considered experimental. There are currently only x86_64 images. Environment Variables --------------------- DIB_RELEASE :Required: No :Default: 15.1 :Description: Set the desired openSUSE release. diskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/element-provides0000664000175000017500000000002113640271474031156 0ustar zuulzuul00000000000000operating-system diskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/element-deps0000664000175000017500000000002713640271474030264 0ustar zuulzuul00000000000000sysprep zypper-minimal diskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/environment.d/0000775000175000017500000000000013640271564030546 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016000000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/environment.d/10-opensuse-distro-name.bashdiskimage-builder-2.35.0/diskimage_builder/elements/opensuse-minimal/environment.d/10-opensuse-distr0000664000175000017500000000026413640271474033675 0ustar zuulzuul00000000000000export DISTRO_NAME=opensuse DIB_RELEASE=${DIB_RELEASE:-15.1} export DIB_RELEASE=${DIB_RELEASE,,} export DIB_OPENSUSE_PATTERNS=patterns-openSUSE-base export DIB_INIT_SYSTEM=systemd diskimage-builder-2.35.0/diskimage_builder/elements/pip-cache/0000775000175000017500000000000013640271564024324 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-cache/README.rst0000664000175000017500000000137013640271474026014 0ustar zuulzuul00000000000000========= pip-cache ========= # Use a cache for pip Using a download cache speeds up image builds. Including this element in an image build causes $HOME/.cache/image-create/pip to be bind mounted as /tmp/pip inside the image build chroot. The $PIP_DOWNLOAD_CACHE environment variable is then defined as /tmp/pip, which causes pip to cache all downloads to the defined location. Note that pip and its use of $PIP_DOWNLOAD_CACHE is not concurrency safe. Running multiple instances of diskimage-builder concurrently can cause issues. Therefore, it is advised to only have one instance of diskimage-builder that includes the pip-cache element running at a time. The pip concurrency issue is being tracked upstream at https://github.com/pypa/pip/issues/1141 diskimage-builder-2.35.0/diskimage_builder/elements/pip-cache/environment.d/0000775000175000017500000000000013640271564027112 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-cache/environment.d/10-pip-cache0000664000175000017500000000004313640271474031101 0ustar zuulzuul00000000000000export PIP_DOWNLOAD_CACHE=/tmp/pip diskimage-builder-2.35.0/diskimage_builder/elements/pip-cache/root.d/0000775000175000017500000000000013640271564025531 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-cache/root.d/11-pip-cache0000775000175000017500000000037013640271474027527 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail PIP_CACHE_DIR=$DIB_IMAGE_CACHE/pip mkdir -p $PIP_CACHE_DIR sudo mkdir -p $TMP_MOUNT_PATH/tmp/pip sudo mount --bind $PIP_CACHE_DIR $TMP_MOUNT_PATH/tmp/pip diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/0000775000175000017500000000000013640271564025035 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/udev.d/0000775000175000017500000000000013640271564026222 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/udev.d/60-persistent-storage.rules0000664000175000017500000001302613640271474033365 0ustar zuulzuul00000000000000# do not edit this file, it will be overwritten on update # persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} # scheme based on "Linux persistent device names", 2004, Hannes Reinecke # forward scsi device event to corresponding block device ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" ACTION=="remove", GOTO="persistent_storage_end" # enable in-kernel media-presence polling ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}=="0", ATTR{parameters/events_dfl_poll_msecs}="2000" ACTION=="add", ATTR{removable}=="1", ATTR{events_poll_msecs}=="-1", ATTR{events_poll_msecs}="2000" SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices KERNEL=="fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md*", GOTO="persistent_storage_end" # ignore partitions that span the entire disk TEST=="whole_disk", GOTO="persistent_storage_end" # for partitions import parent information ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" # virtio-blk KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}" KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n" # ATA devices using the "scsi" subsystem KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $devnode" # ATA/ATAPI devices (SPC-3 or later) using the "scsi" subsystem KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $devnode" # Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures) KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $devnode" # Otherwise fall back to using usb_id for USB devices KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" # scsi devices KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="scsi" KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="cciss" KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" # firewire KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}" KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n" KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" KERNEL=="mmcblk[0-9]p[0-9]", ENV{PARTNAME}=="?*", SYMLINK+="disk/by-partlabel/$env{PARTNAME}" KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}" KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" # by-path (parent device path) ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # skip unpartitioned removable media devices from drivers which do not send "change" events ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" # probe filesystem metadata of optical drives which have a media inserted KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", \ IMPORT{builtin}="blkid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}" # single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \ IMPORT{builtin}="blkid --noraid" # probe filesystem metadata of disks KERNEL!="sr*", IMPORT{builtin}="blkid" # watch metadata changes by tools closing the device after writing KERNEL!="sr*", OPTIONS+="watch" # by-label/by-uuid links (filesystem metadata) ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" # by-id (World Wide Name) ENV{DEVTYPE}=="disk", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}" ENV{DEVTYPE}=="partition", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}-part%n" # by-partlabel/by-partuuid links (partition metadata) ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}" ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}" LABEL="persistent_storage_end" diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/extra-data.d/0000775000175000017500000000000013640271564027311 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/extra-data.d/01-inject-ramdisk-build-filesdiskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/extra-data.d/01-inject-ramdisk-buil0000775000175000017500000000060713640271474033315 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail export RAMDISK_BUILD_PATH="$TMP_MOUNT_PATH/tmp/ramdisk-build" mkdir -p $RAMDISK_BUILD_PATH for file in common-defaults common-functions ramdisk-defaults ramdisk-functions img-defaults img-functions ; do cp $_LIB/$file $RAMDISK_BUILD_PATH done cp -r $(dirname $0)/scripts $RAMDISK_BUILD_PATH diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/extra-data.d/scripts/0000775000175000017500000000000013640271564031000 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/extra-data.d/scripts/d/0000775000175000017500000000000013640271564031223 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/extra-data.d/scripts/d/init-func0000664000175000017500000001671413640271474033053 0ustar zuulzuul00000000000000# Copyright (c) 2012 NTT DOCOMO, INC. # Copyright 2012 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. source /iscsi-func function configure_vmedia_dir() { VMEDIA_MOUNT_POINT="/vfloppy_mnt" VMEDIA_DIR="/vfloppy" VMEDIA_CONFIG_FILE="parameters.txt" VMEDIA_DEVICE_BY_LABEL="/dev/disk/by-label/ir-vfd-dev" # Wait for some seconds for kernel to finish initializing the # virtual media devices. wait_for 5 1 "ls $VMEDIA_DEVICE_BY_LABEL" if [[ $? != 0 ]]; then # TODO(rameshg87) - 04/29/15 : This block of code is there only # for backward compatibility to older versions of Ironic. Remove this # after 2 releases. Ironic will now assign labels to Virtual Media # devices. SYSFS_DEVICE_MODELS="/sys/class/block/*/device/model" SYSFS_VMEDIA_DEVICE_MODEL="virtual media" grep -q -i "$SYSFS_VMEDIA_DEVICE_MODEL" $SYSFS_DEVICE_MODELS if [[ $? != 0 ]]; then echo "Error finding the virtual floppy device on the node." troubleshoot fi # Find the virtual media device from the kernel sysfs file system. VMEDIA_DEVICE=$(grep -l -i "$SYSFS_VMEDIA_DEVICE_MODEL" $SYSFS_DEVICE_MODELS | awk -F'/' '{print $5}') if [[ -z $VMEDIA_DEVICE ]]; then echo "Error finding the virtual floppy device on the node." troubleshoot fi VMEDIA_DEVICE_FILE="/dev/$VMEDIA_DEVICE" else VMEDIA_DEVICE_FILE="$VMEDIA_DEVICE_BY_LABEL" fi # Mount the virtual media device mkdir -p $VMEDIA_MOUNT_POINT mount $VMEDIA_DEVICE_FILE $VMEDIA_MOUNT_POINT if [[ $? != 0 ]]; then echo "Error mounting virtual media device $VMEDIA_DEVICE_FILE" troubleshoot fi # Copy the contents of the virtual media to a directory in root # filesystem so that we can unmount virtual media soon. cp -rf $VMEDIA_MOUNT_POINT $VMEDIA_DIR umount $VMEDIA_MOUNT_POINT } function get_kernel_parameter() { if [ "$BOOT_METHOD" = "$VMEDIA_BOOT_TAG" ]; then echo $(find_parameter_from_file $1 "$VMEDIA_DIR/$VMEDIA_CONFIG_FILE") else echo $(find_parameter_from_file $1 "/proc/cmdline") fi } function find_parameter_from_file() { local paramname=$1 local filename=$2 for i in `cat $filename`; do case "$i" in ${paramname}=*) echo "${i#${paramname}=}" return 0 ;; ${paramname}) echo "" return 0 ;; *) ;; esac done echo "" return 1 } function string_contains() { local string=$1 local word=$2 if [ "$string" != "${string/$word/}" ]; then return 0 else return 1 fi } function load_modules_by_udev() { udevadm trigger --action=add udevadm settle } function strip_dev() { echo "$1" | sed -e 's:^/dev/::' } function prepend_dev() { case "$1" in /dev/*) echo "$1" ;; *) echo "/dev/$1" ;; esac } function whole_disk_name() { local dev=`prepend_dev "$1"` case "$dev" in /dev/sd*|/dev/hd*|/dev/vd*|/dev/xvd*) echo "$dev" | sed -e 's/[0-9]*$//' ;; /dev/cciss/*) echo "$dev" | sed -e 's/p[0-9]*$//' ;; *) echo "" return 1 ;; esac } function partition_name() { local dev=`prepend_dev "$1"` local part=$2 case "$dev" in /dev/sd*|/dev/hd*|/dev/vd*|/dev/xvd*) echo "${dev}${part}" ;; /dev/cciss/*) echo "${dev}p${part}" ;; *) echo "" return 1 ;; esac } function find_interface() { local mac=$1 local interface interface=$(ip link show | grep -B1 -i $mac | awk '/mtu/ { print $2 }') if [ -n "$interface" ]; then echo "${interface%:}" return 0 else # Note(moshele): try to find the InfinBand interface by # matching the InfinBand MAC upper and lower # 3 octets to the GUID lower and upper 3 octets. local upper_octs=${mac:0:8} local lower_octs=${mac:9:16} ib_re="${upper_octs}:[A-F0-9][A-F0-9]:[A-F0-9][A-F0-9]:${lower_octs}" interface=$(ip link show | grep -B1 -i ${ib_re} | grep mtu | \ awk {'print $2'}) if [ -n "$interface" ]; then echo "${interface%:}" return 0 fi return 1 fi } function set_mac() { local dev=$1 local mac=$2 ip link set "$dev" address "$mac" } function swap_ifname() { local dev=$1 local dev2=$2 if [ "$dev" = "$dev2" ]; then return fi if ip link show "$dev2" >/dev/null; then # dev2 exists # swap device name ip link set "$dev" name "_$dev" ip link set "$dev2" name "$dev" ip link set "_$dev" name "$dev2" else ip link set "$dev" name "$dev2" fi } function partition_exists() { local dev=$1 dev=`strip_dev "$dev"` if tail -n +3 /proc/partitions | grep "$dev" >/dev/null; then return 0 else return 1 fi } function find_disk() { local disks=$1 local dev # find device local OLD_IFS=$IFS IFS=, for i in $disks; do dev=`whole_disk_name "$i"` if partition_exists "$dev"; then dev=`prepend_dev "$dev"` break fi dev="" done IFS=$OLD_IFS if [ -z "$dev" ]; then return 1 fi echo "$dev" return 0 } function check_tgtd_socket() { echo -n "waiting for tgtd socket..." if [ -e /var/run/tgtd.ipc_abstract_namespace.0 ]; then echo "found" return 0 else echo "not found" return 1 fi } wait_for(){ LOOPS=$1 SLEEPTIME=$2 shift ; shift i=0 while [ $i -lt $LOOPS ] ; do i=$((i + 1)) eval "$@" && return 0 || true sleep $SLEEPTIME done return 1 } function troubleshoot() { if [ "$TROUBLESHOOT" != 1 ]; then _DO_TROUBLESHOOT="" _t=0 echo -n "Troubleshooting required, press t to launch shell." while [ $_t -lt 10 ]; do read -n 1 -t 1 _DO_TROUBLESHOOT _t=$(($_t + 1)) if [ "$_DO_TROUBLESHOOT" == "t" ]; then export TROUBLESHOOT=1 break fi echo -n "." done echo "" fi if [ "$TROUBLESHOOT" == 1 ]; then echo "Starting troubleshooting shell." bash fi } function safe_url_encode() { local str=$1 local out="" for (( i=0; i<${#str}; i++ )); do c=${str:$i:1} case $c in [a-zA-Z0-9.-_] ) out+="$c" ;; ' ' ) out+="+" ;; *) #skip it ;; esac done echo "$out" } function err_msg() { message=$1 if [ -z "$FIRST_ERR_MSG" ]; then FIRST_ERR_MSG=$(safe_url_encode "$message") fi echo "$message" } diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/extra-data.d/scripts/init-end0000664000175000017500000000016613640271474032435 0ustar zuulzuul00000000000000 # Final init steps echo "rebooting" reboot -f echo "failed to reboot" echo "Starting troubleshooting shell." bash diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/extra-data.d/scripts/init0000775000175000017500000000167013640271474031675 0ustar zuulzuul00000000000000#!/bin/bash # Copyright (c) 2012 NTT DOCOMO, INC. # Copyright 2012 Hewlett-Packard Development Company, L.P. # # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # NOTE(bnemec): We don't want this script to exit on failures because if init # dies then we get a kernel panic on ramdisk boot. # dib-lint: disable=sete setu setpipefail dibdebugtrace echo "init" source /init-func PATH=/sbin:/bin:/usr/bin:/usr/sbin export PATH diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/post-install.d/0000775000175000017500000000000013640271564027710 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/post-install.d/01-ensure-binaries0000775000175000017500000000207213640271474033150 0ustar zuulzuul00000000000000#!/bin/bash # Ensure that all binaries listed in ramdisk elements, exist if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail export TARGET_DIR="/tmp/in_target.d/" if [ -z $TARGET_DIR ] ; then echo "Target dir not specified" exit 1 fi if [ ! -d $TARGET_DIR ] ; then echo "Unable to find specified directory in target: $TARGET_DIR" bash exit 1 fi BINARY_DEPS= for _FILE in $(ls ${TARGET_DIR}/binary-deps.d/) ; do _FILE="${TARGET_DIR}/binary-deps.d/${_FILE}" if [ -a $_FILE ]; then for _LINE in $(cat $_FILE) ; do BINARY_DEPS="${BINARY_DEPS} $_LINE" done fi done for _BIN in $BINARY_DEPS ; do _LOCATION=$(type -p "$_BIN" || echo "") if [ -z "$_LOCATION" ]; then echo "$_BIN is not found in PATH. Please ensure your elements install it" exit 1 fi done if [ "$BINARY_DEPS" == "" ]; then echo "No binary-deps found" else DEPS_OUTPUT="/etc/dib_binary_deps" echo "Creating binary_deps record at: ${DEPS_OUTPUT}" echo "$BINARY_DEPS" >${DEPS_OUTPUT} fi diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/init.d/0000775000175000017500000000000013640271564026222 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/init.d/20-init-variables0000664000175000017500000000420213640271474031273 0ustar zuulzuul00000000000000FIRST_ERR_MSG= # To identify that the node has booted from virtual media, a kernel # command-line argument boot_method=vmedia is added in the iso bootloader # configuration file (like isolinux.cfg for isolinux). VMEDIA_BOOT_TAG="vmedia" BOOT_METHOD=$(get_kernel_parameter boot_method) if [ "$BOOT_METHOD" = "$VMEDIA_BOOT_TAG" ]; then # If the node booted from virtual media cdrom, the arguments for the # installation are provided in virtual media floppy. Find out # the virtual media device, mount it and get the information. configure_vmedia_dir fi readonly _BOOTIF_=$(get_kernel_parameter BOOTIF) readonly _IP_=$(get_kernel_parameter ip) # _BOOTIF_ is the hardware type with the MAC address # see http://www.syslinux.org/wiki/index.php/PXELINUX if [[ $_BOOTIF_ =~ ^20.* && ${#_BOOTIF_} == 20 ]]; then # InfiniBand hardware type is 20 with InfiniBand MAC # For example InfiniBand GID: # 80:00:02:08:fe:80:00:00:00:00:00:00:f4:52:14:03:00:3a:16:b1 # is converted to BOOTIF 20:f4:52:14:3a:16:b1 MAC_ADDRESS=$(echo "$_BOOTIF_" | sed -e "s/-/:/g" | \ sed -e "s/^20://g" | tr 'a-f' 'A-F') else # Ethernet BOOTIF hardware type is 01 with MAC MAC_ADDRESS=$(echo "$_BOOTIF_" | sed -e "s/-/:/g" | \ sed -e "s/^01://g" | tr 'a-f' 'A-F') fi readonly BOOT_MAC_ADDRESS=$MAC_ADDRESS # If bootloader did not pass on network info, we fallback to a kernel # parameter to locate the address of the boot server. if [ -n "$_IP_" ]; then readonly BOOT_SERVER=$(echo "$_IP_" | cut -d':' -f2) else readonly BOOT_SERVER=$(get_kernel_parameter boot_server) fi # IP address, netmask, gateway can be set a later point of time if # IP address is assigned by dhcp (for non-pxe boots). BOOT_IP_ADDRESS=$(echo "$_IP_" | cut -d':' -f1) BOOT_NETMASK=$(echo "$_IP_" | cut -d':' -f4) BOOT_GATEWAY=$(echo "$_IP_" | cut -d':' -f3) readonly DISK=$(get_kernel_parameter disk) readonly DEPLOYMENT_ID=$(get_kernel_parameter deployment_id) readonly DEPLOYMENT_KEY=$(get_kernel_parameter deployment_key) readonly ISCSI_TARGET_IQN=$(get_kernel_parameter iscsi_target_iqn) TROUBLESHOOT=$(get_kernel_parameter troubleshoot) diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/init.d/40-check-network-ready0000664000175000017500000000023713640271474032236 0ustar zuulzuul00000000000000if [ -n "$BOOT_SERVER" ]; then echo "pinging to boot server $BOOT_SERVER" wait_for 6 5 ping -c 5 -q "$BOOT_SERVER" > /dev/null fi echo "network ready"diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/cleanup.d/0000775000175000017500000000000013640271564026706 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/cleanup.d/99-extract-ramdisk-files0000775000175000017500000000045413640271474033300 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail IMAGE_NAME=${IMAGE_NAME:-'image'} sudo chmod a+r $TMP_MOUNT_PATH/tmp/ramdisk $TMP_MOUNT_PATH/tmp/kernel cp $TMP_MOUNT_PATH/tmp/ramdisk $IMAGE_NAME.initramfs cp $TMP_MOUNT_PATH/tmp/kernel $IMAGE_NAME.kernel diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk-base/README.rst0000664000175000017500000000015713640271474026527 0ustar zuulzuul00000000000000============ ramdisk-base ============ Shared functionality required by all of the different ramdisk elements. diskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/0000775000175000017500000000000013640271564025021 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/cleanup.d/0000775000175000017500000000000013640271564026672 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/cleanup.d/99-clean-up-cache0000775000175000017500000000145113640271474031625 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2016 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail # NOTE(pabelanger): Remove cached info about APT repositories, as it will go # stale fast. sudo rm -rf $TARGET_ROOT/var/lib/apt/lists/* diskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/package-installs.yaml0000664000175000017500000000010713640271474031125 0ustar zuulzuul00000000000000adduser: ca-certificates: locales: lsb-release: phase: pre-install.d diskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/install.d/0000775000175000017500000000000013640271564026711 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/install.d/12-debian-locale-gen0000775000175000017500000000215713640271474032312 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2015 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail [ -f /etc/locale.gen ] && rm /etc/locale.gen debconf-set-selections - < /etc/default/locale < /etc/hostname # If you want eth0 and eth1 created as DHCP based interfaces, enable # this. You don't want this if systemd is going to call the # interfaces on the real system something else, or if you're using a # network-manager like cloud-init, glean or systemd-networkd that will # handle the interfaces dynamically. if [[ "${DIB_APT_MINIMAL_CREATE_INTERFACES:-1}" -eq "1" ]]; then mkdir -p /etc/network/interfaces.d if ! grep -E -q '^source(|-directory) /etc/network/interfaces.d/\*' /etc/network/interfaces; then echo "source /etc/network/interfaces.d/*" >> /etc/network/interfaces echo 'Network configuration set to source /etc/network/interfaces.d/*' fi for interface in ${DIB_NETWORK_INTERFACE_NAMES}; do cat << EOF | tee /etc/network/interfaces.d/$interface auto $interface iface $interface inet dhcp EOF done fi diskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/install.d/15-cleanup-debootstrap0000775000175000017500000000136213640271474033037 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2015 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail install -d -m 0755 -o root -g root /etc/sudoers.d diskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/README.rst0000664000175000017500000000667213640271474026523 0ustar zuulzuul00000000000000=========== debootstrap =========== Base element for creating minimal debian-based images. This element is incomplete by itself, you'll want to use elements like debian-minimal or ubuntu-minimal to get an actual base image. There are two ways to configure apt-sources: 1. Using the standard way of defining the default, backports, updates and security repositories is the default. In this case you can overwrite the two environment variables to adapt the behavior: * ``DIB_DISTRIBUTION_MIRROR``: the mirror to use (default: ``__) * ``DIB_DEBIAN_COMPONENTS``: (default: ``main``) a comma separated list of components. For Debian this can be e.g. ``main,contrib,non-free``. By default only the ``main`` component is used. If ``DIB_DEBIAN_COMPONENTS`` (comma separated) from the ``debootstrap`` element has been set, that list of components will be used instead. Backports, updates and security are included unless ``DIB_RELEASE`` is ``unstable``. 2. Complete configuration given in the variable ``DIB_APT_SOURCES_CONF``. Each line contains exactly one entry for the sources.list.d directory. The first word must be the logical name (which is used as file name with ``.list`` automatically appended), followed by a colon ``:``, followed by the complete repository specification. .. code-block:: bash DIB_APT_SOURCES_CONF=\ "default:deb http://10.0.0.10/ stretch main contrib mysecurity:deb http://10.0.0.10/ stretch-security main contrib" If necessary, a custom apt keyring and debootstrap script can be supplied to the ``debootstrap`` command via ``DIB_APT_KEYRING`` and ``DIB_DEBIAN_DEBOOTSTRAP_SCRIPT`` respectively. Both options require the use of absolute rather than relative paths. Use of this element will also require the tool 'debootstrap' to be available on your system. It should be available on Ubuntu, Debian, and Fedora. It is also recommended that the 'debian-keyring' package be installed. The ``DIB_OFFLINE`` or more specific ``DIB_DEBIAN_USE_DEBOOTSTRAP_CACHE`` variables can be set to prefer the use of a pre-cached root filesystem tarball. The ``DIB_DEBOOTSTRAP_EXTRA_ARGS`` environment variable may be used to pass extra arguments to the debootstrap command used to create the base filesystem image. If --keyring is used in ``DIB_DEBOOTSTRAP_EXTRA_ARGS``, it will override ``DIB_APT_KEYRING`` if that is used as well. For further information about ``DIB_DEBIAN_DEBOOTSTRAP_SCRIPT`` , ``DIB_DEBIAN_USE_DEBOOTSTRAP_CACHE`` and ``DIB_DEBOOTSTRAP_EXTRA_ARGS`` please consult "README.rst" of the debootstrap element. ---------- Networking ---------- By default ``/etc/network/interfaces.d/eth[0|1]`` files will be created and enabled with DHCP networking. If you do not wish this to be done, set ``DIB_APT_MINIMAL_CREATE_INTERFACES`` to ``0``. If you need different interface names than ``eth[0|1]`` set ``DIB_NETWORK_INTERFACE_NAMES`` to a space separated list of network interface names like: .. code-block:: bash export DIB_NETWORK_INTERFACE_NAMES="ens3 ens4" ------------------- Note on ARM systems ------------------- Because there is not a one-to-one mapping of ``ARCH`` to a kernel package, if you are building an image for ARM on debian, you need to specify which kernel you want in the environment variable ``DIB_ARM_KERNEL``. For instance, if you want the ``linux-image-mx5`` package installed, set ``DIB_ARM_KERNEL`` to ``mx5``. .. element_deps:: diskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/element-deps0000664000175000017500000000003613640271474027325 0ustar zuulzuul00000000000000dpkg modprobe pkg-map sysprep diskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/environment.d/0000775000175000017500000000000013640271564027607 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/environment.d/10-debootstrap-default-localediskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/environment.d/10-debootstrap-default0000664000175000017500000000012113640271474033712 0ustar zuulzuul00000000000000export DIB_DEBOOTSTRAP_DEFAULT_LOCALE=${DIB_DEBOOTSTRAP_DEFAULT_LOCALE:-C.UTF-8} ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/environment.d/20-network-interface-namesdiskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/environment.d/20-network-interface-n0000664000175000017500000000011513640271474033630 0ustar zuulzuul00000000000000export DIB_NETWORK_INTERFACE_NAMES=${DIB_NETWORK_INTERFACE_NAMES:-eth0 eth1} diskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/pkg-map0000664000175000017500000000007213640271474026277 0ustar zuulzuul00000000000000{ "default": { "cloud-initramfs-growroot": "" } } diskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/root.d/0000775000175000017500000000000013640271564026226 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debootstrap/root.d/08-debootstrap0000775000175000017500000000617713640271474030742 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ -f ${TARGET_ROOT}/.extra_settings ] ; then . ${TARGET_ROOT}/.extra_settings fi [ -n "$DISTRO_NAME" ] [ -n "$DIB_RELEASE" ] [ -n "$DIB_DISTRIBUTION_MIRROR" ] DIB_DEBIAN_COMPONENTS=${DIB_DEBIAN_COMPONENTS:-main} DIB_DEBOOTSTRAP_EXTRA_ARGS=${DIB_DEBOOTSTRAP_EXTRA_ARGS:-} DEBOOTSTRAP_TARBALL=$DIB_IMAGE_CACHE/debootstrap-${DISTRO_NAME}-${DIB_RELEASE}-${ARCH}.tar.gz http_proxy=${http_proxy:-} no_proxy=${no_proxy:-} DEBOOTSTRAP_QEMU="" _debootstrap_version=$(debootstrap --version) # could be like "debootstrap 1.0.114~bpo16.04+1" _debootstrap_version=${_debootstrap_version:16:3} if [[ "${DIB_RELEASE}" == "buster" && "${_debootstrap_version}" -lt 105 ]]; then die "Unable to build buster with this debootstrap; see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901977" fi if [ -n "$DIB_OFFLINE" -o -n "${DIB_DEBIAN_USE_DEBOOTSTRAP_CACHE:-}" ] && [ -f $DEBOOTSTRAP_TARBALL ] ; then echo $DEBOOTSTRAP_TARBALL found in cache. Using. sudo tar -C $TARGET_ROOT --numeric-owner -xzf $DEBOOTSTRAP_TARBALL else KEYRING_OPT= if [ -n "${DIB_APT_KEYRING:-${DIB_DEBIAN_KEYRING:-}}" ] ; then KEYRING_OPT="--keyring=${DIB_APT_KEYRING:-${DIB_DEBIAN_KEYRING:-}}" fi # Have to --include=python because of dib-run-parts # Have to --include=sudo for pre-install.d use of sudoers files # Have to --include=busybox because initramfs needs it if [ $(dpkg --print-architecture) != ${ARCH} ]; then # Target architecture different from host architecture: # there is the need to call 'qemu-debootstrap'. DEBOOTSTRAP_QEMU="qemu-" fi sudo sh -c "http_proxy=$http_proxy no_proxy=$no_proxy ${DEBOOTSTRAP_QEMU}debootstrap --verbose \ --variant=minbase \ --components=${DIB_DEBIAN_COMPONENTS} \ --arch=${ARCH} \ $KEYRING_OPT \ $DIB_DEBOOTSTRAP_EXTRA_ARGS \ $DIB_RELEASE \ $TARGET_ROOT \ $DIB_DISTRIBUTION_MIRROR \ ${DIB_DEBIAN_DEBOOTSTRAP_SCRIPT:-}" # debootstrap creates sometimes a not-usable # /etc/apt/sources.list: DIB wants to set up its own anyway # and the old has to go. sudo rm -fr ${TARGET_ROOT}/etc/apt/sources.list \ ${TARGET_ROOT}/etc/apt/sources.list.d echo Caching debootstrap result in $DEBOOTSTRAP_TARBALL if [ "${DIB_DEBOOTSTRAP_CACHE:-0}" != "0" ]; then sudo tar --numeric-owner -C $TARGET_ROOT -zcf $DEBOOTSTRAP_TARBALL --exclude='./tmp/*' . fi fi sudo rm -f ${TARGET_ROOT}/.extra_settings diskimage-builder-2.35.0/diskimage_builder/elements/install-types/0000775000175000017500000000000013640271564025303 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/install-types/extra-data.d/0000775000175000017500000000000013640271564027557 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/install-types/extra-data.d/99-enable-install-typesdiskimage-builder-2.35.0/diskimage_builder/elements/install-types/extra-data.d/99-enable-install-typ0000775000175000017500000000452313640271474033454 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2014 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail declare -a SPECIFIED_ELEMS # Add a blank first element to the array, since we're running with -u, we don't # want an unbound variable error if no element install types were specified. SPECIFIED_ELEMS[0]="" # List of all env vars to set install types PREFIX="DIB_INSTALLTYPE_" INSTALL_TYPE_VARS=$(env | grep ^$PREFIX | cut -d'=' -f1 || echo "") for _install_type_var in $INSTALL_TYPE_VARS; do # Get the element name and its install type INSTALLDIRPREFIX=${_install_type_var:${#PREFIX}} INSTALLDIRPREFIX=${INSTALLDIRPREFIX//_/-} eval INSTALLTYPE=\$$_install_type_var # Create symlink for correct install type pushd $TMP_HOOKS_PATH/install.d if [ -d $INSTALLDIRPREFIX-$INSTALLTYPE-install ]; then ln -sf $INSTALLDIRPREFIX-$INSTALLTYPE-install/* . fi popd SPECIFIED_ELEMS+=($INSTALLDIRPREFIX) done # For any existing *--install directory under install.d, # if an environment variable setting a different install type was not seen, # enable the default (set via --install-type). default_install_type_dirs=$(find $TMP_HOOKS_PATH/install.d -maxdepth 1 -name "*-${DIB_DEFAULT_INSTALLTYPE}-install" -type d) for _install_dir in $default_install_type_dirs; do SUFFIX="-${DIB_DEFAULT_INSTALLTYPE}-install" _install_dir=$(basename $_install_dir) INSTALLDIRPREFIX=${_install_dir%$SUFFIX} found=0 for specified in ${SPECIFIED_ELEMS[@]}; do if [ "$specified" = "$INSTALLDIRPREFIX" ]; then found=1 break fi done # install type not specified, assume source if [ "$found" = "0" ]; then pushd $TMP_HOOKS_PATH/install.d ln -sf $_install_dir/* . popd fi done diskimage-builder-2.35.0/diskimage_builder/elements/install-types/README.rst0000664000175000017500000000332313640271474026773 0ustar zuulzuul00000000000000============= install-types ============= Enable install-types support for elements. Install types permit elements to be installed from different sources, such as git repositories, distribution packages, or pip. The default install type is 'source' but it can be modified on the disk-image-create command line via the --install-type option. For example you can set: --install-type=package to enable package installs by default. Alternately, you can also set DIB\_DEFAULT\_INSTALLTYPE. Many elements expose different install types. The different implementations live under `--install` directories under an element's install.d. The base element enables the chosen install type by symlinking the correct hook scripts under install.d directly. `` can be a string of alphanumeric and '-' characters, but typically corresponds to the element name. For example, the nova element would provide: nova/install.d/nova-package-install/74-nova nova/install.d/nova-source-install/74-nova The following symlink would be created for the package install type: install.d/74-nova -> nova-package-install/74-nova Or, for the source install type: install.d/74-nova -> nova-source-install/74-nova All other scripts that exist under install.d for an element will be executed as normal. This allows common install code to live in a script under install.d. Environment Variables --------------------- DIB_INSTALLTYPE_ :Required: No :Default: source :Description: Set the install type for the dir prefix. '-' characters can be replaced with a '_'. :Example: ``DIB_INSTALLTYPE_simple_init=repo`` Sets the simple-init element install type to be repo. diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/0000775000175000017500000000000013640271564024334 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/extra-data.d/0000775000175000017500000000000013640271564026610 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/extra-data.d/01-inject-defaults0000775000175000017500000000043413640271474032036 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail export OPENSUSE_EXTRAS_PATH="$TMP_MOUNT_PATH/tmp/opensuse-extras" mkdir -p $OPENSUSE_EXTRAS_PATH for file in common-defaults img-defaults ; do cp $_LIB/$file $OPENSUSE_EXTRAS_PATH done diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/test-elements/0000775000175000017500000000000013640271564027125 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/test-elements/opensuse15-build-succeeds/diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/test-elements/opensuse15-build-succeeds0000775000175000017500000000000013640271564033746 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016000000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/test-elements/opensuse15-build-succeeds/README.rstdiskimage-builder-2.35.0/diskimage_builder/elements/opensuse/test-elements/opensuse15-build-succeeds0000664000175000017500000000006113640271474033745 0ustar zuulzuul00000000000000Verify we can build an openSUSE Leap 15.1 image. ././@LongLink0000000000000000000000000000016400000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/test-elements/opensuse15-build-succeeds/environment.d/diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/test-elements/opensuse15-build-succeeds0000775000175000017500000000000013640271564033746 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000020600000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/test-elements/opensuse15-build-succeeds/environment.d/10-set-distro.bashdiskimage-builder-2.35.0/diskimage_builder/elements/opensuse/test-elements/opensuse15-build-succeeds0000664000175000017500000000003013640271474033741 0ustar zuulzuul00000000000000export DIB_RELEASE=15.1 diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/test-elements/build-succeeds/0000775000175000017500000000000013640271564032020 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/test-elements/build-succeeds/README.rst0000664000175000017500000000004713640271474033510 0ustar zuulzuul00000000000000Verify we can build an openSUSE image. ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/test-elements/build-succeeds/element-depsdiskimage-builder-2.35.0/diskimage_builder/elements/opensuse/test-elements/build-succeeds/element-de0000664000175000017500000000002513640271474033757 0ustar zuulzuul00000000000000openstack-ci-mirrors diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/package-installs.yaml0000664000175000017500000000022713640271474030443 0ustar zuulzuul00000000000000# sudo is not included by default. sudo: # install kernel package needed by dkms. kernel-devel: # lsb-release is not included by default. lsb-release: diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/README.rst0000664000175000017500000000212313640271474026021 0ustar zuulzuul00000000000000======== opensuse ======== Use an openSUSE cloud image as the baseline for built disk images. The images are located in distribution specific sub directories under https://download.opensuse.org/repositories/Cloud:/Images:/ These images should be considered experimental. There are currently only x86_64 images. Environment Variables --------------------- DIB_RELEASE :Required: No :Default: 15.1 :Description: Set the desired openSUSE release. DIB_CLOUD_IMAGES :Required: No :Default: https://download.opensuse.org/repositories/Cloud:/Images:/(openSUSE|Leap)_${DIB_RELEASE} :Description: Set the desired URL to fetch the images from. Notes: * There are very frequently new automated builds that include changes that happen during the product maintenance. The download directories contain an unversioned name and a versioned name. The unversioned name will always point to the latest image, but will frequently change its content. The versioned one will never change content, but will frequently be deleted and replaced by a newer build with a higher version-release number. diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/element-provides0000664000175000017500000000002113640271474027532 0ustar zuulzuul00000000000000operating-system diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/element-deps0000664000175000017500000000005213640271474026636 0ustar zuulzuul00000000000000cache-url package-installs sysprep zypper diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/environment.d/0000775000175000017500000000000013640271564027122 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/environment.d/10-opensuse-distro-name.bashdiskimage-builder-2.35.0/diskimage_builder/elements/opensuse/environment.d/10-opensuse-distro-name.b0000664000175000017500000000100713640271474033562 0ustar zuulzuul00000000000000export DISTRO_NAME=opensuse export DIB_RELEASE=${DIB_RELEASE:-15.1} export DIB_OPENSUSE_PATTERNS=patterns-openSUSE-base export DIB_INIT_SYSTEM=systemd case ${DIB_RELEASE} in # Old Leap releases 42*) export OPENSUSE_REPO_DIR=openSUSE_Leap_${DIB_RELEASE} ;; # New Leap releases 15*) export OPENSUSE_REPO_DIR=openSUSE_Leap_${DIB_RELEASE} ;; *) echo "Unsupported openSUSE release: ${DIB_RELEASE}"; exit 1 ;; esac export DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-https://download.opensuse.org} diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/root.d/0000775000175000017500000000000013640271564025541 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/opensuse/root.d/10-opensuse-cloud-image0000775000175000017500000000432213640271474031733 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail [ -n "$ARCH" ] [ -n "$TARGET_ROOT" ] if [ 'amd64' = "$ARCH" ] ; then ARCH="x86_64" fi if ! [ 'x86_64' = "$ARCH" ] ; then echo "Only x86_64 images are currently available but ARCH is set to $ARCH." exit 1 fi # Set some image defaults case ${DIB_RELEASE} in # Old Leap releases 42*) OPENSUSE_IMAGE_BASEDIR=Leap OPENSUSE_IMAGE_FILE=openSUSE-Leap-${DIB_RELEASE}-OpenStack OPENSUSE_IMAGE_EXT=tbz ;; # New Leap releases 15*) OPENSUSE_IMAGE_BASEDIR=Leap OPENSUSE_IMAGE_FILE=openSUSE-Leap-${DIB_RELEASE}-OpenStack OPENSUSE_IMAGE_EXT=tar.xz ;; # We handle unknown cases in environment.d/10-opensuse-distro-name.bash esac # NOTE(toabctl): if something changes here on the buildservice side, please # first ask in #opensuse-cloud on freenode before you change the format here! DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://download.opensuse.org/repositories/Cloud:/Images:/${OPENSUSE_IMAGE_BASEDIR}_${DIB_RELEASE}/images/} BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-${OPENSUSE_IMAGE_FILE}-rootfs.${ARCH}.${OPENSUSE_IMAGE_EXT}} SHA256SUMS_FILE=${SHA256SUMS_FILE:-${BASE_IMAGE_FILE}.sha256} CACHED_FILE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE CACHED_SHA256SUMS_FILE=$DIB_IMAGE_CACHE/SHA256SUMS.$BASE_IMAGE_FILE # FIXME: either check the checksums into git or verify the signature # on the checksums. We should not be trusting checksums we download # over HTTP if [ -n "$DIB_OFFLINE" -a -f "$CACHED_FILE" ] ; then echo "Not checking freshness of cached $CACHED_FILE." else echo "Fetching Base Image" $TMP_HOOKS_PATH/bin/cache-url $DIB_CLOUD_IMAGES/$SHA256SUMS_FILE $CACHED_SHA256SUMS_FILE $TMP_HOOKS_PATH/bin/cache-url $DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE $CACHED_FILE pushd $DIB_IMAGE_CACHE # Calculate sha256sum of downloaded image and check against content from sha256 file SHA256SUM=$(sha256sum ${BASE_IMAGE_FILE} | cut -d " " -f1) grep -q $SHA256SUM SHA256SUMS.$BASE_IMAGE_FILE popd fi # Extract the base image (use --numeric-owner to avoid UID/GID mismatch between # image tarball and host OS) sudo tar -C $TARGET_ROOT --numeric-owner -xf $CACHED_FILE diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/0000775000175000017500000000000013640271564025405 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/binary-deps.d/0000775000175000017500000000000013640271564030044 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/binary-deps.d/dracut-ramdisk0000664000175000017500000000007513640271474032703 0ustar zuulzuul00000000000000tail head awk ifconfig cut expr route ping nc wget tftp grep diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/extra-data.d/0000775000175000017500000000000013640271564027661 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/extra-data.d/scripts/0000775000175000017500000000000013640271564031350 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/extra-data.d/scripts/module/0000775000175000017500000000000013640271564032635 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/extra-data.d/scripts/module/module-setup.shdiskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/extra-data.d/scripts/module/modul0000775000175000017500000000046113640271474033704 0ustar zuulzuul00000000000000#!/bin/bash # Dracut is bash too, and it doesn't play nicely with our usual sets # dib-lint: disable=setu sete setpipefail dibdebugtrace check() { return 0 } depends() { return 0 } install() { inst_hook cmdline 80 "$moddir/deploy-cmdline.sh" inst_hook pre-mount 50 "$moddir/init.sh" } ././@LongLink0000000000000000000000000000016100000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/extra-data.d/scripts/module/deploy-cmdline.shdiskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/extra-data.d/scripts/module/deplo0000775000175000017500000000103713640271474033667 0ustar zuulzuul00000000000000#!/bin/bash # NOTE(bnemec): Dracut doesn't like it if we enable these # dib-lint: disable=setu sete setpipefail dibdebugtrace # We never let Dracut boot off the specified root anyway, so all # we need is a value it will accept. root=/dev/zero rootok=1 # Dracut doesn't correctly parse the ip argument passed to us. # Override /proc/cmdline to rewrite it in a way dracut can grok. sed 's/\(ip=\S\+\)/\1:::off/' /proc/cmdline > /run/cmdline mount -n --bind -o ro /run/cmdline /proc/cmdline # Force Dracut to re-read the cmdline args CMDLINE= diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/dracut-drivers.d/0000775000175000017500000000000013640271564030565 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/dracut-drivers.d/base-drivers0000664000175000017500000000003513640271474033074 0ustar zuulzuul00000000000000virtio virtio_net virtio_blk diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/post-install.d/0000775000175000017500000000000013640271564030260 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/post-install.d/99-build-dracut-ramdiskdiskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/post-install.d/99-build-dracut-ra0000775000175000017500000000567613640271474033442 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail _LIB="/tmp/ramdisk-build" source "$_LIB/common-defaults" source "$_LIB/img-defaults" source "$_LIB/ramdisk-defaults" source "$_LIB/common-functions" source "$_LIB/img-functions" source "$_LIB/ramdisk-functions" KERNEL_VERSION="${DIB_KERNEL_VERSION:-$(find_kernel_version)}" MODULE_DIR="$MODULE_ROOT/lib/modules/$KERNEL_VERSION" FIRMWARE_DIR="$MODULE_ROOT/lib/firmware" LIB_UDEV="$LIB_UDEV_ROOT/lib/udev" INIT="$_LIB/scripts/init" FUNCTIONS_D="$_LIB/scripts/d" MODULE="$_LIB/scripts/module" # NOTE(bnemec): IMAGE_ELEMENT is normally set in disk-image-create, but we're # not using that to build the image here. IMAGE_ELEMENT= mk_build_dir mkdir -p "$TMP_BUILD_DIR/mnt" export TMP_HOOKS_PATH=/tmp export TMP_MOUNT_PATH="$TMP_BUILD_DIR/mnt" echo "building ramdisk in $TMP_MOUNT_PATH" populate_init SCRIPT_HOME=/tmp/in_target.d/bin TMP_HOOKS_PATH=/tmp/in_target.d run_d ramdisk-install MODULE_PATH="/usr/lib/dracut/modules.d" cp -r "$MODULE" "$MODULE_PATH/80deploy-ramdisk" mv "$TMP_MOUNT_PATH/init" "$MODULE_PATH/80deploy-ramdisk/init.sh" # NOTE(bnemec): Workaround for bug in Dracut. This fix has been proposed to # Dracut as well in https://github.com/haraldh/dracut/pull/34 , and once it has # been released for all of our supported platforms we can remove this. Until then # this makes --include work correctly and will be a noop if we're running a fixed # Dracut version. sed -i 's|cp --reflink=auto --sparse=auto -fa -t "$s" "$i"$|cp --reflink=auto --sparse=auto -fa -t "${initdir}/${tgt}" "$i"|g' $(type -p dracut) # Notes on the options passed to Dracut: # -N: Do not build a host-specific ramdisk. We want to be able to run this ramdisk # on as many different machines as possible. # --install: A list of the binaries needed by our ramdisk script fragments. # --kernel-cmdline: Kernel parameters to pass to the ramdisk. rd.neednet is required # to force Dracut to bring up networking even if it isn't passed a # network target root. Pre-loading the ahci module is necessary # on some systems to ensure that SATA disks are recognized. # --include: Files from the chroot to include in the ramdisk. # --kver: The kernel version to use, as determined above. # --add-drivers: Extra kernel modules to include in the ramdisk. # -o: Force omission of these dracut modules. Our scripts are written for bash, # so dash is not desirable, and plymouth was causing some issues on Ubuntu. dracut -N \ --install "$(cat /etc/dib_binary_deps)" \ --kernel-cmdline "rd.shell rd.debug rd.neednet=1 rd.driver.pre=ahci" \ --include "$TMP_MOUNT_PATH/" / \ --kver "${KERNEL_VERSION}" \ --add-drivers "$(cat /etc/dib_dracut_drivers)" \ -o "dash plymouth" \ /tmp/ramdisk cp "/boot/vmlinuz-${KERNEL_VERSION}" /tmp/kernel chmod o+r /tmp/kernel # We don't want to run cleanup (set in mk_build_dir above) when this exits trap EXIT diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/post-install.d/01-ensure-drivers0000775000175000017500000000116113640271474033400 0ustar zuulzuul00000000000000#!/bin/bash set -eu set -o pipefail if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi TARGET_DIR="/tmp/in_target.d/" EXTRA_DRIVERS= for _FILE in $(ls ${TARGET_DIR}/dracut-drivers.d/) ; do _FILE="${TARGET_DIR}/dracut-drivers.d/${_FILE}" if [ -s $_FILE ]; then for _LINE in $(cat $_FILE) ; do EXTRA_DRIVERS="${EXTRA_DRIVERS} $_LINE" done fi done if [ "$EXTRA_DRIVERS" = "" ]; then echo "No extra drivers found" else DRIVERS_OUTPUT="/etc/dib_dracut_drivers" echo "Creating extra drivers record at: ${DRIVERS_OUTPUT}" echo "$EXTRA_DRIVERS" >${DRIVERS_OUTPUT} fi diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/init.d/0000775000175000017500000000000013640271564026572 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/init.d/00-override-troubleshoot0000664000175000017500000000037013640271474033300 0ustar zuulzuul00000000000000# NOTE(bnemec): Dracut provides its own emergency shell, and it doesn't # seem to allow directly starting bash as the existing troubleshoot function # does. function troubleshoot() { echo "Starting troubleshooting shell." emergency_shell } diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/install.d/0000775000175000017500000000000013640271564027275 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/install.d/20-install-dracut-deps0000775000175000017500000000123513640271474033322 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail DRACUT_NETWORK="dracut-network" if [ 'ubuntu' = "$DISTRO_NAME" ]; then DRACUT_NETWORK= # Install Dracut from source because the packaged version is # broken and old. For Dracut builds we throw away the chroot # anyway so it won't matter if we've installed some build deps. install-packages build-essential arping pushd /tmp tar xJvf dracut.tar.xz pushd dracut-$DRACUT_VERSION ./configure make make install popd popd fi PACKAGES=$(pkg-map --element dracut-ramdisk ncat tftp) install-packages $DRACUT_NETWORK wget $PACKAGES diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/README.rst0000664000175000017500000000144113640271474027074 0ustar zuulzuul00000000000000============== dracut-ramdisk ============== Build Dracut-based ramdisks This is an alternative to the `ramdisk` element that uses Dracut to provide the base system functionality instead of Busybox. For elements that need additional drivers in the ramdisk image, a dracut-drivers.d feature is included that works in a similar fashion to the binary-deps.d feature. The element needing to add drivers should create a dracut-drivers.d directory and populate it with a single file listing all of the kernel modules it needs added to the ramdisk. Comments are not supported in this file. Note that these modules must be installed in the chroot first. By default, the virtio, virtio_net, and virtio_blk modules are included so that ramdisks are able to function properly in a virtualized environment. diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/source-repository-dracut0000664000175000017500000000016013640271474032322 0ustar zuulzuul00000000000000dracut file /tmp/dracut.tar.xz https://www.kernel.org/pub/linux/utils/boot/dracut/dracut-$DRACUT_VERSION.tar.xz diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/element-deps0000664000175000017500000000007213640271474027711 0ustar zuulzuul00000000000000deploy-targetcli pkg-map ramdisk-base source-repositories diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/environment.d/0000775000175000017500000000000013640271564030173 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/environment.d/10-dracut-version.bashdiskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/environment.d/10-dracut-version.b0000664000175000017500000000012613640271474033520 0ustar zuulzuul00000000000000# Using 037 because that matches the current Fedora package export DRACUT_VERSION=037 diskimage-builder-2.35.0/diskimage_builder/elements/dracut-ramdisk/pkg-map0000664000175000017500000000037213640271474026666 0ustar zuulzuul00000000000000{ "family":{ "debian":{ "ncat":"netcat-traditional", "tftp":"tftp-hpa" }, "redhat":{ "ncat":"nmap-ncat" }, "suse":{ "arping": "iputils" } }, "default":{ "ncat":"ncat", "tftp":"tftp" } } diskimage-builder-2.35.0/diskimage_builder/elements/modprobe/0000775000175000017500000000000013640271564024302 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/modprobe/extra-data.d/0000775000175000017500000000000013640271564026556 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/modprobe/extra-data.d/50-modprobe-blacklist0000775000175000017500000000166013640271474032506 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail # This would only not be here if there was no kmod package installed, # which can happen in some container situations. Obviously # blacklisting a kernel module is not really useful; however allowing # this to work can allow modules that do other things that *are* # useful for a container to "just work" without a whole bunch of # refactoring. if [ ! -d $TMP_MOUNT_PATH/etc/modprobe.d ]; then # ^ so we can see in the logs if we took this path ... sudo mkdir -p $TMP_MOUNT_PATH/etc/modprobe.d fi # copy all modprobe.d snippets to /etc/modprobe.d eval declare -A image_elements=($(get_image_element_array)) for i in "${!image_elements[@]}"; do element=$i element_dir=${image_elements[$i]} if [ -d "${element_dir}/modprobe.d/" ]; then sudo cp ${element_dir}/modprobe.d/*.conf $TMP_MOUNT_PATH/etc/modprobe.d/ fi done diskimage-builder-2.35.0/diskimage_builder/elements/modprobe/install.d/0000775000175000017500000000000013640271564026172 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/modprobe/install.d/80-modprobe-blacklist0000775000175000017500000000036113640271474032122 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail MODULES_LIST=${DIB_MODPROBE_BLACKLIST:-""} for mod_name in $MODULES_LIST; do echo "blacklist $mod_name" >> /etc/modprobe.d/blacklist.conf done diskimage-builder-2.35.0/diskimage_builder/elements/modprobe/README.rst0000664000175000017500000000125613640271474025775 0ustar zuulzuul00000000000000======== modprobe ======== Allows to configure specific modprobe options on the image. It contains the following functionalities: 1. Ability to blacklist specific modules using modprobe.d/blacklist.conf. In order to use set DIB_MODPROBE_BLACKLIST to the name of your module. To disable multiple modules you can set DIB_MODPROBE_BLACKLIST to a list of string separated by spaces. Example: export DIB_MODPROBE_BLACKLIST="igb" 2. Ability to copy specific files into /etc/modprobe.d directory, so it allows to configure settings with freedom. To achieve that, the files to be copied needs to be placed inside an specific modprobe.d directory of the element. diskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/0000775000175000017500000000000013640271564026300 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/package-installs.yaml0000664000175000017500000000003713640271474032406 0ustar zuulzuul00000000000000dhcp-client: ifupdown: ndisc6: diskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/install.d/0000775000175000017500000000000013640271564030170 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016100000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces-udev.rulesdiskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interface0000664000175000017500000000016213640271474033534 0ustar zuulzuul00000000000000SUBSYSTEM=="net", KERNEL!="lo", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}+="dhcp-interface@$name.service" ././@LongLink0000000000000000000000000000016300000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/install.d/60-remove-cloud-image-interfacesdiskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/install.d/60-remove-cloud-im0000775000175000017500000000152113640271474033344 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # Cloud images may hard code the eth0 interfaces so they # boot with DHCP. # Fedora rm -f /etc/sysconfig/network-scripts/ifcfg-eth* # Ubuntu rm -f /etc/network/interfaces.d/eth*.cfg # Debian rm -f /etc/network/interfaces.d/eth* # Gentoo rm -f /etc/conf.d/net* # /etc/network/interfaces distributions if [ -f "/etc/network/interfaces" ]; then printf "auto lo\niface lo inet loopback\n\n" > /etc/network/interfaces if [ -d "/etc/network/interfaces.d/" ]; then if [ "$DISTRO_NAME" == "ubuntu" ] && [ "$DIB_RELEASE" == "trusty" ]; then printf "source-directory interfaces.d\n\n" >> /etc/network/interfaces else printf "source /etc/network/interfaces.d/*\n\n" >> /etc/network/interfaces fi fi fi ././@LongLink0000000000000000000000000000015300000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.initdiskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interface0000775000175000017500000000127413640271474033544 0ustar zuulzuul00000000000000#!/bin/sh -e ### BEGIN INIT INFO # Provides: dhcp-all-interfaces # Required-Start: $local_fs # Required-Stop: $local_fs # Default-Start: S # Default-Stop: 0 6 # X-Start-Before: networking # chkconfig: 3 9 50 # Short-Description: Autodetect network interfaces # Description: Autodetect network interfaces during boot and configure them for DHCP ### END INIT INFO NAME=dhcp-all-interfaces INIT_NAME=/etc/init.d/${NAME} SCRIPT_NAME=/usr/local/sbin/${NAME}.sh [ -x $SCRIPT_NAME ] || exit 0 case "$1" in start) $SCRIPT_NAME ;; stop) ;; *) echo "Usage: $INIT_NAME {start|stop}" exit 1 ;; esac exit 0 ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.shdiskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interface0000775000175000017500000001635713640271474033554 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail INTERFACE=${1:-} #optional, if not specified configure all available interfaces ENI_FILE="/etc/network/interfaces" PATH=/sbin:$PATH if [ -d "/etc/network" ]; then CONF_TYPE="eni" elif [ -d "/etc/sysconfig/network-scripts/" ]; then CONF_TYPE="rhel-netscripts" SCRIPTS_PATH="/etc/sysconfig/network-scripts/" elif [ -d "/etc/sysconfig/network/" ]; then # SUSE network scripts location CONF_TYPE="suse-netscripts" SCRIPTS_PATH="/etc/sysconfig/network/" else echo "Unsupported network configuration type!" exit 1 fi ARGS="$0 $@" function serialize_me() { if [ "$CONF_TYPE" == "eni" ]; then # Serialize runs so that we don't miss hot-add interfaces FLOCKED=${FLOCKED:-} if [ -z "$FLOCKED" ] ; then FLOCKED=true exec flock -x $ENI_FILE $ARGS fi fi } function get_if_link() { cat /sys/class/net/${1}/carrier || echo 0 } function get_if_type() { cat /sys/class/net/${1}/type } function enable_interface() { local interface=$1 local ipv6_init=$2 local ipv6_AdvManagedFlag=$3 local ipv6_AdvOtherConfigFlag=$4 serialize_me if [ "$CONF_TYPE" == "eni" ]; then printf "auto $interface\niface $interface inet dhcp\n\n" >>$ENI_FILE if [ "$ipv6_init" == "True" ]; then # Make DUID-UUID Type 4 (RFC 6355) echo "default-duid \"\\x00\\x04$(sed 's/.\{2\}/\\x&/g' < /etc/machine-id)\";" >"/var/lib/dhclient/dhclient6--$interface.lease" if [ $ipv6_AdvManagedFlag == "Yes" ]; then # IPv6 DHCPv6 Stateful address configuration printf "iface $interface inet6 dhcp\n\n" >>$ENI_FILE echo "DHCPv6 Stateful Configured." elif [ $ipv6_AdvOtherConfigFlag == "Yes" ]; then # IPv6 DHCPv6 Stateless address configursation printf "iface $interface inet6 auto\n\tdhcp 1\n\n" >>$ENI_FILE echo "DHCPv6 Stateless Configured." else # IPv6 Autoconfiguration (SLAAC) printf "iface $interface inet6 auto\tdhcp 0\n\n" >>$ENI_FILE echo "IPv6 SLAAC Configured" fi fi printf "\n" >>$ENI_FILE elif [ "$CONF_TYPE" == "rhel-netscripts" ]; then if [ "$(get_if_type $interface)" == "32" ]; then printf "DEVICE=\"$interface\"\nBOOTPROTO=\"dhcp\"\nONBOOT=\"yes\"\nTYPE=\"InfiniBand\"\nCONNECTED_MODE=\"no\"\nDEFROUTE=\"yes\"\nPEERDNS=\"yes\"\nPEERROUTES=\"yes\"\nIPV4_FAILURE_FATAL=\"yes\"\nIPV6INIT=\"no\"" >"${SCRIPTS_PATH}ifcfg-$interface" else printf "DEVICE=\"$interface\"\nBOOTPROTO=\"dhcp\"\nONBOOT=\"yes\"\nTYPE=\"Ethernet\"\n" >"${SCRIPTS_PATH}ifcfg-$interface" if [ "$ipv6_init" == "True" ]; then # Make DUID-UUID Type 4 (RFC 6355) echo "default-duid \"\\x00\\x04$(sed 's/.\{2\}/\\x&/g' < /etc/machine-id)\";" >"/var/lib/dhclient/dhclient6--$interface.lease" printf "IPV6INIT=\"yes\"\n" >>"${SCRIPTS_PATH}ifcfg-$interface" if [ $ipv6_AdvManagedFlag == "Yes" ]; then # IPv6 DHCPv6 Stateful address configuration printf "IPV6_FORCE_ACCEPT_RA=\"yes\"\nDHCPV6C=\"yes\"\n" >>"${SCRIPTS_PATH}ifcfg-$interface" echo "DHCPv6 Stateful Configured" elif [ $ipv6_AdvOtherConfigFlag == "Yes" ]; then # IPv6 DHCPv6 Stateless address configursation printf "IPV6_AUTOCONF=\"yes\"\nDHCPV6C=\"yes\"\nDHCPV6C_OPTIONS=\"-S\"\n" >>"${SCRIPTS_PATH}ifcfg-$interface" echo "DHCPv6 Stateless Configured" else # IPv6 Autoconfiguration (SLAAC) printf "IPV6_AUTOCONF=\"yes\"\n" >>"${SCRIPTS_PATH}ifcfg-$interface" echo "IPv6 SLAAC Configured" fi fi fi elif [ "$CONF_TYPE" == "suse-netscripts" ]; then printf "BOOTPROTO=\"dhcp\"\nSTARTMODE=\"auto\"" >"${SCRIPTS_PATH}ifcfg-$interface" fi echo "Configured $1" } function config_exists() { local interface=$1 if [[ "$CONF_TYPE" =~ "netscripts" ]]; then if [ -f "${SCRIPTS_PATH}ifcfg-$interface" ]; then return 0 fi else if ifquery $interface >/dev/null 2>&1; then if [ -z "$(ifquery $interface 2>&1)" ]; then return 1 else return 0 fi else return 1 fi fi return 1 } function inspect_interface() { local interface=$1 local mac_addr_type mac_addr_type=$(cat /sys/class/net/${interface}/addr_assign_type) echo -n "Inspecting interface: $interface..." if config_exists $interface; then echo "Has config, skipping." elif [ "$mac_addr_type" != "0" ]; then echo "Device has generated MAC, skipping." else local has_link local tries=DIB_DHCP_TIMEOUT for ((; tries > 0; tries--)); do # Need to set the link up on each iteration ip link set dev $interface up &>/dev/null has_link=$(get_if_link $interface) [ "$has_link" == "1" ] && break sleep 1 done if [ "$has_link" == "1" ]; then local ipv6_init=False local ipv6_AdvManagedFlag=No local ipv6_AdvOtherConfigFlag=No if type rdisc6 &>/dev/null; then # We have rdisc6, let's try to configure IPv6 autoconfig/dhcpv6 tries=DIB_DHCP_TIMEOUT for ((; tries > 0; tries--)); do # Need to retry this, link-local-address required for # Neighbor Discovery, DHCPv6 etc. set +e # Do not exit on error, capture rdisc6 error codes. RA=$(rdisc6 --retry 3 --single "$interface" 2>/dev/null) local return_code=$? set -e # Re-enable exit on error. if [ $return_code -eq 0 ]; then ipv6_init=True ipv6_AdvManagedFlag=$(echo "$RA" | grep "Stateful address conf." | awk -F: '{ print $2 }') ipv6_AdvOtherConfigFlag=$(echo "$RA" | grep "Stateful other conf." | awk -F: '{ print $2 }') break elif [ $return_code -eq 1 ]; then sleep 1 elif [ $return_code -eq 2 ]; then # If rdisc6 does not receive any response after the # specified number of attempts waiting for wait_ms # (1000ms by default) milliseconds each time, it will # exit with code 2. break fi done else echo "rdisc6 not available, skipping IPv6 configuration." fi enable_interface "$interface" "$ipv6_init" "$ipv6_AdvManagedFlag" "$ipv6_AdvOtherConfigFlag" else echo "No link detected, skipping" fi fi } if [ -n "$INTERFACE" ]; then inspect_interface $INTERFACE else for iface in $(ls /sys/class/net | grep -v ^lo$); do inspect_interface $iface done fi ././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-interface@.servicediskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-interface@.se0000664000175000017500000000136213640271474033477 0ustar zuulzuul00000000000000[Unit] Description=DHCP interface %i # We want to run after network.target so it doesn't try to bring # up the interfaces a second time, but network-online should not # be reached until after we've brought up the interfaces. # We also need to break the default dependencies which prevents # this from operating on Ubuntu/Debian as the unit gets stuck # into a cyclical dependency loop. DefaultDependencies=no After=network.target Before=network-online.target Wants=network-online.target ConditionPathExists=!/etc/sysconfig/network-scripts/ifcfg-%i [Service] Type=oneshot User=root ExecStartPre=/usr/local/sbin/dhcp-all-interfaces.sh %i ExecStart=/sbin/ifup %i RemainAfterExit=true TimeoutStartSec=DIB_DHCP_TIMEOUT [Install] WantedBy=multi-user.target ././@LongLink0000000000000000000000000000015300000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.confdiskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interface0000664000175000017500000000053213640271474033535 0ustar zuulzuul00000000000000# Call a script to generate a /etc/network/interfaces file to DHCP all available interfaces # Then remove this config file so the script is never run again description "DHCP any connected, but unconfigured network interfaces" start on starting network-interface instance $INTERFACE task exec /usr/local/sbin/dhcp-all-interfaces.sh $INTERFACE ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfacesdiskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interf0000775000175000017500000000536713640271474033324 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail SCRIPTDIR=$(dirname $0) # TODO(hjensas): Once ndisc6 package is available in EPEL8 drop this, and add the package back in pkg-map. # See: https://bugzilla.redhat.com/show_bug.cgi?id=1779134 if [ -e "/etc/redhat-release" ]; then if type dnf &>/dev/null; then dnf -v -y install ndisc6 || true else yum -v -y install ndisc6 || true fi fi # this script is not needed on Gentoo. if [ "$DISTRO_NAME" != "gentoo" ]; then install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.sh /usr/local/sbin/dhcp-all-interfaces.sh sed -i "s/DIB_DHCP_TIMEOUT/${DIB_DHCP_TIMEOUT:-30}/" /usr/local/sbin/dhcp-all-interfaces.sh fi if [ -f /etc/dhcp/dhclient.conf ] ; then # Set the dhclient timeout configurations to match DIB_DHCP_TIMEOUT, if grep -o "^timeout " /etc/dhcp/dhclient.conf ; then sed -i -e "s/^timeout .*/# \"timeout\" Value set by dhcp-all-interfaces\ntimeout ${DIB_DHCP_TIMEOUT:-30};/" /etc/dhcp/dhclient.conf else echo -e "# \"timeout\" Value set by dhcp-all-interfaces\ntimeout ${DIB_DHCP_TIMEOUT:-30};" >> /etc/dhcp/dhclient.conf fi if grep -o "^retry " /etc/dhcp/dhclient.conf ; then sed -i -e '/^retry/s/^/# \"retry\" Value commented by dhcp-all-interfaces\n# /g' /etc/dhcp/dhclient.conf fi fi if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then if [ -e "/etc/redhat-release" ] ; then # the init system is upstart but networking is using sysv compatibility (i.e. Centos/RHEL 6) install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.init /etc/init.d/dhcp-all-interfaces chkconfig dhcp-all-interfaces on else install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.conf /etc/init/dhcp-all-interfaces.conf fi elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then install -D -g root -o root -m 0644 ${SCRIPTDIR}/dhcp-interface@.service /usr/lib/systemd/system/dhcp-interface@.service install -D -g root -o root -m 0644 ${SCRIPTDIR}/dhcp-all-interfaces-udev.rules /etc/udev/rules.d/99-dhcp-all-interfaces.rules sed -i "s/TimeoutStartSec=DIB_DHCP_TIMEOUT/TimeoutStartSec=$(( ${DIB_DHCP_TIMEOUT:-30} * 2 ))s/" /usr/lib/systemd/system/dhcp-interface@.service elif [ "$DIB_INIT_SYSTEM" == "sysv" ]; then install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.init /etc/init.d/dhcp-all-interfaces update-rc.d dhcp-all-interfaces defaults elif [ "$DISTRO_NAME" == "gentoo" ]; then # let ipv6 use normal slaac sed -i 's/slaac/#slaac/g' /etc/dhcpcd.conf # don't let dhcpcd set domain name or hostname sed -i 's/domain_name\,\ domain_search\,\ host_name/domain_search/g' /etc/dhcpcd.conf rc-update add dhcpcd default fi diskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/README.rst0000664000175000017500000000222013640271474027763 0ustar zuulzuul00000000000000=================== dhcp-all-interfaces =================== Autodetect network interfaces during boot and configure them for DHCP The rationale for this is that we are likely to require multiple network interfaces for use cases such as baremetal and there is no way to know ahead of time which one is which, so we will simply run a DHCP client on all interfaces with real MAC addresses (except lo) that are visible on the first boot. On non-Gentoo based distributions the script /usr/local/sbin/dhcp-all-interfaces.sh will be called early in each boot and will scan available network interfaces and ensure they are configured properly before networking services are started. On Gentoo based distributions we will install the dhcpcd package and ensure the service starts at boot. This service automatically sets up all interfaces found via dhcp and/or dhcpv6 (or SLAAC). Environment Variables --------------------- DIB_DHCP_TIMEOUT :Required: No :Default: 30 :Description: Amount of time in seconds that the systemd service(or dhclient) will wait to get an address. Should be increased in networks such as Infiniband. :Example: DIB_DHCP_TIMEOUT=300 diskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/element-deps0000664000175000017500000000005113640271474030601 0ustar zuulzuul00000000000000dib-init-system package-installs pkg-map diskimage-builder-2.35.0/diskimage_builder/elements/dhcp-all-interfaces/pkg-map0000664000175000017500000000064613640271474027565 0ustar zuulzuul00000000000000{ "family": { "redhat": { "dhcp-client": "dhclient", "ndisc6": "" }, "gentoo": { "dhcp-client": "net-misc/dhcpcd", "ndisc6": "net-misc/ndisc6" }, "suse": { "dhcp-client": "dhcp-client" }, "debian": { "ifupdown": "ifupdown", "ndisc6": "ndisc6" } }, "default": { "dhcp-client": "isc-dhcp-client", "ifupdown": "", "ndisc6": "" } } diskimage-builder-2.35.0/diskimage_builder/elements/dkms/0000775000175000017500000000000013640271564023431 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dkms/post-install.d/0000775000175000017500000000000013640271564026304 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dkms/post-install.d/97-dkms0000775000175000017500000000150013640271474027421 0ustar zuulzuul00000000000000#!/bin/bash # Trigger a run of dkms for all the modules installed # to ensure we have valid modules build for all. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail modules=$(dkms status | tr ',:' ' ' | awk '{ print $1 "/" $2 }') kernels=$(ls /usr/src/linux-headers-*-*-* -d | sed -e 's|/usr/src/linux-headers-||' || echo "") # NOTE(bnemec): On Fedora, the versions can be found in /usr/src/kernels if [ -z "$kernels" ]; then kernels=$(ls /usr/src/kernels/* -d | sed -e 's|/usr/src/kernels/||' || echo "") fi if [ -z "$kernels" ]; then echo "Warning: No kernel versions found for DKMS" fi __ARCH=$ARCH unset ARCH for module in $modules ; do for kernel in $kernels ; do dkms build $module -k $kernel dkms install $module -k $kernel done done ARCH=$__ARCH dkms status diskimage-builder-2.35.0/diskimage_builder/elements/dkms/package-installs.yaml0000664000175000017500000000000613640271474027533 0ustar zuulzuul00000000000000dkms: diskimage-builder-2.35.0/diskimage_builder/elements/dkms/README.rst0000664000175000017500000000046013640271474025120 0ustar zuulzuul00000000000000==== dkms ==== This is the dkms (Dynamic Kernel Module System) element. Some distributions such as Fedora and Ubuntu include DKMS in their packaging. In these distros, it is reasonable to include dkms. Other RHEL based derivatives do not include DKMS, so those distros should not use the DKMS element. diskimage-builder-2.35.0/diskimage_builder/elements/dkms/element-deps0000664000175000017500000000002113640271474025727 0ustar zuulzuul00000000000000package-installs diskimage-builder-2.35.0/diskimage_builder/elements/lvm/0000775000175000017500000000000013640271564023271 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/lvm/package-installs.yaml0000664000175000017500000000002713640271474027376 0ustar zuulzuul00000000000000lvm2: initramfs-tools: diskimage-builder-2.35.0/diskimage_builder/elements/lvm/README.rst0000664000175000017500000000072013640271474024757 0ustar zuulzuul00000000000000===== lvm ===== This is the LVM support element for Ubuntu Xenial. Note that this element requires initramfs-tools and lvm2 packages to be added to the DIB image using -p option. If this is not the case, an error will be triggered. This element enables that an image build with a customized DIB_BLOCK_DEVICE_CONFIG containing LVM volumes will boot properly. On CentOS like distributions, you should use dracut-regenerate element instead of current lvm element. diskimage-builder-2.35.0/diskimage_builder/elements/lvm/element-deps0000664000175000017500000000004213640271474025572 0ustar zuulzuul00000000000000bootloader pkg-map ubuntu-minimal diskimage-builder-2.35.0/diskimage_builder/elements/lvm/finalise.d/0000775000175000017500000000000013640271564025305 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/lvm/finalise.d/60-bootloader0000775000175000017500000000450113640271474027610 0ustar zuulzuul00000000000000#!/bin/bash # Configure grub. Note that the various conditionals here are to handle # different distributions gracefully. if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail BOOT_DEV=$IMAGE_BLOCK_DEVICE # All available devices, handy for some bootloaders... declare -A DEVICES eval DEVICES=( $IMAGE_BLOCK_DEVICES ) # This might be better factored out into a per-distro 'install-bootblock' # helper. if [ -d /boot/grub2 ]; then GRUB_CFG=/boot/grub2/grub.cfg elif [ -d /boot/grub ]; then GRUB_CFG=/boot/grub/grub.cfg fi if type grub2-mkconfig >/dev/null; then GRUB_MKCONFIG="grub2-mkconfig -o $GRUB_CFG" else GRUB_MKCONFIG="grub-mkconfig -o $GRUB_CFG" fi # Retrieve root filesystem mount point to check if it is LVM based ROOTFS=$(awk '$2=="/"{print}' /proc/mounts) # Standard filesystems are mounted as /dev/mapper/loop* within DIB # so we need to exclude this case if echo "$ROOTFS" | grep -qv '/dev/mapper/loop'; then # LVM based filesystems are mounted as /dev/mapper/- within DIB if echo "$ROOTFS" | grep -q '/dev/mapper/'; then # Check if initramfs-tools are installed if [ ! -d /etc/initramfs-tools ]; then echo "You must have initramfs-tools installed for LVM based root filesystem to work properly" exit 1 fi # Check if system supports LVM if ! type pvs >/dev/null 2>&1; then echo "You must have lvm2 package installed for LVM based root filesystem to work properly" exit 1 fi # Check for appropriate filesystem support (for fsck) FSTYPE=$(echo $ROOTFS | awk '{print $3}') if ! type fsck.$FSTYPE >/dev/null 2>&1; then echo "You must have utility package for $FSTYPE filesystem installed for LVM based root filesystem to work properly (fsck.$FSTYPE is missing)" exit 1 fi # Change the current GRUB_DEVICE from LABEL=(cloud)img-rootfs to /dev/mapper/... sed -i -e "s?^GRUB_DEVICE=.*?GRUB_DEVICE=$(echo $ROOTFS | awk '{print $1}')?" /etc/default/grub # This is required for LVM2 driver to be included in the # ramdisk of the image. echo "lvm2" >> /etc/initramfs-tools/modules # We need to regenerated the init ramdisk at this point update-initramfs -u -v fi fi $GRUB_MKCONFIG diskimage-builder-2.35.0/diskimage_builder/elements/lvm/root.d/0000775000175000017500000000000013640271564024476 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/lvm/root.d/10-lvm-check-distro0000775000175000017500000000062013640271474030013 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ 'ubuntu' != $DISTRO_NAME ]; then echo "Only ubuntu is supported for LVM support. The DISTRO is set to $DISTRO_NAME" exit 1 fi if [[ ! $DIB_RELEASE =~ (xenial|bionic) ]]; then echo "Only xenial and bionic are supported for LVM support. The DIB_RELEASE is set to $DIB_RELEASE" exit 1 fi diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/0000775000175000017500000000000013640271564026220 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/post-install.d/0000775000175000017500000000000013640271564031073 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/post-install.d/89-clean-up-pip-cachediskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/post-install.d/89-clean-up-pi0000775000175000017500000000042013640271474033365 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # TODO(johnsom) Fix this when https://github.com/pypa/pip/issues/4685 is # available. if [ "${DIB_DISABLE_PIP_CLEANUP:-0}" != "1" ]; then rm -rf ~/.cache/pip fi ././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/source-repository-pip-and-virtualenvdiskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/source-repository-pip-and-vir0000664000175000017500000000011513640271474034001 0ustar zuulzuul00000000000000pip-and-virtualenv file /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/0000775000175000017500000000000013640271564031011 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-ubuntu/diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-0000775000175000017500000000000013640271564033753 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000017000000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-ubuntu/element-depsdiskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-0000664000175000017500000000004413640271474033753 0ustar zuulzuul00000000000000openstack-ci-mirrors ubuntu-minimal ././@LongLink0000000000000000000000000000017200000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-ubuntu/environment.d/diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-0000775000175000017500000000000013640271564033753 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000024200000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-ubuntu/environment.d/10-source-installtype-pip-and-virtualenvdiskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-0000664000175000017500000000006113640271474033752 0ustar zuulzuul00000000000000export DIB_INSTALLTYPE_pip_and_virtualenv=source ././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-fedora/diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-0000775000175000017500000000000013640271564033753 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000017000000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-fedora/element-depsdiskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-0000664000175000017500000000004413640271474033753 0ustar zuulzuul00000000000000fedora-minimal openstack-ci-mirrors ././@LongLink0000000000000000000000000000017200000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-fedora/environment.d/diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-0000775000175000017500000000000013640271564033753 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000024200000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-fedora/environment.d/10-source-installtype-pip-and-virtualenvdiskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-0000664000175000017500000000006113640271474033752 0ustar zuulzuul00000000000000export DIB_INSTALLTYPE_pip_and_virtualenv=source ././@LongLink0000000000000000000000000000015600000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-opensuse/diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-0000775000175000017500000000000013640271564033753 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000017200000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-opensuse/element-depsdiskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-0000664000175000017500000000004713640271474033756 0ustar zuulzuul00000000000000openstack-ci-mirrors opensuse-minimal ././@LongLink0000000000000000000000000000017400000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-opensuse/environment.d/diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-0000775000175000017500000000000013640271564033753 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000024400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-opensuse/environment.d/10-source-installtype-pip-and-virtualenvdiskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/test-elements/source-install-0000664000175000017500000000006113640271474033752 0ustar zuulzuul00000000000000export DIB_INSTALLTYPE_pip_and_virtualenv=source diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/package-installs.yaml0000664000175000017500000000176513640271474032337 0ustar zuulzuul00000000000000# The python-xml and python3 openSUSE packages contain core python modules # such as the XML one but the python devel packages do not pull them. As # such we need to install them during the pre-install.d phase so they are # available as early as possible. See # - https://bugzilla.suse.com/show_bug.cgi?id=1046990 # - https://review.opendev.org/#/c/478648/ # - https://review.opendev.org/#/c/478650/ # for discussions about this issue. python-xml: phase: pre-install.d dib_python_version: 2 python3: phase: pre-install.d installtype: package dib_python_version: 3 python-pip: installtype: package dib_python_version: 2 python3-pip: installtype: package dib_python_version: 3 python-virtualenv: installtype: package dib_python_version: 2 python3-virtualenv: installtype: package dib_python_version: 3 python-dev: installtype: source dib_python_version: 2 python3-dev: installtype: source dib_python_version: 3 # Separate package on debubuntu python3-venv: dib_python_version: 3 diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/install.d/0000775000175000017500000000000013640271564030110 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016400000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-0000775000175000017500000000000013640271564033633 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000020200000000000011207 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pipdiskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-0000775000175000017500000002256613640271474033653 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel|rhel7) ]]; then # Default packages _do_py3=0 _extra_repo='' # see notes below on this var... _clear_old_files=0 case "$DISTRO_NAME" in centos*|rhel7) # note python2-pip in epel _extra_repo="--enablerepo=epel" packages="python-virtualenv python2-pip" if [[ "$(rpm -q --qf '[%{obsoletes}\n]' python2-setuptools)" == "python-setuptools" ]]; then # If OpenStack release is installed, then python-setuptools is # obsoleted by python2-setuptools packages+=" python2-setuptools" else packages+=" python-setuptools" fi # see notes below _clear_old_files=1 ;; fedora) _do_py3=1 packages="python2-virtualenv python2-pip python2-setuptools" packages=" python3-virtualenv python3-pip python3-setuptools" ;; rhel) case "$DIB_RELEASE" in 8) _do_py3=1 _clear_old_files=0 packages=" python3-virtualenv python3-pip python3-setuptools" ;; 7) # note python2-pip in epel _extra_repo="--enablerepo=epel" _clear_old_files=1 packages="python-virtualenv python2-pip" if [[ "$(rpm -q --qf '[%{obsoletes}\n]' python2-setuptools)" == "python-setuptools" ]]; then packages+=" python2-setuptools" else packages+=" python-setuptools" fi ;; esac ;; opensuse) case "$DIB_RELEASE" in 42*) packages="python-virtualenv python-pip python-setuptools" _clear_old_files=1 ;; tumbleweed|15*) # XXX: python3? packages="python2-virtualenv python2-pip python2-setuptools" ;; esac ;; esac # force things to happen so our assumptions hold pip_args="-U --force-reinstall" # GENERAL WARNING : mixing packaged python libraries with # pip-installed versions always creates issues. Upstream # openstack-infra uses this a lot (especially devstack) but be # warned: here be dragons :) # Firstly we want to install the system packages. Otherwise later # on somebody does a "yum install python-virtualenv" and goes and # overwrites the pip installed version with the packaged version, # leading to all sorts of weird version issues. if [[ $DISTRO_NAME = opensuse ]]; then zypper -n install $packages else ${YUM:-yum} ${_extra_repo} install -y $packages fi # pip10 onwards (unlike earlier versions) will not uninstall # packages installed by distutils (note this is only a subset of # packages that don't use setuptools for various reasons; the # problem is essentially they do not include a manifest of files # in the package to delete, so pip was just guessing). We give it # a little help by clearing out the files from the packages we are # about to re-install so pip doesn't think anything is installed. # See: https://github.com/pypa/pip/issues/4805 # # This is only necessary on old CentOS and suse -- for complicated # reasons of course. On Fedora, the Python2 virtualenv packages # are *not* distutils based and pip overwrites them correctly. # For python3, pip has changed to not overwrite system packages (a # long standing difference between Debuntu and Fedora), but a # number of tools run with "python3 -Es" to isolate themselves to # the package installed versions. So we definitely don't want to # clear the packaged versions out in that case. if [[ ${_clear_old_files} == 1 ]]; then for pkg in $packages; do rpm -ql $pkg | xargs rm -rf done fi # install the latest python2 pip; this overwrites packaged pip python /tmp/get-pip.py ${pip_args} # Install latest setuptools; there is a slight chicken-egg issue in # that pip requires setuptools for some operations like building a # wheel. But this simple install should be fine. pip install ${pip_args} setuptools if [[ $_do_py3 -eq 1 ]]; then # Repeat above for python3 # python2 on fedora always installs into /usr/bin. Move pip2 # binary out, as we want "pip" in the final image to be # python2 for historical reasons. mv /usr/bin/pip /usr/bin/pip2 # You would think that installing python3 bits first, then # python2 would work -- alas get-pip.py doesn't seem to leave # python3 alone: # https://github.com/pypa/pip/issues/4435 python3 /tmp/get-pip.py ${pip_args} pip3 install ${pip_args} setuptools # on < 27, this installed pip3 to /usr/bin/pip. On >=27 it's # /usr/local/bin/pip. reclaim /usr/bin/pip back to pip2 and # remove the /usr/local/bin/pip (i.e. python3 version) if it # exists, so that "pip" calls pip2 always. if we want pip3 we # call it explicitly. ln -sf /usr/bin/pip2 /usr/bin/pip rm -f /usr/local/bin/pip # So on Fedora, there are now supposed to be two versions of # python3 setuptools installed; the one installed by pip in # /usr/local and the one installed by the system # python3-setuptools rpm package in /usr/local. The idea is # that packaged python tools use the "system" python (with -Es # flag) and are isolated from pip installs ... except there is # an issue where pip clears out the RPM version files before # installing it's isolated version: # https://bugzilla.redhat.com/show_bug.cgi?id=1550368 # # Thus we need to *reinstall* the RPM version now, so those # files come back and system tools continue to work dnf reinstall -y python3-setuptools fi # now install latest virtualenv. it vendors stuff it needs so # doesn't have issues with other system packages. # python[2|3]-virtualenv package has installed versioned scripts # (/usr/bin/virtualenv-[2|3]) but upstream does not! (see [2]). # For consistency, reinstall so we're just left with python2's # version. Note this is a rather moot point, the usual way we get # a python3 environment is to call "virtualenv -p python3 foo" and # that works to create a python3 virtualenv, even if using # python2's version. Thus we probably don't *really* need to # "pip3 install virtualenv". What we don't want is "virtualenv # foo" creating a python3 virtualenv by default, because that # confuses a lot of legacy code. # #[2] http://pkgs.fedoraproject.org/cgit/rpms/python-virtualenv.git/tree/python-virtualenv.spec#n116) pip install ${pip_args} virtualenv mv /usr/bin/virtualenv /usr/bin/virtualenv2 if [[ $_do_py3 -eq 1 ]]; then pip3 install ${pip_args} virtualenv fi # Reclaim virtualenv to virtualenv2; similar to above, on fedora # >27 the pip3 version has gone into /usr/local/bin; remove it so # only /usr/bin/virtualenv exists ln -sf /usr/bin/virtualenv2 /usr/bin/virtualenv rm -f /usr/local/bin/virtualenv # at this point, we should have the latest # pip/setuptools/virtualenv packages for python2 & 3, and # "/usr/bin/pip" and "/usr/bin/virtualenv" should be python2 # versions. if [[ $DISTRO_NAME = opensuse ]]; then for pkg in virtualenv pip setuptools; do cat - >> /etc/zypp/locks <> ${conf} fi elif [[ $DISTRO_NAME = gentoo ]]; then packages="dev-python/pip dev-python/virtualenv" emerge -U $packages else # pre-install packages so dependencies are there. We will # overwrite with latest below. packages="python-pip python3-pip python-virtualenv" # Unfortunately older ubuntu (trusty) doesn't have a # python3-virtualenv package -- it seems it wasn't ready at the # time and you had to use "python -m venv". Since then virtualenv # has gained 3.4 support so the pip install below will work if [[ ${DIB_PYTHON_VERSION} == 3 ]]; then packages+=" python3-virtualenv" fi apt-get -y install $packages # force things to happen so our assumptions hold pip_args="-U --force-reinstall" # These install into /usr/local/bin so override any packages, even # if installed later. python3 /tmp/get-pip.py $pip_args python2 /tmp/get-pip.py $pip_args pip3 install $pip_args virtualenv pip install $pip_args virtualenv fi diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/README.rst0000664000175000017500000001010613640271474027705 0ustar zuulzuul00000000000000================== pip-and-virtualenv ================== This element installs pip and virtualenv in the image. Package install =============== If the package installtype is used then these programs are installed from distribution packages. In this case, ``pip`` and ``virtualenv`` will be installed *only* for the python version identified by ``dib-python`` (i.e. the default python for the platform). Namespacing of the tools will be up to your distribution. Some distribution packages have worked out name-spacing such that only python2 or python3 owns common scripts like ``/usr/bin/pip`` (on most platforms, ``pip`` refers to python2 pip, and ``pip3`` refers to python3 pip, although some may choose the reverse). Other platforms have avoided making a decision and require explicit version suffixes. To install pip and virtualenv from package:: export DIB_INSTALLTYPE_pip_and_virtualenv=package Source install ============== .. note:: For source installs this element setups and Python 2 and Python 3 environments. This means it will bring in python2 packages, so isn't appropriate if you want a python3 only environment. .. note:: Source install is considered deprecated for several reasons. Because it makes for a hetrogenous environment between distro packaged tools and upstream it means the final images create bespoke environments that make standarised testing difficult. The tricks used around holding packages to overwrite them cause difficulty for users of images. This also brings in Python 2 unconditonally, something not wanted on modern Python 3 only distributions. Source install is the default on most platforms for historical purposes. The current exception(s) are RHEL8 and CentOS 8. If the source installtype is used, ``pip`` and ``virtualenv`` are installed from the latest upstream releases. Source installs from upstream releases are not name-spaced. It is inconsistent across platforms if the first or last install will own common scripts like ``/usr/bin/pip`` and ``virtualenv``. To avoid inconsistency, we firstly install the packaged python 2 **and** 3 versions of ``pip`` and ``virtualenv``. This prevents a later install of these distribution packages conflicting with the source install. We then overwrite ``pip`` and ``virtualenv`` via ``get-pip.py`` and ``pip`` respectively. The system will be left in the following state: * ``/usr/bin/pip`` : python2 pip * ``/usr/bin/pip2`` : python2 pip (same as prior) * ``/usr/bin/pip3`` : python3 pip * ``/usr/bin/virtualenv`` : python2 virtualenv (note python3 ``virtualenv`` script is *not* installed, see below) Source install is supported on limited platforms. See the code, but this includes Ubuntu and RedHat platforms. Environment Variables ===================== To simplify the common-case of "install a package" or "create a virtualenv" with the default system Python, the following variables are exported by this element: * ``DIB_PYTHON_PIP`` * ``DIB_PYTHON_VIRTUALENV`` This will create/install using the ``dib-python`` version for the platform (i.e. python2 for older distros, python3 for modern distros). Note that on Python 3 platforms it will use the inbuilt ``venv`` (rather than the ``virtualenv`` package -- if you absolutely need features only ``virtualenv`` provides you should call it directly in your element; see below). Explicit use of the tools ========================= Due to the essentially unsolvable problem of "who owns the script", it is recommended to *not* call ``pip`` or ``virtualenv`` directly. You can directly call them with the ``-m`` argument to the python interpreter you wish to install with. For example, to create a python3 environment do:: # python3 -m virtualenv myenv # myenv/bin/pip install mytool To install a python2 tool from pip:: # python2 -m pip install mytool In this way, you can always know which interpreter is being used (and affected by) the call. Ordering ======== Any element that uses these commands must be designated as 05-* or higher to ensure that they are first installed. diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/element-deps0000664000175000017500000000010313640271474030517 0ustar zuulzuul00000000000000dib-python epel install-types package-installs source-repositories diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/environment.d/0000775000175000017500000000000013640271564031006 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000017000000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/environment.d/51-pip-and-virutalenv-default.bashdiskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/environment.d/51-pip-and-viru0000664000175000017500000000262213640271474033471 0ustar zuulzuul00000000000000# Due to the many historical problems mixing python2/3 versions and # upgrading packaged system pip/setuptools/virtualenv binaries with # upstream non-packaged versions, we wish to avoid this completely on # modern distros. if [[ $DISTRO_NAME =~ (centos|rhel) && $DIB_RELEASE -ge 8 ]]; then export DIB_INSTALLTYPE_pip_and_virtualenv=${DIB_INSTALLTYPE_pip_and_virtualenv:-package} if [[ ${DIB_INSTALLTYPE_pip_and_virtualenv} == "source" ]]; then echo "*** pip-and-virtualenv does not support 'source' install for $DISTRO_NAME/$DIB_RELEASE" exit 1 fi fi # The default variables setup below are only useful during the phases # that dib-python exists if [[ ! -e /usr/local/bin/dib-python ]]; then return 0 fi # NOTE(ianw): you don't want to call "dib-python -m pip" because that # can leave behind interpreters #!/usr/local/bin/dib-python in # scripts. De-reference the link _dib_python_path=$(readlink /usr/local/bin/dib-python) export DIB_PYTHON_PIP="$_dib_python_path -m pip" # We make an opinionated, but simplifying decision here that on # Python3 platforms, just use venv. There are some corner cases that # the external "virtualenv" package still handles better, but for most # purposes "venv" should be fine. if [[ $DIB_PYTHON_VERSION == 3 ]]; then export DIB_PYTHON_VIRTUALENV="$_dib_python_path -m venv" else export DIB_PYTHON_VIRTUALENV="$_dib_python_path -m virtualenv" fi diskimage-builder-2.35.0/diskimage_builder/elements/pip-and-virtualenv/pkg-map0000664000175000017500000000145113640271474027500 0ustar zuulzuul00000000000000{ "release": { "rhel": { "8": { "python3-dev": "platform-python-devel" } } }, "family": { "debian": { "python3-venv": "python3-venv" }, "gentoo": { "python-pip": "dev-python/pip", "python3-pip": "dev-python/pip", "python-virtualenv": "dev-python/virtualenv", "python3-virtualenv": "dev-python/virtualenv", "python-dev": "dev-lang/python", "python3-dev": "dev-lang/python" }, "suse": { "python-xml": "python-xml", "python-dev": "python-devel", "python3-dev": "python3-devel", "python3": "python3" }, "redhat": { "python-dev": "python2-devel", "python3-dev": "python3-devel" } }, "default": { "python-xml": "", "python3": "", "python3-venv": "" } } diskimage-builder-2.35.0/diskimage_builder/elements/dracut-regenerate/0000775000175000017500000000000013640271564026074 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dracut-regenerate/extra-data.d/0000775000175000017500000000000013640271564030350 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dracut-regenerate/extra-data.d/50-dracut-conf0000775000175000017500000000106113640271474032723 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 1 ]; then set -x fi set -eu set -o pipefail if [ ! -d $TMP_MOUNT_PATH/etc/dracut.conf.d ]; then sudo mkdir -p $TMP_MOUNT_PATH/etc/dracut.conf.d fi eval declare -A image_elements=($(get_image_element_array)) for i in "${!image_elements[@]}"; do element=$i element_dir=${image_elements[$i]} if [ -d "${element_dir}/dracut.conf.d/" ]; then echo "Copying dracut config from ${element_dir}" sudo cp ${element_dir}/dracut.conf.d/*.conf $TMP_MOUNT_PATH/etc/dracut.conf.d/ fi done diskimage-builder-2.35.0/diskimage_builder/elements/dracut-regenerate/package-installs.yaml0000664000175000017500000000021613640271474032201 0ustar zuulzuul00000000000000PyYAML: phase: pre-install.d dib_python_version: 2 python3-PyYAML: phase: pre-install.d installtype: package dib_python_version: 3 diskimage-builder-2.35.0/diskimage_builder/elements/dracut-regenerate/README.rst0000664000175000017500000000132213640271474027561 0ustar zuulzuul00000000000000================= dracut-regenerate ================= Adds the possibility of regenerating dracut on image build time, giving the possibility to load extra modules. It relies on the ``DIB_DRACUT_ENABLED_MODULES`` setting, that will accept a yaml blob with the following format:: - name: packages: - - - name: packages: - - By default, this element will bring lvm and crypt modules. Also adds the ability to copy specific files into /etc/dracut.conf.d directory to allow any dracut settings to be configured. To achieve that the files to be copied need to be placed inside an specific dracut.d directory of the element. diskimage-builder-2.35.0/diskimage_builder/elements/dracut-regenerate/element-deps0000664000175000017500000000005413640271474030400 0ustar zuulzuul00000000000000package-installs select-boot-kernel-initrd diskimage-builder-2.35.0/diskimage_builder/elements/dracut-regenerate/environment.d/0000775000175000017500000000000013640271564030662 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dracut-regenerate/environment.d/10-dracut-regeneratediskimage-builder-2.35.0/diskimage_builder/elements/dracut-regenerate/environment.d/10-dracut-regene0000664000175000017500000000041513640271474033550 0ustar zuulzuul00000000000000export DIB_DRACUT_ENABLED_MODULES_DEFAULT_CONFIG=" - name: crypt packages: - cryptsetup - name: lvm packages: - lvm2 " DIB_DRACUT_ENABLED_MODULES=${DIB_DRACUT_ENABLED_MODULES:-${DIB_DRACUT_ENABLED_MODULES_DEFAULT_CONFIG}} export DIB_DRACUT_ENABLED_MODULES diskimage-builder-2.35.0/diskimage_builder/elements/dracut-regenerate/pkg-map0000664000175000017500000000064513640271474027360 0ustar zuulzuul00000000000000{ "family": { "gentoo": { "PyYAML": "dev-python/pyyaml" }, "suse": { "PyYAML": "python-PyYAML", "python3-PyYAML": "python3-PyYAML" }, "redhat": { "PyYAML": "PyYAML", "python3-PyYAML": "python3-PyYAML" }, "debian": { "PyYAML": "python-yaml", "python3-PyYAML": "python3-yaml" } }, "default": { "PyYAML": "", "python3-PyYAML": "" } } diskimage-builder-2.35.0/diskimage_builder/elements/dracut-regenerate/finalise.d/0000775000175000017500000000000013640271564030110 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dracut-regenerate/finalise.d/50-dracut-regeneratediskimage-builder-2.35.0/diskimage_builder/elements/dracut-regenerate/finalise.d/50-dracut-regenerat0000775000175000017500000000614213640271474033517 0ustar zuulzuul00000000000000#!/usr/local/bin/dib-python # Copyright 2017 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import glob import logging import os import re import subprocess import yaml logging.basicConfig( level=logging.DEBUG if int(os.getenv('DIB_DEBUG_TRACE', 0)) > 0 else logging.INFO) def main(): logging.info("Starting dracut regeneration") logging.debug("Debug logging enabled") dracut_env = os.getenv('DIB_DRACUT_ENABLED_MODULES') dracut_objects = yaml.safe_load(dracut_env) logging.debug(dracut_objects) modules_to_boot = [] for dracut_object in dracut_objects: # first, install dependent packages packages = dracut_object.get('packages', []) for package in packages: cmdline = ["install-packages", package] logging.debug("Calling: %s" % cmdline) subp = subprocess.Popen(cmdline, stdout=subprocess.PIPE) out = subp.communicate()[0] if subp.returncode: e = subprocess.CalledProcessError(subp.returncode, cmdline) e.output = out raise e # second, compose the list of modules to boot modules_to_boot.append(dracut_object.get('name', None)) conf_overrides = glob.glob('/etc/dracut.conf.d/*.conf') # regenerate dracut with the list of installed modules and conf overrides if modules_to_boot or conf_overrides: cmdline = ["select-boot-kernel-initrd"] logging.debug("Calling: %s" % cmdline) subp = subprocess.Popen(cmdline, stdout=subprocess.PIPE) out, err = subp.communicate() if subp.returncode: e = subprocess.CalledProcessError(subp.returncode, cmdline) e.output = out raise e kernel_set = out.decode().split(':') kernel_search = re.match("vmlinuz-(.*)", kernel_set[0]) kernel_version = "%s" % kernel_search.groups(1) ramdisk_path = "/boot/%s" % kernel_set[1].strip() cmdline = ['dracut', '--force'] if modules_to_boot: modules_to_boot = ' ' .join(modules_to_boot) cmdline += ['--add', modules_to_boot] cmdline += ['-f', ramdisk_path, kernel_version] logging.debug("Calling: %s" % cmdline) subp = subprocess.Popen(cmdline, stdout=subprocess.PIPE) out, err = subp.communicate() if subp.returncode: e = subprocess.CalledProcessError(subp.returncode, cmdline) e.output = out raise e logging.info("dracut regenerate done") if __name__ == '__main__': main() # Local Variables: # mode: python # End: diskimage-builder-2.35.0/diskimage_builder/elements/yum-minimal/0000775000175000017500000000000013640271564024731 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/yum-minimal/cleanup.d/0000775000175000017500000000000013640271564026602 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/yum-minimal/cleanup.d/95-remove-yum-mirror0000775000175000017500000000203413640271474032377 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2015 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # # dib-lint: disable=safe_sudo if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail # This removes any build-time repos that might be set in 08-yum-chroot if [[ -n ${DIB_YUM_MINIMAL_BOOTSTRAP_REPOS:-} ]]; then sudo rm -f $TMP_MOUNT_PATH/etc/yum.repos.d/dib-mirror*.repo for repo in $TMP_MOUNT_PATH/etc/yum.repos.d/*.USING_MIRROR; do sudo mv $repo ${repo/.USING_MIRROR/} done fi diskimage-builder-2.35.0/diskimage_builder/elements/yum-minimal/pre-install.d/0000775000175000017500000000000013640271564027405 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/yum-minimal/pre-install.d/03-yum-cleanup0000775000175000017500000000576713640271474032031 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2015 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail # effectively: febootstrap-minimize --keep-zoneinfo --keep-rpmdb --keep-services "$target" # This is only required on CentOS7 ... see notes in # root.d/08-yum-chroot about %_install_langs if [[ $DISTRO_NAME == "centos" && $DIB_RELEASE == "7" ]]; then # Stripping *all* locales is a bad idea. For now, we take the # suggestion in [1] for reducing this # [1] https://bugzilla.redhat.com/show_bug.cgi?id=156477 if [ ! -f /usr/lib/locale/locale-archive ]; then die "locale-archive not found? Can not do cleanup." fi # now the archive has everything in it, and is about 100MiB. Strip it # to just en_US (basically, this is the locale we support if you ssh # in, other than POSIX) localedef --delete-from-archive \ $(localedef --list-archive | grep -v '^en_US' | xargs) # This removes the locales from the archive index but doesn't rebuild # the file, so it is still the same size (maybe it is sparse? # presumably as it's mmapped you don't want to fiddle with the offsets # of locales in the archive on a live system. We are not live). # build-locale-archive is a tool provided by the RH packaging of # glibc. Documentation is scarce, but it takes the pre-built locales # in the tmpl file and creates an archive. It seems originally the # installer would set some flags to rpm to tell the package what # languages to pick out of the template, but along the way, this was # reverted to install them (size considered less important than locale # support). # We hack this by moving the locale-archive we've removed the extra # locales from to the template, then re-run the build. mv /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.tmpl # rebuild archive from template /usr/sbin/build-locale-archive # leave empty template behind as package does. I think this stops # upgrades redoing things echo > /usr/lib/locale/locale-archive.tmpl # remove the unnecessary source locale files and iconv files pushd /usr/share/locale find . ! -name 'locale.alias' -delete popd rm -rf {lib.lib64}/gconv fi # docs rm -rf /usr/share/{doc,info,gnome/help} # i18n rm -rf /usr/share/i18n # sln rm -rf /sbin/sln # ldconfig rm -rf /etc/ld.so.cache /var/cache/ldconfig mkdir -p --mode=0755 /var/cache/ldconfig diskimage-builder-2.35.0/diskimage_builder/elements/yum-minimal/package-installs.yaml0000664000175000017500000000075513640271474031046 0ustar zuulzuul00000000000000audit: dracut: dracut-config-generic: grubby: kernel: initscripts: man-pages: lsb_release: redhat-rpm-config: linux-firmware: uninstall: true linux-firmware-whence: uninstall: true # NOTE(ianw) pkg-map restricts this to !rhel/centos 7; in 7 # the "initscripts" package handles basic networking, in # 8+ it's the role of NetworkManager and dhcp-client. This # mirrors the default packages installed in upstream cloud images # to facilitate a basic network. NetworkManager: dhcp-client:diskimage-builder-2.35.0/diskimage_builder/elements/yum-minimal/install.d/0000775000175000017500000000000013640271564026621 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/yum-minimal/install.d/10-base-networking0000775000175000017500000000264713640271474032075 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2015 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail # allow networking init scripts inside the container to work without extra steps cat << EOF | sudo tee /etc/sysconfig/network > /dev/null NETWORKING=yes NETWORKING_IPV6=yes NOZEROCONF=yes EOF # If you want eth0 and eth1 created as DHCP based interfaces, enable # this. You don't want this if systemd is going to call the # interfaces on the real system something else, or if you're using a # network-manager like cloud-init, glean or network-manager that will # handle the interfaces dynamically. if [[ "${DIB_YUM_MINIMAL_CREATE_INTERFACES:-0}" -eq "1" ]]; then for interface in eth0 eth1; do cat << EOF | tee /etc/sysconfig/network-scripts/ifcfg-$interface > /dev/null DEVICE=$interface BOOTPROTO=dhcp ONBOOT=on EOF done fi diskimage-builder-2.35.0/diskimage_builder/elements/yum-minimal/install.d/11-ensure-dbus-daemon0000775000175000017500000000157013640271474032466 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2019 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail # Ensure that dbus-daemon is enabled; fedora 30 and above has switched to # dbus-broker. if [[ ${DISTRO_NAME} == 'fedora' && ${DIB_RELEASE} -eq 29 ]]; then systemctl --no-reload enable dbus-daemon.service fi diskimage-builder-2.35.0/diskimage_builder/elements/yum-minimal/README.rst0000664000175000017500000000174513640271474026427 0ustar zuulzuul00000000000000=========== yum-minimal =========== Base element for creating minimal yum-based images. This element is incomplete by itself, you'll want to use the centos-minimal or fedora-minimal elements to get an actual base image. Use of this element will require 'yum' and 'yum-utils' to be installed on Ubuntu and Debian. Nothing additional is needed on Fedora or CentOS. If you wish to have DHCP networking setup for eth0 & eth1 via /etc/sysconfig/network-config scripts/ifcfg-eth[0|1], set the environment variable `DIB_YUM_MINIMAL_CREATE_INTERFACES` to `1`. If you wish to build from specific mirrors, set ``DIB_YUM_MINIMAL_BOOTSTRAP_REPOS`` to a directory with the ``.repo`` files to use during bootstrap and build. The repo files should be named with a prefix ``dib-mirror-`` and will be removed from the final image. If you wish to include extra repositories, set ``DIB_YUM_MINIMAL_EXTRA_REPOS`` to a directory with the ``.repo`` files. The repo files will not be removed from the final image. diskimage-builder-2.35.0/diskimage_builder/elements/yum-minimal/element-deps0000664000175000017500000000003513640271474027234 0ustar zuulzuul00000000000000redhat-common rpm-distro yum diskimage-builder-2.35.0/diskimage_builder/elements/yum-minimal/pkg-map0000664000175000017500000000034113640271474026206 0ustar zuulzuul00000000000000{ "release": { "centos": { "7": { "NetworkManager": "", "dhcp-client": "" } } }, "family": { "redhat": { "lsb_release": "redhat-lsb-core" } } } diskimage-builder-2.35.0/diskimage_builder/elements/yum-minimal/root.d/0000775000175000017500000000000013640271564026136 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot0000775000175000017500000003264113640271474030425 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2015 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # # dib-lint: disable=safe_sudo if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail source $_LIB/common-functions if [ -f ${TARGET_ROOT}/.extra_settings ] ; then . ${TARGET_ROOT}/.extra_settings fi ARCH=${ARCH:-x86_64} if [ $ARCH = amd64 ]; then ARCH=x86_64 fi # Calling elements will need to set DISTRO_NAME and DIB_RELEASE # TODO Maybe deal with DIB_DISTRIBUTION_MIRROR http_proxy=${http_proxy:-} YUM=${YUM:-yum} WORKING=$(mktemp --tmpdir=${TMP_DIR:-/tmp} -d) EACTION="rm -r $WORKING" trap "$EACTION" EXIT YUM_CACHE=$DIB_IMAGE_CACHE/yum mkdir -p $YUM_CACHE # Note, on Debian/Ubuntu, %_dbpath is set in the RPM macros as # ${HOME}/.rpmdb/ -- this makes sense as RPM isn't the system # packager. This path is relative to the "--root" argument _RPM="rpm --dbpath=/var/lib/rpm" # install the [fedora|centos]-[release|repo] packages inside the # chroot, which are needed to bootstrap yum/dnf # # note this runs outside the chroot, where we're assuming the platform # has yum/yumdownloader function _install_repos { local packages local rc # pre-install the base system packages via rpm. We previously # just left it up to yum to drag these in when we "yum install # yum" in the chroot in _install_pkg_manager. This raised a small # problem that inside the empty chroot yum went ahead and did a # mkdir for /var/run to put some pid file in, which then messed up # the "filesystem" package making /var/run a symlink to /run # ... which leads to odd issues with a running system. # # TODO: these packages still have some small %posttrans stuff that # depends on other packages (see rhbz#1306489) ... maybe the idea # is that they are only installed in one big transaction with the # rest of the system? but we don't want to use yum to do this # (see above) so ... packages="basesystem filesystem setup " if [[ ${DISTRO_NAME} = fedora && ${DIB_RELEASE} -gt 29 ]]; then packages+="fedora-release-cloud fedora-release-common " else packages+="${DISTRO_NAME}-release " fi # Starting in F21 this was split into a separate package if [[ ${DISTRO_NAME} == 'fedora' ]]; then packages+="fedora-repos " fi # F27 started putting gpg keys into this separate package if [[ ${DISTRO_NAME} = fedora && ${DIB_RELEASE} -gt 26 ]]; then packages+="fedora-gpg-keys " fi # CentOS 8.1 split repositories and GPG keys out into subpackages if [[ ${DISTRO_NAME} = centos && ${DIB_RELEASE} -ge 8 ]]; then packages+="centos-repos centos-gpg-keys " fi # By default, parent elements (fedora-minimal, centos-minimal) # have a yum.repos.d directory in the element with a default repo; # this is copied to TMP_HOOK_PATH by the usual hook-copying # routines. In the gate, environment.d files for the funtional # tests will set DIB_YUM_MINIMAL_BOOTSTRAP_REPOS -- this contains # mirrors correct for the region setup by contrib/setup-gate-mirrors.sh local repo=${DIB_YUM_MINIMAL_BOOTSTRAP_REPOS:-} if [[ -z ${repo} ]]; then # take in preference more specific subdirs if [[ -d ${TMP_HOOKS_PATH}/yum.repos.d/${DIB_RELEASE} ]]; then repo=${TMP_HOOKS_PATH}/yum.repos.d/${DIB_RELEASE} else repo=${TMP_HOOKS_PATH}/yum.repos.d fi fi # yumdownloader puts repo xml files and such into a directory # ${TMPDIR}/yum-$USER-random. Since we don't need this once the # initial download happens, redirect TMPDIR for this call so we # can clean it up nicely local temp_tmp temp_tmp=$(mktemp -d) TMPDIR=${temp_tmp} yumdownloader --verbose \ --releasever=$DIB_RELEASE \ --setopt=reposdir=$repo \ --destdir=$WORKING \ ${packages} && rc=$? || rc=$? rm -rf ${temp_tmp} if [[ ${rc} != 0 ]]; then die "Failed to download initial packages: ${packages}" fi # --nodeps works around these wanting /bin/sh in some fedora # releases, see rhbz#1265873 sudo $_RPM --root $TARGET_ROOT --nodeps -ivh $WORKING/*rpm # install the bootstrap mirror repos over the default ones, if # set. we will remove this at the end so the final image has # regular mirrors if [[ -n ${DIB_YUM_MINIMAL_BOOTSTRAP_REPOS:-} ]]; then for repo in $TARGET_ROOT/etc/yum.repos.d/*.repo; do sudo mv $repo $repo.USING_MIRROR done sudo cp ${DIB_YUM_MINIMAL_BOOTSTRAP_REPOS}/* \ $TARGET_ROOT/etc/yum.repos.d/ fi if [[ -n ${DIB_YUM_MINIMAL_EXTRA_REPOS:-} ]]; then sudo cp ${DIB_YUM_MINIMAL_EXTRA_REPOS}/* \ $TARGET_ROOT/etc/yum.repos.d/ fi } # _install_pkg_manager packages... # # install the package manager packages. This is done outside the chroot # and with yum from the build system. # TODO: one day build systems will be dnf only, but we don't handle # that right now function _install_pkg_manager { # Install into the chroot, using the gpg keys from the release # rpm's installed in the chroot sudo sed -i "s,/etc/pki/rpm-gpg,$TARGET_ROOT/etc/pki/rpm-gpg,g" \ $TARGET_ROOT/etc/yum.repos.d/*repo # See notes on $_RPM variable -- we need to override the # $HOME-based dbpath set on debian/ubuntu here. Unfortunately, # yum does not have a way to override rpm macros from the command # line. So we modify the user's ~/.rpmmacros to set %_dbpath back # to "/var/lib/rpm" (note, this is taken relative to the # --installroot). # # Also note, we only want this done around this call -- this is # the only place we are using yum outside the chroot, and hence # picking up the base-system's default rpm macros. For example, # the yumdownloader calls above in _install_repos want to use # ~/.rpmdb/ ... there is nothing in the build-system /var/lib/rpm! # # Another issue we hit is having to set --releasedir here. yum # determines $releasevar based on (more or less) "rpm -q # --whatprovides $distroverpkg". By default, this is # "redhat-release" (fedora-release provides redhat-release) but # some platforms like CentOS override it in /etc/yum.conf (to # centos-release in their case). You can't override this (see # [1]), but setting --releasever works around this. # # [1] https://bugzilla.redhat.com/show_bug.cgi?id=1287333 ( flock -w 1200 9 || die "Can not lock .rpmmacros" echo "%_dbpath /var/lib/rpm" >> $HOME/.rpmmacros local _lang_pack="" local _extra_pkgs="" if [[ $DISTRO_NAME == "fedora" ]] || \ [[ $DISTRO_NAME == "centos" && $DIB_RELEASE -ge 8 ]]; then # glibc from F24 onwards has split locales into "langpack" # packages. Host yum doesn't understand the # weak-dependencies glibc now uses to get the # minimal-langpack and chooses a random(ish) one that # satisfies the locale dependency (rhbz#1349258). # Work-around this by explicitly requring the minimal and # english (for en_US.UTF-8) pack. _lang_pack="glibc-minimal-langpack glibc-langpack-en" fi # Yum has some issues choosing weak dependencies. It can end # up choosing "coreutils-single" instead of "coreutils" which # causes problems later when a package actually requires # coreutils. For more info see # https://bugzilla.redhat.com/show_bug.cgi?id=1286445 # Really all we can do is pre-install the right thing _extra_pkgs+="coreutils " sudo -E yum -y \ --disableexcludes=all \ --setopt=cachedir=$YUM_CACHE/$ARCH/$DIB_RELEASE \ --setopt=reposdir=$TARGET_ROOT/etc/yum.repos.d \ --releasever=$DIB_RELEASE \ --installroot $TARGET_ROOT \ install $@ ${_lang_pack} ${_extra_pkgs} && rc=$? || rc=$? # Note we've modified the base system's .rpmmacros. Ensure we # clean it up *always* # sed makes it easy to remove last line, but not last n lines... sed -i '$ d' $HOME/.rpmmacros; sed -i '$ d' $HOME/.rpmmacros; if [ $rc != 0 ]; then die "Initial yum install to chroot failed! Can not continue." fi ) 9>$DIB_LOCKFILES/.rpmmacros.dib.lock # Set gpg path back because subsequent actions will take place in # the chroot sudo sed -i "s,$TARGET_ROOT/etc/pki/rpm-gpg,/etc/pki/rpm-gpg,g" \ $TARGET_ROOT/etc/yum.repos.d/*repo } # Note this is not usually done for root.d elements (see # lib/common-functions:mount_proc_dev_sys) but it's important that # we have things like /dev/urandom around inside the chroot for # the rpm [pre|post]inst scripts within the packages. sudo mkdir -p $TARGET_ROOT/proc $TARGET_ROOT/dev $TARGET_ROOT/sys sudo mount -t proc none $TARGET_ROOT/proc sudo mount --bind /dev $TARGET_ROOT/dev sudo mount -t devpts $(mount_dev_pts_options) devpts $TARGET_ROOT/dev/pts sudo mount -t sysfs none $TARGET_ROOT/sys # initalize rpmdb sudo mkdir -p $TARGET_ROOT/var/lib/rpm sudo $_RPM --root $TARGET_ROOT --initdb # this makes sure that running yum/dnf in the chroot it can get # out to download stuff sudo mkdir $TARGET_ROOT/etc sudo cp /etc/resolv.conf $TARGET_ROOT/etc/resolv.conf # Bind mount the external yum cache inside the chroot. Same logic # as in the yum element to provide for yum caching copied here # because the sequencing is wrong otherwise sudo mkdir -p $TMP_MOUNT_PATH/tmp/yum sudo mount --bind $YUM_CACHE $TMP_MOUNT_PATH/tmp/yum _install_repos # Install package manager # We are somewhat fighting against the "yum" version on the host to # get things installed correctly. Fedora 27 onwards has a # "curl-minimal" package that will get pulled in by default for the # initial install (ianw: I think because the yum doesn't understand # weak dependencies correctly). This causes problems later if/when # "curl" gets installed (you need to add --allowerasing to let dnf get # rid of the old package). To avoid this, just install the full curl # and first up. On Centos, it's different again and we need to # specify libcurl as well, or the minimal libcurl packages come in # causing similar problems. *But* -- we can't also do that on Fedora # it seems, as it seems like as part of the Fedora modular updates # (https://docs.fedoraproject.org/en-US/modularity/) we can pick up # seemingly mismatched libraries. if [[ ${DISTRO_NAME} == 'fedora' ]]; then _install_pkg_manager dnf dnf-plugins-core curl elif [[ ${DISTRO_NAME} == centos && $DIB_RELEASE -ge 8 ]]; then _install_pkg_manager dnf dnf-plugins-core curl libcurl else _install_pkg_manager yum fi # we just installed yum/dnf with "outside" tools (yum/rpm) which # might have created /var/lib/[yum|rpm] (etc) that are slighlty # incompatible. Refresh everything with the in-chroot tools sudo -E chroot $TARGET_ROOT rpm --rebuilddb sudo -E chroot $TARGET_ROOT ${YUM} clean all # populate the lang reduction macro in the chroot echo "%_install_langs C:en_US:en_US.UTF-8" | \ sudo tee -a $TARGET_ROOT/etc/rpm/macros.langs > /dev/null _base_packages="systemd passwd findutils sudo util-linux-ng " # This package is split out from systemd on >F24, dracut is # missing the dependency and will fail to make an initrd without # it; see # https://bugzilla.redhat.com/show_bug.cgi?id=1398505 _base_packages+="systemd-udev " # bootstrap the environment within the chroot; bring in new # metadata with an update and install some base packages we need. sudo -E chroot $TARGET_ROOT ${YUM} -y update sudo -E chroot $TARGET_ROOT ${YUM} -y \ --setopt=cachedir=/tmp/yum/$ARCH/$DIB_RELEASE \ install ${_base_packages} # Put in a dummy /etc/resolv.conf over the temporary one we used # to bootstrap. systemd has a bug/feature [1] that it will assume # you want systemd-networkd as the network manager and create a # broken symlink to /run/... if the base image doesn't have one. # This broken link confuses things like dhclient. # [1] https://bugzilla.redhat.com/show_bug.cgi?id=1197204 echo -e "# This file intentionally left blank\n" | \ sudo tee $TARGET_ROOT/etc/resolv.conf # set the most reliable UTF-8 locale echo -e 'LANG="en_US.UTF-8"' | \ sudo tee $TARGET_ROOT/etc/locale.conf # default to UTC sudo -E chroot $TARGET_ROOT ln -sf /usr/share/zoneinfo/UTC \ /etc/localtime # cleanup # TODO : move this into a exit trap; and reconsider how # this integrates with the global exit cleanup path. sudo umount $TMP_MOUNT_PATH/tmp/yum sudo umount $TARGET_ROOT/proc sudo umount $TARGET_ROOT/dev/pts sudo umount $TARGET_ROOT/dev sudo umount $TARGET_ROOT/sys # RPM doesn't know whether files have been changed since install # At this point though, we know for certain that we have changed no # config files, so anything marked .rpmnew is just a bug. for newfile in $(sudo find $TARGET_ROOT -type f -name '*rpmnew') ; do sudo mv $newfile $(echo $newfile | sed 's/.rpmnew$//') done sudo rm -f ${TARGET_ROOT}/.extra_settings diskimage-builder-2.35.0/diskimage_builder/elements/uboot/0000775000175000017500000000000013640271564023623 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/uboot/cleanup.d/0000775000175000017500000000000013640271564025474 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/uboot/cleanup.d/98-uboot0000775000175000017500000000162413640271474027013 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail function post_process() { mkimage -A $1 -O linux -T kernel -C none -a $UBOOT_KERNEL_ADDR -e $UBOOT_KERNEL_EP -n "Kernel" -d $KERNEL uImage mv uImage $KERNEL mkimage -A $1 -O linux -T ramdisk -a 0 -n "RAMdisk" -C gzip -d $RAMDISK uInitrd mv uInitrd $RAMDISK } UBOOT_KERNEL_ADDR=${UBOOT_KERNEL_ADDR:-0x80000} UBOOT_KERNEL_EP=${UBOOT_KERNEL_EP:-0x80000} [ -n "$TARGET_ROOT" ] # Check if RAMDISK is being built. if [ -f "$TARGET_ROOT/tmp/ramdisk" ] ; then KERNEL="$TARGET_ROOT/tmp/kernel" RAMDISK="$TARGET_ROOT/tmp/ramdisk" else source "$_LIB/img-functions" # Dig up the initrd and kernel to use. select_boot_kernel_initrd "$TARGET_ROOT" KERNEL="$TARGET_ROOT/boot/$KERNEL" RAMDISK="$TARGET_ROOT/boot/$RAMDISK" fi case "$ARCH" in arm*) post_process arm ;; esac diskimage-builder-2.35.0/diskimage_builder/elements/uboot/README.rst0000664000175000017500000000066613640271474025322 0ustar zuulzuul00000000000000===== uboot ===== Perform kernel/initrd post-processing for UBoot. This element helps post-process the kernel/initrd for use with uboot. It works with ramdisk images as well as user images. This element needs u-boot-tools to be installed on the host. The load address and entry point for UBoot kernel can be specified as shown in the example below. Example: export UBOOT\_KERNEL\_ADDR=0x80000 export UBOOT\_KERNEL\_EP=0x80000 diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/0000775000175000017500000000000013640271564025540 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/post-install.d/0000775000175000017500000000000013640271564030413 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015300000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/post-install.d/70-init-ibft-interfacesdiskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/post-install.d/70-init-ibft-inte0000775000175000017500000000061213640271474033406 0ustar zuulzuul00000000000000#!/bin/bash if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail case "$DIB_INIT_SYSTEM" in upstart) ;; systemd) systemctl enable init-ibft-interfaces.service ;; sysv) update-rc.d init-ibft-interfaces.init defaults ;; *) echo "Unsupported init system $DIB_INIT_SYSTEM" exit 1 ;; esac diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/package-installs.yaml0000664000175000017500000000001713640271474031644 0ustar zuulzuul00000000000000iscsi_package: diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/README.rst0000664000175000017500000000016713640271474027233 0ustar zuulzuul00000000000000=============== ibft-interfaces =============== Initialize network interfaces with information provided through iBFT. diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/element-deps0000664000175000017500000000007013640271474030042 0ustar zuulzuul00000000000000dib-init-system install-static package-installs pkg-map diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/pkg-map0000664000175000017500000000032613640271474027020 0ustar zuulzuul00000000000000{ "family": { "redhat": { "iscsi_package": "iscsi-initiator-utils" }, "gentoo": { "iscsi_package": "sys-block/open-iscsi" } }, "default": { "iscsi_package": "open-iscsi" } } diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/init-scripts/0000775000175000017500000000000013640271564030170 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/init-scripts/systemd/0000775000175000017500000000000013640271564031660 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016600000000000011220 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/init-scripts/systemd/init-ibft-interfaces.servicediskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/init-scripts/systemd/init-ibft-i0000664000175000017500000000042313640271474033715 0ustar zuulzuul00000000000000[Unit] Description=Initialize iBFT network interfaces After=network.target Before=network-online.target Wants=network-online.target [Service] Type=oneshot User=root ExecStart=/usr/local/sbin/init-ibft-interfaces.sh RemainAfterExit=true [Install] WantedBy=multi-user.target diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/init-scripts/sysv/0000775000175000017500000000000013640271564031174 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016000000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/init-scripts/sysv/init-ibft-interfaces.initdiskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/init-scripts/sysv/init-ibft-inte0000775000175000017500000000117113640271474033744 0ustar zuulzuul00000000000000#!/bin/sh -e ### BEGIN INIT INFO # Provides: init-ibft-interfaces # Required-Start: $local_fs networking # Required-Stop: $local_fs # Default-Start: S # Default-Stop: 0 6 # X-Start-Before: # Short-Description: Initialize iBFT interfaces # Description: Initialize iBFT network interfaces ### END INIT INFO NAME=init-ibft-interfaces INIT_NAME=/etc/init.d/${NAME} SCRIPT_NAME=/usr/local/sbin/${NAME}.sh [ -x $SCRIPT_NAME ] || exit 0 case "$1" in start) $SCRIPT_NAME ;; stop) ;; *) echo "Usage: $INIT_NAME {start|stop}" exit 1 ;; esac exit 0 diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/init-scripts/upstart/0000775000175000017500000000000013640271564031672 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016300000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/init-scripts/upstart/init-ibft-interfaces.confdiskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/init-scripts/upstart/init-ibft-i0000664000175000017500000000042613640271474033732 0ustar zuulzuul00000000000000# init-ibft-interfaces - Initialize iBFT network interfaces description "Initialize iBFT network interfaces" start on runlevel [2345] stop on runlevel [!2345] respawn respawn limit 10 5 umask 022 expect stop console output exec /usr/local/sbin/init-ibft-interfaces.sh diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/static/0000775000175000017500000000000013640271564027027 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/static/etc/0000775000175000017500000000000013640271564027602 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/static/etc/modules-load.d/0000775000175000017500000000000013640271564032411 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/static/etc/modules-load.d/ibft.confdiskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/static/etc/modules-load.d/ibft.c0000664000175000017500000000004613640271474033501 0ustar zuulzuul00000000000000iscsi_boot_sysfs iscsi_ibft iscsi_tcp diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/static/usr/0000775000175000017500000000000013640271564027640 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/static/usr/local/0000775000175000017500000000000013640271564030732 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/static/usr/local/sbin/0000775000175000017500000000000013640271564031665 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016200000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/static/usr/local/sbin/init-ibft-interfaces.shdiskimage-builder-2.35.0/diskimage_builder/elements/ibft-interfaces/static/usr/local/sbin/init-ibft-0000775000175000017500000000076513640271474033565 0ustar zuulzuul00000000000000#!/bin/bash # dib-lint: disable=dibdebugtrace set -eux set -o pipefail # iscsistart is a part of the dependencies, but check just in case. if ! iscsistart -v; then echo "iscsistart not found, iBFT devices won't be connected" exit 1 fi if iscsistart -f; then if ! iscsistart -N; then echo "Could not configure iBFT devices" exit 1 fi # Make sure the events for new devices are processed udevadm settle else echo "No iBFT devices to configure, exiting" fi diskimage-builder-2.35.0/diskimage_builder/elements/selinux-permissive/0000775000175000017500000000000013640271564026346 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/selinux-permissive/pre-install.d/0000775000175000017500000000000013640271564031022 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015300000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/selinux-permissive/pre-install.d/11-selinux-permissivediskimage-builder-2.35.0/diskimage_builder/elements/selinux-permissive/pre-install.d/11-selinux-perm0000775000175000017500000000030113640271474033611 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail echo "SELINUX=permissive" > /etc/selinux/config echo "SELINUXTYPE=targeted" >> /etc/selinux/config diskimage-builder-2.35.0/diskimage_builder/elements/selinux-permissive/README.rst0000664000175000017500000000030413640271474030032 0ustar zuulzuul00000000000000================== selinux-permissive ================== Puts selinux into permissive mode by writing SELINUX=permissive to /etc/selinux/config Enable this element when debugging selinux issues. diskimage-builder-2.35.0/diskimage_builder/elements/hwburnin/0000775000175000017500000000000013640271564024327 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/hwburnin/binary-deps.d/0000775000175000017500000000000013640271564026766 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/hwburnin/binary-deps.d/hwburnin0000664000175000017500000000001713640271474030543 0ustar zuulzuul00000000000000spew memtester diskimage-builder-2.35.0/diskimage_builder/elements/hwburnin/init.d/0000775000175000017500000000000013640271564025514 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/hwburnin/init.d/70-hwburnin0000664000175000017500000000015513640271474027520 0ustar zuulzuul00000000000000echo "Starting HW Burnin" memtester 1G 10 # XXX: Discover RAM size # XXX: Discover and test disks with spew diskimage-builder-2.35.0/diskimage_builder/elements/hwburnin/README.rst0000664000175000017500000000015413640271474026016 0ustar zuulzuul00000000000000======== hwburnin ======== A hardware test ramdisk - exercises the machine RAM and exercises the hard disks diskimage-builder-2.35.0/diskimage_builder/elements/grub2/0000775000175000017500000000000013640271564023514 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/grub2/post-install.d/0000775000175000017500000000000013640271564026367 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/grub2/post-install.d/01-delete-grubenv0000775000175000017500000000033213640271474031441 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # Delete /boot/grub2/grubenv if it exists because # it will fail while doing grub-install again. rm -f /boot/grub2/grubenv diskimage-builder-2.35.0/diskimage_builder/elements/grub2/package-installs.yaml0000664000175000017500000000023313640271474027620 0ustar zuulzuul00000000000000signed_grub_efi: arch: amd64 signed_shim_efi: arch: amd64 grub_bios: arch: amd64 signed_grub_efi_arm64: arch: arm64 grub_bios_arm64: arch: arm64 diskimage-builder-2.35.0/diskimage_builder/elements/grub2/README.rst0000664000175000017500000000045013640271474025202 0ustar zuulzuul00000000000000===== grub2 ===== This image installs grub2 bootloader on the image, that's necessary for the local boot feature in Ironic to work. This is being made a separated element because usually images have grub2 removed for space reasons and also because they are going to boot from network (PXE boot). diskimage-builder-2.35.0/diskimage_builder/elements/grub2/pkg-map0000664000175000017500000000154413640271474024777 0ustar zuulzuul00000000000000{ "release": { "rhel": { "8": { "signed_grub_efi": "efibootmgr grub2-efi-x64-modules grub2-efi-x64", "signed_shim_efi": "shim", "grub_bios": "grub2" } } }, "family":{ "debian":{ "signed_grub_efi": "grub-efi-amd64-signed", "signed_shim_efi": "shim-signed", "grub_bios": "grub-pc-bin", "signed_grub_efi_arm64": "grub-efi-arm64", "grub_bios_arm64": "grub-efi-arm64-bin" }, "redhat":{ "signed_grub_efi": "efibootmgr grub2-efi-x64-modules grub2-efi-x64", "signed_shim_efi": "shim", "grub_bios": "grub2" }, "suse":{ "signed_grub_efi": "", "signed_shim_efi": "", "grub_bios": "grub2" } }, "default":{ "signed_grub_efi": "grub-efi-amd64-signed", "signed_shim_efi": "shim-signed", "grub_bios": "grub-pc-bin" } } diskimage-builder-2.35.0/diskimage_builder/elements/zipl/0000775000175000017500000000000013640271564023451 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/zipl/pre-install.d/0000775000175000017500000000000013640271564026125 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/zipl/pre-install.d/kernel_config0000775000175000017500000000163113640271474030661 0ustar zuulzuul00000000000000#!/bin/bash # Copyright (c) 2017 IBM Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail KERNEL_CONF_FILE=/etc/kernel-img.conf if [ -e "$KERNEL_CONF_FILE" ]; then # Remove the line if already set sed -i "/^link_in_boot.*/d" "$KERNEL_CONF_FILE" fi # Set the kernel config option echo "link_in_boot = yes" >>"$KERNEL_CONF_FILE" diskimage-builder-2.35.0/diskimage_builder/elements/zipl/package-installs.yaml0000664000175000017500000000006113640271474027554 0ustar zuulzuul00000000000000s390-tools: arch: s390x dmsetup: arch: s390x diskimage-builder-2.35.0/diskimage_builder/elements/zipl/README.rst0000664000175000017500000000104713640271474025142 0ustar zuulzuul00000000000000========== zipl ========== Zipl is the bootloader for s390x. This element installs zipl on the base device holding the /boot directory on the system. It's mandatory for building s390x images. It replaces the `bootloader` element (which would install grub2 by default). This element has been tested with `ubuntu` and `ubuntu-minimal` distro. Arguments ========= * ``DIB_ZIPL_DEFAULT_CMDLINE`` sets the CMDLINE parameters that are appended to the zipl.conf parameter configuration. It defaults to 'LANG=en_US.UTF-8 console=ttyS0 console=ttyS1' diskimage-builder-2.35.0/diskimage_builder/elements/zipl/element-provides0000664000175000017500000000001313640271474026650 0ustar zuulzuul00000000000000bootloader diskimage-builder-2.35.0/diskimage_builder/elements/zipl/element-deps0000664000175000017500000000002113640271474025747 0ustar zuulzuul00000000000000package-installs diskimage-builder-2.35.0/diskimage_builder/elements/zipl/environment.d/0000775000175000017500000000000013640271564026237 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/zipl/environment.d/10-zipl-default-cmdline0000664000175000017500000000015413640271474032411 0ustar zuulzuul00000000000000export DIB_ZIPL_DEFAULT_CMDLINE=${DIB_ZIPL_DEFAULT_CMDLINE:-"LANG=en_US.UTF-8 console=ttyS0 console=ttyS1"} diskimage-builder-2.35.0/diskimage_builder/elements/zipl/finalise.d/0000775000175000017500000000000013640271564025465 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/zipl/finalise.d/50-zipl0000775000175000017500000000372213640271474026617 0ustar zuulzuul00000000000000#!/bin/bash # Copyright (c) 2017 IBM Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. # Configure zipl. if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail # get the device containing the /boot directory base_device=`df /boot --output=source | grep "/dev/*"` cat > /lib/s390-tools/zipl_helper.loop < /etc/zipl.conf < $CACHED_FILE_LOCK diskimage-builder-2.35.0/diskimage_builder/elements/apt-preferences/0000775000175000017500000000000013640271564025556 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/apt-preferences/extra-data.d/0000775000175000017500000000000013640271564030032 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/apt-preferences/extra-data.d/99-set-apt-package-pinsdiskimage-builder-2.35.0/diskimage_builder/elements/apt-preferences/extra-data.d/99-set-apt-package-0000775000175000017500000000314313640271474033243 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # exit directly if DIB_DPKG_MANIFEST is not defined properly if [ -z "${DIB_DPKG_MANIFEST:-}" ]; then echo "DIB_DPKG_MANIFEST must be set to the location of a manifest file you wish to use" exit 0 elif [ ! -f "$DIB_DPKG_MANIFEST" -o ! -s "$DIB_DPKG_MANIFEST" ]; then echo "$DIB_DPKG_MANIFEST is not a valid manifest file." echo "You should assign a proper manifest file in DIB_DPKG_MANIFEST" exit 1 fi DIB_DPKG_MANIFEST=$(readlink -f $DIB_DPKG_MANIFEST) # Create the preferences file from the given manifest outfile=$(mktemp) for package in $(jq -r ".packages[].package" $DIB_DPKG_MANIFEST); do version=$(jq -r ".packages[] | select(.package == \"${package}\") |\ .version" $DIB_DPKG_MANIFEST) cat << EOF >> $outfile Package: ${package} Pin: version ${version} Pin-Priority: 1001 EOF done if [ -s $outfile ]; then sudo mv $outfile $TMP_MOUNT_PATH/etc/apt/preferences else rm $outfile fi diskimage-builder-2.35.0/diskimage_builder/elements/apt-preferences/README.rst0000664000175000017500000000126313640271474027247 0ustar zuulzuul00000000000000=============== apt-preferences =============== This element generates the APT preferences file based on the provided manifest provided by the :doc:`../manifests/README` element. The APT preferences file can be used to control which versions of packages will be selected for installation. APT uses a priority system to make this determination. For more information about APT preferences, see the apt_preferences(5) man page. Environment Variables --------------------- DIB_DPKG_MANIFEST: :Required: No :Default: None :Description: The manifest file to generate the APT preferences file from. :Example: ``DIB\_DPKG\_MANIFEST=~/image.d/dib-manifests/dib-manifest-dpkg-image`` diskimage-builder-2.35.0/diskimage_builder/elements/vm/0000775000175000017500000000000013640271564023115 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/vm/README.rst0000664000175000017500000000015013640271474024600 0ustar zuulzuul00000000000000== vm == Sets up a partitioned disk (rather than building just one filesystem with no partition table). diskimage-builder-2.35.0/diskimage_builder/elements/vm/element-deps0000664000175000017500000000003013640271474025413 0ustar zuulzuul00000000000000block-device bootloader diskimage-builder-2.35.0/diskimage_builder/elements/vm/finalise.d/0000775000175000017500000000000013640271564025131 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/vm/finalise.d/50-remove-bogus-udev-links0000775000175000017500000000036213640271474031773 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ $DISTRO_NAME = 'opensuse' ] ; then # workaround for https://bugzilla.novell.com/show_bug.cgi?id=859493 rm -f /dev/mapper/loop*_part1 fi diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-signed/0000775000175000017500000000000013640271564025264 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-signed/post-install.d/0000775000175000017500000000000013640271564030137 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-signed/post-install.d/90-get-signed-kerneldiskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-signed/post-install.d/90-get-signed-kerne0000775000175000017500000000216213640271474033444 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2015 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail # Get signed kernel version LATEST_SIGNED_KERNEL=$(ls /boot/vmlinu*.efi.signed | sort | tail -1) if [ "$LATEST_SIGNED_KERNEL" == "" ]; then echo "Unable to find a suitable kernel" >>/dev/stderr exit 1 fi SIGNED_KERNEL_VERSION=${LATEST_SIGNED_KERNEL##/boot/vmlinu[zx]-} echo "Found signed ubuntu kernel version $SIGNED_KERNEL_VERSION" cat > /dib-signed-kernel-version << EOF DIB_SIGNED_KERNEL_VERSION=$SIGNED_KERNEL_VERSION EOF diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-signed/package-installs.yaml0000664000175000017500000000003413640271474031367 0ustar zuulzuul00000000000000linux-signed-image-generic: diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-signed/README.rst0000664000175000017500000000032613640271474026754 0ustar zuulzuul00000000000000============= ubuntu-signed ============= The ``ubuntu-signed`` element installs ``linux-signed-image-generic`` that provides signed kernel that can be used for deploy in UEFI secure boot mode. .. element_deps:: diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-signed/element-deps0000664000175000017500000000000713640271474027566 0ustar zuulzuul00000000000000ubuntu diskimage-builder-2.35.0/diskimage_builder/elements/disable-nouveau/0000775000175000017500000000000013640271564025556 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/disable-nouveau/README.rst0000664000175000017500000000026713640271474027252 0ustar zuulzuul00000000000000=============== disable-nouveau =============== Blacklist nouveau module This is required when installing NVIDIA GPU drivers and to avoid issues with PCI passthrough of NVIDIA GPUs. diskimage-builder-2.35.0/diskimage_builder/elements/disable-nouveau/element-deps0000664000175000017500000000001113640271474030053 0ustar zuulzuul00000000000000modprobe diskimage-builder-2.35.0/diskimage_builder/elements/disable-nouveau/modprobe.d/0000775000175000017500000000000013640271564027607 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/disable-nouveau/modprobe.d/disable-nouveau.conf0000664000175000017500000000005413640271474033540 0ustar zuulzuul00000000000000blacklist nouveau options nouveau modeset=0 diskimage-builder-2.35.0/diskimage_builder/elements/disable-nouveau/dracut.conf.d/0000775000175000017500000000000013640271564030206 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/disable-nouveau/dracut.conf.d/disable-nouveau.confdiskimage-builder-2.35.0/diskimage_builder/elements/disable-nouveau/dracut.conf.d/disable-nouveau.co0000664000175000017500000000003213640271474033607 0ustar zuulzuul00000000000000omit_drivers+=" nouveau " diskimage-builder-2.35.0/diskimage_builder/elements/enable-serial-console/0000775000175000017500000000000013640271564026636 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/enable-serial-console/cleanup.d/0000775000175000017500000000000013640271564030507 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/enable-serial-console/cleanup.d/99-fix-grub0000664000175000017500000000072113640271474032414 0ustar zuulzuul00000000000000set -euxo BOOTDIR=$TARGET_ROOT/boot # Splashimage in grub has a known issue with serial console # So grub config file needs to be fixed. if [ -f $BOOTDIR/grub/grub.conf ] ; then sed -i -e "/^splashimage/d;s/ rhgb\( \|$\)/\1/g;s/ quiet\( \|$\)/\1/g;/^serial/d;/^terminal/d;/^hiddenmenu/d" $BOOTDIR/grub/grub.conf sed -i "/^default/aserial --unit=0 --speed=9600 --word=8 --parity=no --stop=1\nterminal --timeout=5 serial console" $BOOTDIR/grub/grub.conf fi diskimage-builder-2.35.0/diskimage_builder/elements/enable-serial-console/install.d/0000775000175000017500000000000013640271564030526 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/enable-serial-console/install.d/20-stty0000775000175000017500000000063613640271474031703 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail SCRIPTDIR=$(dirname $0) if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then install -m 0644 -o root -g root ${SCRIPTDIR}/ttySx.conf /etc/init/ttySx.conf elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then install -D -g root -o root -m 0644 ${SCRIPTDIR}/serial-console-udev.rules /etc/udev/rules.d/99-serial-console.rules fi diskimage-builder-2.35.0/diskimage_builder/elements/enable-serial-console/install.d/ttySx.conf0000664000175000017500000000070413640271474032531 0ustar zuulzuul00000000000000# This service maintains a getty on ttyS0/1 from the point the system is # started until it is shut down again. start on stopped rc or RUNLEVEL=[2345] stop on runlevel [!2345] respawn script console_port=0 echo "ttySx probing ttyS1" >/dev/ttyS1 2>/dev/null && console_port=1 echo "ttySx: console tty = /dev/ttyS$console_port" >&2 exec /sbin/agetty -m ttyS$console_port 115200,57600,38400,9600,4800 vt102 end script ././@LongLink0000000000000000000000000000015600000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/enable-serial-console/install.d/serial-console-udev.rulesdiskimage-builder-2.35.0/diskimage_builder/elements/enable-serial-console/install.d/serial-console-u0000664000175000017500000000015513640271474033633 0ustar zuulzuul00000000000000SUBSYSTEM=="tty", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}+="getty@$name.service", ATTRS{type}=="4" diskimage-builder-2.35.0/diskimage_builder/elements/enable-serial-console/README.rst0000664000175000017500000000060513640271474030326 0ustar zuulzuul00000000000000===================== enable-serial-console ===================== Start getty on active serial consoles. With ILO and other remote admin environments, having a serial console can be useful for debugging and troubleshooting. For upstart: If ttyS1 exists, getty will run on that, otherwise on ttyS0. For systemd: We dynamically start a getty on any active serial port via udev rules. diskimage-builder-2.35.0/diskimage_builder/elements/openssh-server/0000775000175000017500000000000013640271564025456 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/openssh-server/post-install.d/0000775000175000017500000000000013640271564030331 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/openssh-server/post-install.d/99-harden-sshd-configdiskimage-builder-2.35.0/diskimage_builder/elements/openssh-server/post-install.d/99-harden-sshd-con0000775000175000017500000000252413640271474033476 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ ${DIB_OPENSSH_SERVER_HARDENING:-1} -eq 1 ]; then macs="MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com" ciphers="Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr" kexalgorithms="KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256" if ! grep -qE "^MACs" /etc/ssh/sshd_config; then sed -i "/# Ciphers and keying/a $macs" /etc/ssh/sshd_config elif ! grep -qE "$macs" /etc/ssh/sshd_config; then sed -i "s/^MACs.*/$macs/" /etc/ssh/sshd_config fi if ! grep -qE "^Ciphers" /etc/ssh/sshd_config; then sed -i "/# Ciphers and keying/a $ciphers" /etc/ssh/sshd_config elif ! grep -qE "$ciphers" /etc/ssh/sshd_config; then sed -i "s/^Ciphers.*/$ciphers/" /etc/ssh/sshd_config fi if ! grep -qE "^KexAlgorithms" /etc/ssh/sshd_config; then sed -i "/# Ciphers and keying/a $kexalgorithms" /etc/ssh/sshd_config elif ! grep -qE "$kexalgorithms" /etc/ssh/sshd_config; then sed -i "s/^KexAlgorithms.*/$kexalgorithms/" /etc/ssh/sshd_config fi fi ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/openssh-server/post-install.d/80-enable-sshd-servicediskimage-builder-2.35.0/diskimage_builder/elements/openssh-server/post-install.d/80-enable-sshd-ser0000775000175000017500000000116513640271474033463 0ustar zuulzuul00000000000000#!/bin/bash if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail case "$DIB_INIT_SYSTEM" in upstart) # nothing to do exit 0 ;; systemd) if [[ $DISTRO_NAME = "ubuntu" || $DISTRO_NAME = "debian" ]]; then systemctl enable ssh.service else systemctl enable sshd.service fi ;; openrc) rc-update add sshd default ;; sysv) # ssh is enabled by default, nothing to do exit 0 ;; *) echo "Unsupported init system $DIB_INIT_SYSTEM" exit 1 ;; esac diskimage-builder-2.35.0/diskimage_builder/elements/openssh-server/package-installs.yaml0000664000175000017500000000002013640271474031554 0ustar zuulzuul00000000000000openssh-server: diskimage-builder-2.35.0/diskimage_builder/elements/openssh-server/README.rst0000664000175000017500000000140013640271474027140 0ustar zuulzuul00000000000000============== openssh-server ============== This element ensures that openssh server is installed and enabled during boot. To disable hardening of sshd configuration, you have to set ``DIB_OPENSSH_SERVER_HARDENING`` to 0. This option will configure KexAlgorithms, Ciphers and MAC following good pratices on https://infosec.mozilla.org/guidelines/openssh Note ---- Most cloud images come with the openssh server service installed and enabled during boot. However, certain cloud images, especially those created by the \*-minimal elements may not have it installed or enabled. In these cases, using this element may be helpful to ensure your image will accessible via SSH. It's usually helpful to combine this element with others such as the `runtime-ssh-host-keys`. diskimage-builder-2.35.0/diskimage_builder/elements/openssh-server/element-deps0000664000175000017500000000006713640271474027766 0ustar zuulzuul00000000000000dib-init-system package-installs runtime-ssh-host-keys diskimage-builder-2.35.0/diskimage_builder/elements/openssh-server/pkg-map0000664000175000017500000000020513640271474026732 0ustar zuulzuul00000000000000{ "family": { "suse": { "openssh-server": "openssh" }, "gentoo": { "openssh-server": "openssh" } } } diskimage-builder-2.35.0/diskimage_builder/elements/docker/0000775000175000017500000000000013640271564023742 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/docker/extra-data.d/0000775000175000017500000000000013640271564026216 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/docker/extra-data.d/01-docker-minimal0000775000175000017500000000226313640271474031260 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2015 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail # This is not using install-packages because it's before install-packages can # work - and is work needed to make it possible for it to work if [ -x $TMP_MOUNT_PATH/usr/bin/apt-get ] ; then sudo chroot $TMP_MOUNT_PATH apt-get update sudo chroot $TMP_MOUNT_PATH apt-get -y install python elif [ -x $TMP_MOUNT_PATH/bin/dnf ] ; then sudo chroot $TMP_MOUNT_PATH dnf install -y findutils elif [ -x $TMP_MOUNT_PATH/usr/bin/yum ] ; then sudo chroot $TMP_MOUNT_PATH yum install -y findutils fi diskimage-builder-2.35.0/diskimage_builder/elements/docker/README.rst0000664000175000017500000000121213640271474025425 0ustar zuulzuul00000000000000====== docker ====== Base element for creating images from docker containers. This element is incomplete by itself, you'll want to add additional elements, such as dpkg or yum to get richer features. At its heart, this element simply exports a root tarball from a named docker container so that other diskimage-builder elements can build on top of it. The variables `DISTRO_NAME` and `DIB_RELEASE` will be used to decide which docker image to pull, and are required for most other elements. Additionally, the `DIB_DOCKER_IMAGE` environment variable can be set in addition to `DISTRO_NAME` and `DIB_RELEASE` if a different docker image is desired. diskimage-builder-2.35.0/diskimage_builder/elements/docker/element-provides0000664000175000017500000000002113640271474027140 0ustar zuulzuul00000000000000operating-system diskimage-builder-2.35.0/diskimage_builder/elements/docker/root.d/0000775000175000017500000000000013640271564025147 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/docker/root.d/08-docker0000775000175000017500000000210713640271474026571 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2015 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ -f ${TARGET_ROOT}/.extra_settings ] ; then . ${TARGET_ROOT}/.extra_settings fi [ -n "$DISTRO_NAME" ] [ -n "$DIB_RELEASE" ] DIB_DOCKER_IMAGE=${DIB_DOCKER_IMAGE:-${DISTRO_NAME}:${DIB_RELEASE}} container=$(docker run -d $DIB_DOCKER_IMAGE /bin/sh) docker export $container | sudo tar -C $TARGET_ROOT --numeric-owner -xf - docker rm $container sudo rm -f ${TARGET_ROOT}/.extra_settings diskimage-builder-2.35.0/diskimage_builder/elements/rhel7/0000775000175000017500000000000013640271564023514 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rhel7/README.rst0000664000175000017500000000261713640271474025211 0ustar zuulzuul00000000000000===== rhel7 ===== .. warning:: This element is deprecated and is left only for backward compatibility. Use the `rhel` element instead. Note that you should set DIB_RELEASE to 7 to indicate which release you are using. Please read the notes. Use RHEL 7 cloud images as the baseline for built disk images. Because RHEL 7 base images are not publicly available, it is necessary to first download the RHEL 7 cloud image from the Red Hat Customer Portal and pass the path to the resulting file to disk-image-create as the ``DIB_LOCAL_IMAGE`` environment variable. The cloud image can be found at (login required): https://access.redhat.com/downloads/content/69/ver=/rhel---7/7.1/x86_64/product-downloads Then before running the image build, define DIB_LOCAL_IMAGE (replace the file name with the one downloaded, if it differs from the example): .. code-block:: bash export DIB_LOCAL_IMAGE=rhel-guest-image-7.1-20150224.0.x86_64.qcow2 The downloaded file will then be used as the basis for any subsequent image builds. For further details about building RHEL 7 images, see the rhel-common and redhat-common element README files. Environment Variables --------------------- DIB_LOCAL_IMAGE :Required: Yes :Default: None :Description: The RHEL 7 base image you have downloaded. See the element description above for more details. :Example: ``DIB_LOCAL_IMAGE=/tmp/rhel7-cloud.qcow2`` diskimage-builder-2.35.0/diskimage_builder/elements/rhel7/element-deps0000664000175000017500000000000413640271474026013 0ustar zuulzuul00000000000000rheldiskimage-builder-2.35.0/diskimage_builder/elements/rhel7/environment.d/0000775000175000017500000000000013640271564026302 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rhel7/environment.d/00-rhel7-element-deprecation.bashdiskimage-builder-2.35.0/diskimage_builder/elements/rhel7/environment.d/00-rhel7-element-deprecation0000664000175000017500000000015513640271474033406 0ustar zuulzuul00000000000000echo "The rhel7 element is deprecated and will be removed in future releases. Use the rhel element instead." diskimage-builder-2.35.0/diskimage_builder/elements/rhel7/environment.d/10-rhel7-distro-name.bash0000664000175000017500000000002513640271474032615 0ustar zuulzuul00000000000000export DIB_RELEASE=7 diskimage-builder-2.35.0/diskimage_builder/elements/zypper/0000775000175000017500000000000013640271564024024 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/zypper/bin/0000775000175000017500000000000013640271564024574 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/zypper/bin/install-packages0000775000175000017500000000407313640271474027750 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2013 SUSE Linux Products GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail MAP_ELEMENT= ACTION=install ACTION_ARGS="--no-recommends" SCRIPTNAME=$(basename $0) function show_options () { echo "Usage: $SCRIPTNAME [package ...]" echo echo "Options:" echo " -u -- update all packages" echo " -e -- erase/remove packages" echo " -d -- download the packages only" echo " -m -- use custom element package map (Example: -m nova)" exit 0 } function run_zypper() { # TODO: Uncertain if this can ever block wanting input from user zypper --non-interactive --gpg-auto-import-keys "$@" } TEMP=$(getopt -o hudem: -n $SCRIPTNAME -- "$@") if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi eval set -- "$TEMP" while true ; do case "$1" in -u) run_zypper dist-upgrade --no-recommends; exit 0;; -e) ACTION="remove"; ACTION_ARGS="--clean-deps"; shift;; -d) ACTION_ARGS="${ACTION_ARGS} --download-only"; shift;; -m) MAP_ELEMENT=$2; shift 2;; -h) show_options;; --) shift; break ;; *) echo "Error: unsupported option $1."; exit 1;; esac done PKGS=$@ if [ -n "$MAP_ELEMENT" ]; then if ! PKGS=$(pkg-map --element $MAP_ELEMENT $@); then echo "bin/pkg-map error. $PKGS" exit 1 fi fi if [ -z "${PKGS}" ]; then echo "Not running install-packages $ACTION with empty packages list" else run_zypper $ACTION $ACTION_ARGS $PKGS fi diskimage-builder-2.35.0/diskimage_builder/elements/zypper/post-install.d/0000775000175000017500000000000013640271564026677 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/zypper/post-install.d/10-mkinitrd0000775000175000017500000000131613640271474030665 0ustar zuulzuul00000000000000#!/bin/bash # The base image created by kiwi does not contain an initrd so create one # here. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # This is to tell mkinitrd to include the right tools for the root filesystem # that will actually be used for the final image. This is likely something # different than what the chroot is currently on (which might currently be a # tmpfs even). echo "rootfstype=${DIB_ROOT_FSTYPE}" > /etc/sysconfig/initrd # ToDo: This it not really clear to me. # Let's see which error occurs. # openSuse mkinitrd requires a valid root device be in fstab. ##sed -i 's/vda1/sda1/' /etc/fstab mkinitrd -A -B # And cleanup again rm /etc/sysconfig/initrd diskimage-builder-2.35.0/diskimage_builder/elements/zypper/post-install.d/98-zypper-clean-cache0000775000175000017500000000022613640271474032535 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # clean all locally cached metadata sudo zypper clean -a diskimage-builder-2.35.0/diskimage_builder/elements/zypper/post-install.d/99-zypper-no-keep-packages0000775000175000017500000000027513640271474033531 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # Disable caching packages for all repositories sudo zypper modifyrepo --all --no-keep-packages diskimage-builder-2.35.0/diskimage_builder/elements/zypper/pre-install.d/0000775000175000017500000000000013640271564026500 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/zypper/pre-install.d/01-zypper-keep-packages0000775000175000017500000000026413640271474032675 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # Enable caching packages for all repositories zypper modifyrepo --all --keep-packages diskimage-builder-2.35.0/diskimage_builder/elements/zypper/install.d/0000775000175000017500000000000013640271564025714 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/zypper/install.d/01-login-defs0000775000175000017500000000042713640271474030112 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [[ ${DIB_RELEASE} == tumbleweed ]] ; then login_defs=/usr/etc/login.defs else login_defs=/etc/login.defs fi sed -i -e "s,^USERGROUPS_ENAB.*$,USERGROUPS_ENAB yes," $login_defs diskimage-builder-2.35.0/diskimage_builder/elements/zypper/README.rst0000664000175000017500000000113413640271474025512 0ustar zuulzuul00000000000000====== zypper ====== This element provides some customizations for zypper based distributions like SLES and openSUSE. It works in a very similar way as the yum element does for yum based distributions. Zypper is reconfigured so that it keeps downloaded packages cached outside of the build chroot so that they can be reused by subsequent image builds. The cache increases image building speed when building multiple images, especially on slow connections. This is more effective than using an HTTP proxy for caching packages since the download servers will often redirect clients to different mirrors. diskimage-builder-2.35.0/diskimage_builder/elements/zypper/element-deps0000664000175000017500000000001413640271474026324 0ustar zuulzuul00000000000000install-bin diskimage-builder-2.35.0/diskimage_builder/elements/zypper/root.d/0000775000175000017500000000000013640271564025231 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/zypper/root.d/50-zypper-cache0000775000175000017500000000045113640271474027773 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail [ -n "$TARGET_ROOT" ] ZYPPER_CACHE_DIR=$DIB_IMAGE_CACHE/zypper mkdir -p $ZYPPER_CACHE_DIR sudo mkdir -p $TMP_MOUNT_PATH/var/cache/zypp sudo mount --bind $ZYPPER_CACHE_DIR $TMP_MOUNT_PATH/var/cache/zypp diskimage-builder-2.35.0/diskimage_builder/elements/__init__.py0000664000175000017500000000000013640271474024572 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dib-init-system/0000775000175000017500000000000013640271564025514 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dib-init-system/post-install.d/0000775000175000017500000000000013640271564030367 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dib-init-system/post-install.d/10-enable-init-scriptsdiskimage-builder-2.35.0/diskimage_builder/elements/dib-init-system/post-install.d/10-enable-init-sc0000775000175000017500000000124213640271474033324 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail SCRIPTS_DIR="$(dirname $0)/../init-scripts/${DIB_INIT_SYSTEM}/" if [[ -d "${SCRIPTS_DIR}" ]]; then # figure out init prefix case "${DIB_INIT_SYSTEM}" in upstart) ;; openrc) # only gentoo needs manual runlevel adding for INIT_SCRIPT in "${SCRIPTS_DIR}"*; do rc-update add $(basename "${INIT_SCRIPT}") default done ;; systemd) ;; sysv) ;; *) echo "ERROR: DIB_INIT_SYSTEM (${DIB_INIT_SYSTEM}) is not a known type" exit 1 ;; esac fi diskimage-builder-2.35.0/diskimage_builder/elements/dib-init-system/pre-install.d/0000775000175000017500000000000013640271564030170 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dib-init-system/pre-install.d/04-dib-init-system0000775000175000017500000000064213640271474033362 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail FILE=/usr/local/bin/dib-init-system # This is a dummy script that simply echos the output of # ${DIB_INIT_SYSTEM}. This script used to try and guess the init # system, but that doesn't work. This script is deprecated. cat > ${FILE} < /etc/iscsi/iscsi.initramfs update-initramfs -u fi diskimage-builder-2.35.0/diskimage_builder/elements/iscsi-boot/package-installs.yaml0000664000175000017500000000003713640271474030654 0ustar zuulzuul00000000000000open-iscsi: phase: install.d diskimage-builder-2.35.0/diskimage_builder/elements/iscsi-boot/README.rst0000664000175000017500000000134213640271474026235 0ustar zuulzuul00000000000000========== iscsi-boot ========== Handles configuration for the disk to be capable of serving as a remote root filesystem through iSCSI. Currently, this element can configure Ubuntu/Debian images and CentOS7 images. It performs the following actions: For Ubuntu/Debian images: * Installs the ``open-iscsi`` package. * Creates the ``etc/iscsi/iscsi.initramfs`` configuration file and sets ``ISCSI_AUTO=true`` within it. * Updates the initramfs to apply the changes. For CentOS7 images: * Required ``dracut-regenerate`` element when performs ``disk-image-create``. * Updates ``network`` and ``iscsi`` into ``dracut-regenerate`` during pre-installs. * Updates ``GRUB_CMDLINE_LINUX_DEFAULT`` into ``/etc/default/grub``. diskimage-builder-2.35.0/diskimage_builder/elements/iscsi-boot/element-deps0000664000175000017500000000002113640271474027044 0ustar zuulzuul00000000000000package-installs diskimage-builder-2.35.0/diskimage_builder/elements/iscsi-boot/environment.d/0000775000175000017500000000000013640271564027334 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/iscsi-boot/environment.d/open-iscsi-config0000664000175000017500000000023013640271474032566 0ustar zuulzuul00000000000000if [[ $DISTRO_NAME = "centos7" ]]; then DIB_DRACUT_ENABLED_MODULES+=" - name: network - name: iscsi " export DIB_DRACUT_ENABLED_MODULES fi diskimage-builder-2.35.0/diskimage_builder/elements/iscsi-boot/finalise.d/0000775000175000017500000000000013640271564026562 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/iscsi-boot/finalise.d/51-open-iscsi-config0000775000175000017500000000043113640271474032245 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [[ $DISTRO_NAME = "centos7" ]]; then sed -i -E 's/(GRUB_CMDLINE_LINUX_DEFAULT=")(.+)(")/\1\2 rd.iscsi.firmware=1"/' /etc/default/grub grub2-mkconfig -o /boot/grub2/grub.cfg fi diskimage-builder-2.35.0/diskimage_builder/elements/openstack-ci-mirrors/0000775000175000017500000000000013640271564026546 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/openstack-ci-mirrors/extra-data.d/0000775000175000017500000000000013640271564031022 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/openstack-ci-mirrors/extra-data.d/75-copy-mirror-infodiskimage-builder-2.35.0/diskimage_builder/elements/openstack-ci-mirrors/extra-data.d/75-copy-mirror0000775000175000017500000000056413640271474033470 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # On infra nodes, make a copy of the mirror_info.sh script inside the # chroot for elements running in chroot like EPEL that want to # reference it. mirror_info=/etc/ci/mirror_info.sh if [ -f $mirror_info ]; then cp /etc/ci/mirror_info.sh $TMP_HOOKS_PATH/mirror_info.sh fi diskimage-builder-2.35.0/diskimage_builder/elements/openstack-ci-mirrors/README.rst0000664000175000017500000000046113640271474030236 0ustar zuulzuul00000000000000==================== openstack-ci-mirrors ==================== This element contains various settings to setup mirrors for openstack ci gate testing in a generic fashion. It is intended to be used as a dependency of testing elements that run in the gate. It should do nothing outside that environment. diskimage-builder-2.35.0/diskimage_builder/elements/openstack-ci-mirrors/environment.d/0000775000175000017500000000000013640271564031334 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016700000000000011221 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/openstack-ci-mirrors/environment.d/11-dib-distribution-mirror.bashdiskimage-builder-2.35.0/diskimage_builder/elements/openstack-ci-mirrors/environment.d/11-dib-distri0000664000175000017500000000465113640271474033536 0ustar zuulzuul00000000000000# Set DIB_DISTRIBUTION_MIRROR and related if running in openstack gate # don't spam logs with this source _xtrace=$(set +o | grep xtrace) set +o xtrace if [ -f /etc/ci/mirror_info.sh ]; then # outside chroot mirror_info=/etc/ci/mirror_info.sh elif [ -f /tmp/in_target.d/mirror_info.sh ]; then # inside chroot mirror_info=/tmp/in_target.d/mirror_info.sh else echo "No mirror file found. Not an OpenStack CI node?" return 0 fi source $mirror_info $_xtrace # note 11- is after 10- which is where DISTRO_NAME is set usually if [[ "${DISTRO_NAME}" == "ubuntu" ]]; then if [[ "${ARCH}" == "arm64" ]]; then export DIB_DISTRIBUTION_MIRROR=${NODEPOOL_UBUNTU_PORTS_MIRROR} elif [[ "${ARCH}" == "amd64" ]]; then export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_UBUNTU_MIRROR fi export DIB_DEBOOTSTRAP_EXTRA_ARGS+=" --no-check-gpg" elif [[ "${DISTRO_NAME}" == "debian" ]]; then export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_DEBIAN_MIRROR export DIB_DEBOOTSTRAP_EXTRA_ARGS+=" --no-check-gpg" elif [[ "${DISTRO_NAME}" == "fedora" ]]; then export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_FEDORA_MIRROR elif [[ "${DISTRO_NAME}" == "centos" ]]; then export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_CENTOS_MIRROR export DIB_EPEL_MIRROR=$NODEPOOL_EPEL_MIRROR elif [[ "${DISTRO_NAME}" == "centos7" ]]; then export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_CENTOS_MIRROR export DIB_EPEL_MIRROR=$NODEPOOL_EPEL_MIRROR elif [[ "${DISTRO_NAME}" == "opensuse" ]]; then export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_OPENSUSE_MIRROR fi # Infra doesn't mirror non-free repos, so instruct to ignore these export DIB_DISTRIBUTION_MIRROR_UBUNTU_IGNORE="(universe|multiverse)" export DIB_DISTRIBUTION_MIRROR_UBUNTU_INSECURE=1 # These repo files are pre-created for the fedora/centos-minimal jobs # in the gate. Not relevant inside the chroot. if [[ -d ${DIB_OS_CI_YUM_REPOS:-/not/a/path/} ]]; then if [[ "${DISTRO_NAME}" == "fedora" ]]; then if [[ -d ${DIB_OS_CI_YUM_REPOS}/fedora-minimal/${DIB_RELEASE} ]]; then export DIB_YUM_MINIMAL_BOOTSTRAP_REPOS=${DIB_OS_CI_YUM_REPOS}/fedora-minimal/${DIB_RELEASE}/yum.repos.d else export DIB_YUM_MINIMAL_BOOTSTRAP_REPOS=${DIB_OS_CI_YUM_REPOS}/fedora-minimal/default/yum.repos.d fi elif [[ "${DISTRO_NAME}" == "centos" ]]; then export DIB_YUM_MINIMAL_BOOTSTRAP_REPOS=${DIB_OS_CI_YUM_REPOS}/centos-minimal/${DIB_RELEASE}/yum.repos.d fi fi diskimage-builder-2.35.0/diskimage_builder/elements/openstack-ci-mirrors/root.d/0000775000175000017500000000000013640271564027753 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/openstack-ci-mirrors/root.d/10-apt-disable-gpg0000775000175000017500000000212113640271474033053 0ustar zuulzuul00000000000000#!/bin/bash # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # dib-lint: disable=safe_sudo if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # Disable gpg signing for apt openstack ci repos are created by reprepro # and not signed. # This has to be after debootstrap, but before anything else tries to # use the mirror. APT_DIR=${TARGET_ROOT}/etc/apt/apt.conf.d if [ -d ${APT_DIR} ]; then FILE=${APT_DIR}/99unauthenticated sudo dd of=${FILE} < $TMP_HOOKS_PATH/ssh-authorized-keys fi diskimage-builder-2.35.0/diskimage_builder/elements/local-config/pre-install.d/0000775000175000017500000000000013640271564027504 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/local-config/pre-install.d/02-proxy-settings0000775000175000017500000000403313640271474032670 0ustar zuulzuul00000000000000#!/bin/bash # Save the HTTP/[S] and noproxy settings if available. # XXX: Obviously not suitable for downloadable images. if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail have_apt= have_yum= have_zypper= http_proxy=${http_proxy:-""} https_proxy=${https_proxy:-""} if [ -d /etc/apt ] ; then have_apt=1 fi if [ -e /etc/yum.conf ] ; then have_yum=1 fi if [ -d /etc/zypp ] ; then have_zypper=1 fi if [ -n "$http_proxy" ]; then if [ -d ~stack ]; then echo export http_proxy=$http_proxy >> ~stack/.profile fi if [ -n "$have_apt" ] ; then echo "Acquire::http::Proxy \"$http_proxy\";" > /etc/apt/apt.conf.d/02-use-http-proxy fi if [ -n "$have_yum" ] ; then sed -i -e "s,\[main\],[main]\nproxy=$http_proxy," /etc/yum.conf fi if [ -n "$have_zypper" ] ; then sed -i -e "s,^HTTP_PROXY=.*$,HTTP_PROXY=\"$http_proxy\"," /etc/sysconfig/proxy fi fi if [ -n "$https_proxy" ]; then if [ -d ~stack ]; then echo export https_proxy=$https_proxy >> ~stack/.profile fi if [ -n "$have_apt" ] ; then echo "Acquire::https::Proxy \"$https_proxy\";" > /etc/apt/apt.conf.d/02-use-https-proxy fi if [ -n "$have_zypper" ] ; then sed -i -e "s,^HTTPS_PROXY=.*$,HTTPS_PROXY=\"$https_proxy\"," /etc/sysconfig/proxy fi fi no_proxy=${no_proxy:+"$no_proxy,192.0.2.1"} no_proxy=${no_proxy:-"192.0.2.1"} if [ -n "$no_proxy" ]; then if [ -d ~stack ]; then echo export no_proxy=$no_proxy >> ~stack/.profile fi if [ -n "$have_apt" ] ; then for host in $(sed 's/,/ /g' <<<$no_proxy); do echo "Acquire::http::Proxy::$host \"DIRECT\";" >> /etc/apt/apt.conf.d/02-no-proxy done fi if [ -n "$have_zypper" ] ; then sed -i -e "s,^\(NO_PROXY=.*\)\"$,\1\, $no_proxy\"," /etc/sysconfig/proxy fi fi if [ -n "$http_proxy" -o -n "$https_proxy" -o -n "$no_proxy" ]; then if [ -n "$have_zypper" ] ; then sed -i -e "s,^PROXY_ENABLED=.*$,PROXY_ENABLED=\"yes\"," /etc/sysconfig/proxy fi fi diskimage-builder-2.35.0/diskimage_builder/elements/local-config/install.d/0000775000175000017500000000000013640271564026720 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/local-config/install.d/62-ssh-key0000775000175000017500000000112013640271474030450 0ustar zuulzuul00000000000000#!/bin/bash # Save user SSH public key if available. # XXX: Obviously not suitable for downloadable images. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ "$DIB_LOCAL_CONFIG_USERNAME" == "root" ]; then DIR_NAME=${DIB_LOCAL_CONFIG_USERNAME} else DIR_NAME=home/${DIB_LOCAL_CONFIG_USERNAME} fi if [ -e "/tmp/in_target.d/ssh-authorized-keys" ]; then mkdir -p /${DIR_NAME}/.ssh cat /tmp/in_target.d/ssh-authorized-keys >> /${DIR_NAME}/.ssh/authorized_keys chmod 0700 /${DIR_NAME}/.ssh chmod 0600 /${DIR_NAME}/.ssh/authorized_keys fi diskimage-builder-2.35.0/diskimage_builder/elements/local-config/README.rst0000664000175000017500000000045713640271474026525 0ustar zuulzuul00000000000000============ local-config ============ Copies local user settings such as .ssh/authorized\_keys and $http\_proxy into the image. Environment Variables --------------------- DIB_LOCAL_CONFIG_USERNAME :Required: No :Default: root :Description: Username used when installing .ssh/authorized\_keys. diskimage-builder-2.35.0/diskimage_builder/elements/local-config/element-deps0000664000175000017500000000002113640271474027326 0ustar zuulzuul00000000000000package-installs diskimage-builder-2.35.0/diskimage_builder/elements/local-config/environment.d/0000775000175000017500000000000013640271564027616 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/local-config/environment.d/62-ssh-key0000664000175000017500000000010413640271474031344 0ustar zuulzuul00000000000000export DIB_LOCAL_CONFIG_USERNAME=${DIB_LOCAL_CONFIG_USERNAME:-root} diskimage-builder-2.35.0/diskimage_builder/elements/posix/0000775000175000017500000000000013640271564023635 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/posix/package-installs.yaml0000664000175000017500000000246013640271474027745 0ustar zuulzuul00000000000000"admin": "alias": "ar": "asa": "at": "awk": "basename": "batch": "bc": "bg": "c99": "cal": "cat": "cd": "cflow": "chgrp": "chmod": "chown": "cksum": "cmp": "comm": "command": "compress": "cp": "crontab": "csplit": "ctags": "cut": "cxref": "date": "dd": "delta": "df": "diff": "dirname": "du": "echo": "ed": "env": "ex": "expand": "expr": "false": "fc": "fg": "file": "find": "fold": "fort77": "fuser": "gencat": "get": "getconf": "getopts": "grep": "hash": "head": "iconv": "id": "ipcrm": "ipcs": "jobs": "join": "kill": "lex": "link": "ln": "locale": "localedef": "logger": "logname": "lp": "ls": "m4": "mailx": "make": "man": "mesg": "mkdir": "mkfifo": "more": "mv": "newgrp": "nice": "nl": "nm": "nohup": "od": "paste": "patch": "pathchk": "pax": "pr": "printf": "prs": "ps": "pwd": "qalter": "qdel": "qhold": "qmove": "qmsg": "qrerun": "qrls": "qselect": "qsig": "qstat": "qsub": "read": "renice": "rm": "rmdel": "rmdir": "sact": "sccs": "sed": "sh": "sleep": "sort": "split": "strings": "strip": "stty": "tabs": "tail": "talk": "tee": "test": "time": "touch": "tput": "tr": "true": "tsort": "tty": "type": "ulimit": "umask": "unalias": "uname": "uncompress": "unexpand": "unget": "uniq": "unlink": "uucp": "uudecode": "uuencode": "uustat": "uux": "val": "vi": "wait": "wc": "what": "who": "write": "xargs": "yacc": "zcat": diskimage-builder-2.35.0/diskimage_builder/elements/posix/README.rst0000664000175000017500000000074013640271474025325 0ustar zuulzuul00000000000000posix ===== * This element installs packages to ensure that the resulting image has binaries necessary to meet the requirements of POSIX, laid out in the following URL: + http://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html * This has been tested to work on Ubuntu, Debian, and CentOS, although should work on Red Hat Enterprise Linux. * To add support for other distros please consult the URL for binaries, then add the providing packages to pkg-map. diskimage-builder-2.35.0/diskimage_builder/elements/posix/element-deps0000664000175000017500000000001713640271474026140 0ustar zuulzuul00000000000000openssh-server diskimage-builder-2.35.0/diskimage_builder/elements/posix/pkg-map0000664000175000017500000001727113640271474025124 0ustar zuulzuul00000000000000{ "family":{ "debian":{ "admin": "", "alias": "", "ar": "binutils", "asa": "", "at": "at", "awk": "gawk", "basename": "coreutils", "batch": "at", "bc": "bc", "bg": "", "c99": "gcc", "cal": "bsdmainutils", "cat": "coreutils", "cd": "", "cflow": "cflow", "chgrp": "coreutils", "chmod": "coreutils", "chown": "coreutils", "cksum": "coreutils", "cmp": "diffutils", "comm": "coreutils", "command": "", "compress": "ncompress", "cp": "coreutils", "crontab": "cron", "csplit": "coreutils", "ctags": "exuberant-ctags", "cut": "coreutils", "cxref": "cxref", "date": "coreutils", "dd": "coreutils", "delta": "", "df": "coreutils", "diff": "diffutils", "dirname": "coreutils", "du": "coreutils", "echo": "coreutils", "ed": "ed", "env": "coreutils", "ex": "vim", "expand": "coreutils", "expr": "coreutils", "false": "coreutils", "fc": "", "fg": "", "file": "file", "find": "findutils", "fold": "coreutils", "fort77": "fort77", "fuser": "psmisc", "gencat": "libc-dev-bin", "get": "", "getconf": "libc-bin", "getopts": "", "grep": "grep", "hash": "", "head": "coreutils", "iconv": "libc-bin", "id": "coreutils", "ipcrm": "util-linux", "ipcs": "util-linux", "jobs": "", "join": "coreutils", "kill": "procps", "lex": "flex", "link": "coreutils", "ln": "coreutils", "locale": "libc-bin", "localedef": "libc-bin", "logger": "bsdutils", "logname": "coreutils", "lp": "cups-client", "ls": "coreutils", "m4": "m4", "mailx": "mailutils", "make": "make", "man": "man-db", "mesg": "sysvinit-utils", "mkdir": "coreutils", "mkfifo": "coreutils", "more": "util-linux", "mv": "coreutils", "newgrp": "login", "nice": "coreutils", "nl": "coreutils", "nm": "binutils", "nohup": "coreutils", "od": "coreutils", "paste": "coreutils", "patch": "patch", "pathchk": "coreutils", "pax": "pax", "pr": "coreutils", "printf": "coreutils", "prs": "", "ps": "procps", "pwd": "coreutils", "qalter": "", "qdel": "", "qhold": "", "qmove": "", "qmsg": "", "qrerun": "", "qrls": "", "qselect": "", "qsig": "", "qstat": "", "qsub": "", "read": "", "renice": "bsdutils", "rm": "coreutils", "rmdel": "cssc", "rmdir": "coreutils", "sact": "cssc", "sccs": "cssc", "sed": "sed", "sh": "dash", "sleep": "coreutils", "sort": "coreutils", "split": "coreutils", "strings": "binutils", "strip": "binutils", "stty": "coreutils", "tabs": "ncurses-bin", "tail": "coreutils", "talk": "talk", "tee": "coreutils", "test": "coreutils", "time": "", "touch": "coreutils", "tput": "ncurses-bin", "tr": "coreutils", "true": "coreutils", "tsort": "coreutils", "tty": "coreutils", "type": "", "ulimit": "", "umask": "", "unalias": "", "uname": "coreutils", "uncompress": "gzip", "unexpand": "coreutils", "unget": "", "uniq": "coreutils", "unlink": "coreutils", "uucp": "uucp", "uudecode": "sharutils", "uuencode": "sharutils", "uustat": "uucp", "uux": "uucp", "val": "", "vi": "vim", "wait": "", "wc": "coreutils", "what": "", "who": "coreutils", "write": "bsdmainutils", "xargs": "findutils", "yacc": "bison", "zcat": "gzip" }, "redhat":{ "admin": "", "alias": "bash", "ar": "binutils", "asa": "", "at": "at", "awk": "gawk", "basename": "coreutils", "batch": "at", "bc": "bc", "bg": "", "c99": "gcc", "cal": "util-linux", "cat": "coreutils", "cd": "bash", "cflow": "", "chgrp": "coreutils", "chmod": "coreutils", "chown": "coreutils", "cksum": "coreutils", "cmp": "diffutils", "comm": "coreutils", "command": "bash", "compress": "ncompress", "cp": "coreutils", "crontab": "cronie", "csplit": "coreutils", "ctags": "ctags", "cut": "coreutils", "cxref": "", "date": "coreutils", "dd": "coreutils", "delta": "", "df": "coreutils", "diff": "diffutils", "dirname": "coreutils", "du": "coreutils", "echo": "coreutils", "ed": "ed", "env": "coreutils", "ex": "vim-minimal", "expand": "coreutils", "expr": "coreutils", "false": "coreutils", "fc": "", "fg": "", "file": "file", "find": "findutils", "fold": "coreutils", "fort77": "", "fuser": "psmisc", "gencat": "glibc-common", "get": "", "getconf": "glibc-common", "getopts": "bash", "grep": "grep", "hash": "", "head": "coreutils", "iconv": "glibc-common", "id": "coreutils", "ipcrm": "util-linux", "ipcs": "util-linux", "jobs": "bash", "join": "coreutils", "kill": "util-linux", "lex": "flex", "link": "coreutils", "ln": "coreutils", "locale": "glibc-common", "localedef": "", "logger": "util-linux", "logname": "coreutils", "lp": "cups-client", "ls": "coreutils", "m4": "m4", "mailx": "mailx", "make": "make", "man": "man-db", "mesg": "sysvinit-utils", "mkdir": "coreutils", "mkfifo": "coreutils", "more": "util-linux", "mv": "coreutils", "newgrp": "shadow-utils", "nice": "coreutils", "nl": "coreutils", "nm": "binutils", "nohup": "coreutils", "od": "coreutils", "paste": "coreutils", "patch": "patch", "pathchk": "coreutils", "pax": "pax", "pr": "coreutils", "printf": "coreutils", "prs": "", "ps": "procps-ng", "pwd": "coreutils", "qalter": "", "qdel": "", "qhold": "", "qmove": "", "qmsg": "", "qrerun": "", "qrls": "", "qselect": "", "qsig": "", "qstat": "", "qsub": "", "read": "bash", "renice": "util-linux", "rm": "coreutils", "rmdel": "", "rmdir": "coreutils", "sact": "", "sccs": "", "sed": "sed", "sh": "bash", "sleep": "coreutils", "sort": "coreutils", "split": "coreutils", "strings": "binutils", "strip": "binutils", "stty": "coreutils", "tabs": "ncurses-bin", "tail": "coreutils", "talk": "talk", "tee": "coreutils", "test": "coreutils", "time": "", "touch": "coreutils", "tput": "ncurses", "tr": "coreutils", "true": "coreutils", "tsort": "coreutils", "tty": "coreutils", "type": "", "ulimit": "", "umask": "bash", "unalias": "bash", "uname": "coreutils", "uncompress": "ncompress", "unexpand": "coreutils", "unget": "", "uniq": "coreutils", "unlink": "coreutils", "uucp": "", "uudecode": "sharutils", "uuencode": "sharutils", "uustat": "", "uux": "", "val": "", "vi": "vim-minimal", "wait": "bash", "wc": "coreutils", "what": "", "who": "coreutils", "write": "util-linux", "xargs": "findutils", "yacc": "byacc", "zcat": "gzip" } } } diskimage-builder-2.35.0/diskimage_builder/elements/block-device-gpt/0000775000175000017500000000000013640271564025612 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/block-device-gpt/block-device-ppc64el.yaml0000664000175000017500000000145113640271474032301 0ustar zuulzuul00000000000000# Default GPT block device setup for PPC # -------------------------------------- # # Details (extracted from [1]) # # Power Firmware (OFW) scans chosen (nvram value boot-device) device, # for either PReP* partition or vfat. # # PReP is raw and small (8M max) partition which caries only stage1 # binary. # # [1] https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/W51a7ffcf4dfd_4b40_9d82_446ebc23c550/page/PowerLinux%20Boot%20howto - local_loop: name: image0 - partitioning: base: image0 label: gpt partitions: - name: boot type: '0x4100' size: 8MiB - name: root size: 100% mkfs: type: ext4 mount: mount_point: / fstab: options: "defaults" fsck-passno: 1 diskimage-builder-2.35.0/diskimage_builder/elements/block-device-gpt/block-device-default.yaml0000664000175000017500000000070013640271474032444 0ustar zuulzuul00000000000000# Default single partition loopback using a GPT based partition table - local_loop: name: image0 - partitioning: base: image0 label: gpt partitions: - name: BSP type: 'EF02' size: 8MiB - name: root flags: [ boot ] size: 100% mkfs: type: ext4 mount: mount_point: / fstab: options: "defaults" fsck-passno: 1 diskimage-builder-2.35.0/diskimage_builder/elements/block-device-gpt/README.rst0000664000175000017500000000047513640271474027307 0ustar zuulzuul00000000000000================ Block Device GPT ================ This provides a block-device configuration for the ``vm`` element to get a GPT based single-partition disk. Note on x86 this provides the extra `BIOS boot partition `__ as required for non-EFI boot environments. diskimage-builder-2.35.0/diskimage_builder/elements/block-device-gpt/element-provides0000664000175000017500000000001413640271474031012 0ustar zuulzuul00000000000000block-devicediskimage-builder-2.35.0/diskimage_builder/elements/block-device-gpt/environment.d/0000775000175000017500000000000013640271564030400 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/block-device-gpt/environment.d/15-block-device.bashdiskimage-builder-2.35.0/diskimage_builder/elements/block-device-gpt/environment.d/15-block-device.b0000664000175000017500000000026213640271474033315 0ustar zuulzuul00000000000000# # Arch gate # if [[ "arm64 aarch64" =~ $ARCH ]]; then echo "block-device-gpt is not supported on AARCH64; use block-device-efi" exit 1 fi export DIB_BLOCK_DEVICE=gpt diskimage-builder-2.35.0/diskimage_builder/elements/source-repositories/0000775000175000017500000000000013640271564026520 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/source-repositories/extra-data.d/0000775000175000017500000000000013640271564030774 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/source-repositories/extra-data.d/98-source-repositoriesdiskimage-builder-2.35.0/diskimage_builder/elements/source-repositories/extra-data.d/98-source-repos0000775000175000017500000003020413640271474033605 0ustar zuulzuul00000000000000#!/bin/bash # dib-lint: disable=safe_sudo if [ ${DIB_DEBUG_TRACE:-0} -gt 1 ]; then set -x fi set -eu set -o pipefail # Don't provide any source repositories in environments where they are not allowed if [ -n "${NO_SOURCE_REPOSITORIES:-}" ]; then exit 0 fi # If the old cache exists, move it to the new name function make_new_cache(){ local OLD_CACHE_BASE=$1 local CACHE_BASE=$2 # If the old cache name exists, move it to the new cache name if [ -e "$OLD_CACHE_BASE" ] ; then if [ ! -e "$CACHE_BASE" ] ; then mv -n $OLD_CACHE_BASE $CACHE_BASE else echo "Not replacing new cache location with old cache" fi fi } # Gets repositories or individual files listed in the a repository file # and places them in the specified destination path. # The format of the repository file is one or more lines matching # [] function get_repos_for_element(){ local REPO_SOURCES=$1 local CACHE_URL=$TMP_HOOKS_PATH/bin/cache-url local REGEX="^([^ ]+) (git|tar|file|package) ?(/[^ ]+)? ?([^ ]+)? ?([^ ]*)$" # this can be a rather long list (e.g. caching ~1000 openstack # repos), so we make a rough count for progress display local COUNT=1 local REPO_SOURCES_COUNT=$(grep -v '^$\|^\s*\#' $REPO_SOURCES | wc -l) while read line; do # temporarily turn off globbing '*' (since it may be used as # the REPOREF for tarballs) and expand variables set -f; line=$(eval echo $line); set +f # ignore blank lines and lines beginning in '#' [[ "$line" == \#* ]] || [[ -z "$line" ]] && continue # rough progress counter printf "(%04d / %04d)\n" ${COUNT} ${REPO_SOURCES_COUNT} COUNT=$(( COUNT + 1)) if [[ "$line" =~ $REGEX ]] ; then local REPONAME=${BASH_REMATCH[1]} local REPOTYPE=${BASH_REMATCH[2]} local REPOPATH=${BASH_REMATCH[3]} local REPOLOCATION=${BASH_REMATCH[4]} local REPO_ORIG_LOCATION=$REPOLOCATION if [ $REPONAME = "tar" -a -z "${BASH_REMATCH[5]:-}" ] ; then echo "Warning: Default tarball REPOREF of '*' is deprecated; do not rely on it." fi # Default of '*' for tar repositories is deprecated; do not rely on it. local REPOREF_DEFAULT_TAR=* local REPOREF_DEFAULT_GIT=master local REPOREF_LOOKUP_DEFAULT=REPOREF_DEFAULT_${REPOTYPE^^} local REPOREF=${BASH_REMATCH[5]:-${!REPOREF_LOOKUP_DEFAULT:-}} local REPO_DEST=$TMP_MOUNT_PATH$REPOPATH local REPO_SUB_DIRECTORY=$(dirname $REPO_DEST) # REPOTYPE can be overridden with DIB_REPOTYPE_{name} local REPOTYPE_OVERRIDE=DIB_REPOTYPE_${REPONAME//[^A-Za-z0-9]/_} REPOTYPE=${!REPOTYPE_OVERRIDE:-$REPOTYPE} # REPOLOCATION can be overridden with DIB_REPOLOCATION_{name} local REPOLOCATION_OVERRIDE=DIB_REPOLOCATION_${REPONAME//[^A-Za-z0-9]/_} REPOLOCATION=${!REPOLOCATION_OVERRIDE:-$REPOLOCATION} # REPOREF can be overridden with DIB_REPOREF_{name} local REPOREF_OVERRIDE=DIB_REPOREF_${REPONAME//[^A-Za-z0-9]/_} REPOREF=${!REPOREF_OVERRIDE:-$REPOREF} # Determine a unique cache path for this repo CACHE_NAME=$(echo "${REPOTYPE}_${REPOLOCATION}" | sha1sum | awk '{ print $1 }' ) OLD_CACHE_PATH=${CACHE_BASE}/${CACHE_NAME} # Add the repo name to the sha1sum for readability CACHE_NAME=${REPONAME//[^A-Za-z0-9]/_}_${CACHE_NAME} CACHE_PATH=${CACHE_BASE}/$CACHE_NAME make_new_cache $OLD_CACHE_PATH $CACHE_PATH # Return if install type is not source local INSTALL_TYPE_VAR=DIB_INSTALLTYPE_${REPONAME//[^A-Za-z0-9]/_} local INSTALL_TYPE=${!INSTALL_TYPE_VAR:-$DIB_DEFAULT_INSTALLTYPE} if [ ! $INSTALL_TYPE = "source" ]; then echo "$REPONAME install type not set to source" continue fi case $REPOTYPE in git) if [ -z "${!REPOLOCATION_OVERRIDE:-""}" -a -n "${DIB_GITREPOBASE:-""}" ] ; then # Transform the current repo base to the new one local NEW_REPOLOCATION=$(echo $REPOLOCATION |\ sed "s,^[^:]\+://[^/]\+/\(~[^/]\+\)\?\(.*\)$,${DIB_GITREPOBASE}\2,g") echo "Transformed ${REPOLOCATION} to ${NEW_REPOLOCATION}" REPOLOCATION=$NEW_REPOLOCATION # Also update the cache location CACHE_NAME=$(echo "${REPOTYPE}_${REPOLOCATION}" | sha1sum | awk '{ print $1 }' ) CACHE_PATH=~/.cache/image-create/repository-sources/$CACHE_NAME fi sudo mkdir -p $REPO_SUB_DIRECTORY if [ ! -e "$CACHE_PATH" ] ; then echo "Caching $REPONAME from $REPOLOCATION in $CACHE_PATH" git clone -q $REPOLOCATION $CACHE_PATH.tmp mv ${CACHE_PATH}{.tmp,} fi if [ "$REPOREF" != "*" ] ; then HAS_REF=$(git --git-dir=$CACHE_PATH/.git name-rev $REPOREF 2>/dev/null || true) fi if [ -z "$DIB_OFFLINE" -o -z "${HAS_REF:-}" ] ; then echo "Updating cache of $REPOLOCATION in $CACHE_PATH with ref $REPOREF" # Copy named refs (which might be outside the usual heads # pattern) - e.g. gerrit if [ "$REPOREF" == "*" ] || ! git --git-dir=$CACHE_PATH/.git fetch -q --prune --update-head-ok $REPOLOCATION \ +${REPOREF}:${REPOREF} ; then # Copy all heads from the remote repository - this permits # using a SHA1 object reference so long as the object # reference is reachable from one of the heads. git does # not permit arbitrary sha fetching from remote servers. # This is a separate fetch to the prior one as the prior # one will fail when REPOREF is a SHA1. git --git-dir=$CACHE_PATH/.git fetch -q --prune --update-head-ok $REPOLOCATION \ +refs/heads/*:refs/heads/* +refs/tags/*:refs/tags/* fi # Ensure that we have a reference to the revision. if [ "$REPOREF" != "*" ] ; then if ! git --git-dir=$CACHE_PATH/.git rev-parse -q --verify $REPOREF^{commit} > /dev/null; then echo "Failed to find reference to $REPOREF" exit 1 fi fi fi echo "Cloning from $REPONAME cache and applying ref $REPOREF" # If the local dir is already used, see if the pertinent details differ if [[ -d $REPO_DEST ]]; then DESIRED="$(sudo git --git-dir=$REPO_DEST/.git config remote.origin.url)" if [[ "$CACHE_PATH" != "$DESIRED" ]]; then echo "REPOLOCATIONS don't match ("$CACHE_PATH" != "$DESIRED")" >&2 exit 1 elif [[ "$REPOREF" != "*" ]]; then pushd $REPO_DEST > /dev/null # When we first clone we create a branch naming what we fetched # that must match, or we are asking for two different references from the # same repo, which is an error if ! git rev-parse fetch_$REPOREF; then echo "REPOREFS don't match - failed to get sha1 of fetch_$REPOREF" >&2 exit 1 fi popd > /dev/null fi else sudo git clone -q $CACHE_PATH $REPO_DEST pushd $REPO_DEST > /dev/null if [[ "$REPOREF" == "*" ]]; then sudo git fetch -q --prune --update-head-ok $CACHE_PATH \ +refs/heads/*:refs/heads/* +refs/tags/*:refs/tags/* git_sha=$(git rev-parse HEAD) else sudo git fetch -q $CACHE_PATH $REPOREF:fetch_$REPOREF sudo git reset --hard FETCH_HEAD # Get the sha in use git_sha=$(git rev-parse FETCH_HEAD) fi popd > /dev/null # Write the sha being used into the source-repositories manifest echo "$REPONAME git $REPOPATH $REPOLOCATION $git_sha" >> $GIT_MANIFEST fi ;; tar) # The top level directory of the tarball mightn't have a fixed name i.e. # it could contain version numbers etc... so we write it to a tmpdir # for inspection before transferring the contents into the target directory local tmpdir=$(mktemp --tmpdir=$TMP_MOUNT_PATH/tmp -d) if [ -n "$CACHE_PATH" ] ; then echo "Caching $REPONAME tarball from $REPOLOCATION in $CACHE_PATH" if [ ! -f "$CACHE_PATH" -o -z "$DIB_OFFLINE" ] ; then $CACHE_URL $REPOLOCATION $CACHE_PATH fi tar -C $tmpdir -xzf $CACHE_PATH else echo "Fetching $REPONAME tarball from $REPOLOCATION" curl -f $REPOLOCATION | tar -C $tmpdir -xzf - fi sudo mkdir -p $REPO_DEST # A REPOREF of '.' will select the entire contents of the tarball, # while '*' will select only the contents of its subdirectories. sudo rsync -a --remove-source-files $tmpdir/$REPOREF/. $REPO_DEST rm -rf $tmpdir ;; file) sudo mkdir -p $REPO_SUB_DIRECTORY if [ -n "$CACHE_PATH" ] ; then echo "Caching $REPONAME file from $REPOLOCATION in $CACHE_PATH" if [ ! -f "$CACHE_PATH" -o -z "$DIB_OFFLINE" ] ; then $CACHE_URL $REPOLOCATION $CACHE_PATH fi sudo cp $CACHE_PATH $REPO_DEST else echo "Fetching $REPONAME file from $REPOLOCATION" sudo curl -f $REPOLOCATION -o $REPO_DEST fi ;; *) echo "Unsupported repository type: $REPOTYPE" return 1 ;; esac # Capture the in-instance repository path for later review / other # elements (like a pypi dependency cache). echo "$REPOPATH" | sudo tee -a $TMP_MOUNT_PATH/etc/dib-source-repositories > /dev/null else echo "Couldn't parse '$line' as a source repository" return 1 fi done < $REPO_SOURCES } CACHE_BASE=$DIB_IMAGE_CACHE/source-repositories OLD_CACHE_BASE=$DIB_IMAGE_CACHE/repository-sources make_new_cache $OLD_CACHE_BASE $CACHE_BASE mkdir -p $CACHE_BASE # Use the IMAGE_NAME from the calling script, and make it unique with the temporary path GIT_MANIFEST_NAME=dib-manifest-git-$(basename ${IMAGE_NAME}) GIT_MANIFEST_CACHE_NAME=${GIT_MANIFEST_NAME}_$(dirname ${TMP_MOUNT_PATH##*.}) GIT_MANIFEST=$CACHE_BASE/${GIT_MANIFEST_CACHE_NAME} rm -f $GIT_MANIFEST # Get source repositories for the target for _SOURCEREPO in $(find $TMP_HOOKS_PATH -maxdepth 1 -name "source-repository-*" -not -name '*~'); do repo_flock=$CACHE_BASE/repositories_flock ( echo "Getting $repo_flock: $(date) for $_SOURCEREPO" if ! flock -w 600 9 ; then echo "Did not get $repo_flock: $(date)" exit 1 fi get_repos_for_element $_SOURCEREPO ) 9> $repo_flock done # Copy the manifest into the image if it exists (there may be no git repositories used) if [ -e "$GIT_MANIFEST" ] ; then sudo mv $GIT_MANIFEST $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR}/$GIT_MANIFEST_NAME fi diskimage-builder-2.35.0/diskimage_builder/elements/source-repositories/package-installs.yaml0000664000175000017500000000035013640271474032624 0ustar zuulzuul00000000000000# Git isn't a dependency of this element, but is a dependency of pbr # if you are doing pip install on a git cloned directory, because this # looks to be a fairly common pattern it makes sense to have git on the # target image git: diskimage-builder-2.35.0/diskimage_builder/elements/source-repositories/README.rst0000664000175000017500000001336713640271474030221 0ustar zuulzuul00000000000000=================== source-repositories =================== With this element other elements can register their installation source by placing their details in the file ``source-repository-*``. source-repository-* file format ------------------------------- The plain text file format is space separated and has four mandatory fields optionally followed by fields which are type dependent:: [] ``name`` Identifier for the source repository. Should match the file suffix. ``type`` Format of the source. Either ``git``, ``tar``, ``package`` or ``file``. ``destination`` Base path to place sources. ``location`` Resource to fetch sources from. For ``git`` the location is cloned. For ``tar`` it is extracted. ``ref`` (optional). Meaning depends on the ``type``: ``file``: unused/ignored. ``git``: a git reference to fetch. A value of "``*``" prunes and fetches all heads and tags. Defaults to ``master`` if not specified. ``tar``: | "``.``" extracts the entire contents of the tarball. | "``*``" extracts the contents within all its subdirectories. | A subdirectory path may be used to extract only its contents. | A specific file path within the archive is **not supported**. The lines in the source-repository scripts are eval'd, so they may contain environment variables. The ``package`` type indicates the element should install from packages onto the root filesystem of the image build during the ``install.d`` phase. If the element provides an -package-install directory, symlinks will be created for those scripts instead. ``git`` and ``tar`` are treated as source installs. If the element provides an -source-install directory under it's ``install.d`` hook directory, symlinks to the scripts in that directory will be created under ``install.d`` for the image build. For example, the nova element would provide:: nova/install.d/nova-package-install/74-nova nova/install.d/nova-source-install/74-nova source-repositories will create the following symlink for the package install type:: install.d/74-nova -> nova-package-install/74-nova Or, for the source install type:: install.d/74-nova -> nova-source-install/74-nova All other scripts that exist under ``install.d`` for an element will be executed as normal. This allows common install code to live in a script outside of -package-install or -source-install. If multiple elements register a source location with the same then source-repositories will exit with an error. Care should therefore be taken to only use elements together that download source to different locations. The repository paths built into the image are stored in etc/dib-source-repositories, one repository per line. This permits later review of the repositories (by users or by other elements). The repository names and types are written to an environment.d hook script at 01-source-repositories-environment. This allows later hook scripts during the install.d phase to know which install type to use for the element. An example of an element "custom-element" that wants to retrieve the ironic source from git and pbr from a tarball would be: *Element file: elements/custom-element/source-repository-ironic*:: ironic git /usr/local/ironic https://opendev.org/openstack/ironic.git *File : elements/custom-element/source-repository-pbr*:: pbr tar /usr/local/pbr http://tarballs.openstack.org/pbr/pbr-master.tar.gz . diskimage-builder will then retrieve the sources specified and place them at the directory ````. Override per source ------------------- A number of environment variables can be set by the process calling diskimage-builder which can change the details registered by the element, these are: ``DIB_REPOTYPE_`` : change the registered type ``DIB_REPOLOCATION_`` : change the registered location ``DIB_REPOREF_`` : change the registered reference For example if you would like diskimage-builder to get ironic from a local mirror you would override the ```` field and could set: .. sourcecode:: sh DIB_REPOLOCATION_ironic=git://localgitserver/ironic.git *As you can see above, the \ of the repo is used in several bash variables. In order to make this syntactically feasible, any characters not in the set \[A-Za-z0-9_\] will be converted to \_* *For instance, a repository named "diskimage-builder" would set a variable called "DIB_REPOTYPE_diskimage_builder"* Alternatively if you would like to use the keystone element and build an image with keystone from a stable branch *stable/grizzly* then you would set: .. sourcecode:: sh DIB_REPOREF_keystone=stable/grizzly If you wish to build an image using code from a Gerrit review, you can set ``DIB_REPOLOCATION_`` and ``DIB_REPOREF_`` to the values given by Gerrit in the fetch/pull section of a review. For example, setting up Nova with change 61972 at patchset 8: .. sourcecode:: sh DIB_REPOLOCATION_nova=https://review.opendev.org/openstack/nova DIB_REPOREF_nova=refs/changes/72/61972/8 Alternate behaviors ------------------- Override git remote ^^^^^^^^^^^^^^^^^^^ The base url for all git repositories can be set by use of: ``DIB_GITREPOBASE`` So setting ``DIB_GITREPOBASE=https://github.com/`` when the repo location is set to https://opendev.org/openstack/nova.git will result in use of the https://github.com/openstack/nova.git repository instead. Disable external fetches ^^^^^^^^^^^^^^^^^^^^^^^^ When doing image builds in environments where external resources are not allowed, it is possible to disable fetching of all source repositories by including an element in the image that sets ``NO_SOURCE_REPOSITORIES=1`` in an ``environment.d`` script. diskimage-builder-2.35.0/diskimage_builder/elements/source-repositories/element-deps0000664000175000017500000000004513640271474031024 0ustar zuulzuul00000000000000cache-url manifests package-installs diskimage-builder-2.35.0/diskimage_builder/elements/source-repositories/pkg-map0000664000175000017500000000023113640271474027773 0ustar zuulzuul00000000000000{ "family": { "gentoo": { "git": "dev-vcs/git" }, "suse": { "git": "git-core" } }, "default": { "git": "git" } } diskimage-builder-2.35.0/diskimage_builder/elements/debian/0000775000175000017500000000000013640271564023715 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debian/test-elements/0000775000175000017500000000000013640271564026506 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debian/test-elements/build-succeeds/0000775000175000017500000000000013640271564031401 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debian/test-elements/build-succeeds/README.rst0000664000175000017500000000006413640271474033070 0ustar zuulzuul00000000000000Test that we can successfully build a debian image. diskimage-builder-2.35.0/diskimage_builder/elements/debian/test-elements/build-succeeds/element-deps0000664000175000017500000000000513640271474033701 0ustar zuulzuul00000000000000base ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debian/test-elements/build-succeeds/environment.d/diskimage-builder-2.35.0/diskimage_builder/elements/debian/test-elements/build-succeeds/environment.0000775000175000017500000000000013640271564033744 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016700000000000011221 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debian/test-elements/build-succeeds/environment.d/09-debian-stablediskimage-builder-2.35.0/diskimage_builder/elements/debian/test-elements/build-succeeds/environment.0000664000175000017500000000025413640271474033747 0ustar zuulzuul00000000000000# We don't want to build against Debian unstable # (Needs to be a 09- because must be executed before # debian-minimal 10-debian-minimal.bash.) export DIB_RELEASE="stable" diskimage-builder-2.35.0/diskimage_builder/elements/debian/package-installs.yaml0000664000175000017500000000020613640271474030021 0ustar zuulzuul00000000000000file: less: kbd: curl: rsync: bash-completion: isc-dhcp-client: net-tools: cloud-init: cloud-utils: cloud-initramfs-growroot: dialog: diskimage-builder-2.35.0/diskimage_builder/elements/debian/install.d/0000775000175000017500000000000013640271564025605 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debian/install.d/10-cloud-opinions0000775000175000017500000000263613640271474030722 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail DIB_DEBIAN_ALT_INIT_PACKAGE=${DIB_DEBIAN_ALT_INIT_PACKAGE:-sysvinit} adduser --gecos Debian-cloud-init-user --disabled-password --quiet debian install -d -m 0755 -o root -g root /etc/sudoers.d echo 'debian ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/debian-cloud-init chmod 0440 /etc/sudoers.d/debian-cloud-init if [ "$DIB_DEBIAN_ALT_INIT_PACKAGE" != "sysvinit" ]; then # To avoid a conflict against an essential package, we need to remove sysvinit first dpkg --purge --force remove-essential sysvinit apt-get install -y $apt_get_bp_extra_opts $DIB_DEBIAN_ALT_INIT_PACKAGE printf \"Package: sysvinit\nPin: origin ""\nPin-Priority: -1\n\" > \ /etc/apt/preferences.d/sysvinit > /etc/apt/preferences.d/sysvinit fi diskimage-builder-2.35.0/diskimage_builder/elements/debian/README.rst0000664000175000017500000000074513640271474025412 0ustar zuulzuul00000000000000====== debian ====== This element is based on ``debian-minimal`` with ``cloud-init`` and related tools installed. This produces something more like a standard upstream cloud image. By default this element creates the latest stable release. The exact setting can be found in the ``debian-minimal/environment.d`` directory in the variable ``DIB_RELEASE``. If a different release of Debian should be created, the variable ``DIB_RELEASE`` can be set appropriately. .. element_deps:: diskimage-builder-2.35.0/diskimage_builder/elements/debian/element-deps0000664000175000017500000000004613640271474026222 0ustar zuulzuul00000000000000debian-minimal openssh-server sysprep diskimage-builder-2.35.0/diskimage_builder/elements/dib-python/0000775000175000017500000000000013640271564024550 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dib-python/cleanup.d/0000775000175000017500000000000013640271564026421 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dib-python/cleanup.d/50-dib-python0000775000175000017500000000041313640271474030644 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # Remove dib-python wrapper. Nothing else should be running in chroot # and required this any more. sudo unlink $TARGET_ROOT/usr/local/bin/dib-python # dib-lint: safe_sudo diskimage-builder-2.35.0/diskimage_builder/elements/dib-python/pre-install.d/0000775000175000017500000000000013640271564027224 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dib-python/pre-install.d/01-dib-python0000775000175000017500000000140013640271474031440 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [[ ${DISTRO_NAME} =~ (centos|rhel) && ${DIB_RELEASE} == 8 ]]; then # RHEL8 has a system python, separate from the user python. What # a good idea, abstracting the python binary for system scripts! # :) Use it for dib-python. python_path=/usr/libexec/platform-python elif [[ ${DISTRO_NAME} =~ (debian) && ${DIB_PYTHON_VERSION} == 3 ]]; then apt-get install -y python3 python_path=$(command -v python${DIB_PYTHON_VERSION}) else python_path=$(command -v python${DIB_PYTHON_VERSION}) fi if [ -z "$python_path" ]; then echo "Could not find python${DIB_PYTHON_VERSION} executable." exit 1 fi ln -sf $python_path /usr/local/bin/dib-python diskimage-builder-2.35.0/diskimage_builder/elements/dib-python/README.rst0000664000175000017500000000216713640271474026245 0ustar zuulzuul00000000000000========== dib-python ========== Adds a symlink to ``/usr/local/bin/dib-python`` which points at either a ``python2`` or ``python3`` executable as appropriate. In-chroot scripts should use this as their interpreter (``#!/usr/local/bin/dib-python``) to make scripts that are compatible with both ``python2`` and ``python3``. We can not assume ``/usr/bin/python`` exists, as some platforms have started shipping with only Python 3. ``DIB_PYTHON`` will be exported as the python interpreter. You should use this instead of ``python script.py`` (e.g. ``${DIB_PYTHON} script.py``). Note you can also call ``/usr/local/bin/dib-python script.py`` but in some circumstances, such as creating a ``virtualenv``, it can create somewhat confusing references to ``dib-python`` that remain in the built image. This does not install a python if one does not exist, and instead fails. This also exports a variable ``DIB_PYTHON_VERSION`` which will either be '2' or '3' depending on the python version which dib-python points to. .. note:: The ``dib-python`` interpreter will be removed in ``cleanup.d``. It is only intended for build scripts. diskimage-builder-2.35.0/diskimage_builder/elements/dib-python/environment.d/0000775000175000017500000000000013640271564027336 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dib-python/environment.d/50-dib-python-version0000664000175000017500000000233013640271474033241 0ustar zuulzuul00000000000000# Pick which distros we need to force python2 and which to python3 if [ -z "${DIB_PYTHON_VERSION:-}" ]; then if [ "$DISTRO_NAME" == "ubuntu" ]; then if [ "$DIB_RELEASE" == "trusty" ]; then DIB_PYTHON_VERSION=2 fi elif [ "$DISTRO_NAME" == "debian" ]; then DIB_PYTHON_VERSION=2 elif [ "$DISTRO_NAME" == "fedora" ]; then if [ "$DIB_RELEASE" -le 22 ]; then DIB_PYTHON_VERSION=2 fi elif [ "$DISTRO_NAME" == "centos7" ]; then DIB_PYTHON_VERSION=2 elif [ "$DISTRO_NAME" == "rhel7" ]; then # TODO(nmagnezi): Remove this when the 'rhel7' element gets replaced by 'rhel' DIB_PYTHON_VERSION=2 elif [[ "$DISTRO_NAME" =~ (rhel|centos) ]]; then if [ "$DIB_RELEASE" -le 7 ]; then DIB_PYTHON_VERSION=2 elif [ "$DIB_RELEASE" -ge 8 ]; then DIB_PYTHON_VERSION=3 fi elif [ "$DISTRO_NAME" == "opensuse" ]; then if [ "${DIB_RELEASE:0:2}" == "42" ]; then DIB_PYTHON_VERSION=2 fi fi fi if [ -z "${DIB_PYTHON_VERSION:-}" ]; then DIB_PYTHON_VERSION=3 fi export DIB_PYTHON_VERSION export DIB_PYTHON=python${DIB_PYTHON_VERSION} # Local variables: # mode: sh # End: diskimage-builder-2.35.0/diskimage_builder/elements/dib-run-parts/0000775000175000017500000000000013640271564025162 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dib-run-parts/package-installs.yaml0000664000175000017500000000001213640271474031261 0ustar zuulzuul00000000000000dib-utils:diskimage-builder-2.35.0/diskimage_builder/elements/dib-run-parts/README.rst0000664000175000017500000000142513640271474026653 0ustar zuulzuul00000000000000============= dib-run-parts ============= .. warning:: This element is deprecated and is left only for compatibility. Please read the notes. This element install the ``dib-utils`` package to provide ``dib-run-parts``. Previously this element was a part of most base images and copied the internal version of ``dib-run-parts`` to ``/usr/local/bin`` during the build. Due to a (longstanding) oversight this was never removed and stayed in the final image. The image build process now uses a private copy of ``dib-run-parts`` during the build, so this element has become deprecated. For compatibility this element simply installs the ``dib-utils`` package, which will provide ``dib-run-parts``. However, this is probably better expressed as a dependency in individual elements. diskimage-builder-2.35.0/diskimage_builder/elements/select-boot-kernel-initrd/0000775000175000017500000000000013640271564027460 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/select-boot-kernel-initrd/extra-data.d/0000775000175000017500000000000013640271564031734 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016500000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/select-boot-kernel-initrd/extra-data.d/99-copy-dib-img-functionsdiskimage-builder-2.35.0/diskimage_builder/elements/select-boot-kernel-initrd/extra-data.d/99-copy-d0000775000175000017500000000045313640271474033316 0ustar zuulzuul00000000000000#!/bin/bash # Copy elements-functions into chroot so we can access the get_kernel_image function if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail sudo mkdir -p $TMP_MOUNT_PATH/lib/diskimage-builder sudo cp -t $TMP_MOUNT_PATH/lib/diskimage-builder $_LIB/img-functions diskimage-builder-2.35.0/diskimage_builder/elements/select-boot-kernel-initrd/bin/0000775000175000017500000000000013640271564030230 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/select-boot-kernel-initrd/bin/select-boot-kernel-initrddiskimage-builder-2.35.0/diskimage_builder/elements/select-boot-kernel-initrd/bin/select-boot-kernel0000775000175000017500000000147613640271474033664 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2012 Hewlett-Packard Development Company, L.P. # Copyright 2013 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail source /lib/diskimage-builder/img-functions select_boot_kernel_initrd / echo ${KERNEL}:${RAMDISK} diskimage-builder-2.35.0/diskimage_builder/elements/select-boot-kernel-initrd/cleanup.d/0000775000175000017500000000000013640271564031331 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016400000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/select-boot-kernel-initrd/cleanup.d/99-remove-dib-img-functionsdiskimage-builder-2.35.0/diskimage_builder/elements/select-boot-kernel-initrd/cleanup.d/99-remove-di0000775000175000017500000000031513640271474033404 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail sudo rm -f $TMP_MOUNT_PATH/lib/diskimage-builder/img-functions sudo rmdir $TMP_MOUNT_PATH/lib/diskimage-builder diskimage-builder-2.35.0/diskimage_builder/elements/select-boot-kernel-initrd/README.rst0000664000175000017500000000052713640271474031153 0ustar zuulzuul00000000000000========================= select-boot-kernel-initrd ========================= A helper script to get the kernel and initrd image. It uses the function select_boot_kernel_initrd from the library img-functions to find the newest kernel and ramdisk in the image, and returns them as a concatenated string separating the values with a colon (:). diskimage-builder-2.35.0/diskimage_builder/elements/block-device-efi/0000775000175000017500000000000013640271564025563 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/block-device-efi/block-device-default.yaml0000664000175000017500000000113313640271474032416 0ustar zuulzuul00000000000000- local_loop: name: image0 - partitioning: base: image0 label: gpt partitions: - name: ESP type: 'EF00' size: 550MiB mkfs: type: vfat mount: mount_point: /boot/efi fstab: options: "defaults" fsck-passno: 1 - name: BSP type: 'EF02' size: 8MiB - name: root type: '8300' size: 100% mkfs: type: ext4 mount: mount_point: / fstab: options: "defaults" fsck-passno: 1 diskimage-builder-2.35.0/diskimage_builder/elements/block-device-efi/README.rst0000664000175000017500000000052513640271474027254 0ustar zuulzuul00000000000000================ Block Device EFI ================ This provides a block-device configuration for the ``vm`` element to get a single-partition disk suitable for EFI booting. Note on x86 this provides the extra `BIOS boot partition `__ and a EFI boot partition for maximum compatability. diskimage-builder-2.35.0/diskimage_builder/elements/block-device-efi/element-provides0000664000175000017500000000001413640271474030763 0ustar zuulzuul00000000000000block-devicediskimage-builder-2.35.0/diskimage_builder/elements/block-device-efi/environment.d/0000775000175000017500000000000013640271564030351 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/block-device-efi/environment.d/15-block-device.bashdiskimage-builder-2.35.0/diskimage_builder/elements/block-device-efi/environment.d/15-block-device.b0000664000175000017500000000031613640271474033266 0ustar zuulzuul00000000000000# # Arch gate # if [[ "ppc64 ppc64le ppc64el" =~ "$ARCH" ]]; then echo "block-device-efi is not supported on Power; use block-device-gpt or block-device-mbr" exit 1 fi export DIB_BLOCK_DEVICE=efi diskimage-builder-2.35.0/diskimage_builder/elements/no-final-image/0000775000175000017500000000000013640271564025256 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/no-final-image/README.rst0000664000175000017500000000106413640271474026746 0ustar zuulzuul00000000000000============== no-final-image ============== This is a noop element which can be used to indicate to diskimage-builder that it should not bother creating a final image out of the generated filesystem. It is useful in cases where an element handles all of the image building itself, such as ironic-agent or Docker images. In those cases the final image normally generated by diskimage-builder is not the desired output, so there's no reason to spend time creating it. Elements that wish to behave this way should include this element in their element-deps file. diskimage-builder-2.35.0/diskimage_builder/elements/centos/0000775000175000017500000000000013640271564023766 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos/pre-install.d/0000775000175000017500000000000013640271564026442 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos/pre-install.d/01-set-centos-mirror0000775000175000017500000000237413640271474032210 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-} [ -n "$DIB_DISTRIBUTION_MIRROR" ] || exit 0 # Only set the mirror for the Base, Extras and Updates repositories # The others aren't enabled and do not exist on all mirrors if [[ ${DIB_RELEASE} == '7' ]]; then sed -e "s|^#baseurl=http[s]*://mirror.centos.org/centos|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Base.repo elif [[ ${DIB_RELEASE} == '8' ]]; then sed -e "s|^#baseurl=http[s]*://mirror.centos.org/|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Base.repo sed -e "s|^#baseurl=http[s]*://mirror.centos.org/|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-AppStream.repo sed -e "s|^#baseurl=http[s]*://mirror.centos.org/|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-centosplus.repo sed -e "s|^#baseurl=http[s]*://mirror.centos.org/|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Extras.repo sed -e "s|^#baseurl=http[s]*://mirror.centos.org/|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-PowerTools.repo fi diskimage-builder-2.35.0/diskimage_builder/elements/centos/pre-install.d/02-set-machine-id0000775000175000017500000000140713640271474031400 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # Set a machine-id. The .qcow2 image doesn't have one, and sometimes # one will get made (if systemd is upgraded as part of the build # process) and sometimes not. The problem is that certain kernel # install scripts bail silently without it; kernel packages end up # being installed but the initramfs etc isn't copied into place. # # Note this is cleared out in the sysprep role. # # See also: # 768c5e188c1b4bff01da14a49b96b51301db4c03 : similar thing for fedora # https://bugzilla.redhat.com/show_bug.cgi?id=1737355 : upstream bug # https://bugzilla.redhat.com/show_bug.cgi?id=1486124 : unresolved # bug about kernel install requiring machine-id systemd-machine-id-setup diskimage-builder-2.35.0/diskimage_builder/elements/centos/test-elements/0000775000175000017500000000000013640271564026557 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos/test-elements/8-build-succeeds/0000775000175000017500000000000013640271564031617 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015600000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos/test-elements/8-build-succeeds/test-output-formatsdiskimage-builder-2.35.0/diskimage_builder/elements/centos/test-elements/8-build-succeeds/test-outpu0000664000175000017500000000000513640271474033666 0ustar zuulzuul00000000000000qcow2diskimage-builder-2.35.0/diskimage_builder/elements/centos/test-elements/8-build-succeeds/README.rst0000664000175000017500000000001613640271474033303 0ustar zuulzuul00000000000000Centos 8 test ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos/test-elements/8-build-succeeds/element-depsdiskimage-builder-2.35.0/diskimage_builder/elements/centos/test-elements/8-build-succeeds/element-de0000664000175000017500000000003713640271474033561 0ustar zuulzuul00000000000000base epel openstack-ci-mirrors ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos/test-elements/8-build-succeeds/environment.d/diskimage-builder-2.35.0/diskimage_builder/elements/centos/test-elements/8-build-succeeds/environmen0000775000175000017500000000000013640271564033720 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000017300000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos/test-elements/8-build-succeeds/environment.d/10-set-distro.bashdiskimage-builder-2.35.0/diskimage_builder/elements/centos/test-elements/8-build-succeeds/environmen0000664000175000017500000000002713640271474033721 0ustar zuulzuul00000000000000export DIB_RELEASE='8' diskimage-builder-2.35.0/diskimage_builder/elements/centos/README.rst0000664000175000017500000000162213640271474025456 0ustar zuulzuul00000000000000====== centos ====== Use CentOS cloud images as the baseline for built disk images. For further details see the redhat-common README. Environment Variables --------------------- DIB_DISTRIBUTION_MIRROR: :Required: No :Default: None :Description: To use a CentOS Yum mirror, set this variable to the mirror URL before running bin/disk-image-create. This URL should point to the directory containing the ``7/8`` directories. :Example: ``DIB_DISTRIBUTION_MIRROR=http://amirror.com/centos`` DIB_CLOUD_IMAGES: :Required: No :Description: Set the desired URL to fetch the images from. ppc64le: Currently the CentOS community is working on providing the ppc64le images. Until then you'll need to set this to a local image file. :Example: ``DIB_CLOUD_IMAGES=/path/to/my/centos/8/CentOS-8-GenericCloud-x86_64.qcow2`` diskimage-builder-2.35.0/diskimage_builder/elements/centos/element-provides0000664000175000017500000000002113640271474027164 0ustar zuulzuul00000000000000operating-system diskimage-builder-2.35.0/diskimage_builder/elements/centos/element-deps0000664000175000017500000000007313640271474026273 0ustar zuulzuul00000000000000cache-url redhat-common rpm-distro source-repositories yum diskimage-builder-2.35.0/diskimage_builder/elements/centos/environment.d/0000775000175000017500000000000013640271564026554 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos/environment.d/10-centos-distro-name.bash0000664000175000017500000000007713640271474033350 0ustar zuulzuul00000000000000export DISTRO_NAME=centos export DIB_RELEASE=${DIB_RELEASE:-8} diskimage-builder-2.35.0/diskimage_builder/elements/centos/environment.d/11-yum-dnf.bash0000664000175000017500000000024413640271474031211 0ustar zuulzuul00000000000000# since CentOS 8, dnf is the yum replacement. if [[ ${DIB_RELEASE} == '8' ]]; then export YUM=dnf elif [[ ${DIB_RELEASE} == '7' ]]; then export YUM=yum fi diskimage-builder-2.35.0/diskimage_builder/elements/centos/root.d/0000775000175000017500000000000013640271564025173 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos/root.d/10-centos-cloud-image0000775000175000017500000000435613640271474031026 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail [ -n "$ARCH" ] [ -n "$TARGET_ROOT" ] if [[ "${DIB_RELEASE}" = 7 ]]; then if [[ "amd64 x86_64" =~ "$ARCH" ]]; then ARCH="x86_64" DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/centos/${DIB_RELEASE}/images} elif [[ "arm64 aarch64" =~ "$ARCH" ]]; then ARCH="aarch64" DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/altarch/${DIB_RELEASE}/images/aarch64} elif [[ "ppc64le" =~ "$ARCH" ]]; then DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/altarch/${DIB_RELEASE}/images/ppc64le} else echo 'centos root element only support the x86_64, aarch64 and ppc64le values for $ARCH' exit 1 fi else if [[ "amd64 x86_64 arm64 aarch64 ppc64le" =~ "$ARCH" ]]; then if [[ "amd64" =~ "$ARCH" ]]; then ARCH="x86_64" elif [[ "arm64" =~ "$ARCH" ]]; then ARCH="aarch64" fi DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/centos/${DIB_RELEASE}/${ARCH}/images} else echo 'centos root element only support the x86_64, aarch64 and ppc64le values for $ARCH' exit 1 fi fi DIB_LOCAL_IMAGE=${DIB_LOCAL_IMAGE:-} if [ -n "$DIB_LOCAL_IMAGE" ]; then IMAGE_LOCATION=$DIB_LOCAL_IMAGE # No need to copy a local image into the cache directory, so just specify # the cached path as the original path. CACHED_IMAGE=$IMAGE_LOCATION BASE_IMAGE_FILE=$(basename $DIB_LOCAL_IMAGE) BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz else DIB_FLAVOR=${DIB_FLAVOR:-GenericCloud} if [[ "${DIB_RELEASE}" = 7 ]]; then BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-CentOS-${DIB_RELEASE}-${ARCH}-${DIB_FLAVOR}.qcow2.xz} else LATEST_IMAGE_FILE=$(curl -s https://cloud.centos.org/centos/${DIB_RELEASE}/${ARCH}/images/ | grep -o "CentOS-${DIB_RELEASE}-${DIB_FLAVOR}-.[^>]*.qcow2" | head -1) BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$LATEST_IMAGE_FILE} fi BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE fi $TMP_HOOKS_PATH/bin/extract-image $BASE_IMAGE_FILE $BASE_IMAGE_TAR $IMAGE_LOCATION $CACHED_IMAGE diskimage-builder-2.35.0/diskimage_builder/elements/python-brickclient/0000775000175000017500000000000013640271564026303 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/python-brickclient/post-install.d/0000775000175000017500000000000013640271564031156 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015600000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/python-brickclient/post-install.d/55-brick-client-installdiskimage-builder-2.35.0/diskimage_builder/elements/python-brickclient/post-install.d/55-brick-clien0000775000175000017500000000174513640271474033524 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2016 Hewlett Packard Enterprise Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail PBCDIR=/usr/share/python-brickclient mkdir $PBCDIR # create the virtual environment virtualenv $PBCDIR/venv # Install the required packages inside virtual env $PBCDIR/venv/bin/pip install python-brick-cinderclient-ext ln -s $PBCDIR/venv/bin/python-brickclient /usr/local/bin/python-brickclient diskimage-builder-2.35.0/diskimage_builder/elements/python-brickclient/package-installs.yaml0000664000175000017500000000021513640271474032407 0ustar zuulzuul00000000000000libssl-dev: libffi-dev: python-dev: installtype: source dib_python_version: 2 python3-dev: installtype: source dib_python_version: 3 diskimage-builder-2.35.0/diskimage_builder/elements/python-brickclient/README.rst0000664000175000017500000000343713640271474030001 0ustar zuulzuul00000000000000python-brickclient ================== * This element is aimed for providing cinder local attach/detach functionality. * Currently the feature has a dependency on a known bug ``__, which has been resolved and will be part of the upstream with the next release of ``python-brick-cinderclient-ext``. Note: Current version of ``python-brick-cinderclient-ext`` i.e. 0.2.0 requires and update to be made in Line32 for ``/usr/share/python-brickclient/venv/lib/python2.7/site-packages/brick_cinderclient_ext/__init__.py``: update ``brick-python-cinderclient-ext`` to ``python-brick-cinderclient-ext``. Usage ----- Pass the below shell script to parameter ``user-data`` and set ``config-drive=true`` at the time of provisioning the node via nova-boot to make cinder local attach/detach commands talk to your cloud controller. .. code-block:: bash #!/bin/bash FILE="/etc/bash.bashrc" [ ! -f "$FILE" ] && touch "$FILE" echo 'export OS_AUTH_URL="http://:5000/v2.0"' >> "$FILE" echo 'export OS_PASSWORD="password"' >> "$FILE" echo 'export OS_USERNAME="demo"' >> "$FILE" echo 'export OS_TENANT_NAME="demo"' >> "$FILE" echo 'export OS_PROJECT_NAME="demo"' >> "$FILE" exec bash To attach: ``/usr/share/python-brickclient/venv/bin/cinder local-attach `` To detach: ``/usr/share/python-brickclient/venv/bin/cinder local-detach `` Alternatively, the same action can be completed manually at the node which does not require setting up of config drive such as: .. code-block:: bash /usr/share/python-brickclient/venv/bin/cinder \ --os-username demo --os-password password \ --os-tenant-name demo --os-project-name demo \ --os-auth-url=http://:5000/v2.0 local-attach diskimage-builder-2.35.0/diskimage_builder/elements/python-brickclient/element-deps0000664000175000017500000000004413640271474030606 0ustar zuulzuul00000000000000package-installs pip-and-virtualenv diskimage-builder-2.35.0/diskimage_builder/elements/python-brickclient/pkg-map0000664000175000017500000000052713640271474027566 0ustar zuulzuul00000000000000{ "family": { "redhat": { "python2-dev": "python2-devel", "python3-dev": "python3-devel", "libssl-dev": "openssl-devel", "libffi-dev": "libffi-devel" } }, "default": { "python2-dev": "python2-dev", "python3-dev": "python3-dev", "libssl-dev": "libssl-dev", "libffi-dev": "libffi-dev" } } diskimage-builder-2.35.0/diskimage_builder/elements/deploy-tgtadm/0000775000175000017500000000000013640271564025245 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/deploy-tgtadm/binary-deps.d/0000775000175000017500000000000013640271564027704 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/deploy-tgtadm/binary-deps.d/deploy-tgtadm0000664000175000017500000000001413640271474032374 0ustar zuulzuul00000000000000tgtadm tgtd diskimage-builder-2.35.0/diskimage_builder/elements/deploy-tgtadm/extra-data.d/0000775000175000017500000000000013640271564027521 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/deploy-tgtadm/extra-data.d/scripts/0000775000175000017500000000000013640271564031210 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/deploy-tgtadm/extra-data.d/scripts/iscsi-func0000664000175000017500000000113013640271474033171 0ustar zuulzuul00000000000000function start_iscsi_target() { local iqn=$1 local dev=$2 local cli=$3 # used by tgtd mkdir -p /var/run tgtd wait_for 10 0.5 check_tgtd_socket tgtadm --lld iscsi --mode target --op new --tid 1 --targetname "$iqn" tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 --backing-store "$dev" tgtadm --lld iscsi --mode target --op bind --tid 1 --initiator-address "$cli" } function stop_iscsi_target() { tgtadm --lld iscsi --mode logicalunit --op delete --tid 1 --lun 1 tgtadm --lld iscsi --mode target --op delete --tid 1 killall tgtd } ././@LongLink0000000000000000000000000000015300000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/deploy-tgtadm/extra-data.d/50-inject-tgtadm-iscsi-funcdiskimage-builder-2.35.0/diskimage_builder/elements/deploy-tgtadm/extra-data.d/50-inject-tgtadm-iscs0000775000175000017500000000037313640271474033365 0ustar zuulzuul00000000000000#!/bin/bash set -eu set -o pipefail if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi RAMDISK_SCRIPT_PATH="$TMP_MOUNT_PATH/tmp/ramdisk-build/scripts/d" mkdir -p ${RAMDISK_SCRIPT_PATH} cp $(dirname $0)/scripts/iscsi-func ${RAMDISK_SCRIPT_PATH} diskimage-builder-2.35.0/diskimage_builder/elements/deploy-tgtadm/package-installs.yaml0000664000175000017500000000000513640271474031346 0ustar zuulzuul00000000000000tgt: diskimage-builder-2.35.0/diskimage_builder/elements/deploy-tgtadm/README.rst0000664000175000017500000000037613640271474026742 0ustar zuulzuul00000000000000deploy-tgtadm ============= Use tgtadm and tgtd for the deploy ramdisk Provides the necessary scripts and dependencies to use tgtadm and tgtd for exporting the iscsi target in the deploy ramdisk. Will only work with the standard (not dracut) ramdisk. diskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/0000775000175000017500000000000013640271564025743 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/binary-deps.d/0000775000175000017500000000000013640271564030402 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/binary-deps.d/deploy-targetcli0000664000175000017500000000001213640271474033566 0ustar zuulzuul00000000000000targetcli diskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/extra-data.d/0000775000175000017500000000000013640271564030217 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/extra-data.d/50-add-targetcli-modulediskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/extra-data.d/50-add-targetcli-m0000775000175000017500000000040113640271474033320 0ustar zuulzuul00000000000000#!/bin/bash set -eu set -o pipefail if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi MODULE_PATH="/usr/lib/dracut/modules.d" sudo mkdir -p ${TMP_MOUNT_PATH}${MODULE_PATH} sudo cp -r $(dirname $0)/module/ ${TMP_MOUNT_PATH}${MODULE_PATH}/50targetcli diskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/extra-data.d/module/0000775000175000017500000000000013640271564031504 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015300000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/extra-data.d/module/targetcli-wrapperdiskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/extra-data.d/module/targetcli-w0000775000175000017500000000161713640271474033661 0ustar zuulzuul00000000000000#!/usr/bin/python # Copyright 2014 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import rtslib import targetcli_bin class MyISCSIFabricModule(rtslib.fabric.ISCSIFabricModule): def __init__(self): super(rtslib.fabric.ISCSIFabricModule, self).__init__('iscsi') self.wwn_types = ('free',) rtslib.fabric.fabric_modules['iscsi'] = MyISCSIFabricModule targetcli_bin.main() diskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/extra-data.d/module/iscsi-func0000775000175000017500000000134513640271474033500 0ustar zuulzuul00000000000000function start_iscsi_target() { local iqn=$1 local dev=$2 local cli=$3 # used by tgtd mkdir -p /var/run ln -s /usr/bin/targetcli /targetcli_bin.py /targetcli-wrapper /backstores/block create block1 dev=$dev /targetcli-wrapper /iscsi create $iqn /targetcli-wrapper /iscsi/$iqn/tpg1/luns create /backstores/block/block1 1 /targetcli-wrapper /iscsi/$iqn/tpg1/portals create $BOOT_IP_ADDRESS /targetcli-wrapper /iscsi/$iqn/tpg1 set attribute authentication=0 /targetcli-wrapper /iscsi/$iqn/tpg1 set attribute demo_mode_write_protect=0 /targetcli-wrapper /iscsi/$iqn/tpg1 set attribute generate_node_acls=1 } function stop_iscsi_target() { /targetcli-wrapper clearconfig confirm=True } ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/extra-data.d/module/module-setup.shdiskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/extra-data.d/module/module-setu0000775000175000017500000000140213640271474033672 0ustar zuulzuul00000000000000#!/bin/bash # Dracut is bash too, and it doesn't play nicely with our usual sets # dib-lint: disable=setu sete setpipefail dibdebugtrace check() { return 0 } depends() { return 0 } install() { inst /bin/targetcli inst "$moddir/targetcli-wrapper" /targetcli-wrapper inst "$moddir/iscsi-func" /iscsi-func # Install all of Python # TODO(bnemec): At some point this will need to be extended to support # Python 3, but for the moment we aren't using that anyway. inst /usr/bin/python local all_of_python=() while IFS='' read -r -d '' i; do all_of_python+=("$i") done < <(find /usr/lib64/python2.7/ /usr/lib/python2.7/ -type f -not -name "*.pyc" -not -name "*.pyo" -print0) inst_multiple "${all_of_python[@]}" } diskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/dracut-drivers.d/0000775000175000017500000000000013640271564031123 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/dracut-drivers.d/targetcli-driversdiskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/dracut-drivers.d/targetcli-driv0000664000175000017500000000014013640271474033761 0ustar zuulzuul00000000000000target_core_mod iscsi_target_mod target_core_iblock target_core_file target_core_pscsi configfs diskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/package-installs.yaml0000664000175000017500000000001313640271474032043 0ustar zuulzuul00000000000000targetcli: diskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/README.rst0000664000175000017500000000041713640271474027434 0ustar zuulzuul00000000000000deploy-targetcli ================ Use targetcli for the deploy ramdisk Provides the necessary scripts and dependencies to use targetcli for exporting the iscsi target in the deploy ramdisk. Implemented as a dracut module, so will only work with dracut-based ramdisks. diskimage-builder-2.35.0/diskimage_builder/elements/deploy-targetcli/element-deps0000664000175000017500000000002113640271474030241 0ustar zuulzuul00000000000000package-installs diskimage-builder-2.35.0/diskimage_builder/elements/epel/0000775000175000017500000000000013640271564023420 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/epel/pre-install.d/0000775000175000017500000000000013640271564026074 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/epel/pre-install.d/05-rpm-epel-release0000775000175000017500000000260113640271474031402 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [[ ${DISTRO_NAME} =~ "centos" ]]; then # Centos has "epel-release" in extras, which is default enabled. ${YUM} install -y epel-release else # For RHEL, we have to scrape the download page to find the latest # release and install that [ -n "$ARCH" ] if [ 'amd64' = "$ARCH" ] ; then ARCH="x86_64" fi BASE_URL=${DIB_EPEL_MIRROR:-https://dl.fedoraproject.org/pub/epel} case "$DISTRO_NAME" in rhel7) RELEASE=7 URL=$BASE_URL/$RELEASE/x86_64/Packages/e/ ;; *) echo "$DISTRO_NAME is not supported" # Not really a failure; we just don't do anything exit 0 ;; esac PKG_NAME=$(wget -q $URL -O - |grep -oE "(href=\"epel-release-$RELEASE-[0-9,.].*)" | cut -d'"' -f2) rpm -q epel-release || yum install -y $URL/$PKG_NAME fi if [ ${DIB_EPEL_DISABLED:-0} -ne 0 ]; then if [[ ${YUM} == "dnf" ]]; then dnf config-manager --set-disabled epel else yum-config-manager --disable epel fi fi DIB_EPEL_MIRROR=${DIB_EPEL_MIRROR:-} [ -n "$DIB_EPEL_MIRROR" ] || exit 0 # Set the EPEL mirror to use sed -e "s|^#baseurl=http[s]*://download.fedoraproject.org/pub/epel|baseurl=$DIB_EPEL_MIRROR|;/^mirrorlist=/d;/^metalink=/d" -i /etc/yum.repos.d/epel.repo diskimage-builder-2.35.0/diskimage_builder/elements/epel/package-installs.yaml0000664000175000017500000000007713640271474027532 0ustar zuulzuul00000000000000wget: phase: pre-install.d yum-utils: phase: pre-install.d diskimage-builder-2.35.0/diskimage_builder/elements/epel/README.rst0000664000175000017500000000141313640271474025106 0ustar zuulzuul00000000000000==== epel ==== This element installs the Extra Packages for Enterprise Linux (EPEL) repository GPG key as well as configuration for yum. Note this element is only useful with platforms that have EPEL support such as CentOS and RHEL DIB_EPEL_MIRROR: :Required: No :Default: None :Description: To use a EPEL Yum mirror, set this variable to the mirror URL before running bin/disk-image-create. This URL should point to the directory containing the ``5/6/7`` directories. :Example: ``DIB\_EPEL\_MIRROR=http://dl.fedoraproject.org/pub/epel`` DIB_EPEL_DISABLED: :Required: No :Default: 0 :Description: To disable the EPEL repo (but leave it available if used with an explicit ``--enablerepo``) set this to 1 diskimage-builder-2.35.0/diskimage_builder/elements/epel/element-deps0000664000175000017500000000002113640271474025716 0ustar zuulzuul00000000000000package-installs diskimage-builder-2.35.0/diskimage_builder/elements/epel/pkg-map0000664000175000017500000000046113640271474024700 0ustar zuulzuul00000000000000{ "distro": { "centos7": { "wget": "wget", "yum-utils": "yum-utils" }, "centos": { "wget": "wget", "yum-utils": "yum-utils" }, "rhel7": { "wget": "wget", "yum-utils": "yum-utils" } }, "default": { "wget": "", "yum-utils": "" } } diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/0000775000175000017500000000000013640271564027463 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/0000775000175000017500000000000013640271564032254 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016200000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-build-succeeds/diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-bu0000775000175000017500000000000013640271564034061 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000020500000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-build-succeeds/test-output-formatsdiskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-bu0000664000175000017500000000000413640271474034055 0ustar zuulzuul00000000000000tar ././@LongLink0000000000000000000000000000017400000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-build-succeeds/README.rstdiskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-bu0000664000175000017500000000006613640271474034065 0ustar zuulzuul00000000000000Verify we can build a ubuntu-systemd-container image. ././@LongLink0000000000000000000000000000017600000000000011221 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-build-succeeds/element-depsdiskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-bu0000664000175000017500000000002513640271474034060 0ustar zuulzuul00000000000000openstack-ci-mirrors ././@LongLink0000000000000000000000000000020000000000000011205 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-build-succeeds/environment.d/diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-bu0000775000175000017500000000000013640271564034061 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000022200000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-build-succeeds/environment.d/10-set-distro.bashdiskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/xenial-bu0000664000175000017500000000003213640271474034056 0ustar zuulzuul00000000000000export DIB_RELEASE=xenial ././@LongLink0000000000000000000000000000016200000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/trusty-build-succeeds/diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/trusty-bu0000775000175000017500000000000013640271564034153 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000017400000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/trusty-build-succeeds/README.rstdiskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/trusty-bu0000664000175000017500000000006613640271474034157 0ustar zuulzuul00000000000000Verify we can build a ubuntu-systemd-container image. ././@LongLink0000000000000000000000000000017600000000000011221 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/trusty-build-succeeds/element-depsdiskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/trusty-bu0000664000175000017500000000002513640271474034152 0ustar zuulzuul00000000000000openstack-ci-mirrors ././@LongLink0000000000000000000000000000020000000000000011205 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/trusty-build-succeeds/environment.d/diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/trusty-bu0000775000175000017500000000000013640271564034153 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000022200000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/trusty-build-succeeds/environment.d/10-set-distro.bashdiskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/trusty-bu0000664000175000017500000000003213640271474034150 0ustar zuulzuul00000000000000export DIB_RELEASE=trusty ././@LongLink0000000000000000000000000000016200000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-build-succeeds/diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-bu0000775000175000017500000000000013640271564034044 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000020500000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-build-succeeds/test-output-formatsdiskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-bu0000664000175000017500000000000413640271474034040 0ustar zuulzuul00000000000000tar ././@LongLink0000000000000000000000000000017400000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-build-succeeds/README.rstdiskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-bu0000664000175000017500000000006613640271474034050 0ustar zuulzuul00000000000000Verify we can build a ubuntu-systemd-container image. ././@LongLink0000000000000000000000000000017600000000000011221 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-build-succeeds/element-depsdiskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-bu0000664000175000017500000000002513640271474034043 0ustar zuulzuul00000000000000openstack-ci-mirrors ././@LongLink0000000000000000000000000000020000000000000011205 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-build-succeeds/environment.d/diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-bu0000775000175000017500000000000013640271564034044 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000022200000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-build-succeeds/environment.d/10-set-distro.bashdiskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/test-elements/bionic-bu0000664000175000017500000000003213640271474034041 0ustar zuulzuul00000000000000export DIB_RELEASE=bionic diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/README.rst0000664000175000017500000000133213640271474031151 0ustar zuulzuul00000000000000======================== ubuntu-systemd-container ======================== The ``ubuntu-systemd-container`` element uses debootstrap for generating a minimal image for use by machine containers. In contrast the ``ubuntu`` element uses the cloud-image as the initial base and the ``ubuntu-minimal`` builds an image to be used for hosts. By default this element creates the latest LTS release. The exact setting can be found in the ``ubuntu-common`` element's ``environment.d`` directory in the variable ``DIB_RELEASE``. If a different release of Ubuntu should be created, the variable ``DIB_RELEASE`` can be set appropriately. Note that this element installs ``systemd-sysv`` as the init system for 18.04+. .. element_deps:: diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/element-provides0000664000175000017500000000002113640271474032661 0ustar zuulzuul00000000000000operating-system diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/element-deps0000664000175000017500000000003213640271474031763 0ustar zuulzuul00000000000000debootstrap ubuntu-common diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/root.d/0000775000175000017500000000000013640271564030670 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016200000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/root.d/75-ubuntu-minimal-baseinstalldiskimage-builder-2.35.0/diskimage_builder/elements/ubuntu-systemd-container/root.d/75-ubuntu-minima0000775000175000017500000000407313640271474033645 0ustar zuulzuul00000000000000#!/bin/bash # Copyright (c) 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # We should manage this in a betterer way sudo bash -c "cat << EOF >$TARGET_ROOT/etc/apt/sources.list deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE ${DIB_DEBIAN_COMPONENTS//,/ } deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE-updates ${DIB_DEBIAN_COMPONENTS//,/ } deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE-backports ${DIB_DEBIAN_COMPONENTS//,/ } deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE-security ${DIB_DEBIAN_COMPONENTS//,/ } EOF" sudo mount -t proc none $TARGET_ROOT/proc sudo mount -t sysfs none $TARGET_ROOT/sys trap "sudo umount $TARGET_ROOT/proc; sudo umount $TARGET_ROOT/sys" EXIT apt_get="sudo chroot $TARGET_ROOT /usr/bin/apt-get" # dib-lint: safe_sudo # Need to update to retrieve the signed Release file $apt_get update $apt_get clean $apt_get dist-upgrade -y to_install="" # pre-bionic (18.04) brought this in via debootstrap, but init # dependencies have narrowed in the container world, so now we add it # explicitly here so it's brought in early. if [ $DIB_RELEASE != "trusty" ] && [ $DIB_RELEASE != "xenial" ]; then to_install+="systemd-sysv " fi # default required to_install+="sudo " # dib-lint: safe_sudo if [ "$DIB_PYTHON_VERSION" == "2" ]; then to_install+="python " elif [ "$DIB_PYTHON_VERSION" == "3" ]; then to_install+="python3 " else echo "ERROR: DIB_PYTHON_VERSION is '$DIB_PYTHON_VERSION' but needs to be 2 or 3" exit 1 fi $apt_get install -y $to_install diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk/0000775000175000017500000000000013640271564024125 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk/binary-deps.d/0000775000175000017500000000000013640271564026564 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk/binary-deps.d/ramdisk0000664000175000017500000000002413640271474030135 0ustar zuulzuul00000000000000dhclient ip busybox diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk/post-install.d/0000775000175000017500000000000013640271564027000 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk/post-install.d/99-build-ramdisk0000775000175000017500000000352313640271474031717 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail _LIB="/tmp/ramdisk-build" source $_LIB/common-defaults source $_LIB/img-defaults source $_LIB/ramdisk-defaults source $_LIB/common-functions source $_LIB/img-functions source $_LIB/ramdisk-functions KERNEL_VERSION=${DIB_KERNEL_VERSION:-$(find_kernel_version)} MODULE_DIR=$MODULE_ROOT/lib/modules/$KERNEL_VERSION if [ -f /dib-signed-kernel-version ] ; then . /dib-signed-kernel-version fi if [ -n "${DIB_SIGNED_KERNEL_VERSION:-}" ]; then # Though kernel name is suffixed with efi.signed, modules directory is # without that suffix MOD_KERNEL_NAME=`echo "$DIB_SIGNED_KERNEL_VERSION" |sed "s/\.efi\.signed//g"` MODULE_DIR=$MODULE_ROOT/lib/modules/$MOD_KERNEL_NAME fi FIRMWARE_DIR=$MODULE_ROOT/lib/firmware LIB_UDEV=$LIB_UDEV_ROOT/lib/udev INIT="$_LIB/scripts/init" FUNCTIONS_D="$_LIB/scripts/d" BUSYBOX=${BUSYBOX:-$(type -p busybox)} # NOTE(bnemec): IMAGE_ELEMENT is normally set in disk-image-create, but we're # not using that to build the image here. IMAGE_ELEMENT= mk_build_dir mkdir -p $TMP_BUILD_DIR/mnt export TMP_HOOKS_PATH=/tmp export TMP_MOUNT_PATH=$TMP_BUILD_DIR/mnt echo "building ramdisk in $TMP_MOUNT_PATH" create_ramdisk_base populate_lib populate_busybox populate_init populate_udev SCRIPT_HOME=/tmp/in_target.d/bin TMP_HOOKS_PATH=/tmp/in_target.d run_d ramdisk-install finalise_image save_image /tmp/ramdisk # In the past save_image did this for us. If EXIT handler is not # reset ramdisk image builds fail. trap EXIT cp /boot/vmlinu[zx]-${KERNEL_VERSION} /tmp/kernel if [ -n "${DIB_SIGNED_KERNEL_VERSION:-}" ]; then cp /boot/vmlinu[zx]-${DIB_SIGNED_KERNEL_VERSION} /tmp/kernel fi chmod o+r /tmp/kernel if [ -f /dib-signed-kernel-version ] ; then echo "Removing /dib-signed-kernel-version" rm -f /dib-signed-kernel-version fi diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk/init.d/0000775000175000017500000000000013640271564025312 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk/init.d/30-start-network0000664000175000017500000000300713640271474030301 0ustar zuulzuul00000000000000echo "starting network $BOOT_MAC_ADDRESS" t=0 while ! BOOT_INTERFACE=$(find_interface "$BOOT_MAC_ADDRESS"); do t=`expr "$t" + 5` if [ "$t" -gt 10 ]; then break fi sleep 5 done if [ -z "$BOOT_INTERFACE" ]; then err_msg "Could not find an interface that owns MAC: $BOOT_MAC_ADDRESS" troubleshoot fi readonly BOOT_INTERFACE ifconfig lo 127.0.0.1 up rv=0 ifconfig "$BOOT_INTERFACE" up || rv=1 if [ $rv -ne 0 ]; then sleep 10 rv=0 ifconfig "$BOOT_INTERFACE" up || rv=1 if [ $? -ne 0 ]; then err_msg "Failed to ifconfig up $BOOT_INTERFACE" troubleshoot fi fi # Check if boot IP address was specific or retrieve from DHCP if [ -n "$BOOT_IP_ADDRESS" ]; then ifconfig "$BOOT_INTERFACE" "$BOOT_IP_ADDRESS" netmask "$BOOT_NETMASK" route del default || true route add default gw $BOOT_GATEWAY else dhclient -1 "$BOOT_INTERFACE" if [[ $? == 2 ]]; then echo "Error getting IP address for $BOOT_INTERFACE with MAC \ $BOOT_MAC_ADDRESS" troubleshoot fi BOOT_IP_ADDRESS=$(ifconfig "$BOOT_INTERFACE" | grep 'inet addr:' | \ cut -d: -f2 | awk '{ print $1}') BOOT_NETMASK=$(ifconfig "$BOOT_INTERFACE" | grep 'Mask:' | cut -d':' -f4) BOOT_GATEWAY=$(route -n | grep "$BOOT_INTERFACE" | grep '^0.0.0.0' | \ awk '{print $2}') echo "obtained the following from dhcp: " echo " ip address = $BOOT_IP_ADDRESS" echo " netmask = $BOOT_NETMASK" echo " gateway = $BOOT_GATEWAY" fi diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk/init.d/10-start-base-system0000664000175000017500000000246313640271474031047 0ustar zuulzuul00000000000000mkdir -p /proc /sys /dev /boot /etc /mnt /lib/modules mount -t proc proc /proc mount -t sysfs none /sys UDEVD= if [ -x "/bin/systemd-udevd" ]; then UDEVD="systemd-udevd" else UDEVD="udevd" fi # udev versions 176 and newer require a different on-disk setup UDEVD_VERSION=$(udevadm --version) if [ "$UDEVD_VERSION" != "" -a $UDEVD_VERSION -gt 175 ]; then echo "Using new-style udevd setup" mount -t devtmpfs none /dev mkdir -p /run mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run mkdir -p /run/{lock,udev} else echo "Using old-style udevd setup" mount -t tmpfs none /dev ln -sf /proc/self/fd /dev/fd mknod /dev/null c 1 3 mknod /dev/zero c 1 5 mknod /dev/random c 1 8 mknod /dev/urandom c 1 9 mknod /dev/tty0 c 4 0 mknod /dev/tty1 c 4 1 mknod /dev/tty2 c 4 2 mknod /dev/tty3 c 4 3 mknod /dev/tty4 c 4 4 mknod /dev/tty5 c 4 5 mknod /dev/tty6 c 4 6 mknod /dev/tty7 c 4 7 mknod /dev/tty8 c 4 8 mknod /dev/tty9 c 4 9 mknod /dev/tty c 5 0 mknod -m 0600 /dev/console c 5 1 mknod -m 0666 /dev/ptmx c 5 2 mkdir -p /dev/.udev/data fi echo "starting syslogd" echo '*.* /initlog' > /etc/syslog.conf syslogd klogd echo "starting udevd" $UDEVD --daemon --resolve-names=never echo "load modules" load_modules_by_udev diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk/install.d/0000775000175000017500000000000013640271564026015 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk/install.d/52-ramdisk-install-busybox0000775000175000017500000000017013640271474032754 0ustar zuulzuul00000000000000#!/bin/bash if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail install-packages busybox diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk/install.d/20-install-dhcp-client0000775000175000017500000000026013640271474032016 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail DHCP_CLIENT=$(pkg-map --element ramdisk dhcp_client) install-packages $DHCP_CLIENT diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk/README.rst0000664000175000017500000000153313640271474025616 0ustar zuulzuul00000000000000======= ramdisk ======= This is the ramdisk element. Almost any user building a ramdisk will want to include this in their build, as it triggers many of the vital functionality from the basic diskimage-builder libraries (such as init script aggregation, busybox population, etc). An example of when one might want to use this toolchain to build a ramdisk would be the initial deployment of baremetal nodes in a TripleO setup. Various tools and scripts need to be injected into a ramdisk that will fetch and apply a machine image to local disks. That tooling/scripting customisation can be easily applied in a repeatable and automatable way, using this element. NOTE: ramdisks require 1GB minimum memory on the machines they are booting. See the top-level README.md of the project, for more information about the mechanisms available to a ramdisk element. diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk/element-deps0000664000175000017500000000004313640271474026427 0ustar zuulzuul00000000000000deploy-tgtadm pkg-map ramdisk-base diskimage-builder-2.35.0/diskimage_builder/elements/ramdisk/pkg-map0000664000175000017500000000026613640271474025410 0ustar zuulzuul00000000000000{ "family":{ "debian":{ "dhcp_client":"isc-dhcp-client" }, "suse":{ "dhcp_client":"dhcp-client" } }, "default":{ "dhcp_client":"dhclient" } } diskimage-builder-2.35.0/diskimage_builder/elements/manifests/0000775000175000017500000000000013640271564024464 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/manifests/extra-data.d/0000775000175000017500000000000013640271564026740 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/manifests/extra-data.d/20-manifest-dir0000775000175000017500000000136213640271474031471 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail sudo mkdir -p $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR} diskimage-builder-2.35.0/diskimage_builder/elements/manifests/cleanup.d/0000775000175000017500000000000013640271564026335 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/manifests/cleanup.d/01-copy-manifests-dir0000775000175000017500000000323013640271474032214 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2014 Hewlett-Packard Development Company, L.P. # Copyright 2017 Andreas Florath (andreas@florath.net) # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail MANIFEST_IMAGE_PATH=${TMP_MOUNT_PATH}/${DIB_MANIFEST_IMAGE_DIR} # Double check: directory must be created in extra-data.d/20-manifest-dir [ -d ${MANIFEST_IMAGE_PATH} ] || { echo "Error: MANIFEST_IMAGE_PATH [${MANIFEST_IMAGE_PATH}] does not exist"; exit 1; } echo "$DIB_ENV" | sudo dd of=${MANIFEST_IMAGE_PATH}/dib_environment # dib-lint: safe_sudo echo "$DIB_ARGS" | sudo dd of=${MANIFEST_IMAGE_PATH}/dib_arguments # dib-lint: safe_sudo # Save the manifests locally to the save dir mkdir -p ${DIB_MANIFEST_SAVE_DIR} cp --no-preserve=ownership -rv ${MANIFEST_IMAGE_PATH} ${DIB_MANIFEST_SAVE_DIR} # Lock down permissions on the manifest files inside the image to # root. We don't want regular users being able to see what might # contain a password, etc. find ${MANIFEST_IMAGE_PATH} -type f | xargs sudo chown root:root # dib-lint: safe_sudo find ${MANIFEST_IMAGE_PATH} -type f | xargs sudo chmod 600 # dib-lint: safe_sudo diskimage-builder-2.35.0/diskimage_builder/elements/manifests/README.rst0000664000175000017500000000173413640271474026160 0ustar zuulzuul00000000000000========= manifests ========= An framework for saving manifest information generated during the build for later inspection. Manifests are kept in the final image and also copied to the build area post-image creation. Elements that wish to save any form of manifest should depend on this element and can save their data to into the ``DIB_MANIFEST_IMAGE_DIR`` ( which defaults to ``/etc/dib-manifests``). Note this is created in ``extra-data.d`` rather than ``pre-install.d`` to allow the ``source-repositories`` element to make use of it The manifests are copied to ``DIB_MANIFEST_SAVE_DIR``, which defaults to ``${IMAGE_NAME}.d/``, resulting in the manifests being available as ``${IMAGE_NAME}.d/dib-manifests`` by default after the build. Extra status ------------ This element will also add the files ``dib_environment`` and ``dib_arguments`` to the manifest recording the ``diskimage-builder`` specific environment (``DIB_*`` variables) and command-line arguments respectively. diskimage-builder-2.35.0/diskimage_builder/elements/manifests/environment.d/0000775000175000017500000000000013640271564027252 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/manifests/environment.d/14-manifests0000664000175000017500000000136013640271474031410 0ustar zuulzuul00000000000000# Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # export DIB_MANIFEST_IMAGE_DIR=${DIB_MANIFEST_IMAGE_DIR:-/etc/dib-manifests} export DIB_MANIFEST_SAVE_DIR=${DIB_MANIFEST_SAVE_DIR:-${IMAGE_NAME}.d/} diskimage-builder-2.35.0/diskimage_builder/elements/zypper-minimal/0000775000175000017500000000000013640271564025450 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/zypper-minimal/post-install.d/0000775000175000017500000000000013640271564030323 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/zypper-minimal/post-install.d/01-locale-cleanup0000775000175000017500000000043513640271474033355 0ustar zuulzuul00000000000000#!/bin/bash # Only keep the minimum amount of locales to save disk space # if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail find /usr/lib/locale -mindepth 1 -maxdepth 1 -type d 2>/dev/null | \ grep -Ev '/(C.utf8|en_US|en_US.utf8)$' | xargs rm -rf diskimage-builder-2.35.0/diskimage_builder/elements/zypper-minimal/pre-install.d/0000775000175000017500000000000013640271564030124 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015600000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/zypper-minimal/pre-install.d/00-disable-zypper-recommendsdiskimage-builder-2.35.0/diskimage_builder/elements/zypper-minimal/pre-install.d/00-disable-zypper-r0000775000175000017500000000064013640271474033460 0ustar zuulzuul00000000000000#!/bin/bash # Prevent libsolv/zypper from installing recommended packages if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail fgrep -qx "solver.onlyRequires = true" /etc/zypp/zypp.conf || { cat >> /etc/zypp/zypp.conf << _EOF_ ## Disable installation of recommended packages, language packages ## and packages which depend on hardware (modalias). solver.onlyRequires = true _EOF_ } diskimage-builder-2.35.0/diskimage_builder/elements/zypper-minimal/package-installs.yaml0000664000175000017500000000040013640271474031550 0ustar zuulzuul00000000000000# kernel kernel-default: # locale support (we need LC_ALL=en_US.utf8) glibc-locale: # And a few useful tools. Some are pulled # as dependencies but that may change so lets # be explicit. bash: ca-certificates-mozilla: lsb-release: openssl: sed: sudo: tar: diskimage-builder-2.35.0/diskimage_builder/elements/zypper-minimal/README.rst0000664000175000017500000000125513640271474027142 0ustar zuulzuul00000000000000============== zypper-minimal ============== Base element for creating minimal SUSE-based images This element is incomplete by itself so you probably want to use it along with the opensuse-minimal one. It requires 'zypper' to be installed on the host. To create a zypper-based image with non-default repositories, set ``DIB_ZYPPER_REPOS`` to a mapping of repository names to URLs, for example:: DIB_ZYPPER_REPOS="update=>http://smt-mirror.example.com/SUSE:/SLE-15-SP1:/Update/standard/ " DIB_ZYPPER_REPOS+="SLE-15-SP1=>http://smt-mirror.example.com/ibs/SUSE:/SLE-15-SP1:/GA/standard/ " DIB_ZYPPER_REPOS+="SLE-15=>http://smt-mirror.example.com/ibs/SUSE:/SLE-15:/GA/standard/ " diskimage-builder-2.35.0/diskimage_builder/elements/zypper-minimal/element-deps0000664000175000017500000000003013640271474027746 0ustar zuulzuul00000000000000package-installs zypper diskimage-builder-2.35.0/diskimage_builder/elements/zypper-minimal/root.d/0000775000175000017500000000000013640271564026655 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot0000775000175000017500000001255013640271474031660 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2016 SUSE Linux GmbH # Copyright 2015 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # # dib-lint: disable=safe_sudo if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail source $_LIB/common-functions function cleanup() { sudo umount $TARGET_ROOT/proc sudo umount $TARGET_ROOT/dev/pts sudo umount $TARGET_ROOT/dev sudo umount $TARGET_ROOT/sys sudo umount $TMP_MOUNT_PATH/var/cache/zypp } trap cleanup EXIT ZYPPER_TARGET_OPTS="--non-interactive --gpg-auto-import-keys --root $TARGET_ROOT" ZYPPER_INSTALL_SYSTEM_PYTHON="python3" DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-https://download.opensuse.org} ZYPPER_REPOS=${DIB_ZYPPER_REPOS:-''} if [ -z "${ZYPPER_REPOS}" ] ; then case ${DIB_RELEASE} in # Old Leap releases 42*) ZYPPER_REPOS="update=>${DIB_DISTRIBUTION_MIRROR}/update/leap/${DIB_RELEASE}/oss/ " ZYPPER_REPOS+="oss=>${DIB_DISTRIBUTION_MIRROR}/distribution/leap/${DIB_RELEASE}/repo/oss/" ZYPPER_INSTALL_SYSTEM_PYTHON="python" ;; # New Leap releases 15*) ZYPPER_REPOS="update=>${DIB_DISTRIBUTION_MIRROR}/update/leap/${DIB_RELEASE}/oss/ " ZYPPER_REPOS+="oss=>${DIB_DISTRIBUTION_MIRROR}/distribution/leap/${DIB_RELEASE}/repo/oss/" ;; # Tumbleweed tumbleweed) ZYPPER_REPOS="update=>${DIB_DISTRIBUTION_MIRROR}/update/${DIB_RELEASE}/ " ZYPPER_REPOS+="oss=>${DIB_DISTRIBUTION_MIRROR}/${DIB_RELEASE}/repo/oss/" ;; *) echo "Unsupported openSUSE release: ${DIB_RELEASE}"; exit 1 ;; esac fi for repo in ${ZYPPER_REPOS}; do refresh_repo="" reponame=repo-${repo%%=>*} repouri=${repo##*=>} # Refresh all repos in TW and only the update one for the stable ones. This will ensure that # we always get the latest information from the repo. [[ ${DIB_RELEASE} == tumbleweed ]] || [[ ${reponame} == "repo-update" ]] && refresh_repo="-f" sudo zypper ${ZYPPER_TARGET_OPTS} addrepo --name ${reponame} --keep-packages ${refresh_repo} ${repouri} ${reponame} done # It appears that zypper will clean up the repo's cache when it (re-)adds the # repo so we need to add the cache now, once the repos are added. This is # similar to what the zypper/50-zypper-cache script does ZYPPER_CACHE_DIR=$DIB_IMAGE_CACHE/zypper mkdir -p $ZYPPER_CACHE_DIR sudo mkdir -p $TMP_MOUNT_PATH/var/cache/zypp sudo mount --bind $ZYPPER_CACHE_DIR $TMP_MOUNT_PATH/var/cache/zypp # Refresh it so we get updated data in cased we switched DIB_RELEASE # since last run. sudo zypper ${ZYPPER_TARGET_OPTS} refresh # Note this is not usually done for root.d elements (see # lib/common-functions:mount_proc_dev_sys) but it's important that # we have things like /dev/urandom around inside the chroot for # the rpm [pre|post]inst scripts within the packages. sudo mkdir -p $TARGET_ROOT/proc $TARGET_ROOT/dev $TARGET_ROOT/sys sudo mount -t proc none $TARGET_ROOT/proc sudo mount --bind /dev $TARGET_ROOT/dev sudo mount -t devpts $(mount_dev_pts_options) devpts $TARGET_ROOT/dev/pts sudo mount -t sysfs none $TARGET_ROOT/sys # Install filesystem, base and useful tools sudo zypper ${ZYPPER_TARGET_OPTS} install --no-recommends filesystem # Install basic components in order sudo zypper ${ZYPPER_TARGET_OPTS} install \ ${DIB_OPENSUSE_PATTERNS} ${ZYPPER_INSTALL_SYSTEM_PYTHON} \ zypper sudo ca-certificates-mozilla # Remove the installed symlink, otherwise we wipe the resolv.conf # outside the target_root (as the link is not relative) # outside target_root test -L $TARGET_ROOT/etc/resolv.conf && sudo rm -f $TARGET_ROOT/etc/resolv.conf # Put in a dummy /etc/resolv.conf over the temporary one we used # to bootstrap. systemd has a bug/feature [1] that it will assume # you want systemd-networkd as the network manager and create a # broken symlink to /run/... if the base image doesn't have one. # This broken link confuses things like dhclient. # [1] https://bugzilla.redhat.com/show_bug.cgi?id=1197204 echo -e "# This file intentionally left blank\n" | \ sudo tee $TARGET_ROOT/etc/resolv.conf # set the most reliable UTF-8 locale default_lang="C.UTF-8" sudo sed -i -e "s,^RC_LANG=.*,RC_LANG=\"$default_lang\"," \ $TARGET_ROOT/etc/sysconfig/language echo -e "LANG=\"$default_lang\"" | \ sudo tee $TARGET_ROOT/etc/locale.conf # default to UTC sudo chroot $TARGET_ROOT ln -sf /usr/share/zoneinfo/Etc/UTC \ /etc/localtime # RPM doesn't know whether files have been changed since install # At this point though, we know for certain that we have changed no # config files, so anything marked .rpmnew is just a bug. for newfile in $(sudo find $TARGET_ROOT -type f -name '*rpmnew') ; do sudo mv $newfile $(echo $newfile | sed 's/.rpmnew$//') done # Unmounting of all the mount points is handled by the cleanup EXIT # handler so there is nothing else to do here diskimage-builder-2.35.0/diskimage_builder/elements/yum/0000775000175000017500000000000013640271564023305 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/yum/extra-data.d/0000775000175000017500000000000013640271564025561 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/yum/extra-data.d/99-yum-repo-conf0000775000175000017500000000132713640271474030451 0ustar zuulzuul00000000000000#!/bin/bash # Add additional yum repo configuration(s) with $DIB_YUM_REPO_CONF if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail # exit directly if DIB_YUM_REPO_CONF is not defined properly if [ -z "${DIB_YUM_REPO_CONF:-}" ] ; then echo "DIB_YUM_REPO_CONF is not set - no repo configuration will be copied in" exit 0 fi for file in $DIB_YUM_REPO_CONF; do if [ ! -f $file ]; then echo "$file is not a valid yum repo configuration file." echo "You should assign a list of proper yum repo configuration" echo "files in DIB_YUM_REPO_CONF." exit 1 fi # copy the yum repo configuration sudo cp -L -f $file $TMP_MOUNT_PATH/etc/yum.repos.d done diskimage-builder-2.35.0/diskimage_builder/elements/yum/bin/0000775000175000017500000000000013640271564024055 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/yum/bin/install-packages0000775000175000017500000001070713640271474027232 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2012 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [ ${DIB_DEBUG_TRACE:-0} -gt 1 ]; then set -x fi set -eu set -o pipefail EXTRA_ARGS= ACTION=install MAP_ELEMENT= # allow override for dnf, as shipped by default with >=F22 YUM=${YUM:-yum} # save global xtrace state _xtrace=$(set +o | grep xtrace) SCRIPTNAME=$(basename $0) function show_options () { echo "Usage: $SCRIPTNAME [package ...]" echo echo "Options:" echo " -u -- update all packages" echo " -d dir -- download the packages to directory" echo " -e -- erase/remove packages" echo " -m map -- use custom element package map (Example: -m nova)" exit 0 } while getopts "hud:em:" opt; do case "$opt" in u) ${YUM} -y update; exit 0 ;; d) ACTION="download" DOWNLOAD_PATH=$OPTARG ;; e) ACTION="erase" ;; m) MAP_ELEMENT=$OPTARG ;; h) show_options ;; *) exit 1 ;; esac done shift $((OPTIND-1)) # Packages that aren't available in the distro but requested for installation # can be ignored by adding them to the exclude list BLACKLIST=$(cat /tmp/yum-blacklist 2>/dev/null || echo "") WHITELIST="" for i in "$@" do PKG_NAME=$i if [ -n "$MAP_ELEMENT" ]; then if ! PKG_NAME=$(pkg-map --element $MAP_ELEMENT $i); then echo "bin/pkg-map error. $PKG_NAME" exit 1 fi fi if [[ ! ${BLACKLIST[*]} =~ $PKG_NAME ]]; then WHITELIST="$WHITELIST $i" else echo "The package $i is not available and will not be installed" fi done if [ -n "$WHITELIST" ]; then if [ -f /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release ]; then rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release fi if [ -n "$MAP_ELEMENT" ]; then if ! PKGS=$(pkg-map --element $MAP_ELEMENT $WHITELIST); then echo "bin/pkg-map error. $PKGS" exit 1 fi else PKGS=$(map-packages $WHITELIST) fi if [ -z "${PKGS}" ]; then echo "Not running install-packages $ACTION with empty packages list" exit 0 fi echo "Running install-packages ${ACTION}." if [ "$ACTION" == "download" ]; then mkdir -p $DOWNLOAD_PATH if [ ${YUM} == "dnf" ]; then dnf download --destdir=$DOWNLOAD_PATH $PKGS else # note; you don't want to use yum --download only here. # Firstly that only puts things in the yum cache # directory, and secondly it acts funny if old versions # are already in the cache. if [ ! -f /usr/bin/yumdownloader ]; then yum install -y yum-utils fi yumdownloader --destdir=$DOWNLOAD_PATH $PKGS fi exit 0 fi # yum & dnf have a feature/bug where missing packages in a list of # packages for install/erase do not raise an error exit [1]. # There is a corner case when specifying just *one* package, where # it will fail if the package is missing. Thus install-packages # follows this behaviour; we may need to re-evaluate this at some # point. # # [1] https://bugzilla.redhat.com/show_bug.cgi?id=965567 set -o xtrace ${YUM} -v -y $ACTION $EXTRA_ARGS $PKGS if [ "$ACTION" == "install" ]; then if [ ${YUM} == "dnf" ]; then # Make sure dnf won't autoremove these packages dnf mark install $PKGS fi fi $_xtrace # probably not the right place for this; but python-pip package on # fedora/rh calls pip "pip-python" while the rest of the work # expects it to be just called "pip" for pkg in "$@"; do if [ "$pkg" = "python-pip" ] ; then alternatives --install /usr/bin/pip pip /usr/bin/pip-python 10 fi done fi diskimage-builder-2.35.0/diskimage_builder/elements/yum/post-install.d/0000775000175000017500000000000013640271564026160 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/yum/post-install.d/99-reset-yum-conf0000775000175000017500000000050513640271474031222 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail if [[ ${YUM} == "dnf" ]]; then cfg=/etc/dnf/dnf.conf cachedir=/var/cache/dnf else cfg=/etc/yum.conf cachedir=/var/cache/yum fi sed -i "/^keepcache/c\keepcache=0" $cfg sed -i "/^cachedir/c\cachedir=${cachedir}" $cfg diskimage-builder-2.35.0/diskimage_builder/elements/yum/cleanup.d/0000775000175000017500000000000013640271564025156 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/yum/cleanup.d/99-remove-yum-repo-conf0000775000175000017500000000062013640271474031334 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail # exit directly if DIB_YUM_REPO_CONF is not defined properly if [ -z "${DIB_YUM_REPO_CONF:-}" ] ; then echo "DIB_YUM_REPO_CONF is not set - no repo configurations will be cleaned up" exit 0 fi for file in $DIB_YUM_REPO_CONF; do sudo rm -f $TMP_MOUNT_PATH/etc/yum.repos.d/$(basename $file) done diskimage-builder-2.35.0/diskimage_builder/elements/yum/pre-install.d/0000775000175000017500000000000013640271564025761 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/yum/pre-install.d/00-dnf-update0000775000175000017500000000040513640271474030152 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [[ $DISTRO_NAME == "fedora" && $DIB_RELEASE -eq 22 ]]; then # we need dnf mark command from dnf 1.1.1, which is pretty recent dnf --refresh update -y dnf fi diskimage-builder-2.35.0/diskimage_builder/elements/yum/pre-install.d/01-yum-keepcache0000775000175000017500000000065113640271474030647 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [[ ${YUM} == "dnf" ]]; then # dnf is slightly different; doesn't have these by default cfg=/etc/dnf/dnf.conf echo "keepcache=1" >> $cfg echo "cachedir=/tmp/yum" >> $cfg else cfg=/etc/yum.conf sed -i 's/keepcache=0/keepcache=1/' $cfg sed -i 's/cachedir=\/var\/cache\/yum/cachedir=\/tmp\/yum/' $cfg fi diskimage-builder-2.35.0/diskimage_builder/elements/yum/README.rst0000664000175000017500000000151613640271474024777 0ustar zuulzuul00000000000000=== yum === Provide yum specific image building glue. RHEL/Fedora/CentOS and other yum based distributions need specific yum customizations. Customizations include caching of downloaded yum packages outside of the build chroot so that they can be reused by subsequent image builds. The cache increases image building speed when building multiple images, especially on slow connections. This is more effective than using an HTTP proxy as a yum cache since the same rpm from different mirrors is often requested. Custom yum repository configurations can also be applied by defining `DIB_YUM_REPO_CONF` to a space separated list of repo configuration files. The files will be copied to /etc/yum.repos.d/ during the image build, and then removed at the end of the build. Each repo file should be named differently to avoid a filename collision. diskimage-builder-2.35.0/diskimage_builder/elements/yum/element-deps0000664000175000017500000000001413640271474025605 0ustar zuulzuul00000000000000install-bin diskimage-builder-2.35.0/diskimage_builder/elements/yum/root.d/0000775000175000017500000000000013640271564024512 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/yum/root.d/50-yum-cache0000775000175000017500000000041713640271474026537 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail [ -n "$TARGET_ROOT" ] YUM_CACHE_DIR=$DIB_IMAGE_CACHE/yum mkdir -p $YUM_CACHE_DIR sudo mkdir -p $TMP_MOUNT_PATH/tmp/yum sudo mount --bind $YUM_CACHE_DIR $TMP_MOUNT_PATH/tmp/yum diskimage-builder-2.35.0/diskimage_builder/elements/mellanox/0000775000175000017500000000000013640271564024312 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/mellanox/udev.d/0000775000175000017500000000000013640271564025477 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/mellanox/udev.d/81-mellanox-drivers.rules0000664000175000017500000000053413640271474032276 0ustar zuulzuul00000000000000ACTION!="add", GOTO="drivers_end" SUBSYSTEM=="net", RUN+="/sbin/modprobe mlx4_en" SUBSYSTEM=="net", RUN+="/sbin/modprobe mlx4_ib" SUBSYSTEM=="net", RUN+="/sbin/modprobe ib_ipoib" SUBSYSTEM=="net", RUN+="/sbin/modprobe mlx5_ib" SUBSYSTEM=="net", RUN+="/sbin/modprobe ib_umad" SUBSYSTEM=="net", RUN+="/sbin/modprobe ib_uverbs" LABEL="drivers_end" diskimage-builder-2.35.0/diskimage_builder/elements/mellanox/init.d/0000775000175000017500000000000013640271564025477 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/mellanox/init.d/01-mellanox0000664000175000017500000000020313640271474027452 0ustar zuulzuul00000000000000# extra load for mellanox modprobe mlx4_en modprobe mlx4_ib modprobe ib_ipoib modprobe mlx5_ib modprobe ib_umad modprobe ib_uverbs diskimage-builder-2.35.0/diskimage_builder/elements/mellanox/package-installs.yaml0000664000175000017500000000043413640271474030421 0ustar zuulzuul00000000000000dkms: ibacm: ibutils: ibverbs-utils: infiniband-diags: libibcm: libibcommon: libibmad: libibumad: libibverbs: libibverbs-runtime: libmlx4: libmlx4-dev: libmlx5: librdmacm: librdmacm-dev: librdmacm-runtime: mstflint: opensm: pciutils: perftest: qperf: rdma: rpm-build: srptools: vlan: diskimage-builder-2.35.0/diskimage_builder/elements/mellanox/install.d/0000775000175000017500000000000013640271564026202 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/mellanox/install.d/65-mellanox0000775000175000017500000000103613640271474030177 0ustar zuulzuul00000000000000#!/bin/bash # Ensure we load the mellanox driver somehow if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail home=$(dirname $0) install -m 0644 -o root -g root $home/mellanox-rules.udev /etc/udev/rules.d/81-mellanox.rules # needed kernel modules; mlx4_en mlx4_ib ib_ipoib mlx5_ib ib_umad ib_uverbs # mlx5_core loaded by mlx5_ib echo "mlx4_en" >>/etc/modules echo "mlx4_ib" >>/etc/modules echo "ib_ipoib" >>/etc/modules echo "mlx5_ib" >>/etc/modules echo "ib_umad" >>/etc/modules echo "ib_uverbs" >>/etc/modules diskimage-builder-2.35.0/diskimage_builder/elements/mellanox/install.d/mellanox-rules.udev0000664000175000017500000000053413640271474032040 0ustar zuulzuul00000000000000ACTION!="add", GOTO="drivers_end" SUBSYSTEM=="net", RUN+="/sbin/modprobe mlx4_en" SUBSYSTEM=="net", RUN+="/sbin/modprobe mlx4_ib" SUBSYSTEM=="net", RUN+="/sbin/modprobe ib_ipoib" SUBSYSTEM=="net", RUN+="/sbin/modprobe mlx5_ib" SUBSYSTEM=="net", RUN+="/sbin/modprobe ib_umad" SUBSYSTEM=="net", RUN+="/sbin/modprobe ib_uverbs" LABEL="drivers_end" diskimage-builder-2.35.0/diskimage_builder/elements/mellanox/README.rst0000664000175000017500000000007713640271474026005 0ustar zuulzuul00000000000000======== mellanox ======== Force support for mellanox hardware diskimage-builder-2.35.0/diskimage_builder/elements/mellanox/element-deps0000664000175000017500000000003113640271474026611 0ustar zuulzuul00000000000000package-installs pkg-map diskimage-builder-2.35.0/diskimage_builder/elements/mellanox/pkg-map0000664000175000017500000000375513640271474025603 0ustar zuulzuul00000000000000{ "family": { "debian":{ "dkms": "dkms", "libibverbs": "libibverbs*", "ibacm": "ibacm", "librdmacm": "librdmacm*", "libmlx4": "libmlx4*", "libmlx5": "libmlx5*", "libibcm": "libibcm.*", "libibmad": "libibmad.*", "libibumad": "libibumad*", "libmlx4-dev": "libmlx4-dev", "librdmacm-dev": "librdmacm-dev", "rdma": "rdmacm-utils", "vlan": "vlan", "ibverbs-utils": "ibverbs-utils" }, "redhat": { "libibverbs": "libibverbs.*", "librdmacm": "librdmacm.*", "libmlx4": "libmlx4.*", "libmlx5": "libmlx5.*", "libibcm": "libibcm.*", "libibmad": "libibmad.*", "libibumad": "libibumad.*", "rdma": "rdma", "qperf": "qperf", "pciutils": "pciutils" }, "suse":{ "libibverbs": "libibverbs", "librdmacm": "librdmacm", "libmlx4": "libmlx4", "libmlx5": "libmlx5", "libibcm": "libibcm", "libibmad": "libibmad", "libibumad": "libibumad", "rdma": "rdma", "qperf": "qperf", "rpm-build": "rpm-build", "libibverbs-runtime": "libibverbs-runtime", "librdmacm-runtime": "librdmacm-runtime", "libibcommon": "libibcommon" } }, "default": { "infiniband-diags": "infiniband-diags", "mstflint": "mstflint", "opensm": "opensm", "srptools": "srptools", "libmlx4-dev": "", "librdmacm-dev": "", "ibutils": "ibutils", "perftest": "perftest", "vlan": "", "pciutils": "", "ibverbs-utils": "", "rpm-build": "", "libibverbs-runtime": "", "librdmacm-runtime": "", "ibacm": "", "qperf": "", "dkms": "", "libibcommon": "" } } diskimage-builder-2.35.0/diskimage_builder/elements/sysctl/0000775000175000017500000000000013640271564024014 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/sysctl/bin/0000775000175000017500000000000013640271564024564 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/sysctl/bin/sysctl-set-value0000775000175000017500000000227013640271474027737 0ustar zuulzuul00000000000000#!/bin/bash # # Copied from tripleo-image-element's sysctl element # # Validate and manage setting sysctl settings. # # The script is called with name/value pairs which are stored # in the system default sysctl.d directory. Before adding new # settings a validation is done to ensure that conflicting # sysctl settings have not been requested. Once finished sysctl # is used to activate the changes. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail NAME=${1:-} VALUE=${2:-} # Optional comment used to describe the setting COMMENT=${3:-"This file was created by diskimage-builder."} if [ -z "$NAME" -o -z "$VALUE" ]; then echo "NAME and VALUE are required." exit 1 fi FILENAME="/etc/sysctl.d/${NAME}.conf" if [ -f $FILENAME ]; then # check to make sure the settings match... otherwise fail if ! grep -q "^$NAME = $VALUE" $FILENAME; then echo "Conflicting sysctl.conf setting for $NAME == $VALUE. Found:" grep "^$NAME" $FILENAME exit 1 fi else if ! sysctl -a | grep -q "^$NAME"; then echo "Invalid sysctl key: $NAME" exit 1 fi sysctl-write-value $NAME "$VALUE" "$COMMENT" sysctl -p $FILENAME fi diskimage-builder-2.35.0/diskimage_builder/elements/sysctl/bin/sysctl-write-value0000775000175000017500000000174313640271474030302 0ustar zuulzuul00000000000000#!/bin/bash # # Copied from tripleo-image-element's sysctl element # # Validate and manage setting sysctl settings. # # The script is called with name/value pairs which are stored # in the system default sysctl.d directory. This script performs # no checking, just writing out the file. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail NAME=${1:-} VALUE=${2:-} # Optional comment used to describe the setting COMMENT=${3:-"This file was created by diskimage-builder."} if [ -z "$NAME" -o -z "$VALUE" ]; then echo "Usage: sysctl-write-value [comment]" exit 1 fi FILENAME="/etc/sysctl.d/${NAME}.conf" if [ -f $FILENAME ]; then # check to make sure the settings match... otherwise fail if ! grep -q "^$NAME = $VALUE" $FILENAME; then echo "Conflicting sysctl.conf setting for $NAME == $VALUE. Found:" grep "^$NAME" $FILENAME exit 1 fi else cat > $FILENAME </dev/null; then # Likewise, if we booted via the network while running in UEFI mode, and # efibootmgr is installed, we can determine the MAC address of the nic we # booted from. It would be good to have code that can also do this using # efivars or parsing the stuff under /sys/firmware/efi/efivars directly, # but that is a trickier thing to do. local -A boot_entries local bootent_re='^Boot([0-9]{4})' local efimac_re='MAC\(([0-9a-f]+)' local k v current_bootent while read line; do k="${line%% *}" v="${line#* }" if [[ $k = BootCurrent:* ]]; then current_bootent="${line##BootCurrent: }" elif [[ $k =~ $bootent_re ]]; then boot_entries["${BASH_REMATCH[1]}"]="$v" fi done < <(efibootmgr -v) if [[ ${boot_entries["$current_bootent"]} =~ $efimac_re ]]; then _mac='' for o in 0 2 4 6 8 10; do _mac+="${BASH_REMATCH[1]:$o:2}:" done _mac=${_mac%:} fi fi if [[ ! $_mac ]]; then # If none of the exact methods worked, fall back on the heuristic # method and just return the mac addresses of all the interfaces # that have a link. Hopefully whatever consumes this info is smarter # than we are. local _info1 _info2 _dev _info1=$(hwinfo --network|grep -B2 "Link detected: yes"|grep -C1 "HW Address:") _info2=$(echo "${_info1}"|awk '/Device File: (vlan*|br*)/{for(x=NR-2;x<=NR+2;x++)d[x];}{a[NR]=$0}END{for(i=1;i<=NR;i++)if(!(i in d))print a[i]}') _dev=$(echo "${_info1}" | grep "Device File:"|awk -F':' {'print $2'}|tr -d ' ') _mac=$(echo "${_info2}" | grep "HW Address:"|awk -F'ss:' {'print $2'}|tr -d ' ') fi echo $_mac export HW_DISCOVERY_BOOT_IFACE="$_mac" } function disk() { # XXX: This is returning only the first disk discovered, which is very likely to be insufficient on machines that present us with multiple disks # XXX: This is likely reporting in TB, but the units are not guaranteed. Maybe convert to bytes? lshw -C disk | grep size | awk -F'(' '{ print $2 }' | tr -d ')' | head -1 } function raw_disk() { hwinfo --disk } function raw_network() { hwinfo --network } HW_DISCOVERY_OUTPUT=$(cat < $CONF <<_EOF_ DEFAULT linux LABEL linux KERNEL /boot/$KERNEL APPEND ro root=LABEL=${DIB_ROOT_LABEL} console=tty0 console=${SERIAL_CONSOLE} nofb nomodeset vga=normal INITRD /boot/$RAMDISK _EOF_" diskimage-builder-2.35.0/diskimage_builder/elements/bootloader/README.rst0000664000175000017500000000146313640271474026320 0ustar zuulzuul00000000000000========== bootloader ========== Installs ``grub[2]`` on boot partition on the system. In case GRUB2 is not available in the system, a fallback to Extlinux will happen. It's also possible to enforce the use of Extlinux by exporting a ``DIB_EXTLINUX`` variable to the environment. Arguments ========= * ``DIB_GRUB_TIMEOUT`` sets the ``grub`` menu timeout. It defaults to 5 seconds. Set this to 0 (no timeout) for fast boot times. * ``DIB_BOOTLOADER_DEFAULT_CMDLINE`` sets parameters that are appended to the ``GRUB_CMDLINE_LINUX_DEFAULT`` values in ``grub.cfg`` configuration. It defaults to ``nofb nomodeset vga=normal``. * ``DIB_BOOTLOADER_SERIAL_CONSOLE`` sets the serial device to be used as a console. It defaults to ``hvc0`` for PowerPC, ``ttyAMA0,115200`` for ARM64, otherwise ``ttyS0,115200``. diskimage-builder-2.35.0/diskimage_builder/elements/bootloader/environment.d/0000775000175000017500000000000013640271564027413 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015300000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/bootloader/environment.d/10-bootloader-default-cmdlinediskimage-builder-2.35.0/diskimage_builder/elements/bootloader/environment.d/10-bootloader-default-c0000664000175000017500000000025613640271474033553 0ustar zuulzuul00000000000000export DIB_BOOTLOADER_DEFAULT_CMDLINE=${DIB_BOOTLOADER_DEFAULT_CMDLINE:-"nofb nomodeset vga=normal"} export DIB_BOOTLOADER_SERIAL_CONSOLE=${DIB_BOOTLOADER_SERIAL_CONSOLE:-""}diskimage-builder-2.35.0/diskimage_builder/elements/bootloader/pkg-map0000664000175000017500000000264713640271474026115 0ustar zuulzuul00000000000000{ "release": { "rhel": { "8": { "extlinux": "syslinux-extlinux", "grub-pc": "grub2-tools grub2", "grub-efi-amd64": "grub2-tools grub2-efi-x64 grub2-efi-x64-modules", "grub-efi-arm64": "grub2-tools grub2-efi-aa64 grub2-efi-aa64-modules", "grub-efi-aarch64": "grub2-tools grub2-efi-aa64 grub2-efi-aa64-modules", "grub-efi": "grub2-tools grub2-efi", "grub-efi-x86_64": "grub2-tools grub2-efi-x64 grub2-efi-x64-modules", "grub-ppc64": "grub2-tools grub2" } } }, "family": { "gentoo": { "dkms_package": "", "extlinux": "syslinux", "grub-pc": "grub", "grub-efi": "grub" }, "suse": { "dkms_package": "", "extlinux": "syslinux", "grub-pc": "grub2", "grub-efi": "grub2" }, "redhat": { "extlinux": "syslinux-extlinux", "grub-pc": "grub2-tools grub2", "grub-efi-amd64": "grub2-tools grub2-efi-x64 grub2-efi-x64-modules", "grub-efi-arm64": "grub2-tools grub2-efi-aa64 grub2-efi-aa64-modules", "grub-efi-aarch64": "grub2-tools grub2-efi-aa64 grub2-efi-aa64-modules", "grub-efi": "grub2-tools grub2-efi", "grub-ppc64": "grub2-tools grub2" } }, "default": { "dkms_package": "dkms", "extlinux": "extlinux", "grub-pc": "grub-pc", "grub-efi-amd64": "grub-efi", "grub-efi-arm64": "grub-efi-arm64", "grub-ppc64": "grub-ieee1275" } } diskimage-builder-2.35.0/diskimage_builder/elements/bootloader/finalise.d/0000775000175000017500000000000013640271564026641 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/bootloader/finalise.d/50-bootloader0000775000175000017500000002126213640271474031146 0ustar zuulzuul00000000000000#!/bin/bash # Configure grub. Note that the various conditionals here are to handle # different distributions gracefully. if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail BOOT_DEV=$IMAGE_BLOCK_DEVICE # All available devices, handy for some bootloaders... declare -A DEVICES eval DEVICES=( $IMAGE_BLOCK_DEVICES ) function install_extlinux { install-packages -m bootloader extlinux echo "Installing Extlinux..." # Find and install mbr.bin for MBR in /usr/share/syslinux/mbr.bin /usr/lib/syslinux/mbr.bin \ /usr/lib/extlinux/mbr.bin /usr/lib/EXTLINUX/mbr.bin ; do if [ -f $MBR ]; then break fi done if [ ! -f $MBR ]; then echo "mbr.bin (from EXT/SYSLINUX) not found." exit 1 fi dd if=$MBR of=$BOOT_DEV # Find any pre-created extlinux install directory for EXTDIR in /boot/extlinux /boot/syslinux ; do if [ -d $EXTDIR ] ; then break fi done if [ ! -d $EXTDIR ] ; then # No install directory found so default to /boot/syslinux EXTDIR=/boot/syslinux mkdir -p $EXTDIR fi # Finally install extlinux extlinux --install $EXTDIR } function install_grub2 { # Check for offline installation of grub if [ -f "/tmp/grub/install" ] ; then source /tmp/grub/install # Right now we can't use pkg-map to branch by arch, so tag an # architecture specific virtual package so we can install the # rigth thing based on distribution. elif [[ "$ARCH" =~ "ppc" ]]; then install-packages -m bootloader grub-ppc64 elif [[ "${DIB_BLOCK_DEVICE}" == "mbr" || "${DIB_BLOCK_DEVICE}" == "gpt" ]]; then install-packages -m bootloader grub-pc elif [[ "${DIB_BLOCK_DEVICE}" == "efi" ]]; then install-packages -m bootloader grub-efi-$ARCH else echo "Failure: I'm not sure what bootloader to install" echo "Ensure you have included a block-device-* element" exit 1 fi # XXX: grub-probe on the nbd0/loop0 device returns nothing - workaround, manually # specify modules. https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1073731 GRUBNAME=$(type -p grub-install) || echo "trying grub2-install" if [ -z "$GRUBNAME" ]; then GRUBNAME=$(type -p grub2-install) fi # If no GRUB2 is found, fallback to extlinux if [ -z "$GRUBNAME" ] || [ $($GRUBNAME --version | grep "0.97" | wc -l) -ne 0 ]; then echo "No GRUB2 found. Fallback to Extlinux..." install_extlinux exit 0 fi echo "Installing GRUB2..." # We need --force so grub does not fail due to being installed on the # root partition of a block device. GRUB_OPTS=${GRUB_OPTS:-"--force"} # XXX: This is buggy: # - --target=i386-pc is invalid for non-i386/amd64 architectures # - and for UEFI too. # GRUB_OPTS="$GRUB_OPTS --target=i386-pc" if [[ ! $GRUB_OPTS == *--target* ]] && [[ $($GRUBNAME --version) =~ ' 2.' ]]; then # /sys/ comes from the host machine. If the host machine is using EFI # but the image being built doesn't have EFI boot-images installed we # should set the --target to use a BIOS-based boot-image. # # * --target tells grub what's the target platform # * the boot images are placed in /usr/lib/grub/- # * i386-pc is used for BIOS-based machines # http://www.gnu.org/software/grub/manual/grub.html#Installation # if [ -d /sys/firmware/efi ]; then if [ ! -d /usr/lib/grub/*-efi ]; then case $ARCH in "x86_64"|"amd64") GRUB_OPTS="$GRUB_OPTS --target=i386-pc" ;; "i386") target=i386-pc if [ -e /proc/device-tree ]; then for x in /proc/device-tree/*; do if [ -e "$x" ]; then target="i386-ieee1275" fi done fi GRUB_OPTS="$GRUB_OPTS --target=$target" ;; esac fi fi fi if [[ "$ARCH" =~ "ppc" ]] ; then # For PPC (64-Bit regardless of Endian-ness), we use the "boot" # partition as the one to point grub-install to, not the loopback # device. ppc has a dedicated PReP boot partition. # For grub2 < 2.02~beta3 this needs to be a /dev/mapper/... node after # that a dev/loopXpN node will work fine. $GRUBNAME --modules="part_msdos" $GRUB_OPTS ${DEVICES[boot]} --no-nvram else # This set of modules is sufficient for all installs (mbr/gpt/efi) modules="part_msdos part_gpt lvm" extra_options="" if [[ ${DIB_BLOCK_DEVICE} == "mbr" || ${DIB_BLOCK_DEVICE} == "gpt" ]]; then modules="$modules biosdisk" elif [[ ${DIB_BLOCK_DEVICE} == "efi" ]]; then # This tells the EFI install to put the EFI binaries into # the generic /BOOT directory and avoids trying to update # nvram settings. extra_options="--removable" # We need to manually set the target if it's different to # the host. Setup for EFI case $ARCH in "x86_64"|"amd64") GRUB_OPTS="--target=x86_64-efi" ;; # At this point, we don't need to override the target # for any other architectures. esac fi $GRUBNAME --modules="$modules" $extra_options $GRUB_OPTS $BOOT_DEV fi # This might be better factored out into a per-distro 'install-bootblock' # helper. if [ -d /boot/grub2 ]; then GRUB_CFG=/boot/grub2/grub.cfg elif [ -d /boot/grub ]; then GRUB_CFG=/boot/grub/grub.cfg fi # Override the root device to the default label, and disable uuid # lookup. echo "GRUB_DEVICE=LABEL=${DIB_ROOT_LABEL}" >> /etc/default/grub echo 'GRUB_DISABLE_LINUX_UUID=true' >> /etc/default/grub echo "GRUB_TIMEOUT=${DIB_GRUB_TIMEOUT:-5}" >>/etc/default/grub echo 'GRUB_TERMINAL="serial console"' >>/etc/default/grub echo 'GRUB_GFXPAYLOAD_LINUX=auto' >>/etc/default/grub if [[ -n "${DIB_BOOTLOADER_SERIAL_CONSOLE}" ]]; then SERIAL_CONSOLE="${DIB_BOOTLOADER_SERIAL_CONSOLE}" elif [[ "powerpc ppc64 ppc64le" =~ "$ARCH" ]]; then # Serial console on Power is hvc0 SERIAL_CONSOLE="hvc0" elif [[ "arm64" =~ "$ARCH" ]]; then SERIAL_CONSOLE="ttyAMA0,115200" else SERIAL_CONSOLE="ttyS0,115200" fi GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=${SERIAL_CONSOLE} no_timer_check" echo "GRUB_CMDLINE_LINUX_DEFAULT=\"${GRUB_CMDLINE_LINUX_DEFAULT} ${DIB_BOOTLOADER_DEFAULT_CMDLINE}\"" >>/etc/default/grub echo 'GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"' >>/etc/default/grub if type grub2-mkconfig >/dev/null; then GRUB_MKCONFIG="grub2-mkconfig -o $GRUB_CFG" else GRUB_MKCONFIG="grub-mkconfig -o $GRUB_CFG" fi # os-prober leaks /dev/sda into config file in dual-boot host # Disable grub-os-prober to avoid the issue while running # grub-mkconfig # Setting a flag to track whether the entry is already there in grub config PROBER_DISABLED= if ! grep -qe "^\s*GRUB_DISABLE_OS_PROBER=true" /etc/default/grub; then PROBER_DISABLED=true echo 'GRUB_DISABLE_OS_PROBER=true' >> /etc/default/grub fi $GRUB_MKCONFIG # Remove the fix to disable os_prober if [ -n "$PROBER_DISABLED" ]; then sed -i '$d' /etc/default/grub fi # grub-mkconfig generates a config with the device in it, # This shouldn't be needed, but old code has bugs DIB_RELEASE=${DIB_RELEASE:-} if [ "$DIB_RELEASE" = 'wheezy' ]; then sed -i "s%search --no.*%%" $GRUB_CFG sed -i "s%set root=.*%set root=(hd0,1)%" $GRUB_CFG fi # Fix efi specific instructions in grub config file if [ -d /sys/firmware/efi ]; then sed -i 's%\(initrd\|linux\)efi /boot%\1 /boot%g' $GRUB_CFG fi # when using efi, and having linux16/initrd16, it needs to be replaced # by linuxefi/initrdefi. When building images on a non-efi system, # the 16 suffix is added to linux/initrd entries, but we need it to be # linuxefi/initrdefi for the image to boot under efi if [[ ${DIB_BLOCK_DEVICE} == "efi" ]]; then sed -i 's%\(linux\|initrd\)16 /boot%\1efi /boot%g' $GRUB_CFG fi } DIB_EXTLINUX=${DIB_EXTLINUX:-0} if [ "$DIB_EXTLINUX" != "0" ]; then install_extlinux else install_grub2 fi diskimage-builder-2.35.0/diskimage_builder/elements/rpm-distro/0000775000175000017500000000000013640271564024573 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rpm-distro/post-install.d/0000775000175000017500000000000013640271564027446 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rpm-distro/post-install.d/06-network-config-nonzeroconfdiskimage-builder-2.35.0/diskimage_builder/elements/rpm-distro/post-install.d/06-network-config-nonz0000775000175000017500000000054713640271474033543 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # zeroconf should not be activated or it will add a 169.254.0.0 # route. The route will interfere with access to the nova metadata # server at 169.254.169.254. if ! grep NOZEROCONF /etc/sysconfig/network ; then echo "NOZEROCONF=yes" >> /etc/sysconfig/network fi diskimage-builder-2.35.0/diskimage_builder/elements/rpm-distro/cleanup.d/0000775000175000017500000000000013640271564026444 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rpm-distro/cleanup.d/99-selinux-fixfiles-restore0000775000175000017500000001104613640271474033612 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail # parser isn't smart enough to figure out \ # dib-lint: disable=safe_sudo # Here be dragons ... a previous dragon slayer helpfully pointed out in # http://www.spinics.net/lists/selinux/msg17379.html # # Not all of the contexts defined by the offline system's # file_contexts may be valid under the policy of the host on which # you are running (e.g. if they run different distributions or even # different releases of the same distribution), which will normally # prevent setting those contexts (the kernel won't recognize them). # If you have this issue, you'll need to run setfiles as root in a # special domain, setfiles_mac_t, that is allowed to set contexts # unknown to the host policy, and likely chrooted so that it doesn't # ask the kernel whether the contexts are valid via # /sys/fs/selinux/context. That is how livecd-creator supported # creating images for other releases. # One issue you might see without fixing selinux file labels is sshd # will run in the kernel_t domain instead of the sshd_t domain, making # ssh connections fail with "Unable to get valid context for " # error message. Other failures will occur too. # XXX: is it really valid to build rpm-distros without this? if [[ ! -f ${TARGET_ROOT}/etc/selinux/targeted/contexts/files/file_contexts ]]; then echo "No selinux policy found in chroot, skipping..." exit 0 fi if [[ ! -x ${TARGET_ROOT}/usr/sbin/setfiles ]]; then echo "Can not find setfiles in chroot!" exit 1 fi # If we're on a selinux system, enable permissive mode for # setfiles_mac_t so we can relabel within the chroot without concern # for whatever policy is in the host kernel. We will run under # "runcon" to specifically allow this _runcon="" if [[ -d /sys/fs/selinux ]] && selinuxenabled; then sudo semanage permissive -a setfiles_mac_t _runcon="runcon -t setfiles_mac_t -- " fi # setfiles in > Fedora 26 added this flag: # do not read /proc/mounts to obtain a list of # non-seclabel mounts to be excluded from relabeling # checks. Setting this option is useful where there is # a non-seclabel fs mounted with a seclabel fs # this describes our situation of being on a loopback device on # an ubuntu system, say. See also # https://bugzilla.redhat.com/show_bug.cgi?id=1472709 _dash_m="" if [[ $DISTRO_NAME == "fedora" && $DIB_RELEASE -ge 26 ]]; then _dash_m+="-m" fi IFS='|' read -ra SPLIT_MOUNTS <<< "$DIB_MOUNTPOINTS" for MOUNTPOINT in "${SPLIT_MOUNTS[@]}"; do if [ "${MOUNTPOINT}" != "/tmp/in_target.d" ] && [ "${MOUNTPOINT}" != "/dev" ] && [ "${MOUNTPOINT}" != "/boot/efi" ]; then if ! [ -z "${_runcon}" ] && ! pgrep kauditd >/dev/null; then echo "*** SELinux enabled and kauditd not found, suggesting auditing support is disabled in the host kernel. setfiles will fail without this, please enable and rebuild" exit 1 fi if [[ ${MOUNTPOINT} == "/" ]]; then # If you don't label /dev, /proc and /sys (the actual, # on-disk directory in the image) correctly, it will have # bad effects when things like systemd try to do things # like make network or process namespaces. This generally # leads to obscure and hard-to-debug failures; [1] has # plenty of examples. # # But right now, /{dev,proc,sys} are mounted! With the # extant block-device code, we do not have a point to # break in when these are unmounted, but before we've # unmounted everything. So we do a hack; for the root # directory, we bind mount the target so we see the # underlying directories, and then run setfiles on that. # # XXX: we might be able to uncondtionally do this for all # mountpoints? leaving well enough alone for now... # # [1] https://bugzilla.redhat.com/show_bug.cgi?id=1663040 TMP_BIND_MOUNT=$(mktemp -d) sudo mount --bind ${TARGET_ROOT} ${TMP_BIND_MOUNT} sudo ${_runcon} chroot ${TMP_BIND_MOUNT} \ /usr/sbin/setfiles -F ${_dash_m} \ /etc/selinux/targeted/contexts/files/file_contexts / sudo umount ${TMP_BIND_MOUNT} sudo rmdir ${TMP_BIND_MOUNT} else sudo ${_runcon} chroot ${TARGET_ROOT} \ /usr/sbin/setfiles -F ${_dash_m} \ /etc/selinux/targeted/contexts/files/file_contexts ${MOUNTPOINT} fi fi done diskimage-builder-2.35.0/diskimage_builder/elements/rpm-distro/pre-install.d/0000775000175000017500000000000013640271564027247 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rpm-distro/pre-install.d/00-fix-requiretty0000775000175000017500000000073413640271474032417 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # Fedora sets requiretty by default, which while great for machines that are # going to see a lot of passwords sent over the wire because of interactive # activity, that's not how we're using these. Remove the setting, and the # comments about it sed -i -e '/^Defaults\s*requiretty/d' -e '/Disable "ssh hostname/d' /etc/sudoers sed -i -e '/You have to run/d' /etc/sudoers visudo -c ././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rpm-distro/pre-install.d/00-usr-local-bin-secure-pathdiskimage-builder-2.35.0/diskimage_builder/elements/rpm-distro/pre-install.d/00-usr-local-bin-secure0000775000175000017500000000026313640271474033346 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail sed -i -e "/secure_path/ s@\([\'\"]\?\)\$@:/usr/local/bin/\1@" /etc/sudoers visudo -c diskimage-builder-2.35.0/diskimage_builder/elements/rpm-distro/pre-install.d/01-override-yum-arch0000775000175000017500000000175713640271474032767 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ "i386" = "$ARCH" ]; then basearch=i386 arch=i686 elif [[ "amd64 x86_64" =~ "$ARCH" ]]; then basearch=x86_64 arch=x86_64 elif [[ "$ARCH" = "ppc64" ]]; then basearch=ppc64 arch=ppc64 elif [[ "$ARCH" = "ppc64le" ]]; then basearch=ppc64le arch=ppc64le elif [[ "arm64 aarch64" =~ "$ARCH" ]]; then basearch=aarch64 arch=aarch64 else echo "********************" echo "Unknown arch '$ARCH'" echo "********************" exit 1 fi if [[ ${YUM} == "dnf" ]]; then mkdir -p /etc/dnf/vars echo $basearch > /etc/dnf/vars/basearch echo $arch > /etc/dnf/vars/arch else echo $basearch > /etc/yum/vars/basearch echo $arch > /etc/yum/vars/arch fi if [[ ${DISTRO_NAME} =~ "centos" ]]; then if [[ ${arch} == "x86_64" ]]; then contentdir=centos else contentdir=altarch fi echo $contentdir > /etc/${YUM}/vars/contentdir fi diskimage-builder-2.35.0/diskimage_builder/elements/rpm-distro/README.rst0000664000175000017500000000010413640271474026255 0ustar zuulzuul00000000000000rpm-distro ---------- Base element for distributions based on RPM. diskimage-builder-2.35.0/diskimage_builder/elements/fedora/0000775000175000017500000000000013640271564023733 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/fedora/pre-install.d/0000775000175000017500000000000013640271564026407 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/fedora/pre-install.d/01-set-fedora-mirror0000775000175000017500000000136113640271474032115 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-} [ -n "$DIB_DISTRIBUTION_MIRROR" ] || exit 0 if [[ ${DIB_RELEASE} -gt 27 ]]; then # urgh, the repo is wrong in the "baseurl" line, see # https://pagure.io/fedora/repos/issue/70 for FILE in /etc/yum.repos.d/fedora-updates.repo /etc/yum.repos.d/fedora-updates-testing.repo; do sed -i "s|/os/||" $FILE done fi for FILE in /etc/yum.repos.d/fedora.repo /etc/yum.repos.d/fedora-updates.repo /etc/yum.repos.d/fedora-updates-testing.repo; do sudo sed -e "s|^#baseurl=http[s]*://download.fedoraproject.org/pub/fedora/linux|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^metalink/d" -i $FILE done diskimage-builder-2.35.0/diskimage_builder/elements/fedora/pre-install.d/02-set-machine-id0000775000175000017500000000115013640271474031340 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # The systemd .spec file does this in %post [1] and it turns out that # (in what is possibly a bug [2]) that kernel install requires # /etc/machine-id. This affects "fedora" (the image-based build) if # there is no systemd update to install ... with "fedora-minimal" we # are always installing into the chroot so, so %post always runs and # this is always run # # [1] https://src.fedoraproject.org/rpms/systemd/blob/master/f/systemd.spec # [2] https://bugzilla.redhat.com/show_bug.cgi?id=1486124 systemd-machine-id-setup diskimage-builder-2.35.0/diskimage_builder/elements/fedora/test-elements/0000775000175000017500000000000013640271564026524 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/fedora/test-elements/build-succeeds/0000775000175000017500000000000013640271564031417 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/fedora/test-elements/build-succeeds/element-deps0000664000175000017500000000003213640271474033717 0ustar zuulzuul00000000000000base openstack-ci-mirrors diskimage-builder-2.35.0/diskimage_builder/elements/fedora/package-installs.yaml0000664000175000017500000000262513640271474030046 0ustar zuulzuul00000000000000# On a fresh Fedora 18 install you might have to update audit in order to # fix a conflict with a file from the glibc package. # https://bugzilla.redhat.com/show_bug.cgi?id=894307 audit: # The version of openssl shipped in the fedora cloud image is no longer # compatible with new python environments installed by virtualenv, so we need # to update it first. # See https://bugs.launchpad.net/diskimage-builder/+bug/1254879 openssl: # FIXME: To avoid conflict between the pyOpenSSL installed via python-pip # and pyOpenSSL installed via yum, we are going to sort it out installing # it earlier at the beginning of the image building process. Python-pip # is installing pyOpenSSL as part of satisfying the requirements.txt # in python-glanceclient and afterwards yum tries to install it as a # dependency of the python-paste package needed for the heat element, # this seems to be conflicting and causing the image building process to # fail. The problem is happening on a Fedora 18 system. pyOpenSSL: # Workaround for: # https://bugzilla.redhat.com/show_bug.cgi?id=1066983 vim-minimal: # kernel modules to match the core kernel # Newer Fedora 21 splits these out into a separate package. # It contains iscsi_tcp.ko (for Ironic) among other things like network # driver modules, etc. kernel-modules: # This small package is required on Fedora 21 in order to build some # packages via source (MySQL driver). redhat-rpm-config: diskimage-builder-2.35.0/diskimage_builder/elements/fedora/README.rst0000664000175000017500000000115613640271474025425 0ustar zuulzuul00000000000000====== fedora ====== Use Fedora cloud images as the baseline for built disk images. For further details see the redhat-common README. Environment Variables --------------------- DIB_DISTRIBUTION_MIRROR: :Required: No :Default: None :Description: To use a Fedora Yum mirror, set this variable to the mirror URL before running bin/disk-image-create. This URL should point to the directory containing the ``releases/updates/development`` and ``extras`` directories. :Example: ``DIB\_DISTRIBUTION\_MIRROR=http://download.fedoraproject.org/pub/fedora/linux`` diskimage-builder-2.35.0/diskimage_builder/elements/fedora/element-provides0000664000175000017500000000002113640271474027131 0ustar zuulzuul00000000000000operating-system diskimage-builder-2.35.0/diskimage_builder/elements/fedora/element-deps0000664000175000017500000000010013640271474026227 0ustar zuulzuul00000000000000cache-url dkms redhat-common rpm-distro source-repositories yum diskimage-builder-2.35.0/diskimage_builder/elements/fedora/environment.d/0000775000175000017500000000000013640271564026521 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/fedora/environment.d/10-fedora-distro-name.bash0000664000175000017500000000165313640271474033263 0ustar zuulzuul00000000000000export DISTRO_NAME=fedora export DIB_RELEASE=${DIB_RELEASE:-31} # Note the filename URL has a "sub-release" in it # http:// ... Fedora-Cloud-Base-25-1.3.x86_64.qcow2 # ^^^ # It's not exactly clear how this is generated, or how we could # determine this programatically. Other projects have more # complicated regex-based scripts to find this, which we can examine # if this becomes an issue ... see thread at [1] # # [1] https://lists.fedoraproject.org/archives/list/cloud@lists.fedoraproject.org/thread/2WFO2FKIGUQYRQXIR35UVJGRHF7LQENJ/ if [[ ${DIB_RELEASE} == '28' ]]; then export DIB_FEDORA_SUBRELEASE=1.1 elif [[ ${DIB_RELEASE} == '29' ]]; then export DIB_FEDORA_SUBRELEASE=1.2 elif [[ ${DIB_RELEASE} == '30' ]]; then export DIB_FEDORA_SUBRELEASE=1.2 elif [[ ${DIB_RELEASE} == '31' ]]; then export DIB_FEDORA_SUBRELEASE=1.9 else echo "Unsupported Fedora release" exit 1 fi diskimage-builder-2.35.0/diskimage_builder/elements/fedora/environment.d/11-yum-dnf.bash0000664000175000017500000000031613640271474031156 0ustar zuulzuul00000000000000# since f22, dnf is the yum replacement. Mostly it drops in # unmodified, so while we transition KISS and use this to choose if [ $DIB_RELEASE -ge 22 ]; then export YUM=dnf else export YUM=yum fi diskimage-builder-2.35.0/diskimage_builder/elements/fedora/root.d/0000775000175000017500000000000013640271564025140 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/fedora/root.d/10-fedora-cloud-image0000775000175000017500000000355013640271474030733 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail [ -n "$ARCH" ] [ -n "$TARGET_ROOT" ] if [ 'amd64' = "$ARCH" ] ; then ARCH="x86_64" fi DIB_LOCAL_IMAGE=${DIB_LOCAL_IMAGE:-""} if [ -n "$DIB_LOCAL_IMAGE" ]; then IMAGE_LOCATION=$DIB_LOCAL_IMAGE # No need to copy a local image into the cache directory, so just specify # the cached path as the original path. CACHED_IMAGE=$IMAGE_LOCATION BASE_IMAGE_FILE=`basename $DIB_LOCAL_IMAGE` BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz else # note default DIB_RELEASE set in environment setup case ${ARCH} in x86_64|aarch64) if [[ ${DIB_RELEASE} -ge 28 ]]; then DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://download.fedoraproject.org/pub/fedora/linux/releases/${DIB_RELEASE}/Cloud/${ARCH}/images} else DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://download.fedoraproject.org/pub/fedora/linux/releases/${DIB_RELEASE}/CloudImages/${ARCH}/images} fi ;; ppc64|ppc64le) if [[ ${DIB_RELEASE} -ge 28 ]]; then DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://dl.fedoraproject.org/pub/fedora-secondary/releases/${DIB_RELEASE}/Cloud/${ARCH}/images} else DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://dl.fedoraproject.org/pub/fedora-secondary/releases/${DIB_RELEASE}/CloudImages/${ARCH}/images} fi ;; *) echo "Error: unknown ARCH: ${ARCH}" exit 1 ;; esac BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-Fedora-Cloud-Base-$DIB_RELEASE-$DIB_FEDORA_SUBRELEASE.$ARCH.qcow2} BASE_IMAGE_TAR=Fedora-Cloud-Base-$DIB_RELEASE-$DIB_FEDORA_SUBRELEASE.$ARCH.tgz IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE fi $TMP_HOOKS_PATH/bin/extract-image $BASE_IMAGE_FILE $BASE_IMAGE_TAR $IMAGE_LOCATION $CACHED_IMAGE diskimage-builder-2.35.0/diskimage_builder/elements/deploy-kexec/0000775000175000017500000000000013640271564025064 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/deploy-kexec/binary-deps.d/0000775000175000017500000000000013640271564027523 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/deploy-kexec/binary-deps.d/deploy-kexec0000664000175000017500000000000613640271474032033 0ustar zuulzuul00000000000000kexec diskimage-builder-2.35.0/diskimage_builder/elements/deploy-kexec/init.d/0000775000175000017500000000000013640271564026251 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/deploy-kexec/init.d/81-deploy-kexec0000664000175000017500000000071313640271474031014 0ustar zuulzuul00000000000000TFTP_MAC_ADDRESS="01-"`echo $BOOT_MAC_ADDRESS | sed 's/:/-/g' | tr "A-Z" "a-z"` tftp -r /tftpboot/pxelinux.cfg/${TFTP_MAC_ADDRESS} -g ${BOOT_SERVER} APPEND=$(tail -n1 ${TFTP_MAC_ADDRESS} | cut -f3- -d" ") KERNEL=$(get_kernel_parameter BOOT_IMAGE | sed 's/deploy_//g') RAMDISK=$(echo $KERNEL | sed 's/kernel/ramdisk/') tftp -r ${KERNEL} -g ${BOOT_SERVER} tftp -r ${RAMDISK} -g ${BOOT_SERVER} kexec -l kernel --append="${APPEND}" --initrd=ramdisk && kexec -e diskimage-builder-2.35.0/diskimage_builder/elements/deploy-kexec/package-installs.yaml0000664000175000017500000000001513640271474031166 0ustar zuulzuul00000000000000kexec-tools: diskimage-builder-2.35.0/diskimage_builder/elements/deploy-kexec/README.rst0000664000175000017500000000030313640271474026547 0ustar zuulzuul00000000000000============ deploy-kexec ============ Boots into the new image once baremetal-deploy-helper signals it is finished by downloading the kernel and ramdisk via tftp, and using the kexec utilities. diskimage-builder-2.35.0/diskimage_builder/elements/deploy-kexec/element-deps0000664000175000017500000000003013640271474027362 0ustar zuulzuul00000000000000deploy package-installs diskimage-builder-2.35.0/diskimage_builder/elements/redhat-common/0000775000175000017500000000000013640271564025230 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/redhat-common/bin/0000775000175000017500000000000013640271564026000 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/redhat-common/bin/map-packages0000775000175000017500000000763313640271474030270 0ustar zuulzuul00000000000000#!/usr/local/bin/dib-python # dib-lint: disable=indent # dib-lint indent requirements causes issue with pep8 # Copyright 2012 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from __future__ import print_function import sys # Manually maintained for brevity; consider making this compiled from # distromatch or other rich data sources. # Debian name on the left, Fedora/RHEL on the right. # # !!! DO NOT ADD ANY ENTRIES TO THIS FILE !!! # # This global list has been deprecated by the pkg-map element. New # package mappings should go in pkg-map files inside each element. # package_map = { 'apache2': 'httpd', 'arping': 'iputils', 'augeas-tools': 'augeas', 'build-essential': 'make automake gcc gcc-c++ kernel-devel', 'default-jre': 'java', 'extlinux': 'syslinux-extlinux', 'gearman-job-server': 'gearmand', 'grub-pc': 'grub2-tools grub2', 'libaio1': 'libaio', 'libapache2-mod-wsgi': 'mod_wsgi', 'libc6-dev': 'glibc-devel', 'libmariadb-dev': 'mariadb-devel', 'libffi-dev': 'libffi-devel', 'libldap2-dev': 'python-ldap', 'libmysql-dev': 'mysql++-devel', 'libmysql-java': 'mysql-connector-java', 'libmysqlclient-dev': 'mysql-devel', 'libpq-dev': 'libpqxx-devel', 'libxslt-dev': 'libxslt-devel', 'libsasl2-dev': 'cyrus-sasl-devel', 'libsqlite3-dev': 'libsqlite3x-devel', 'libssl-dev': 'openssl-devel', 'libvirt-bin': 'libvirt', 'libxml2-dev': 'libxml2-devel', 'libz-dev': 'zlib-devel', 'linux-headers-generic': 'kernel-headers', 'linux-image-generic': 'kernel', 'lm-sensors': 'lm_sensors', 'mysql-client-5.5': 'mariadb', 'mysql-server-5.5': 'mariadb-server', 'nagios-plugins-basic': 'nagios-plugins-all', 'netcat-openbsd': 'nmap-ncat', 'nfs-common': 'nfs-utils', 'nfs-kernel-server': 'nfs-utils', 'open-iscsi': 'iscsi-initiator-utils', 'openjdk-7-jre-headless': 'java-1.7.0-openjdk-headless', 'openssh-client': 'openssh-clients', 'openvswitch-common': 'openvswitch', 'openvswitch-switch': 'openvswitch', 'python-dev': 'python-devel', 'python-libvirt': 'libvirt-python', 'python-memcache': 'python-memcached', 'python-mysqldb': 'MySQL-python', 'python-numpy': 'numpy', 'python-pyopenssl': 'pyOpenSSL', 'python-xattr': 'pyxattr', 'qemu-utils': 'qemu-img', 'qpid-client': 'qpid-cpp-client', 'qpidd': 'qpid-cpp-server', 'snmp-mibs-downloader': '', 'snmpd': 'net-snmp', 'stunnel4': 'stunnel', 'tftpd-hpa': 'tftp-server', 'tgt': 'scsi-target-utils', 'vlan': 'vconfig', # openstack mappings 'openstack-neutron-dhcp-agent': 'openstack-neutron', } deprecated = [] for arg in sys.argv[1:]: if arg not in package_map and arg.endswith('-dev'): # convert -dev into devel converted = '%s%s' % (arg, 'el') deprecated.append((arg, converted)) print(converted) else: converted = package_map.get(arg, arg) if converted != arg: deprecated.append((arg, converted)) print(converted) if deprecated: print("WARNING: The following packages were re-mapped by " "redhat-common map-packages\n" "They should be converted to pkg-map:", file=sys.stderr) for arg, converted in deprecated: print(" %s -> %s" % (arg, converted), file=sys.stderr) sys.exit(0) # Tell emacs to use python-mode # Local variables: # mode: python # End: diskimage-builder-2.35.0/diskimage_builder/elements/redhat-common/bin/extract-image0000775000175000017500000001203513640271474030461 0ustar zuulzuul00000000000000#!/bin/bash # Intended to be called from the root.d cloud-image script as follows: # $TMP_HOOKS_PATH/bin/extract-image $BASE_IMAGE_FILE $BASE_IMAGE_TAR $IMAGE_LOCATION $CACHED_IMAGE if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail BASE_IMAGE_FILE=$1 BASE_IMAGE_TAR=$2 IMAGE_LOCATION=$3 CACHED_IMAGE=$4 CACHED_TAR=$DIB_IMAGE_CACHE/$BASE_IMAGE_TAR DIB_LOCAL_IMAGE=${DIB_LOCAL_IMAGE:-""} TAR_LOCK=$CACHED_TAR.lock function extract_image() { if [ -n "$DIB_OFFLINE" -a -f "$CACHED_TAR" ] ; then echo "Not checking freshness of cached $CACHED_TAR." else if [ -z "$DIB_LOCAL_IMAGE" ]; then echo "Fetching Base Image" # There seems to be some bad Fedora mirrors returning http 404's for the cloud image. # If the image fails to download due to a 404 we retry once. set +e $TMP_HOOKS_PATH/bin/cache-url $IMAGE_LOCATION $CACHED_IMAGE RV=$? set -e if [ "$RV" == "44" ] ; then $TMP_HOOKS_PATH/bin/cache-url $IMAGE_LOCATION $CACHED_IMAGE elif [ "$RV" != "0" ] ; then exit 1 fi fi if [ ! -f $CACHED_TAR -o \ $CACHED_IMAGE -nt $CACHED_TAR ] ; then echo "Repacking base image as tarball." WORKING=$(mktemp --tmpdir=${TMP_DIR:-/tmp} -d) EACTION="rm -r $WORKING" trap "$EACTION" EXIT echo "Working in $WORKING" RAW_FILE=$(mktemp --tmpdir=$WORKING XXXXXX.raw) if [ "${CACHED_IMAGE: -3}" == ".xz" ] ; then QCOW2_FILE=$(mktemp --tmpdir=$WORKING XXXXXX.qcow2) # This leaves the old image in place so cache-url wont get it again unxz --stdout $CACHED_IMAGE > $QCOW2_FILE CACHED_IMAGE=$QCOW2_FILE fi qemu-img convert -f qcow2 -O raw $CACHED_IMAGE $RAW_FILE ROOT_PARTITION=p$(sudo kpartx -l $RAW_FILE | awk "/loop[0-9]+p/"|wc -l) sudo udevadm settle # kpartx fails if no /dev/loop* exists, "losetup -f" prints first unused # loop device and creates it if it doesn't exist sudo losetup -f # XXX: Parsing stdout is dangerous, would like a better way to discover # the device used for the image. ROOT_LOOPDEV=$(sudo kpartx -av $RAW_FILE | \ awk "/loop[0-9]+$ROOT_PARTITION/ {print \$3}") # If running inside Docker, make our nodes manually, because udev will not be working. if [ -f /.dockerenv ]; then sudo dmsetup --noudevsync mknodes fi if ! timeout 5 sh -c "while ! [ -e /dev/mapper/$ROOT_LOOPDEV ]; do sleep 1; done"; then echo "Error: Could not find /dev/mapper/$ROOT_LOOPDEV" exit 1 fi EACTION="sudo kpartx -d $RAW_FILE ; $EACTION" trap "$EACTION" EXIT mkdir $WORKING/mnt if [ "xfs" = "$(sudo blkid -o value -s TYPE /dev/mapper/$ROOT_LOOPDEV)" ]; then # mount xfs with nouuid, just in case that uuid is already mounted # use ro to avoid/workaround xfs uuid issues on older # kernels with newer rhel images which seem to set # flags to generate unique uuid's: # xfs superblock has incompatible features (0x4) # we don't need to worry about this, we just want the data MOUNTOPTS="-o nouuid,ro" else MOUNTOPTS="" fi sudo mount $MOUNTOPTS /dev/mapper/$ROOT_LOOPDEV $WORKING/mnt EACTION="sudo umount -f $WORKING/mnt ; $EACTION" trap "$EACTION" EXIT # find out if chroot tar has full xattr support if [ 0 == `sudo chroot $WORKING/mnt bin/tar --help | grep -c xattrs-exclude` ]; then TAROPTS="--no-xattrs" else TAROPTS="--xattrs --xattrs-include=* --xattrs-exclude=security.selinux" fi # Chroot in so that we get the correct uid/gid sudo chroot $WORKING/mnt bin/tar $TAROPTS -cz . > $WORKING/tmp.tar mv $WORKING/tmp.tar $CACHED_TAR else echo "Using cached tar from $CACHED_TAR" fi fi # Extract the base image (use --numeric-owner to avoid UID/GID mismatch between # image tarball and host OS e.g. when building Fedora image on an openSUSE host) # Include all xattrs except selinux because the selinux ones cause issues in our # chroot environment, and we restore all of those at the end of the build anyway. echo "Extracting base root image from $CACHED_TAR" sudo tar -C $TARGET_ROOT --numeric-owner --xattrs --xattrs-include='*' --xattrs-exclude='security.selinux' -xzf $CACHED_TAR } ( echo "Getting $TAR_LOCK: $(date)" # Wait up to 20 minutes for another process to download if ! flock -w 1200 9 ; then echo "Did not get $TAR_LOCK: $(date)" exit 1 fi extract_image ) 9> $TAR_LOCK diskimage-builder-2.35.0/diskimage_builder/elements/redhat-common/package-installs.yaml0000664000175000017500000000054113640271474031336 0ustar zuulzuul00000000000000# Install any packages in this file that may not be in the base cloud # image but could reasonably be expected lsof: tcpdump: traceroute: which: gettext: phase: pre-install.d ca-certificates: # selinux-targeted policy and related tools selinux-policy: selinux-policy-targeted: libselinux-python: policycoreutils: policycoreutils-python: rng-tools: diskimage-builder-2.35.0/diskimage_builder/elements/redhat-common/README.rst0000664000175000017500000000205513640271474026721 0ustar zuulzuul00000000000000============= redhat-common ============= Image installation steps common to RHEL, CentOS, and Fedora. Requirements: If used to build an image form a cloud image compress with xz (the default in centos), this element uses "unxz" to decompress the image. Depending on your distro you may need to install either the xz or xz-utils package. Environment Variables --------------------- DIB_LOCAL_IMAGE :Required: No :Default: None :Description: Use the local path of a qcow2 cloud image. This is useful in that you can use a customized or previously built cloud image from diskimage-builder as input. The cloud image does not have to have been built by diskimage-builder. It should be a full disk image, not just a filesystem image. :Example: ``DIB_LOCAL_IMAGE=rhel-guest-image-7.1-20150224.0.x86_64.qcow2`` DIB_DISABLE_KERNEL_CLEANUP :Required: No :Default: 0 :Description: Specify if kernel needs to be cleaned up or not. When set to true, the bits that cleanup old kernels will not be executed. :Example: DIB_DISABLE_KERNEL_CLEANUP=1 diskimage-builder-2.35.0/diskimage_builder/elements/redhat-common/element-deps0000664000175000017500000000003113640271474027527 0ustar zuulzuul00000000000000package-installs sysprep diskimage-builder-2.35.0/diskimage_builder/elements/redhat-common/environment.d/0000775000175000017500000000000013640271564030016 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/redhat-common/environment.d/50-redhat-common0000664000175000017500000000014213640271474032715 0ustar zuulzuul00000000000000export DIB_DISABLE_KERNEL_CLEANUP=${DIB_DISABLE_KERNEL_CLEANUP:-0} export DIB_INIT_SYSTEM=systemd diskimage-builder-2.35.0/diskimage_builder/elements/redhat-common/pkg-map0000664000175000017500000000121513640271474026506 0ustar zuulzuul00000000000000{ "distro": { "fedora": { "libselinux-python": "python3-libselinux", "policycoreutils": "python3-policycoreutils", "policycoreutils-python": "policycoreutils-python-utils" } }, "release": { "rhel": { "8": { "libselinux-python": "python3-libselinux", "policycoreutils": "python3-policycoreutils", "policycoreutils-python": "policycoreutils-python-utils" } }, "centos": { "8": { "libselinux-python": "python3-libselinux", "policycoreutils": "python3-policycoreutils", "policycoreutils-python": "policycoreutils-python-utils" } } } } diskimage-builder-2.35.0/diskimage_builder/elements/redhat-common/finalise.d/0000775000175000017500000000000013640271564027244 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/redhat-common/finalise.d/01-clean-old-kernels0000775000175000017500000000106513640271474032711 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ $DIB_DISABLE_KERNEL_CLEANUP -ne 0 ]; then echo "Skipping kernel cleanup as configured" exit 0 fi YUM=${YUM:-yum} if [[ ${YUM} == "dnf" ]]; then # cribbed from # http://dnf.readthedocs.org/en/latest/cli_vs_yum.html _old_kernels="$(dnf repoquery --installonly --latest-limit=-1 -q)" if [[ -n "${_old_kernels}" ]]; then rpm -e ${_old_kernels} fi else install-packages yum-utils package-cleanup --oldkernels -y --count=1 fi diskimage-builder-2.35.0/diskimage_builder/elements/iso/0000775000175000017500000000000013640271564023265 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/iso/post-install.d/0000775000175000017500000000000013640271564026140 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/iso/post-install.d/01-copy-bootloaders0000775000175000017500000000270413640271474031574 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eux set -o pipefail TMP_BOOTLOADER_DIR=/tmp/bootloader_files mkdir -p $TMP_BOOTLOADER_DIR #fedora if [ $DISTRO_NAME = "fedora" ]; then GRUB_FILE="/boot/efi/EFI/fedora/grubx64.efi" SHIM_FILE="/boot/efi/EFI/fedora/shim.efi" SYSLINUX_FILE="/usr/share/syslinux/isolinux.bin" LDLINUX_FILE="/usr/share/syslinux/ldlinux.c32" #debian elif [ $DISTRO_NAME = "debian" ]; then GRUB_FILE="/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed" SHIM_FILE="/usr/lib/shim/shim.efi.signed" SYSLINUX_FILE="/usr/lib/ISOLINUX/isolinux.bin" LDLINUX_FILE="/usr/lib/syslinux/modules/bios/ldlinux.c32" #rhel7 elif [ $DISTRO_NAME = "rhel7" ]; then GRUB_FILE="/boot/efi/EFI/redhat/grubx64.efi" SHIM_FILE="/boot/efi/EFI/redhat/shim.efi" SYSLINUX_FILE="/usr/share/syslinux/isolinux.bin" LDLINUX_FILE="/usr/share/syslinux/ldlinux.c32" #ubuntu else GRUB_FILE="/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed" SHIM_FILE="/usr/lib/shim/shim.efi.signed" SYSLINUX_FILE="/usr/lib/syslinux/isolinux.bin" LDLINUX_FILE="/usr/lib/syslinux/ldlinux.c32" fi cp $GRUB_FILE $TMP_BOOTLOADER_DIR cp $SHIM_FILE $TMP_BOOTLOADER_DIR cp $SYSLINUX_FILE $TMP_BOOTLOADER_DIR # Starting from SYSLINUX 5.00, the isolinux.bin is dependent # on ldlinux.c32. # http://www.syslinux.org/wiki/index.php/Library_modules if [ -f "$LDLINUX_FILE" ]; then cp $LDLINUX_FILE $TMP_BOOTLOADER_DIR fi diskimage-builder-2.35.0/diskimage_builder/elements/iso/cleanup.d/0000775000175000017500000000000013640271564025136 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/iso/cleanup.d/100-build-iso0000775000175000017500000001373513640271474027262 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # dib-lint: disable=safe_sudo if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail function build_efiboot_img() { # Signed bootloader files are saved at tmp/bootloader_files during # post-install stage needs to copy them into image. # Signed bootloader packages used are:- # Ubuntu: grub-efi-amd64-signed and shim-signed # Fedora: grub2-efi and shim if [[ $DISTRO_NAME = "fedora" || $DISTRO_NAME = "rhel7" ]] ; then cp $TMP_BOOTLOADER_DIR/shim.efi $TMP_BUILD_DIR/bootx64.efi cp $TMP_BOOTLOADER_DIR/grubx64.efi $TMP_BUILD_DIR/grubx64.efi else cp $TMP_BOOTLOADER_DIR/shim.efi.signed $TMP_BUILD_DIR/bootx64.efi cp $TMP_BOOTLOADER_DIR/grubx64.efi.signed $TMP_BUILD_DIR/grubx64.efi fi dd if=/dev/zero of=$TMP_BUILD_DIR/efiboot.img bs=1K count=5760 mkdosfs -F 12 $TMP_BUILD_DIR/efiboot.img # Create a temporary mount point: MOUNTPOINT=$TMP_BUILD_DIR/tmpmount mkdir $MOUNTPOINT sudo mount -o loop $TMP_BUILD_DIR/efiboot.img $MOUNTPOINT sudo mkdir -p $MOUNTPOINT/EFI/BOOT sudo cp $TMP_BUILD_DIR/bootx64.efi $MOUNTPOINT/EFI/BOOT sudo cp $TMP_BUILD_DIR/grubx64.efi $MOUNTPOINT/EFI/BOOT sudo umount $MOUNTPOINT rmdir $MOUNTPOINT cp $TMP_BUILD_DIR/efiboot.img $TMP_IMAGE_DIR/isolinux } function build_iso() { KERNEL=$1 INITRD=$2 KERNEL_CMDLINE_ARGS=$3 OUTPUT_FILENAME=$4 SCRIPTNAME=$(basename $0) SCRIPTDIR=$(dirname $0) MKISOFS="/usr/bin/mkisofs" if [ $DISTRO_NAME = "fedora" ]; then EFI_BOOT_DIR="EFI/fedora" EXTRA_KERNEL_PARAMS="usbcore.autosuspend=-1" #debian elif [ $DISTRO_NAME = "debian" ]; then EFI_BOOT_DIR="EFI/debian" EXTRA_KERNEL_PARAMS="" #ubuntu: else EFI_BOOT_DIR="EFI/ubuntu" EXTRA_KERNEL_PARAMS="" fi # Create a temporary build directory for holding the contents of iso TMP_IMAGE_DIR="$TMP_BUILD_DIR/image" echo "Creating temporary directory $TMP_IMAGE_DIR" mkdir -p "$TMP_IMAGE_DIR" # Copy isolinux bin to the isolinux directory mkdir -p "$TMP_IMAGE_DIR/isolinux" echo "Copying isolinux.bin" ISOLINUX_BIN=$TMP_BOOTLOADER_DIR/isolinux.bin LDLINUX_BIN=$TMP_BOOTLOADER_DIR/ldlinux.c32 cp $ISOLINUX_BIN "$TMP_IMAGE_DIR/isolinux" # Starting from SYSLINUX 5.00, the isolinux.bin is dependent # on ldlinux.c32. # http://www.syslinux.org/wiki/index.php/Library_modules if [ -f "$LDLINUX_BIN" ]; then cp $LDLINUX_BIN "$TMP_IMAGE_DIR/isolinux" fi # Copy initrd, kernel echo "Copying kernel to $TMP_IMAGE_DIR/vmlinuz" cp $KERNEL "$TMP_IMAGE_DIR/vmlinuz" echo "Copying initrd to $TMP_IMAGE_DIR/initrd" cp $INITRD "$TMP_IMAGE_DIR/initrd" # Generate isolinux.cfg for default booting echo "Generating isolinux.cfg" cat > "$TMP_IMAGE_DIR/isolinux/isolinux.cfg" << END_CONFIG DEFAULT install LABEL install menu label "Install image" kernel /vmlinuz append initrd=/initrd $KERNEL_CMDLINE_ARGS -- TIMEOUT 5 PROMPT 0 END_CONFIG echo "Creating EFI/ubuntu directory" mkdir -p "$TMP_IMAGE_DIR/$EFI_BOOT_DIR" # Generate grub.cfg for default booting echo "Generating grub.cfg" cat > "$TMP_IMAGE_DIR/$EFI_BOOT_DIR/grub.cfg" << END_CONFIG set default="0" set timeout="5" set hidden_timeout_quiet=false menuentry "install" { search --set=root --label VMEDIA_BOOT_ISO linuxefi /vmlinuz $EXTRA_KERNEL_PARAMS $KERNEL_CMDLINE_ARGS -- initrdefi /initrd } END_CONFIG build_efiboot_img # Create the ISO echo "Generating the ISO" $MKISOFS -r -V "VMEDIA_BOOT_ISO" -cache-inodes -J -l \ -b isolinux/isolinux.bin -no-emul-boot \ -boot-load-size 4 -boot-info-table \ -eltorito-alt-boot -e isolinux/efiboot.img \ -no-emul-boot -o $OUTPUT_FILENAME $TMP_IMAGE_DIR } IMAGE_NAME=${IMAGE_NAME:-'image'} if echo $IMAGE_ELEMENT | grep -q '\bramdisk\b'; then EMITTED_KERNEL=$IMAGE_NAME.kernel EMITTED_RAMDISK=$IMAGE_NAME.initramfs DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS=${DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS:-} EMITTED_KERNEL_CMDLINE_ARGS="boot_method=vmedia $DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS" EMITTED_ISO_FILENAME=$IMAGE_NAME.iso elif echo $IMAGE_ELEMENT | grep -q '\bironic-agent\b'; then EMITTED_KERNEL=$IMAGE_NAME.vmlinuz EMITTED_RAMDISK=$IMAGE_NAME.initramfs DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS=${DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS:-} EMITTED_KERNEL_CMDLINE_ARGS="boot_method=vmedia $DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS" EMITTED_ISO_FILENAME=$IMAGE_NAME.iso elif echo $IMAGE_ELEMENT | grep -q '\bbaremetal\b'; then EMITTED_KERNEL=${IMAGE_NAME}.vmlinuz EMITTED_RAMDISK=${IMAGE_NAME}.initrd EMITTED_KERNEL_CMDLINE_ARGS="root=UUID=$DIB_IMAGE_ROOT_FS_UUID" DIB_BOOT_ISO_KERNEL_CMDLINE_ARGS=${DIB_BOOT_ISO_KERNEL_CMDLINE_ARGS:-} if [ -n "$DIB_BOOT_ISO_KERNEL_CMDLINE_ARGS" ]; then EMITTED_KERNEL_CMDLINE_ARGS="$EMITTED_KERNEL_CMDLINE_ARGS $DIB_BOOT_ISO_KERNEL_CMDLINE_ARGS" fi export EMITTED_ISO_FILENAME="$IMAGE_NAME-boot.iso" else echo "Cannot find the kernel/ramdisk to build the iso image. " echo "Please use 'iso' element with either 'baremetal' or 'ramdisk' elements" fi export TMP_BOOTLOADER_DIR=$TARGET_ROOT/tmp/bootloader_files build_iso "$EMITTED_KERNEL" "$EMITTED_RAMDISK" "$EMITTED_KERNEL_CMDLINE_ARGS" \ "$EMITTED_ISO_FILENAME" # Clean-up the bootloaders directory sudo rm -fr $TMP_BOOTLOADER_DIR diskimage-builder-2.35.0/diskimage_builder/elements/iso/package-installs.yaml0000664000175000017500000000004513640271474027372 0ustar zuulzuul00000000000000syslinux: syslinux-common: isolinux: diskimage-builder-2.35.0/diskimage_builder/elements/iso/README.rst0000664000175000017500000000356113640271474024761 0ustar zuulzuul00000000000000=== iso === Generates a bootable ISO image from the kernel/ramdisk generated by the elements ``baremetal``, ``ironic-agent`` or ``ramdisk``. It uses isolinux to boot on BIOS machines and grub to boot on EFI machines. This element has been tested on the following distro(s): * ubuntu * fedora * debian **NOTE**: For other distros, please make sure the ``isolinux.bin`` file exists at ``/usr/lib/syslinux/isolinux.bin``. baremetal element ----------------- When used with ``baremetal`` element, this generates a bootable ISO image named ``-boot.iso`` booting the generated kernel and ramdisk. It also automatically appends kernel command-line argument 'root=UUID='. Any more kernel command-line arguments required may be provided by specifying them in ``DIB_BOOT_ISO_KERNEL_CMDLINE_ARGS``. **NOTE**: It uses pre-built efiboot.img by default to work for UEFI machines. This is because of a bug in latest version of grub[1]. The user may choose to avoid using pre-built binary and build efiboot.img on their own machine by setting the environment variable DIB\_UEFI\_ISO\_BUILD\_EFIBOOT to 1 (this might work only on certain versions of grub). The current efiboot.img was generated by the method build\_efiboot\_img() in 100-build-iso on Ubuntu 13.10 with grub 2.00-19ubuntu2.1. ramdisk element --------------- When used with ``ramdisk`` element, this generates a bootable ISO image named ``.iso`` booting the generated kernel and ramdisk. It also automatically appends kernel command-line argument 'boot\_method=vmedia' which is required for Ironic drivers ``iscsi_ilo``. ironic-agent element -------------------- When used with ``ironic-agent`` element, this generates a bootable ISO image named ``.iso`` which boots the agent kernel and agent ramdisk. **REFERENCES** [1] https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1378658 diskimage-builder-2.35.0/diskimage_builder/elements/iso/element-deps0000664000175000017500000000002713640271474025571 0ustar zuulzuul00000000000000grub2 package-installs diskimage-builder-2.35.0/diskimage_builder/elements/iso/pkg-map0000664000175000017500000000073013640271474024544 0ustar zuulzuul00000000000000{ "distro":{ "debian":{ "syslinux": "syslinux", "syslinux-common": "syslinux-common", "isolinux": "isolinux" } }, "family":{ "debian":{ "syslinux": "syslinux", "syslinux-common": "", "isolinux": "" }, "redhat":{ "syslinux": "syslinux", "syslinux-common": "", "isolinux": "" } }, "default":{ "syslinux": "syslinux", "syslinux-common": "", "isolinux": "" } } diskimage-builder-2.35.0/diskimage_builder/elements/rhel-common/0000775000175000017500000000000013640271564024713 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rhel-common/pre-install.d/0000775000175000017500000000000013640271564027367 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rhel-common/pre-install.d/00-rhel-registration0000775000175000017500000000736713640271474033211 0ustar zuulzuul00000000000000#!/bin/bash # This script deals quite a bit with passwords, which we don't ever want # included in trace output # dib-lint: disable=dibdebugtrace set -eu set -o pipefail opts= attach_opts= if [ "${DIB_RELEASE:-7}" == "7" ]; then repos="repos --enable rhel-7-server-rpms" satellite_repo="rhel-7-server-rh-common-rpms" elif [ "${DIB_RELEASE}" == "8" ]; then repos="repos --enable rhel-8-for-x86_64-appstream-rpms --enable rhel-8-for-x86_64-baseos-rpms" satellite_repo="satellite-tools-6.5-for-rhel-8-x86_64-rpms" fi REG_SAT_CERT=${REG_SAT_CERT:-"katello-ca-consumer-latest.noarch.rpm"} if [ -n "${REG_AUTO_ATTACH:-}" ]; then opts="$opts --auto-attach" if [ -n "${REG_SERVICE_LEVEL:-}" ]; then opts="$opts --servicelevel $REG_SERVICE_LEVEL" fi if [ -n "${REG_RELEASE:-}" ]; then opts="$opts --release=$REG_RELEASE" fi else if [ -n "${REG_SERVICE_LEVEL:-}" ]; then echo "WARNING: REG_SERVICE_LEVEL set without REG_AUTO_ATTACH." fi if [ -n "${REG_RELEASE:-}" ]; then echo "WARNING: REG_RELEASE set without REG_AUTO_ATTACH." fi if [ -n "${REG_POOL_ID:-}" ]; then attach_opts="$attach_opts --pool=$REG_POOL_ID" fi fi if [ -n "${REG_BASE_URL:-}" ]; then opts="$opts --baseurl=$REG_BASE_URL" fi if [ -n "${REG_ENVIRONMENT:-}" ]; then opts="$opts --env=$REG_ENVIRONMENT" fi if [ -n "${REG_FORCE:-}" ]; then opts="$opts --force" fi if [ -n "${REG_SERVER_URL:-}" ]; then opts="$opts --serverurl=$REG_SERVER_URL" fi if [ -n "${REG_ACTIVATION_KEY:-}" ]; then opts="$opts --activationkey=$REG_ACTIVATION_KEY" if [ -z "${REG_ORG:-}" ]; then echo "WARNING: REG_ACTIVATION_KEY set without REG_ORG." fi else if [ -n "${REG_PASSWORD:-}" ]; then opts="$opts --password $REG_PASSWORD" fi if [ -n "${REG_USER:-}" ]; then opts="$opts --username $REG_USER" fi fi if [ -n "${REG_MACHINE_NAME:-}" ]; then opts="$opts --name $REG_MACHINE_NAME" fi if [ -n "${REG_ORG:-}" ]; then opts="$opts --org=$REG_ORG" fi if [ -n "${REG_REPOS:-}" ]; then for repo in $(echo $REG_REPOS | tr ',' '\n'); do repos="$repos --enable $repo" done fi if [ -n "${REG_TYPE:-}" ]; then opts="$opts --type=$REG_TYPE" fi sanitized_opts=$(echo "$opts" | sed 's/--password \([^ ]*\)/--password ***/g') sanitized_opts=$(echo "$sanitized_opts" | sed 's/--activationkey=\([^ ]*\)/--activationkey=***/g') case "${REG_METHOD:-}" in portal) echo "Registering with options: $sanitized_opts" subscription-manager register $opts if [ -z "${REG_AUTO_ATTACH:-}" -a -z "${REG_ACTIVATION_KEY:-}" ]; then echo "Attaching with options: $attach_opts" subscription-manager attach $attach_opts fi echo "Disabling all previous repos" subscription-manager repos --disable=\* echo "Enabling repos: $repos" subscription-manager $repos if [ -n "${REG_RELEASE:-}" ]; then subscription-manager release --set=${REG_RELEASE} fi ;; satellite) # Save an unmodified copy of the repo list for logging user_repos=$repos repos="$repos --enable ${satellite_repo}" echo "Installing satellite dependencies" rpm -Uvh "$REG_SAT_URL/pub/$REG_SAT_CERT" || true echo "Registering with options: $sanitized_opts" subscription-manager register $opts echo "Disabling all previous repos" subscription-manager repos --disable=\* echo "Enabling repos: $user_repos" subscription-manager $repos ;; disable) echo "Disabling RHEL registration" ;; *) echo "WARNING: only 'portal', 'satellite', and 'disable' are valid values for REG_METHOD." exit 0 esac diskimage-builder-2.35.0/diskimage_builder/elements/rhel-common/pre-install.d/10-rhel-blacklist0000775000175000017500000000044013640271474032431 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # This is packages that are required for installation by other # elements (like base) but aren't actually available for this # platform. This is a bit of a hack echo "dkms" > /tmp/yum-blacklist diskimage-builder-2.35.0/diskimage_builder/elements/rhel-common/pre-install.d/00-rhsm0000775000175000017500000000444213640271474030507 0ustar zuulzuul00000000000000#!/bin/bash # This script is for RHEL6 use only. For RHEL7, please see the readme for # documentation on which scripts are used for registration and the variables # needed to enable the registration process. if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail export DIB_RHSM_USER=${DIB_RHSM_USER:-} if [ -n "${DIB_RHSM_USER:-}" ] && [ -n "${DIB_RHSM_PASSWORD:-}" ] ; then opts="--force" if [[ -n "${DIB_SAT_KEY:-}" ]]; then opts="$opts --activationkey ${DIB_SAT_KEY}" else opts="$opts --username ${DIB_RHSM_USER} --password ${DIB_RHSM_PASSWORD}" fi if [[ -n "${DIB_SAT_URL:-}" ]]; then if [[ "${DIB_REG_TYPE:-}" == "rhn" ]]; then opts="$opts --serverUrl ${DIB_SAT_URL}" else opts="$opts --serverurl ${DIB_SAT_URL} --sslCACert /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT" fi fi if [[ -n "${DIB_SAT_CERT_RPM_URL:-}" ]]; then yum install -y ${DIB_SAT_CERT_RPM_URL} fi if [[ "${DIB_REG_TYPE:-}" == "rhn" ]]; then rhnreg_ks $opts --norhnsd sleep 1 # optional channel required for diskimage-builder dependency channels="-a -c rhel-x86_64-server-optional-6" if [[ -n "${DIB_RHN_CHANNELS:-}" ]]; then for chan in $DIB_RHN_CHANNELS; do channels="$channels -a -c $chan" done fi rhn-channel --user=$DIB_RHSM_USER --password=$DIB_RHSM_PASSWORD $channels rhn-channel -l else subscription-manager register $opts # wait a second to ensure consumer certificate is finished writing to disk sleep 1 if [ -z ${DIB_RHSM_POOL:-} ]; then subscription-manager attach --auto else subscription-manager attach --pool $DIB_RHSM_POOL fi # optional repo required for diskimage-builder dependency if [ "$DISTRO_NAME" == "rhel7" ]; then repos="--enable rhel-7-server-optional-rpms" else repos="--enable rhel-6-server-optional-rpms" fi if [[ -n "${DIB_RHSM_REPOS:-}" ]]; then for repo in $DIB_RHSM_REPOS; do repos="$repos --enable $repo" done fi subscription-manager repos $repos subscription-manager repos --list fi fi diskimage-builder-2.35.0/diskimage_builder/elements/rhel-common/install.d/0000775000175000017500000000000013640271564026603 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rhel-common/install.d/10-openstack-selinux-rhel0000775000175000017500000000044013640271474033351 0ustar zuulzuul00000000000000#!/bin/bash # Install openstack-selinux if it is available # dib-lint: disable=sete if [ "${DIB_DEBUG_TRACE:-1}" -gt 0 ]; then set -x fi set -u set -o pipefail HAS_PACKAGE=$(yum list | grep openstack-selinux) if [ -n "$HAS_PACKAGE" ]; then install-packages openstack-selinux fi diskimage-builder-2.35.0/diskimage_builder/elements/rhel-common/README.rst0000664000175000017500000002431213640271474026404 0ustar zuulzuul00000000000000=========== rhel-common =========== This element contains the common installation steps between RHEL os releases. RHEL Registration ----------------- This element provides functionality for registering RHEL images during the image build process with the disk-image-create script from diskimage-builder. The RHEL image will register itself with either the hosted Red Hat Customer Portal or Satellite to enable software installation from official repositories. After the end of the image creation process, the image will unregister itself so an entitlement will not be decremented from the account. SECURITY WARNING: ----------------- While the image building workflow will allow you to register with a username and password combination, that feature is deprecated in the boot process via Heat as it will expose your username and password in clear text for anyone that has rights to run heat stack-show. A compromised username and password can be used to login to the Red Hat Customer Portal or an instance of Satellite. An activation key can only be used for registration purposes using the subscription-manager command line tool and is considered a lower security risk. IMPORTANT NOTE: ---------------- The 00-rhsm script is specific to RHEL6. If you use the REG\_ variables to use with RHEL7, you do not need to set any DIB_RHSM variables. The scripts named with "rhel-registration" have not been developed or tested for RHEL6. For information on building RHEL6 images, please see the rhel element README. Environment Variables For Image Creation ---------------------------------------- The following environment variables are used for registering a RHEL instance with either the Red Hat Customer Portal or Satellite 6. #### REG\_ACTIVATION\_KEY Attaches existing subscriptions as part of the registration process. The subscriptions are pre-assigned by a vendor or by a systems administrator using Subscription Asset Manager. #### REG\_AUTO\_ATTACH Automatically attaches the best-matched compatible subscription. This is good for automated setup operations, since the system can be configured in a single step. #### REG\_BASE\_URL Gives the hostname of the content delivery server to use to receive updates. Both Customer Portal Subscription Management and Subscription Asset Manager use Red Hat's hosted content delivery services, with the URL https://cdn.redhat.com. Since Satellite 6 hosts its own content, the URL must be used for systems registered with Satellite 6. #### REG\_ENVIRONMENT Registers the system to an environment within an organization. #### REG\_FORCE Registers the system even if it is already registered. Normally, any register operations will fail if the machine is already registered. #### REG\_HALT\_UNREGISTER At the end of the image build process, the element runs a cleanup script that will unregister it from the system it registered with. There are some cases when building an image where you may want to stop this from happening so you can verify the registration or to build a one off-image where the boot-time registration will not be enabled. Set this value to '1' to stop the unregistration process. #### REG\_MACHINE\_NAME Sets the name of the system to be registered. This defaults to be the same as the hostname. #### REG\_METHOD Sets the method of registration. Use "portal" to register a system with the Red Hat Customer Portal. Use "satellite" to register a system with Red Hat Satellite 6. Use "disable" to skip the registration process. #### REG\_ORG Gives the organization to which to join the system. #### REG\_POOL\_ID The pool ID is listed with the product subscription information, which is available from running the list subcommand of subscription-manager. #### REG\_PASSWORD Gives the password for the user account. #### REG\_RELEASE Sets the operating system minor release to use for subscriptions for the system. Products and updates are limited to that specific minor release version. This is used only used with the REG_AUTO_ATTACH option. Possible values for this include 5Server, 5.7, 5.8, 5.9, 5.10, 6.1,...6.6, 7.0. It will change over time as new releases come out. There are also variants 6Server, 6Client, 6Workstation, 7Server, etc. #### REG\_REPOS A single string representing a list of repository names separated by a comma (No spaces). Each of the repositories in this string are enabled through subscription manager. Once you've attached a subscription, you can find available repositories by running subscription-manager repos --list. #### REG\_SERVER\_URL Gives the hostname of the subscription service to use. The default is for Customer Portal Subscription Management, subscription.rhn.redhat.com. If this option is not used, the system is registered with Customer Portal Subscription Management. #### REG\_SERVICE\_LEVEL Sets the service level to use for subscriptions on that machine. This is only used with the REG_AUTO_ATTACH option. #### REG\_USER Gives the content server user account name. #### REG\_TYPE Sets what type of consumer is being registered. The default is system, which is applicable to both physical systems and virtual guests. Other types include hypervisor for virtual hosts, person, domain, rhui, and candlepin for some subscription management applications. Image Build Registration Examples ------------------------------------ To register with Satellite 6, a common example would be to set the following variables: REG_SAT_URL='http://my-sat06.server.org' REG_ORG='tripleo' REG_ENV='Library' REG_USER='tripleo' REG_PASSWORD='tripleo' REG_METHOD=satellite To register with the Red Hat Customer Portal, a common example would be to set the following variables: REG_REPOS='rhel-7-server-optional-rpms,rhel-7-server-extras-rpms' REG_AUTO_ATTACH=true REG_USER='tripleo' REG_PASSWORD='tripleo' REG_METHOD=portal Configuration ------------- Heat metadata can be used to configure the rhel-common element. rh_registration: activation_key: # Attaches existing subscriptions as part of the registration # process. The subscriptions are pre-assigned by a vendor or by # a systems administrator using Subscription Asset Manager. auto_attach: 'true' # Automatically attaches the best-matched compatible subscription. # This is good for automated setup operations, since the system can # be configured in a single step. base_url: # Gives the hostname of the content delivery server to use to # receive updates. Both Customer Portal Subscription Management # and Subscription Asset Manager use Red Hat's hosted content # delivery services, with the URL https://cdn.redhat.com. Since # Satellite 6 hosts its own content, the URL must be used for # systems registered with Satellite 6. environment: # Registers the system to an environment within an organization. force: # Registers the system even if it is already registered. Normally, # any register operations will fail if the machine is already # registered. machine_name: # Sets the name of the system to be registered. This defaults to be # the same as the hostname. org: # Gives the organization to which to join the system. password: # DEPRECATED # Gives the password for the user account. release: # Sets the operating system minor release to use for subscriptions # for the system. Products and updates are limited to that specific # minor release version. This is only used with the auto_attach # option. repos: # A single string representing a list of repository names separated by a # comma (No spaces). Each of the repositories in this string are enabled # through subscription manager. satellite_url: # The url of the Satellite instance to register with. Required for # Satellite registration. server_url: # Gives the hostname of the subscription service to use. The default # is for Customer Portal Subscription Management, # subscription.rhn.redhat.com. If this option is not used, the system # is registered with Customer Portal Subscription Management. service_level: # Sets the service level to use for subscriptions on that machine. # This is only used with the auto_attach option. user: # DEPRECATED # Gives the content server user account name. type: # Sets what type of consumer is being registered. The default is # "system", which is applicable to both physical systems and virtual # guests. Other types include "hypervisor" for virtual hosts, # "person", "domain", "rhui", and "candlepin" for some subscription # management applications. method: # Sets the method of registration. Use "portal" to register a # system with the Red Hat Customer Portal. Use "satellite" to # register a system with Red Hat Satellite 6. Use "disable" to # skip the registration process. satellite_cert: # Defines the ssl certificate to be installed when using "satellite" # as register mechanism. Default values of this is # "katello-ca-consumer-latest.noarch.rpm". Configuration Registration Examples ------------------------------------ To register with Satellite 6, a common example would be to use the following metadata:: { "rh_registration":{ "satellite_url": "http://my-sat06.server.org", "org": "tripleo", "environment": "Library", "activation_key": "my-key-SQQkh4", "method":"satellite", "repos": "rhel-ha-for-rhel-7-server-rpms" } } To register with the Red Hat Customer Portal, a common example would be to use the following metadata:: { "rh_registration":{ "repos":"rhel-7-server-optional-rpms,rhel-7-server-extras-rpms", "auto_attach":true, "activation_key": "my-key-SQQkh4", "org": "5643002", "method":"portal" } } diskimage-builder-2.35.0/diskimage_builder/elements/rhel-common/os-refresh-config/0000775000175000017500000000000013640271564030233 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rhel-common/os-refresh-config/pre-configure.d/0000775000175000017500000000000013640271564033222 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016700000000000011221 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rhel-common/os-refresh-config/pre-configure.d/06-rhel-registrationdiskimage-builder-2.35.0/diskimage_builder/elements/rhel-common/os-refresh-config/pre-configure.d/060000775000175000017500000001301513640271474033375 0ustar zuulzuul00000000000000#!/bin/bash # dib-lint: disable=dibdebugtrace set -eu set -o pipefail OK=/mnt/state/var/lib/rhsm/rhsm.ok if [ -e $OK ] ; then exit 0 fi REG_ACTIVATION_KEY="$(os-apply-config --key rh_registration.activation_key --type raw --key-default '')" REG_AUTO_ATTACH="$(os-apply-config --key rh_registration.auto_attach --type raw --key-default 'true')" REG_BASE_URL="$(os-apply-config --key rh_registration.base_url --type raw --key-default '')" REG_ENVIRONMENT="$(os-apply-config --key rh_registration.environment --type raw --key-default '')" REG_FORCE="$(os-apply-config --key rh_registration.force --type raw --key-default '')" REG_MACHINE_NAME="$(os-apply-config --key rh_registration.machine_name --type raw --key-default '')" REG_ORG="$(os-apply-config --key rh_registration.org --type raw --key-default '')" REG_PASSWORD="$(os-apply-config --key rh_registration.password --type raw --key-default '')" REG_POOL_ID="$(os-apply-config --key rh_registration.poolid --type raw --key-default '')" REG_RELEASE="$(os-apply-config --key rh_registration.release --type raw --key-default '')" REG_REPOS="$(os-apply-config --key rh_registration.repos --type raw --key-default '')" REG_SAT_URL="$(os-apply-config --key rh_registration.satellite_url --type raw --key-default '')" REG_SAT_CERT="$(os-apply-config --key rh_registration.satellite_cert --type raw --key-default '')" REG_SERVER_URL="$(os-apply-config --key rh_registration.server_url --type raw --key-default '')" REG_SERVICE_LEVEL="$(os-apply-config --key rh_registration.service_level --type raw --key-default '')" REG_USER="$(os-apply-config --key rh_registration.user --type raw --key-default '')" REG_TYPE="$(os-apply-config --key rh_registration.type --type raw --key-default '')" REG_METHOD="$(os-apply-config --key rh_registration.method --type raw --key-default '')" opts= attach_opts= repos="repos --enable rhel-7-server-rpms" satellite_repo="rhel-7-server-rh-common-rpms" REG_SAT_CERT=${REG_SAT_CERT:-"katello-ca-consumer-latest.noarch.rpm"} if [ -n "${REG_AUTO_ATTACH:-}" ]; then opts="$opts --auto-attach" if [ -n "${REG_SERVICE_LEVEL:-}" ]; then opts="$opts --servicelevel $REG_SERVICE_LEVEL" fi if [ -n "${REG_RELEASE:-}" ]; then opts="$opts --release=$REG_RELEASE" fi else if [ -n "${REG_SERVICE_LEVEL:-}" ]; then echo "WARNING: REG_SERVICE_LEVEL set without REG_AUTO_ATTACH." fi if [ -n "${REG_RELEASE:-}" ]; then echo "WARNING: REG_RELEASE set without REG_AUTO_ATTACH." fi if [ -n "${REG_POOL_ID:-}" ]; then attach_opts="$attach_opts --pool=$REG_POOL_ID" fi fi if [ -n "${REG_BASE_URL:-}" ]; then opts="$opts --baseurl=$REG_BASE_URL" fi if [ -n "${REG_ENVIRONMENT:-}" ]; then opts="$opts --env=$REG_ENVIRONMENT" fi if [ -n "${REG_FORCE:-}" ]; then opts="$opts --force" fi if [ -n "${REG_SERVER_URL:-}" ]; then opts="$opts --serverurl=$REG_SERVER_URL" fi if [ -n "${REG_ACTIVATION_KEY:-}" ]; then opts="$opts --activationkey=$REG_ACTIVATION_KEY" if [ -z "${REG_ORG:-}" ]; then echo "WARNING: REG_ACTIVATION_KEY set without REG_ORG." fi else echo "WARNING: Support for registering with a username and password is deprecated." echo "Please use activation keys instead. See the README for more information." if [ -n "${REG_PASSWORD:-}" ]; then opts="$opts --password $REG_PASSWORD" fi if [ -n "${REG_USER:-}" ]; then opts="$opts --username $REG_USER" fi fi if [ -n "${REG_MACHINE_NAME:-}" ]; then opts="$opts --name $REG_MACHINE_NAME" fi if [ -n "${REG_ORG:-}" ]; then opts="$opts --org=$REG_ORG" fi if [ -n "${REG_REPOS:-}" ]; then for repo in $(echo $REG_REPOS | tr ',' '\n'); do repos="$repos --enable $repo" done fi if [ -n "${REG_TYPE:-}" ]; then opts="$opts --type=$REG_TYPE" fi sanitized_opts=$(echo "$opts" | sed 's/--password \([^ ]*\)/--password ***/g') sanitized_opts=$(echo "$sanitized_opts" | sed 's/--activationkey=\([^ ]*\)/--activationkey=***/g') case "${REG_METHOD:-}" in portal) echo "Registering with options: $sanitized_opts" subscription-manager register $opts if [ -z "${REG_AUTO_ATTACH:-}" -a -z "${REG_ACTIVATION_KEY:-}" ]; then echo "Attaching with options: $attach_opts" subscription-manager attach $attach_opts fi echo "Enabling repos: $repos" subscription-manager $repos if [ -n "${REG_RELEASE:-}" ]; then subscription-manager release --set=${REG_RELEASE} fi ;; satellite) # Save an unmodified copy of the repo list for logging user_repos=$repos repos="$repos --enable ${satellite_repo}" echo "Installing satellite dependencies" rpm -Uvh "$REG_SAT_URL/pub/$REG_SAT_CERT" || true echo "Registering with options: $sanitized_opts" subscription-manager register $opts echo "Disabling all previous repos" subscription-manager repos --disable=\* echo "Enabling repos: $user_repos" subscription-manager $repos echo "Installing katello-agent" yum install -y katello-agent || true # needed for errata reporting to satellite6 katello-package-upload echo "Disabling satellite repo because it is no longer needed" subscription-manager repos --disable ${satellite_repo} ;; disable) echo "Disabling RHEL registration" ;; *) echo "WARNING: only 'portal', 'satellite', and 'disable' are valid values for REG_METHOD." exit 0 esac mkdir -p $(dirname $OK) touch $OK diskimage-builder-2.35.0/diskimage_builder/elements/rhel-common/finalise.d/0000775000175000017500000000000013640271564026727 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/rhel-common/finalise.d/60-unregister0000775000175000017500000000161613640271474031273 0ustar zuulzuul00000000000000#!/bin/bash if [ "${DIB_DEBUG_TRACE:-1}" -gt 0 ]; then set -x fi set -eu set -o pipefail # When building an image with diskimage-builder, you will need to register # with either the customer portal or a satellite instance in order to enable # repos for software installation. In most cases, it is desirable to # unregister a system when diskimage-builder is completing so the customer # entitlements are not decremented. This option is here for the case when # a single image needs to be built and deployed as a single instance or for # debugging purposes so you can check the portal or satellite to see what was # registered. Set REG_HALT_UNREGISTER to any non-null value to enable this # functionality. case "${REG_METHOD:-}" in portal | satellite) if [ -z "${REG_HALT_UNREGISTER:-}" ]; then subscription-manager unregister fi ;; disable) ;; esac diskimage-builder-2.35.0/diskimage_builder/elements/pypi/0000775000175000017500000000000013640271564023454 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pypi/extra-data.d/0000775000175000017500000000000013640271564025730 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pypi/extra-data.d/00-mount-pypi-mirror0000775000175000017500000000055113640271474031525 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail MIRROR_SOURCE=$DIB_IMAGE_CACHE/pypi/mirror/ if [ -d "$MIRROR_SOURCE" ]; then MIRROR_TARGET=$TMP_MOUNT_PATH/tmp/pypi sudo mkdir -p $MIRROR_SOURCE $MIRROR_TARGET # dib-lint: safe_sudo sudo mount --bind $MIRROR_SOURCE $MIRROR_TARGET # dib-lint: safe_sudo fi diskimage-builder-2.35.0/diskimage_builder/elements/pypi/post-install.d/0000775000175000017500000000000013640271564026327 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pypi/post-install.d/00-unconfigure-pypi-mirror0000775000175000017500000000030013640271474033276 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ -e ~/.pip/pip.conf.orig ]; then mv ~/.pip/pip.conf{.orig,} else rm ~/.pip/pip.conf fi diskimage-builder-2.35.0/diskimage_builder/elements/pypi/pre-install.d/0000775000175000017500000000000013640271564026130 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pypi/pre-install.d/04-configure-pypi-mirror0000775000175000017500000000540713640271474032555 0ustar zuulzuul00000000000000#!/usr/local/bin/dib-python # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from __future__ import print_function import os.path try: from urllib.parse import urlparse except ImportError: from urlparse import urlparse def main(): home = os.path.expanduser("~") backup_configs(home) indices = [] if (os.environ.get('DIB_PYPI_MIRROR_URL') or os.environ.get('PYPI_MIRROR_URL')): candidates = [k for k in os.environ if k.startswith('DIB_PYPI_MIRROR_URL')] back_compat = [k for k in os.environ if k.startswith('PYPI_MIRROR_URL')] if len(back_compat) > 0: print('DEPRECATION WARNING: Please use DIB_PYPI_MIRROR_URL* rather' ' than PYPI_MIRROR_URL*') candidates += back_compat indices = list(map(os.environ.get, sorted(candidates))) else: indices = ['file:///tmp/pypi'] print('WARNING: You are using the pypi element but no pypi mirror is ' 'defined via the PYPI_MIRROR_URL env variable') use_pypi_python_org = True if os.environ.get('DIB_OFFLINE'): use_pypi_python_org = False if os.environ.get('DIB_NO_PYPI_PIP'): use_pypi_python_org = False if use_pypi_python_org: indices.append('https://pypi.python.org/simple') retries = os.environ.get('DIB_PIP_RETRIES') with open(home + '/.pip/pip.conf', 'wt') as output: output.write('[global]\n') output.write('log = %s/pip.log\n' % (home,)) output.write('index-url = %s\n' % (indices[0],)) output.write('trusted-host = %s\n' % (urlparse(indices[0]).hostname,)) if retries is not None: output.write('retries = %s\n' % retries) if len(indices) > 1: output.write('extra-index-url =\n') for index in indices[1:]: output.write(' %s\n' % (index,)) def backup_configs(home): pip_dir = home + '/.pip' if not os.path.exists(pip_dir): os.mkdir(pip_dir) if os.path.exists(pip_dir + '/pip.conf'): os.rename(pip_dir + '/pip.conf', pip_dir + '/pip.conf.orig') if os.path.exists(home + '/.pydistutils.cfg'): os.rename(home + '/.pydistutils.cfg', home + '/.pydistutils.cfg.orig') if __name__ == '__main__': main() diskimage-builder-2.35.0/diskimage_builder/elements/pypi/README.rst0000664000175000017500000000452213640271474025146 0ustar zuulzuul00000000000000==== pypi ==== ==================== Inject a PyPI mirror ==================== Use a custom PyPI mirror to build images. The default is to bind mount one from ~/.cache/image-create/pypi/mirror into the build environment as mirror URL file:///tmp/pypi. The element temporarily overwrites /root/.pip.conf to use it. When online, the official pypi.python.org pypi index is supplied as an extra-url, so uncached dependencies will still be available. When offline, only the mirror is used - be warned that a stale mirror will cause build failures. To disable the pypi.python.org index without using --offline (e.g. when working behind a corporate firewall that prohibits pypi.python.org) set DIB\_NO\_PYPI\_PIP to any non-empty value. To use an arbitrary mirror set DIB\_PYPI\_MIRROR\_URL=http[s]://somevalue/ Additional mirrors can be added by exporting DIB\_PYPI\_MIRROR\_URL\_1=... etc. NB: The sort order for these variables is a simple string sort - if you have more than 9 additional mirrors, some care will be needed. You can also set the number of retries that occur on failure by setting the DIB\_PIP\_RETRIES environment variable. If setting fallback pip mirrors you typically want to set this to 0 to prevent the need to fail multiple times before falling back. A typical use of this element is thus: export DIB\_PYPI\_MIRROR\_URL=http://site/pypi/Ubuntu-13.10 export DIB\_PYPI\_MIRROR\_URL\_1=http://site/pypi/ export DIB\_PYPI\_MIRROR\_URL\_2=file:///tmp/pypi export DIB\_PIP\_RETRIES=0 [devpi-server](https://pypi.python.org/pypi/devpi-server) can be useful in making a partial PyPI mirror suitable for building images. For instance: * pip install -U devpi * devpi-server quickstart * devpi use http://machinename:3141 * Re-export your variables to point at the new mirror: export DIB\_PYPI\_MIRROR\_URL=http://machinename:3141/ unset DIB\_PYPI\__MIRROR\_URL\_1 unset DIB\_PYPI\__MIRROR\_URL\_2 The next time packages are installed, they'll be cached on the local devpi server; subsequent runs pointed at the same mirror will use the local cache if the upstream can't be contacted. Note that this process only has the server running temporarily; see [Quickstart: Permanent install on server/laptop](https://devpi.net/docs/devpi/devpi/latest/+d/quickstart-server.html) guide from the devpi developers for more information on a more permanent setup. diskimage-builder-2.35.0/diskimage_builder/elements/pypi/element-deps0000664000175000017500000000001313640271474025753 0ustar zuulzuul00000000000000dib-python diskimage-builder-2.35.0/diskimage_builder/elements/cache-url/0000775000175000017500000000000013640271564024336 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/cache-url/bin/0000775000175000017500000000000013640271564025106 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/cache-url/bin/cache-url0000775000175000017500000000720513640271474026703 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2012 Hewlett-Packard Development Company, L.P. # Copyright 2013 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # Download a URL to a local cache # e.g. cache-url http://.../foo ~/.cache/image-create/foo SCRIPT_NAME=$(basename $0) SCRIPT_HOME=$(dirname $0) FORCE_REVALIDATE=0 function show_options () { echo "Usage: $SCRIPT_NAME [options] " echo echo "Download a URL and cache it to a specified location." echo "Subsequent requests will compare the last modified date" echo "of the upstream file to determine whether it needs to be" echo "downloaded again." echo echo "Options:" echo " -f -- force upstream caches to fetch a new copy of the file" echo " -h -- show this help" echo exit $1 } TEMP=$(getopt -o hf -n $SCRIPT_NAME -- "$@") if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi # Note the quotes around `$TEMP': they are essential! eval set -- "$TEMP" while true ; do case "$1" in -h|"-?") show_options 0;; -f) FORCE_REVALIDATE=1; shift 1;; --) shift; break;; *) echo "Error: unsupported option $1." ; exit 1 ;; esac done url=$1 dest=$2 time_cond= curl_opts=(--retry 3 --retry-delay 30) if [ -z $url -o -z $dest ] ; then show_options 1 fi if [ -p $dest ]; then type="fifo" tmp=$(mktemp --tmpdir download.XXXXXXXX) else type="normal" mkdir -p $(dirname $dest) tmp=$(mktemp $(dirname $dest)/.download.XXXXXXXX) fi if [ "$FORCE_REVALIDATE" = "1" ]; then curl_opts+=(-H "Pragma: no-cache, must-revalidate" -H "Cache-Control: no-cache, must-revalidate") success="Downloaded and cached $url, having forced upstream caches to revalidate" elif [ -f $dest -a -s $dest ] ; then time_cond="-z $dest" success="Server copy has changed. Using server version of $url" else success="Downloaded and cached $url for the first time" fi rcode=$(curl -v -L -o $tmp -w '%{http_code}' --connect-timeout 10 "${curl_opts[@]}" $url $time_cond) if [ "$rcode" == "200" -o "${url:0:7}" == "file://" ] ; then # In cases where servers ignore the Modified time, # curl cancels the download, outputs a 200 and leaves # the output file untouched, we don't want this empty file. if [ -n "$time_cond" -a ! -s $tmp ] ; then echo "Ignoring empty file returned by curl. Using locally cached $url" rm -f $tmp else echo $success if [ "fifo" = "$type" ]; then cp $tmp $dest rm $tmp else mv $tmp $dest fi fi # 213 is the response to a ftp MDTM command, curl outputs a 213 as the status # if the url redirected to a ftp server and Not-Modified elif [ "$rcode" = "304" -o "$rcode" = "213" ] ; then echo "Server copy has not changed. Using locally cached $url" rm -f $tmp else echo "Server returned an unexpected response code. [$rcode]" rm -f $tmp # expose some error codes so the calling process might know what happened if [ "$rcode" = "404" ] ; then exit 44 fi exit 1 fi diskimage-builder-2.35.0/diskimage_builder/elements/cache-url/package-installs.yaml0000664000175000017500000000000613640271474030440 0ustar zuulzuul00000000000000curl: diskimage-builder-2.35.0/diskimage_builder/elements/cache-url/__init__.py0000664000175000017500000000000013640271474026435 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/cache-url/README.rst0000664000175000017500000000012513640271474026023 0ustar zuulzuul00000000000000========= cache-url ========= A helper script to download images into a local cache. diskimage-builder-2.35.0/diskimage_builder/elements/cache-url/element-deps0000664000175000017500000000002113640271474026634 0ustar zuulzuul00000000000000package-installs diskimage-builder-2.35.0/diskimage_builder/elements/cache-url/tests/0000775000175000017500000000000013640271564025500 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/cache-url/tests/__init__.py0000664000175000017500000000000013640271474027577 0ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/cache-url/tests/test_cache_url.py0000664000175000017500000000302213640271474031033 0ustar zuulzuul00000000000000# Copyright 2014 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import os import tempfile import time from diskimage_builder.tests import base class TestCacheUrl(base.ScriptTestBase): def test_cache_url_caches(self): tempdir = tempfile.mkdtemp() target = os.path.join(tempdir, 'target') source = 'http://fake/url' # Write fake data to the target file and return success self._stub_script('curl', 'echo "test" > ${3:7:100}\necho 200') self._run_command( ['diskimage_builder/elements/cache-url/bin/cache-url', source, target]) self.assertTrue(os.path.exists(target)) modification_time = os.path.getmtime(target) # Make sure that the timestamp would change if the file does time.sleep(1) self._stub_script('curl', 'echo "304"') self._run_command( ['diskimage_builder/elements/cache-url/bin/cache-url', source, target]) self.assertEqual(modification_time, os.path.getmtime(target)) diskimage-builder-2.35.0/diskimage_builder/elements/cache-url/pkg-map0000664000175000017500000000013413640271474025613 0ustar zuulzuul00000000000000{ "distro": { "gentoo": { "curl": "net-misc/curl" } } } diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-disable-resizefs/0000775000175000017500000000000013640271564027773 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-disable-resizefs/post-install.d/0000775000175000017500000000000013640271564032646 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000017600000000000011221 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-disable-resizefs/post-install.d/50-cloud-init-disable-resizefsdiskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-disable-resizefs/post-install.d/50-cl0000775000175000017500000000021613640271474033413 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail sed -ie 's/^ - resizefs$//' /etc/cloud/cloud.cfg diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-disable-resizefs/README.rst0000664000175000017500000000053013640271474031460 0ustar zuulzuul00000000000000=========================== cloud-init-disable-resizefs =========================== The cloud-init resizefs module can be extremely slow and will also unwittingly create a root filesystem that cannot be booted by grub if the underlying partition is too big. This removes it from cloud.cfg, putting the onus for resizing on the user post-boot. diskimage-builder-2.35.0/diskimage_builder/elements/baremetal/0000775000175000017500000000000013640271564024427 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/baremetal/cleanup.d/0000775000175000017500000000000013640271564026300 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/baremetal/cleanup.d/99-extract-kernel-and-ramdiskdiskimage-builder-2.35.0/diskimage_builder/elements/baremetal/cleanup.d/99-extract-kernel-and-ramdis0000775000175000017500000000226013640271474033432 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # dib-lint: disable=safe_sudo if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail [ -n "$TARGET_ROOT" ] source $_LIB/img-functions # Dig up the initrd and kernel to use. select_boot_kernel_initrd $TARGET_ROOT sudo cp $BOOTDIR/$KERNEL ${IMAGE_NAME}.vmlinuz sudo cp $BOOTDIR/$RAMDISK ${IMAGE_NAME}.initrd sudo chmod a+r ${IMAGE_NAME}.vmlinuz sudo chmod a+r ${IMAGE_NAME}.initrd if [ -f $TARGET_ROOT/dib-signed-kernel-version ] ; then echo "Removing $TARGET_ROOT/dib-signed-kernel-version" sudo rm -f $TARGET_ROOT/dib-signed-kernel-version fi diskimage-builder-2.35.0/diskimage_builder/elements/baremetal/README.rst0000664000175000017500000000100013640271474026105 0ustar zuulzuul00000000000000.. _element-baremetal: ========= baremetal ========= This is the baremetal (IE: real hardware) element. Does the following: * extracts the kernel and initial ramdisk of the built image. Optional parameters: * DIB_BAREMETAL_KERNEL_PATTERN and DIB_BAREMETAL_INITRD_PATTERN may be supplied to specify which kernel files are preferred; this can be of use when using custom kernels that don't fit the standard naming patterns. Both variables must be provided in order for them to have any effect. diskimage-builder-2.35.0/diskimage_builder/elements/base/0000775000175000017500000000000013640271564023405 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/base/pre-install.d/0000775000175000017500000000000013640271564026061 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/base/pre-install.d/03-baseline-tools0000775000175000017500000000066113640271474031152 0ustar zuulzuul00000000000000#!/bin/bash # Install baseline packages and tools. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail case $DISTRO_NAME in 'ubuntu'|'debian') # Note: add-apt-repository would be nice for RPM platforms too - so when we # need something like it, create a wrapper in dpkg/bin and fedora/bin. apt-get -y update install-packages software-properties-common ;; esac diskimage-builder-2.35.0/diskimage_builder/elements/base/install.d/0000775000175000017500000000000013640271564025275 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/base/install.d/00-up-to-date0000775000175000017500000000040013640271474027411 0ustar zuulzuul00000000000000#!/bin/bash # Fully upgrade everything on the system (if the package manager knows how to # do it). if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ ${DIB_AVOID_PACKAGES_UPDATE} -eq 0 ]; then install-packages -u fi diskimage-builder-2.35.0/diskimage_builder/elements/base/install.d/00-baseline-environment0000775000175000017500000000031213640271474031560 0ustar zuulzuul00000000000000#!/bin/bash # These are useful, or at worst not harmful, for all images we build. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail install-packages -m base iscsi_package diskimage-builder-2.35.0/diskimage_builder/elements/base/install.d/10-cloud-init0000775000175000017500000000056013640271474027511 0ustar zuulzuul00000000000000#!/bin/bash # Tweak the stock ubuntu cloud-init config if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # cloud-init May not actually be installed mkdir -p /etc/cloud/cloud.cfg.d if [ -n "${DIB_CLOUD_INIT_ETC_HOSTS:-}" ]; then dd of=/etc/cloud/cloud.cfg.d/10_etc_hosts.cfg << EOF manage_etc_hosts: $DIB_CLOUD_INIT_ETC_HOSTS EOF fi diskimage-builder-2.35.0/diskimage_builder/elements/base/README.rst0000664000175000017500000000240613640271474025076 0ustar zuulzuul00000000000000==== base ==== This is the base element. Almost all users will want to include this in their disk image build, as it includes a lot of useful functionality. The `DIB_CLOUD_INIT_ETC_HOSTS` environment variable can be used to customize cloud-init's management of `/etc/hosts`: * If the variable is set to something, write that value as cloud-init's manage_etc_hosts. * If the variable is set to an empty string, don't create manage_etc_hosts setting (cloud-init will use its default value). * If the variable is not set, use "localhost" for now. Later, not setting the variable will mean using cloud-init's default. (To preserve diskimage-builder's current default behavior in the future, set the variable to "localhost" explicitly.) The 'DIB_AVOID_PACKAGES_UPDATE' environment variable can be used to avoid updating all packages, useful when wanting to avoid release update. * 'DIB_AVOID_PACKAGES_UPDATE' default is '0', all packages will be updated. * set 'DIB_AVOID_PACKAGES_UPDATE' to '1' to avoid updating all packages. Notes: * If you are getting warnings during the build about your locale being missing, consider installing/generating the relevant locale. This may be as simple as having language-pack-XX installed in the pre-install stage diskimage-builder-2.35.0/diskimage_builder/elements/base/element-deps0000664000175000017500000000004613640271474025712 0ustar zuulzuul00000000000000dib-init-system install-types pkg-map diskimage-builder-2.35.0/diskimage_builder/elements/base/environment.d/0000775000175000017500000000000013640271564026173 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/base/environment.d/10-base-defaults0000664000175000017500000000010013640271474031042 0ustar zuulzuul00000000000000export DIB_AVOID_PACKAGES_UPDATE=${DIB_AVOID_PACKAGES_UPDATE:-0}diskimage-builder-2.35.0/diskimage_builder/elements/base/pkg-map0000664000175000017500000000151313640271474024664 0ustar zuulzuul00000000000000{ "family": { "redhat": { "iscsi_package": "iscsi-initiator-utils" }, "gentoo": { "curl": "net-misc/curl", "dhcp_client": "net-misc/dhcp", "extlinux": "sys-boot/syslinux", "git": "dev-vcs/git", "grub_bios": "sys-boot/grub", "grub-pc": "sys-boot/grub", "ironic-python-agent": "", "iscsi_package": "sys-block/open-iscsi", "isc-dhcp-client": "net-misc/dhcp", "isolinux": "", "ncat": "net-analyzer/netcat", "qemu-utils": "app-emulation/qemu", "python-dev": "", "PyYAML": "dev-python/pyyaml", "syslinux": "sys-boot/syslinux", "syslinux-common": "", "tftp": "net-ftp/tftp-hpa", "tgt": "sys-block/tgt" }, "suse": { "qemu-utils": "qemu-tools" } }, "default": { "iscsi_package": "open-iscsi" } } diskimage-builder-2.35.0/diskimage_builder/elements/sysprep/0000775000175000017500000000000013640271564024200 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/sysprep/README.rst0000664000175000017500000000014513640271474025667 0ustar zuulzuul00000000000000sysprep ======= This element holds configuration and scripts that are common for all distributions. diskimage-builder-2.35.0/diskimage_builder/elements/sysprep/finalise.d/0000775000175000017500000000000013640271564026214 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/sysprep/finalise.d/01-clear-machine-id0000775000175000017500000000034213640271474031441 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ -e /etc/machine-id ]; then > /etc/machine-id fi if [ -e /var/lib/dbus/machine-id ]; then > /var/lib/dbus/machine-id fi diskimage-builder-2.35.0/diskimage_builder/elements/pkg-map/0000775000175000017500000000000013640271564024027 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pkg-map/extra-data.d/0000775000175000017500000000000013640271564026303 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pkg-map/extra-data.d/10-create-pkg-map-dir0000775000175000017500000000076113640271474032024 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 1 ]; then set -x fi set -eu set -o pipefail sudo mkdir -p $TMP_MOUNT_PATH/usr/share/pkg-map/ eval declare -A image_elements=($(get_image_element_array)) for i in "${!image_elements[@]}"; do element=$i element_dir=${image_elements[$i]} pkg_map="${element_dir}/pkg-map" if [ -f "${pkg_map}" ]; then echo "Copying pkg-map for ${element}" sudo cp "${pkg_map}" "$TMP_MOUNT_PATH/usr/share/pkg-map/$element" fi done diskimage-builder-2.35.0/diskimage_builder/elements/pkg-map/bin/0000775000175000017500000000000013640271564024577 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/pkg-map/bin/pkg-map0000775000175000017500000001506013640271474026063 0ustar zuulzuul00000000000000#!/usr/local/bin/dib-python # Copyright 2014 Red Hat Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import argparse import json import logging import os import sys log = logging.getLogger() def os_family(distro): family = None if distro in ['fedora', 'rhel', 'rhel7', 'centos', 'centos7']: family = 'redhat' elif distro in ['debian', 'ubuntu']: family = 'debian' elif distro == 'opensuse': family = 'suse' elif distro == 'gentoo': family = 'gentoo' return family def main(): parser = argparse.ArgumentParser( description="Translate package name to distro specific name." " Exits with 1 if error is encountered, 2 if no pkg-map" " file is found. Otherwise exits with 0.") parser.add_argument('--element', default='', help='The element (namespace) to use for translation.') parser.add_argument('--pkg-map', default='', help='Path to specific pkg-map file. ' '(Useful for testing)') parser.add_argument('--distro', default=os.environ.get('DISTRO_NAME'), help='The distro name to use for translation.' ' Defaults to DISTRO_NAME') parser.add_argument('--release', default=os.environ.get('DIB_RELEASE'), help='A more specfic name for distribution release') parser.add_argument('--missing-ok', action="store_true", help='Do not consider missing mappings an error.' ' Causes packages where no mapping is set to be' ' printed.') # This tool has traditionally output status and debug messages on # stderr. The problem is if a caller has stderr > stdout then # actual output gets messed in with the logs. This allows callers # to disambiguate actual output by specifying a unique prefix. parser.add_argument('--prefix', default='', help='Output mapped packages with this prefix') parser.add_argument('--debug', dest='debug', action="store_true", help="Enable debugging output") args, extra = parser.parse_known_args() # Logs have traditionally gone to stderr with this tool. Maintain # compatibility level = logging.DEBUG if args.debug else logging.INFO logging.basicConfig(stream=sys.stderr, level=level) if not args.element and not args.pkg_map: log.error('Please specify an --element argument.') sys.exit(1) if args.element and args.pkg_map: log.error('Specify either --element or --pkg-map') sys.exit(1) if not args.distro: log.error('Please specify a --distro argument or set DISTRO_NAME.') sys.exit(1) if args.pkg_map: # specifying the pkg-map by hand is just for manual testing element = "<%s>" % args.pkg_map map_file = args.pkg_map else: element = args.element map_file = '/usr/share/pkg-map/%s' % element log.info("Mapping for %s : %s" % (element, ' '.join(extra))) if not os.path.exists(map_file): if args.missing_ok: log.info("No package map for %s, done" % element) for name in extra: print('%s%s' % (args.prefix, name)) sys.exit(0) else: log.error('Required pkg-map for %s element does not exist.' % args.element) sys.exit(2) with open(map_file) as fd: try: package_names = json.loads(fd.read()) # log.debug(pprint.pformat(package_names)) except ValueError: log.error('Unable to parse %s' % map_file) raise # Parse mapping data in this form using release/distro/family/default # Most specific takes priority; order is # - release # - distro # - family # - default # An empty package list can be provided. # # Example for Nova and Glance (using fictitious name for Fedora and SUSE # and package mapping for SUSE family) # { # "release": { # "fedora" : { # "23" : { # "nova_package": "openstack-compute-foo" # } # } # } # "distro": { # "fedora": { # "nova_package": "openstack-compute", # "glance_package": "openstack-image" # } # }, # "family": { # "redhat": { # "nova_package": "openstack-nova", # "glance_package": "openstack-glance" # }, # "suse": { # "nova_package": "" # } # }, # "default": { # "nova_package": "nova", # "glance_package": "glance" # } # } name_map = package_names.get('default', {}) if 'family' in package_names: family_map = package_names['family'].get(os_family(args.distro)) if family_map: name_map.update(family_map) if 'distro' in package_names: distro_map = package_names['distro'].get(args.distro) if distro_map: name_map.update(distro_map) if 'release' in package_names: try: # release is a sub-concept of distro release_map = package_names['release'][args.distro][args.release] name_map.update(release_map) except KeyError: pass # log.debug(pprint.pformat(name_map)) for name in extra: pkg_name = name_map.get(name) if pkg_name: log.debug("map %s -> %s" % (name, pkg_name)) print('%s%s' % (args.prefix, pkg_name)) elif name in name_map: log.debug("map %s -> " % (name)) continue else: if args.missing_ok: log.debug("pass -> %s" % (name)) print('%s%s' % (args.prefix, name)) else: log.error("%s has no valid mapping for package %s" % (element, name)) sys.exit(1) sys.exit(0) if __name__ == '__main__': main() # Tell emacs to use python-mode # Local variables: # mode: python # End: diskimage-builder-2.35.0/diskimage_builder/elements/pkg-map/README.rst0000664000175000017500000000514513640271474025523 0ustar zuulzuul00000000000000======= pkg-map ======= Map package names to distro specific packages. Provides the following: * bin/pkg-map:: usage: pkg-map [-h] [--element ELEMENT] [--distro DISTRO] Translate package name to distro specific name. optional arguments: -h, --help show this help message and exit --element ELEMENT The element (namespace) to use for translation. --distro DISTRO The distro name to use for translation. Defaults to DISTRO_NAME --release RELEASE The release to use for translation. Defaults to DIB_RELEASE * Any element may create its own pkg-map JSON config file using the one of 4 sections for the release/distro/family/ and or default. The family is set automatically within pkg-map based on the supplied distro name. Families include: + redhat: includes centos, fedora, and rhel distros + debian: includes debian and ubuntu distros + suse: includes the opensuse distro The release is a specification of distro; i.e. the distro and release must mach for a translation. The most specific section takes priority. An empty package list can be provided. Example for Nova and Glance (NOTE: using fictitious package names for Fedora and package mapping for suse family to provide a good example!) Example format:: { "release": { "fedora": { "23": { "nova_package": "foo" "bar" } } }, "distro": { "fedora": { "nova_package": "openstack-compute", "glance_package": "openstack-image" } }, "family": { "redhat": { "nova_package": "openstack-nova", "glance_package": "openstack-glance" }, "suse": { "nova_package": "" } }, "default": { "nova_package": "nova", "glance_package": "glance" } } Example commands using this format: pkg-map --element nova-compute --distro fedora nova_package Returns: openstack-compute pkg-map --element nova-compute --distro rhel nova_package Returns: openstack-nova pkg-map --element nova-compute --distro ubuntu nova_package Returns: nova pkg-map --element nova-compute --distro opensuse nova_package Returns: * This output can be used to filter what other tools actually install (install-packages can be modified to use this for example) * Individual pkg-map files live within each element. For example if you are created an Apache element your pkg-map JSON file should be created at elements/apache/pkg-map. diskimage-builder-2.35.0/diskimage_builder/elements/pkg-map/element-deps0000664000175000017500000000001313640271474026326 0ustar zuulzuul00000000000000dib-python diskimage-builder-2.35.0/diskimage_builder/elements/element-manifest/0000775000175000017500000000000013640271564025730 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/element-manifest/extra-data.d/0000775000175000017500000000000013640271564030204 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/element-manifest/extra-data.d/75-inject-element-manifestdiskimage-builder-2.35.0/diskimage_builder/elements/element-manifest/extra-data.d/75-inject-element-0000775000175000017500000000055313640271474033346 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail DIB_ELEMENT_MANIFEST_PATH=${DIB_ELEMENT_MANIFEST_PATH:-"$DIB_MANIFEST_IMAGE_DIR/dib-element-manifest"} sudo mkdir -p $TMP_MOUNT_PATH/$(dirname $DIB_ELEMENT_MANIFEST_PATH) sudo /bin/bash -c "echo $IMAGE_ELEMENT | tr ' ' '\n' > $TMP_MOUNT_PATH/$DIB_ELEMENT_MANIFEST_PATH" diskimage-builder-2.35.0/diskimage_builder/elements/element-manifest/README.rst0000664000175000017500000000041713640271474027421 0ustar zuulzuul00000000000000================ element-manifest ================ Writes a manifest file that is the full list of elements that were used to build the image. The file path can be overridden by setting $DIB\_ELEMENT\_MANIFEST\_PATH, and defaults to /etc/dib-manifests/element-manifest. diskimage-builder-2.35.0/diskimage_builder/elements/element-manifest/element-deps0000664000175000017500000000001213640271474030226 0ustar zuulzuul00000000000000manifests diskimage-builder-2.35.0/diskimage_builder/elements/hpdsa/0000775000175000017500000000000013640271564023572 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/hpdsa/post-install.d/0000775000175000017500000000000013640271564026445 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/hpdsa/post-install.d/98-hpdsa-post-dkms0000775000175000017500000000030513640271474031645 0ustar zuulzuul00000000000000#!/bin/bash if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail # This is required for HPDSA driver to be included in the # ramdisk of the image. update-initramfs -u diskimage-builder-2.35.0/diskimage_builder/elements/hpdsa/post-install.d/95-hpdsa0000775000175000017500000000072413640271474027730 0ustar zuulzuul00000000000000#!/bin/bash if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail # Blacklist the ahci driver for hpdsa to recognize the disks. # It can also be done with element "modprobe-blacklist" which # would add the ahci driver to /etc/modprobe.d/blacklist.conf. # To be on safer side, blacklist the driver ahci without the # element "modprobe-blacklist" also. echo "blacklist ahci" >> /etc/modprobe.d/install-hpdsa.conf echo "hpdsa" >> /etc/modules diskimage-builder-2.35.0/diskimage_builder/elements/hpdsa/pre-install.d/0000775000175000017500000000000013640271564026246 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/hpdsa/pre-install.d/06-hpdsa0000775000175000017500000000054413640271474027521 0ustar zuulzuul00000000000000#!/bin/bash if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail # Add hpdsa repository echo 'deb https://downloads.linux.hp.com/SDR/repo/ubuntu-hpdsa' $DIB_RELEASE ' main' \ >> /etc/apt/sources.list.d/ubuntu-hpdsa.list # Add the key curl -f -s https://downloads.linux.hp.com/SDR/hpPublicKey2048_key1.pub | apt-key add - diskimage-builder-2.35.0/diskimage_builder/elements/hpdsa/package-installs.yaml0000664000175000017500000000012113640271474027672 0ustar zuulzuul00000000000000build-essential: curl: phase: pre-install.d linux-headers-generic: hpdsa-dkms: diskimage-builder-2.35.0/diskimage_builder/elements/hpdsa/README.rst0000664000175000017500000000105113640271474025256 0ustar zuulzuul00000000000000===== hpdsa ===== This is the hpdsa element. This element enables the 'hpdsa' driver to be included in the ramdisk when invoked during ramdisk/image creation. This driver is required for deploying the HP Proliant Servers Gen9 with Dynamic Smart Array Controllers. Note: This element supports only Ubuntu image/ramdisk to be updated with the hpdsa driver. It installs hp certificate from https://downloads.linux.hp.com/SDR/hpPublicKey2048_key1.pub. Since HP has released this currently only for trusty, It has been restricted to work only for trusty. diskimage-builder-2.35.0/diskimage_builder/elements/hpdsa/root.d/0000775000175000017500000000000013640271564024777 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/hpdsa/root.d/10-hpdsa-check-distro0000775000175000017500000000057513640271474030626 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ 'ubuntu' != $DISTRO_NAME ] ; then echo "Only ubuntu is supported for hpdsa driver. The DISTRO is set to $DISTRO_NAME" exit 1 fi if [ 'trusty' != $DIB_RELEASE ] ; then echo "Only trusty is supported for hpdsa driver. The DIB_RELEASE is set to $DIB_RELEASE" exit 1 fi diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/0000775000175000017500000000000013640271564025412 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/test-elements/0000775000175000017500000000000013640271564030203 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/test-elements/7-build-succeeds/0000775000175000017500000000000013640271564033242 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/test-elements/7-build-succeeds/README.rstdiskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/test-elements/7-build-succeeds/RE0000664000175000017500000000005413640271474033472 0ustar zuulzuul00000000000000Verify we can build a centos-minimal image. ././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/test-elements/7-build-succeeds/element-depsdiskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/test-elements/7-build-succeeds/el0000664000175000017500000000002413640271474033561 0ustar zuulzuul00000000000000openstack-ci-mirrorsdiskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/test-elements/8-build-succeeds/0000775000175000017500000000000013640271564033243 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/test-elements/8-build-succeeds/README.rstdiskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/test-elements/8-build-succeeds/RE0000664000175000017500000000005413640271474033473 0ustar zuulzuul00000000000000Verify we can build a centos-minimal image. ././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/test-elements/8-build-succeeds/element-depsdiskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/test-elements/8-build-succeeds/el0000664000175000017500000000002413640271474033562 0ustar zuulzuul00000000000000openstack-ci-mirrors././@LongLink0000000000000000000000000000016100000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/test-elements/8-build-succeeds/environment.d/diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/test-elements/8-build-succeeds/en0000775000175000017500000000000013640271564033566 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000020300000000000011210 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/test-elements/8-build-succeeds/environment.d/09-set-distro.bashdiskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/test-elements/8-build-succeeds/en0000664000175000017500000000002713640271474033567 0ustar zuulzuul00000000000000export DIB_RELEASE='8' diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/README.rst0000664000175000017500000000146613640271474027110 0ustar zuulzuul00000000000000============== centos-minimal ============== Create a minimal image based on CentOS Use of this element will require 'yum' and 'yum-utils' to be installed on Ubuntu and Debian. Nothing additional is needed on Fedora or CentOS. By default this builds CentOS 7 images. Set ``DIB_RELEASE`` to ``7`` or ``8`` to explicitly select the release. For CentOS 7, by default, ``DIB_YUM_MINIMAL_CREATE_INTERFACES`` is set to enable the creation of ``/etc/sysconfig/network-scripts/ifcfg-eth[0|1]`` scripts to enable DHCP on the ``eth0`` & ``eth1`` interfaces. If you do not have these interfaces, or if you are using something else to setup the network such as cloud-init, glean or network-manager, you would want to set this to ``0``. For CentOS 8, this is set to ``0`` by default as the system uses NetworkManager by default. diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/element-provides0000664000175000017500000000002113640271474030610 0ustar zuulzuul00000000000000operating-system diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/element-deps0000664000175000017500000000001513640271474027713 0ustar zuulzuul00000000000000yum-minimal diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/environment.d/0000775000175000017500000000000013640271564030200 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/environment.d/10-centos-distro-name.bashdiskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/environment.d/10-centos-distro-na0000664000175000017500000000074213640271474033535 0ustar zuulzuul00000000000000export DISTRO_NAME=centos export DIB_RELEASE=${DIB_RELEASE:-7} # by default, enable DHCP configuration of eth0 & eth1 in network # scripts for centos 7. See yum-minimal for full details. CentOS 8 # does not come with network-scripts by default so avoid this there. if [[ ${DIB_RELEASE} -le 7 ]]; then export DIB_YUM_MINIMAL_CREATE_INTERFACES=${DIB_YUM_MINIMAL_CREATE_INTERFACES:-1} else export DIB_YUM_MINIMAL_CREATE_INTERFACES=${DIB_YUM_MINIMAL_CREATE_INTERFACES:-0} fi diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/environment.d/11-yum-dnf.bash0000664000175000017500000000011613640271474032633 0ustar zuulzuul00000000000000if [ $DIB_RELEASE -ge 8 ]; then export YUM=dnf else export YUM=yum fi diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/yum.repos.d/0000775000175000017500000000000013640271564027575 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/yum.repos.d/8/0000775000175000017500000000000013640271564027744 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/yum.repos.d/8/appstream.repo0000664000175000017500000000023613640271474032630 0ustar zuulzuul00000000000000[centos-appstream] name=CentOS-$releasever - AppStream mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=appstream gpgcheck=0 diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/yum.repos.d/8/base.repo0000664000175000017500000000022113640271474031540 0ustar zuulzuul00000000000000[centos-base] name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=baseos gpgcheck=0 diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/yum.repos.d/7/0000775000175000017500000000000013640271564027743 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/centos-minimal/yum.repos.d/7/yum.repo0000664000175000017500000000037713640271474031453 0ustar zuulzuul00000000000000[centos] name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os gpgcheck=0 #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/0000775000175000017500000000000013640271564025225 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/install.d/0000775000175000017500000000000013640271564027115 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/install.d/70-enable-dynamic-login-servicesdiskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/install.d/70-enable-dynamic-login-0000775000175000017500000000041313640271474033320 0ustar zuulzuul00000000000000#!/bin/bash if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail case "$DIB_INIT_SYSTEM" in systemd) systemctl enable dynamic-login.service ;; sysv) update-rc.d dynamic-login.init defaults ;; esac diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/README.rst0000664000175000017500000000365313640271474026723 0ustar zuulzuul00000000000000============= dynamic-login ============= This element insert a helper script in the image that allows users to dynamically configure credentials at boot time. This is specially useful for troubleshooting. Troubleshooting an image can be quite hard, specially if you can not get a prompt you can enter commands to find out what went wrong. By default, the images (specially ramdisks) doesn't have any SSH key or password for any user. Of course one could use the ``devuser`` element to generate an image with SSH keys and user/password in the image but that would be a massive security hole and very it's discouraged to run in production with a ramdisk like that. This element allows the operator to inject a SSH key and/or change the root password dynamically when the image boots. Two kernel command line parameters are used to do it: sshkey :Description: If the operator append sshkey="$PUBLIC_SSH_KEY" to the kernel command line on boot, the helper script will append this key to the root user authorized_keys. rootpwd :Description: If the operator append rootpwd="$ENCRYPTED_PASSWORD" to the kernel command line on boot, the helper script will set the root password to the one specified by this option. Note that this password must be **encrypted**. Encrypted passwords can be generated using the ``openssl`` command, e.g: *openssl passwd -1*. .. note:: The value of these parameters must be **quoted**, e.g: sshkey="ssh-rsa BBBA1NBzaC1yc2E ..." .. warning:: Some base operational systems might require selinux to be in **permissive** or **disabled** mode so that you can log in the image. This can be achieved by building the image with the ``selinux-permissive`` element for diskimage-builder or by passing ``selinux=0`` in the kernel command line. RHEL/CentOS are examples of OSs which this is true. diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/element-deps0000664000175000017500000000005613640271474027533 0ustar zuulzuul00000000000000dib-init-system install-static openssh-server diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/init-scripts/0000775000175000017500000000000013640271564027655 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/init-scripts/systemd/0000775000175000017500000000000013640271564031345 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/init-scripts/systemd/dynamic-login.servicediskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/init-scripts/systemd/dynamic-login0000664000175000017500000000023413640271474034021 0ustar zuulzuul00000000000000[Unit] Description=Dynamic Login After=network.target [Service] Type=oneshot ExecStart=/usr/local/bin/dynamic-login [Install] WantedBy=multi-user.target diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/init-scripts/sysv/0000775000175000017500000000000013640271564030661 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/init-scripts/sysv/dynamic-login.initdiskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/init-scripts/sysv/dynamic-login.in0000775000175000017500000000111013640271474033737 0ustar zuulzuul00000000000000#!/bin/sh -e ### BEGIN INIT INFO # Provides: dynamic-login # Required-Start: $local_fs networking # Required-Stop: $local_fs # Default-Start: S # Default-Stop: 0 6 # X-Start-Before: # Short-Description: Dynamic Login # Description: Execute Dynamic Login ### END INIT INFO NAME=dynamic-login INIT_NAME=/etc/init.d/${NAME} SCRIPT_NAME=/usr/local/bin/${NAME} [ -x $SCRIPT_NAME ] || exit 0 case "$1" in start) $SCRIPT_NAME ;; stop) ;; *) echo "Usage: $INIT_NAME {start}" exit 1 ;; esac exit 0 diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/init-scripts/upstart/0000775000175000017500000000000013640271564031357 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/init-scripts/upstart/dynamic-login.confdiskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/init-scripts/upstart/dynamic-login0000664000175000017500000000030213640271474034027 0ustar zuulzuul00000000000000description "Dynamic Login" start on runlevel [2345] stop on runlevel [!2345] umask 022 expect stop script echo "Executing Dynamic Login" /usr/local/bin/dynamic-login end script diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/static/0000775000175000017500000000000013640271564026514 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/static/usr/0000775000175000017500000000000013640271564027325 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/static/usr/local/0000775000175000017500000000000013640271564030417 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/static/usr/local/bin/0000775000175000017500000000000013640271564031167 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dynamic-login/static/usr/local/bin/dynamic-login0000775000175000017500000000221313640271474033645 0ustar zuulzuul00000000000000#!/bin/bash # dib-lint: disable=dibdebugtrace # Copyright 2015 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. set -eu set -o pipefail # Reads an encrypted root password from the kernel command line and set # it to the root user if [[ $( $SSHDIR/authorized_keys chmod 600 $SSHDIR/authorized_keys fi diskimage-builder-2.35.0/diskimage_builder/elements/debian-upstart/0000775000175000017500000000000013640271564025415 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debian-upstart/README.rst0000664000175000017500000000054613640271474027111 0ustar zuulzuul00000000000000============== debian-upstart ============== By default Debian will use sysvinit for booting. If you want to experiment with Upstart, or have need of it due to a need for upstart jobs, this element will build the image with upstart as the init system. Note that this works with the ``debian`` element, not the ``debian-minimal`` element. .. element_deps:: diskimage-builder-2.35.0/diskimage_builder/elements/debian-upstart/element-deps0000664000175000017500000000000713640271474027717 0ustar zuulzuul00000000000000debian diskimage-builder-2.35.0/diskimage_builder/elements/debian-upstart/root.d/0000775000175000017500000000000013640271564026622 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debian-upstart/root.d/20-debian-fix-upstart-jobs0000775000175000017500000000131013640271474033423 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail # Working around bug in Debian cloud-init packages with upstart # where startpar will wait forever for these because they are tasks # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=735204 for sysv_script in cloud-init cloud-init-local cloud-config cloud-final ; do sudo rm -f ${TARGET_ROOT}/etc/rc2.d/??${sysv_script} ${TARGET_ROOT}/etc/init.d/${sysv_script} done # And working around upstart job bug in Debian where cloud-config will never run # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=735207 sudo sed -i -e 's/start on .*/start on started rc RUNLEVEL=[2345]/' ${TARGET_ROOT}/etc/init/cloud-config.conf diskimage-builder-2.35.0/diskimage_builder/elements/debian-upstart/root.d/05-debian-upstart0000775000175000017500000000026113640271474031713 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail cat > ${TARGET_ROOT}/.extra_settings << EOF DIB_DEBIAN_ALT_INIT_PACKAGE=upstart EOF diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-nocloud/0000775000175000017500000000000013640271564026203 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-nocloud/install.d/0000775000175000017500000000000013640271564030073 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-nocloud/install.d/05-inject-local-source-datadiskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-nocloud/install.d/05-inject-local-sou0000775000175000017500000000050313640271474033411 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # without these files, cloud-init will not perform stock operations such as # generating sshd hostkeys. mkdir -p /var/lib/cloud/seed/nocloud touch /var/lib/cloud/seed/nocloud/user-data touch /var/lib/cloud/seed/nocloud/meta-data diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-nocloud/README.rst0000664000175000017500000000046413640271474027676 0ustar zuulzuul00000000000000================== cloud-init-nocloud ================== Configures cloud-init to only use on-disk metadata/userdata sources. This will avoid a boot delay of 2 minutes while polling for cloud data sources such as the EC2 metadata service. Empty on-disk sources are created in /var/lib/cloud/seed/nocloud/. diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-nocloud/element-deps0000664000175000017500000000002713640271474030507 0ustar zuulzuul00000000000000cloud-init-datasources diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-nocloud/environment.d/0000775000175000017500000000000013640271564030771 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016000000000000011212 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-nocloud/environment.d/10-cloud-init-nocloud.bashdiskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-nocloud/environment.d/10-cloud-init-n0000664000175000017500000000005413640271474033433 0ustar zuulzuul00000000000000export DIB_CLOUD_INIT_DATASOURCES="NoCloud" diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-datasources/0000775000175000017500000000000013640271564027055 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-datasources/install.d/0000775000175000017500000000000013640271564030745 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-datasources/install.d/05-set-cloud-init-sourcesdiskimage-builder-2.35.0/diskimage_builder/elements/cloud-init-datasources/install.d/05-set-cloud-in0000775000175000017500000000177213640271474033427 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail DIB_CLOUD_INIT_DATASOURCES=${DIB_CLOUD_INIT_DATASOURCES:-""} if [ -z "$DIB_CLOUD_INIT_DATASOURCES" ] ; then echo "DIB_CLOUD_INIT_DATASOURCES must be set to a comma-separated list " echo "of cloud-init data sources you wish to use, ie 'Ec2, NoCloud, ConfigDrive'" exit 1 fi if [ -d /etc/cloud/cloud.cfg.d ]; then cat > /etc/cloud/cloud.cfg.d/91-dib-cloud-init-datasources.cfg < /etc/cloud/cloud.cfg.d/92-ec2-datasource.cfg <> $TMP_HOOKS_PATH/devuser-ssh-authorized-keys fi else for fmt in rsa dsa; do if [ -f "$HOME/.ssh/id_$fmt.pub" ]; then cat $HOME/.ssh/id_$fmt.pub >> $TMP_HOOKS_PATH/devuser-ssh-authorized-keys break fi done fi diskimage-builder-2.35.0/diskimage_builder/elements/devuser/package-installs.yaml0000664000175000017500000000000613640271474030252 0ustar zuulzuul00000000000000sudo: diskimage-builder-2.35.0/diskimage_builder/elements/devuser/install.d/0000775000175000017500000000000013640271564026040 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/devuser/install.d/50-devuser0000775000175000017500000000174613640271474027675 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail user_shell_args= if [ -n "${DIB_DEV_USER_SHELL}" ]; then user_shell_args="-s ${DIB_DEV_USER_SHELL}" fi useradd -m ${DIB_DEV_USER_USERNAME} $user_shell_args set +x if [ -n "${DIB_DEV_USER_PASSWORD}" ]; then echo "Setting password." echo "${DIB_DEV_USER_USERNAME}:${DIB_DEV_USER_PASSWORD}" | chpasswd fi set -x if [ -n "${DIB_DEV_USER_PWDLESS_SUDO}" ]; then cat > /etc/sudoers.d/${DIB_DEV_USER_USERNAME} << EOF ${DIB_DEV_USER_USERNAME} ALL=(ALL) NOPASSWD:ALL EOF chmod 0440 /etc/sudoers.d/${DIB_DEV_USER_USERNAME} visudo -c || rm /etc/sudoers.d/${DIB_DEV_USER_USERNAME} fi if [ -f /tmp/in_target.d/devuser-ssh-authorized-keys ]; then mkdir -p /home/${DIB_DEV_USER_USERNAME}/.ssh cp /tmp/in_target.d/devuser-ssh-authorized-keys /home/${DIB_DEV_USER_USERNAME}/.ssh/authorized_keys fi chown -R ${DIB_DEV_USER_USERNAME}:${DIB_DEV_USER_USERNAME} /home/${DIB_DEV_USER_USERNAME} diskimage-builder-2.35.0/diskimage_builder/elements/devuser/README.rst0000664000175000017500000000234613640271474025644 0ustar zuulzuul00000000000000======= devuser ======= Creates a user that is useful for development / debugging. The following environment variables can be useful for configuration: Environment Variables --------------------- DIB_DEV_USER_USERNAME :Required: No :Default: devuser :Description: Username for the created user. DIB_DEV_USER_SHELL :Required: No :Default: System default (The useradd default is used) :Description: Full path for the shell of the user. This is passed to useradd using the -s parameter. Note that this does not install the (possibly) required shell package. DIB_DEV_USER_PWDLESS_SUDO :Required: No :Default: No :Description: Enable passwordless sudo for the user. DIB_DEV_USER_AUTHORIZED_KEYS :Required: No :Default: $HOME/.ssh/id_{rsa,dsa}.pub :Description: Path to a file to copy into this users' .ssh/authorized_keys If this is not specified then an attempt is made to use a the building user's public key. To disable this behavior specify an invalid path for this variable (such as /dev/null). DIB_DEV_USER_PASSWORD :Required: No :Default: Password is disabled :Description: Set the default password for this user. This is a fairly insecure method of setting the password and is not advised. diskimage-builder-2.35.0/diskimage_builder/elements/devuser/element-deps0000664000175000017500000000002113640271474026446 0ustar zuulzuul00000000000000package-installs diskimage-builder-2.35.0/diskimage_builder/elements/devuser/environment.d/0000775000175000017500000000000013640271564026736 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/devuser/environment.d/50-devuser0000664000175000017500000000045713640271474030566 0ustar zuulzuul00000000000000export DIB_DEV_USER_USERNAME=${DIB_DEV_USER_USERNAME:-devuser} export DIB_DEV_USER_SHELL=${DIB_DEV_USER_SHELL:-} export DIB_DEV_USER_PWDLESS_SUDO=${DIB_DEV_USER_PWDLESS_SUDO:-} export DIB_DEV_USER_AUTHORIZED_KEYS=${DIB_DEV_USER_AUTHORIZED_KEYS:-} export DIB_DEV_USER_PASSWORD=${DIB_DEV_USER_PASSWORD:-} diskimage-builder-2.35.0/diskimage_builder/elements/devuser/pkg-map0000664000175000017500000000011313640271474025422 0ustar zuulzuul00000000000000{ "family": { "gentoo": { "sudo": "app-admin/sudo" } } } diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/0000775000175000017500000000000013640271564024725 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/post-install.d/0000775000175000017500000000000013640271564027600 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/post-install.d/80-simple-init0000775000175000017500000000255713640271474032216 0ustar zuulzuul00000000000000#!/bin/bash if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail case "$DIB_INIT_SYSTEM" in upstart) # nothing to do exit 0 ;; systemd) if [[ ${DISTRO_NAME} == centos && ${DIB_RELEASE} -eq 7 ]]; then if [[ ${DIB_SIMPLE_INIT_NETWORKMANAGER} != 1 ]]; then # NOTE(pabelanger): Glean requires network.service for # these platforms when not using networkmanager if [[ ${DIB_RELEASE} -lt 8 ]]; then # Not available on Centos 8 # NOTE(ianw) we should evaluate if Fedora needs this systemctl enable network.service fi fi elif [[ ${DISTRO_NAME} =~ (opensuse) ]]; then # on suse, this is named wicked.service, but it's the same # as network.service. systemctl enable wicked.service else # NOTE(ianw): it might be better to whitelist platforms in # the future, but for now assume it will "just work" continue fi ;; openrc) # let dib-init-system's postinstall handle enabling init scripts exit 0 ;; sysv) # nothing to do exit 0 ;; *) echo "Unsupported init system $DIB_INIT_SYSTEM" exit 1 ;; esac diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/source-repository-simple-init0000664000175000017500000000007313640271474032615 0ustar zuulzuul00000000000000glean git /tmp/glean.git https://opendev.org/opendev/glean diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/package-installs.yaml0000664000175000017500000000023213640271474031030 0ustar zuulzuul00000000000000dhcp-client: net-tools: ifupdown: network-scripts: when: DIB_SIMPLE_INIT_NETWORKMANAGER = 0 NetworkManager: when: DIB_SIMPLE_INIT_NETWORKMANAGER != 0 diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/install.d/0000775000175000017500000000000013640271564026615 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/install.d/50-simple-init0000775000175000017500000000160213640271474031216 0ustar zuulzuul00000000000000#!/bin/bash # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail SCRIPTDIR=$(dirname $0) # Ensure the 8021q module is loaded so that glean can support tagged interfaces echo "8021q" >> /etc/modules enable_nm="" if [[ ${DIB_SIMPLE_INIT_NETWORKMANAGER} != 0 ]]; then enable_nm="--use-nm" fi glean-install ${enable_nm} diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/install.d/simple-init-repo-install/0000775000175000017500000000000013640271564033456 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/install.d/simple-init-repo-install/40-gleandiskimage-builder-2.35.0/diskimage_builder/elements/simple-init/install.d/simple-init-repo-install/40000775000175000017500000000171013640271474033546 0ustar zuulzuul00000000000000#!/bin/bash # Copyright (c) 2015 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail python3 -m venv /usr/glean /usr/glean/bin/pip install /tmp/glean.git mkdir -p /usr/local/bin ln -sf /usr/glean/bin/glean /usr/local/bin/glean ln -sf /usr/glean/bin/glean.sh /usr/local/bin/glean.sh ln -sf /usr/glean/bin/glean-install /usr/local/bin/glean-install ././@LongLink0000000000000000000000000000015300000000000011214 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/install.d/60-simple-init-remove-interfacesdiskimage-builder-2.35.0/diskimage_builder/elements/simple-init/install.d/60-simple-init-remove-inte0000775000175000017500000000157513640271474033460 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # Cloud images may hard code the eth0 interfaces so they # boot with DHCP. # Fedora rm -f /etc/sysconfig/network-scripts/ifcfg-eth* # SUSE rm -f /etc/sysconfig/network/ifcfg-eth* # Ubuntu rm -f /etc/network/interfaces.d/eth* # Debian rm -f /etc/network/interfaces.d/eth* # Gentoo rm -f /etc/conf.d/net* # /etc/network/interfaces distributions if [ -f "/etc/network/interfaces" ]; then printf "auto lo\niface lo inet loopback\n\n" > /etc/network/interfaces if [ -d "/etc/network/interfaces.d/" ]; then if [ "$DISTRO_NAME" == "ubuntu" ] && [ "$DIB_RELEASE" == "trusty" ]; then printf "source-directory interfaces.d\n\n" >> /etc/network/interfaces else printf "source /etc/network/interfaces.d/*\n\n" >> /etc/network/interfaces fi fi fi ././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/install.d/simple-init-source-install/diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/install.d/simple-init-source-install0000775000175000017500000000000013640271564033732 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015600000000000011217 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/install.d/simple-init-source-install/40-gleandiskimage-builder-2.35.0/diskimage_builder/elements/simple-init/install.d/simple-init-source-install0000775000175000017500000000167713640271474033752 0ustar zuulzuul00000000000000#!/bin/bash # Copyright (c) 2015 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # # See the License for the specific language governing permissions and # limitations under the License. if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail python3 -m venv /usr/glean /usr/glean/bin/pip install glean mkdir -p /usr/local/bin ln -sf /usr/glean/bin/glean /usr/local/bin/glean ln -sf /usr/glean/bin/glean.sh /usr/local/bin/glean.sh ln -sf /usr/glean/bin/glean-install /usr/local/bin/glean-install diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/README.rst0000664000175000017500000000523513640271474026421 0ustar zuulzuul00000000000000=========== simple-init =========== Basic network and system configuration that can't be done until boot Unfortunately, as much as we'd like to bake it in to an image, we can't know in advance how many network devices will be present, nor if DHCP is present in the host cloud. Additionally, in environments where cloud-init is not used, there are a couple of small things, like mounting config-drive and pulling ssh keys from it, that need to be done at boot time. Autodetect network interfaces during boot and configure them ------------------------------------------------------------ The rationale for this is that we are likely to require multiple network interfaces for use cases such as baremetal and there is no way to know ahead of time which one is which, so we will simply run a DHCP client on all interfaces with real MAC addresses (except lo) that are visible on the first boot. The script `/usr/local/sbin/simple-init.sh` will be called early in each boot and will scan available network interfaces and ensure they are configured properly before networking services are started. Processing startup information from config-drive ------------------------------------------------ On most systems, the DHCP approach desribed above is fine. But in some clouds, such as Rackspace Public cloud, there is no DHCP. Instead, there is static network config via `config-drive`. `simple-init` will happily call `glean` which will do nothing if static network information is not there. Finally, glean will handle ssh-keypair-injection from config drive if cloud-init is not installed. Chosing glean installation source --------------------------------- By default glean is installed using pip using the latest release on pypi. It is also possible to install glean from a specified git repository location. This is useful for debugging and testing new glean changes for example. To do this you need to set these variables:: DIB_INSTALLTYPE_simple_init=repo DIB_REPOLOCATION_glean=/path/to/glean/repo DIB_REPOREF_glean=name_of_git_ref For example to test glean change 364516 do:: git clone https://opendev.org/opendev/glean /tmp/glean cd /tmp/glean git review -d 364516 git checkout -b my-test-ref Then set your DIB env vars like this before running DIB:: DIB_INSTALLTYPE_simple_init=repo DIB_REPOLOCATION_glean=/tmp/glean DIB_REPOREF_glean=my-test-ref NetworkManager -------------- By default, this uses the "legacy" scripts on each platform. To use NetworkManager instead, set ``DIB_SIMPLE_INIT_NETWORKMANAGER`` to non-zero. See the glean documentation for what the implications for this are on each platform. This is currently only implemented for CentOS and Fedora platforms. diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/element-deps0000664000175000017500000000015313640271474027231 0ustar zuulzuul00000000000000cloud-init-datasources dib-init-system ensure-venv install-types runtime-ssh-host-keys source-repositories diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/environment.d/0000775000175000017500000000000013640271564027513 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/environment.d/50-disable-cloud-init0000664000175000017500000000005113640271474033324 0ustar zuulzuul00000000000000export DIB_CLOUD_INIT_DATASOURCES="None" ././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/environment.d/15-simple-init-networkmanagerdiskimage-builder-2.35.0/diskimage_builder/elements/simple-init/environment.d/15-simple-init-network0000664000175000017500000000074113640271474033604 0ustar zuulzuul00000000000000if [[ ${DISTRO_NAME} =~ (centos|fedora) ]]; then export DIB_SIMPLE_INIT_NETWORKMANAGER=${DIB_SIMPLE_INIT_NETWORKMANAGER:-1} else export DIB_SIMPLE_INIT_NETWORKMANAGER=${DIB_SIMPLE_INIT_NETWORKMANAGER:-0} fi if [[ ${DISTRO_NAME} == "centos" && $DIB_RELEASE -ge 8 ]] || [[ ${DISTRO_NAME} == "fedora" ]]; then if [[ $DIB_SIMPLE_INIT_NETWORKMANAGER == 0 ]]; then echo "simple-init only supports NetworkManager mode on Fedora and CentOS 8" exit 1 fi fi diskimage-builder-2.35.0/diskimage_builder/elements/simple-init/pkg-map0000664000175000017500000000143613640271474026210 0ustar zuulzuul00000000000000{ "family": { "redhat": { "dhcp-client": "dhclient" }, "debian": { "dhcp-client": "isc-dhcp-client", "ifupdown": "ifupdown", "NetworkManager": "network-manager" }, "gentoo": { "dhcp-client": "net-misc/dhcp", "python-pip": "dev-python/pip", "net-tools": "sys-apps/net-tools" }, "suse": { "dhcp-client": "dhcp-client", "network-scripts": "wicked-service" } }, "release": { "fedora": { "29": { "network-scripts": "network-scripts" }, "30": { "network-scripts": "network-scripts" }, "31": { "network-scripts": "network-scripts" } } }, "default": { "dhcp-client": "isc-dhcp-client", "ifupdown": "", "network-scripts": "" } } diskimage-builder-2.35.0/diskimage_builder/elements/debian-systemd/0000775000175000017500000000000013640271564025403 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debian-systemd/README.rst0000664000175000017500000000042713640271474027075 0ustar zuulzuul00000000000000============== debian-systemd ============== You may want to use `systemd` instead of the classic sysv init system. In this case, include this element in your element list. Note that this works with the ``debian`` element, not the ``debian-minimal`` element. .. element_deps:: diskimage-builder-2.35.0/diskimage_builder/elements/debian-systemd/element-deps0000664000175000017500000000000713640271474027705 0ustar zuulzuul00000000000000debian diskimage-builder-2.35.0/diskimage_builder/elements/debian-systemd/root.d/0000775000175000017500000000000013640271564026610 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/debian-systemd/root.d/05-debian-systemd0000775000175000017500000000026613640271474031674 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail cat > ${TARGET_ROOT}/.extra_settings << EOF DIB_DEBIAN_ALT_INIT_PACKAGE=systemd-sysv EOF diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/0000775000175000017500000000000013640271564023766 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/extra-data.d/0000775000175000017500000000000013640271564026242 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/extra-data.d/gentoo-releng.gpg0000664000175000017500000013266313640271474031521 0ustar zuulzuul00000000000000™ NÏ! ̈Dôúý}»Éq?÷SJÆÑåZš‚ã4Ñ õGw…"Eز /h ¤æû²v€¹ö^£µCfµòwå7,L3…1æÇ ^Á°èªfåmr~ƒzl¸jFØÆÖˆ˜p5„œì?È»æºiaòcÕÐà× ¬z+Q{4 hàÖ'öâË“àסÖÞ~9‹qùƒ·Mâš?W,H¨¶.’A‡QäŽø ’¦HÏa7¥Ž¬#bv?ño3­.\á^¸\ul0èßž ÝÝè´ì Z5vs•MmˆxµA–ŠJ#¼¹)Yñ`œAÿ—|¯™w[f–ìWíõ¦ª|®I|ÑgˆíôK«…ù3ègäðgFCäL€Rõ¶¼ ò\;/ݨ[§äG¦'mŒ}2d~V¯C OO:Ïäd}6ˆ ±<ËrÌšðîG„B®ÅCb‡a”es†=ùÖ¨^œ ’í{ææÜDÃi-åSqléLŽ›Uþ€ˆÂ\Ã„ŽæBëpƒþ[ u§"^ƒ¶È®zN2ú# µ_Í`±ÔýXžOC÷ù1þiëUÉ“‘Á»Š“Âo;Ámë ¾É{ã¡pÝIk‡Ñw žî†æ–Êek==ŠÞzJ¿¾7 öaéq á³ ßwKäµÞ9¾¨Ã‰#GtAÃ'g´;Gentoo Portage Snapshot Signing Key (Automated Signing Key)ˆFNÏ"Ï ²{”N4ˆN… á ­tè€Ñƒ  ¼ξœŠÓÛ6ž$D±í?/Ýó w¸²} 6_éˆ^QÉ¥. ³÷¸rÙiv­ÿh~7+›ÊH lR=€d£å™±*`7šöK.7uáx…|ÿv—Ëa3Z!òcô Í´ì(;øüë75‰p=¨L/ø‰P×di 3E YZA¯}¿o|Ò.,íC+g°–Z´{Ï—V"ä*d€BzWnœâp”ËÛ¾œ@Í,ìˆSþïdjë¼Ô(üjà–E[wRu)o«Ùð»$ºMÝ_¸Ÿ"I—¹!½ü17Òåû}Ÿj¢ê¶c+qšÌ¸6|ñQÕYf/ŽWNû·÷ëÛNÞc³ùôÏžvÃjçN4ÓUãî´På—„ÀdÉ\cHüó“mÖ3•C7ž/ÙÔ´|¼A"q£YA…Ø`Nís[›Û¼Ò€ÜGKç£üCljPÿKò ,šÅ—¯OøLþ/5äg„h„f-¸‰nÊd4מb.džªÄö&Œì€‹^tp>2A7nF\…ˆqjdhéè´|d¦/}éú_àãÐD^…°!òê–ˆqãá 9ÎÙà>¹Z„´ær/‡{@Œ4u Þ•L{©a§ôêLE~ èM{9ÎËê~ûD°áì£/3„"K9[1R_K/°¨+Ƙ(6}þ[$Âu‘;¢]Œt’Ñ"åÌm;RÃÎær‰€î(¸>²C9™kžú¤:ÑÕ Š³À†4Ö©§EÝÝÀ…Xd8ñ¢3w„VáJ1òA6Â;\Åü÷0¸ÈŒm„‰Rßj@ /&xÒ<]š¤½BÿKrøM/Úôî˜_ÕåCÙ<šâ­ƒÚ0'A:D¯Eàð@‚f¨Ðð¾@¾ë‹)Úß#æ %.^€Ãjž¢:x$ æp-l)Œáƒ~PH.Åg¸Ìû¤ñ?LRc—Çq;Vƒšs/¡²ô#bX–è-e˜qdœýöäe–o²ÂF&æo¸½Øsý® y¿ç·r#×'eG&wðª?å!¬ä˜´¨À3‘0ƒbå¶þ8\êèæ¸÷çþ}©ÝY÷cÂ*UO©’¦ò¼:£Xm’€êî¿ïüˆ=ø©…Vœ=ô+¾\GbŽé_=}³N\2Ü:ˆý4$‰Y}— ?¤A>%Ú–4J6ªk¯‡õõ&bÈê"Èn²áb§ÕʶªøOUJʶI$à@ñ%žfÆË€œ;•ÝQc’ñ?çüQajý¾.•©?aÅòoOÚ¥7UœãTÖ÷°Xw2ŽIF:páæZ)£§GÊà1Ég†€Ûdýü§Ý×ð¦EHòá1׿œÚnäµÕcвzWK Å)B͉‰XŠ9e ÛL1w£C• Máþ+Üçî.]t½w/ba²ÿI–Q±«ÆhK³NáÞV;Þõµ,xøÊÌïk”ù´&;Yò‹+Í­ÿ™ôXlý ¡7À™ƒ.™~X·°7•Ãva÷i ÊiMtžNχSêù2ߑޝ(Iwb€Gvø€ä6•²„·ò‹‘)Ép‚IŒ.V²î¾K‘4Äÿª³Is×AÝûq)@ÆÖóáoãA$$“øØíàÉÅ„չ˜ç'ùU3dÑ)ÇÎìžé\÷ðØë¤ÛÒáÆ¹S;#CClÌÛ´Õ|Þñ‡2M|ŸÓ,Ü>V’øoìÒMMÓxl;(ƒHYõe°û¶   5+¢jzZT²¥:JøH/B*?C®ÎJQÄ6ÙÙû¦ù¼µØù+UæªÀ {ÿ‘lç‡â‡—Šx«ð‹ü窓ޮ¡V.`‚_,>Æ7²_Áý7]ù @n ¢ ÌýÏ6ô‚aÑȰ|зtC•±i>Gœ°Í„´z36y»Õs´êëVìÞïOn‰¢ÃåÙ¶uÔ9´»ý˜tw‡½ù‰=' „΀NÏ"   ÛkŒ–Ø¿m\ÿT÷üQ©èf„åþª×ªÐý!¼…o”rœvá*ÎÃÝ:ä‘Î$}¡ì(þƒi;ßkuZ‚çöà|Á­“”¶è¾CÂÕË.OX°‚Ïî$ø¸s;èÓj3ð¸2…pôSļŒ8–÷%R}M±`£=ôkä€[¢Æ=þi(+º[ü<ÛŠîJ’`¥‰¡Ìç¨ËœŒ%'6X•=n†e3±ºËyôÁéH!ê!5jÖš“õßñÈ"^KãÖ¦S»ë+ k¬‘ÓýNF"Ÿ8OݾÁ›+´¸’e—ï)`ÏDÎsнŒ ±Ã¿Fþ“Â|°ûLŠJƒöް gÂôZΎѲ݆þDýŠevù!ÐÖÛdïù3d«>α¾ç¶£¯”ÛZù]’ê*½Ì²w™Ë¸$òI½?Wi9rÊG¨Å­þ–›^¸³DnN® ãa|X!á ºRÏW"ù)‹6<(–møu°ÃFfÓôty’Þ»A:¼ë Ъx#-ÕW=‡ïƒ@–Pùn~ÿæÝ.@a©a_ïJ´®Ø[ƒZí/ÉÕðPÇušvŒf닃ÓA+ʘfè–æ™•¹EZ$óÈVdÓNš¦[.çÖvòh®÷8A¾Cᜂ¸Þßd*²w<ïæt?œA²äšp…+B‡‚Wsä{D§+U‰='  €VS\ô ¦‘‚ ÛkŒ–Ø¿mÖˆÿW[VcŽDbtÍÃNX(“ÜA©œÓy,§ÉyQt!bá”*Gýìþ¸o¦³$i*댗GäØGô੪"¶Ý1[ÌÀ£Äï^)96Ò"NÆ3¦SD¯ï×þ=ã.b.hãîë>_øÌÛÅ"¿ô¿KM™µŽ“èUÏ04Mžå ŸJ8J0-És†#¯.©@=ÜÕ•ðñ&ý“âMnv LôäÿªV=W˜Ë÷oï!/»„öÃþaˆÙIÉ g p@õæ<Ò·âëeëdŸýP¼Žd²4ä%X2s>¶²þ€,[vK^lñe4˜å…ñLýýF«‘S"©s?kl_˜‘Õ¼ÊÊÉþ¶ù‹EþØmÏ«WÀ—Ø/-º§vø³ûfUm ’Ù#I—MЗª,p5½“vÊ~ç´yÀ¤ô©tëjùÐÜ ªŒÓÞø­ô+ÁÞ MÎÛGÙÍ_Pö5>Öðöýƒ³¿käð'ŸTc ;"Éõ•Û¼,W"9‡Bƒ,Y¤ŸþÑ`ÿî}]R.¸8é'HôɸЭ<çýà‚­ÎøŒ³é69š¤4;÷>‡ÏäÔ¡ÐÉUz猒Îé”ä«[þ©Urì~0Z`ý A1ZÅÞÂMgX¼4ÒsáÌOVeæ¿ÙRªì¡Ê’Ò߈WÐÐZSé†ù°ÞIa#„5^\ë0FÅÓS]ÂhØLð®H‰‡ºnÁåÙø ór'‘h˜®"ÞÎõ0[¦äLLƾ­èÔtƒÔ¼ô¨(‘ž¼±Èð ,9‰$åâ Üiüþݨ"¿-œÌÈfþÌós_l«ó–²÷ª,Û/€ˆãÙõõCˆÒÚÞ¹Ÿ”Þ Y ¢ºK\å¦D…LªË­GYñ–¸9]Íü<@Õ-pþ…žÇo}B_UÃx)6WÍñàŠ)¬xÝuE‰íÆ`®?1( ᯱ×]m­qÇ`E$B> %‚>œr¢{þœ›¡Ý6‚ BT°t_IÕ£b${õ ðçÒúÌ8DÀ†/QÑÌÓ«Ä«²~ƒ \ªÐ•–:ï¨ÝűÉdS]…¹¶÷j¡äyx(+!ß±/± Ÿ8Ql“»6u”_pêÖt›Gnoµ CyÚ0é"-œj `Uc•8ëT~pàEô<º/s*}Ùô¹PLsŽ<¤ösÇÌýµÄU¤•™ð¼ØDZpª(Q0gÛta 'âŽG˜Ä<[$)x)ú¨¬;RC±TeIÓ—«µKd “פY؇“Duw@àÀMY'êöÛÀÆJ63¦‘|·0ÊrwuMKD µC_bãß|«U(f&Zk¥È`ycò»{6KÐÙƒ†%—BEž~˜N˱·†mâFj`ƒ ˜rY‰ü:¡·{Ÿ¸ß‰×üÛ¡‰–°'UÊRË|ÌÏ 3&ôì­0; ûOöcª–¢^ÑžÌØÁ(>çmSûö3`oÞ¦ _úÜ@û½{ŶP¸Ãy@ÇIÄ!Թ߼öÁôšÎ&èwî9$&:À¤ï®×4 Lˆ¯œ³h¹žÓFuǨ?t`›‹°ËÝÌ;CÉü-è NÔbS§h»ðœ7O­Ò§5ŽÐeCZÔÈ kÇ/r¦MÔ`œÝüÎ+ Èœ\5Äø}Ôº>âøQé[–ßH6FZÌ8ßaA¢­•:¶(™«øÚv#þ6 {_‘îpè`À6Kí?xÚÃfì’ܳzÁú@”bðýS€˜¬Eô›£…Ncqn\ *„Lx†‰,uÚAóJ9Cˆ0º½¸„ÿ{RËx÷vŒB.º*';Ž|ïó“ò!=Ì׌áÀCÈC£¼oÛ¬„_Æ‘“}*°rv. ®ÀëI!úñ7P†¹õNtÊ gìÇäïa¸‚§¦Z³S÷§\.D”˜¶jQ[Y.:rÒ×ÜæwÂÀ›A௉äéçÅ(Ù4œ”Q8éJ\é)¤¥!‚Y÷µJ›®…¿¢Ê Éa¶Q.söbUÕgéäh¡ŸÆÎgx2Z':)¶/Ù¯ÑhÓ³&Á_´H3è53(Sµ”‹X[ï :ë•Í>V¨ÆfþÔGQݳ¼ø‹µ#Pe}٤ŔT¥è£Ñ k€ðx`DX¼fá<ð ¥Áå ¥$“Ò°ºÃ¶?“Fø-5âéx6¢Ým°Û¯`µtÐüì–Ò AMS¤à ,˜„¶ßâ!wÎÜ|ìRÁXîá½åeóüÔŒepF¡ûV¼ù=ÿØRÂ8?—b´ão©OûÝAx rˆºÃÏ„X |ÇÏPÉý¯‰˜ˆ*W`Î;“&÷´^݂ ïBÎ&vA¹[ „i§ZÜjtÒ Mî^SQèÛ®JÎÑ3ÿÓÉ–!¾)Ÿs9¬°û9¦©š…$XÂ!@íÒ@·'†N Ö†¦¬¼ 'âM¨)ž›lðßTîáòû§.Ì£÷§©»–M4x$`‘Hþ-@² ¢þ\‘.[ž‡óŒ¯þ—âQ‡_8:^³ã„|“´žÏèâ{Û@_+qö¨…©ŸßQŠïùáë…mĬe_Ö“>B“UˆAûÓ-1”LƒžÆL5( \"ßš¨jòΡûíÆCKèy‹GJЧŒ:S«E´×U-ƒÀ¬á Ö¬Í§èk.óœÒl:{Å«”€æ‰Z D! Ø#ÿzó ôg >…%/›06XÔ4_&https://keybase.pub/h5/pgp/policy.txt …%/›06·9?ýÔƒ&:Ô§kóÕ‘sí<…ä-yze]V-PXÛWÌlj2ÙP^Ï>S‡Þƒ£"v柗(Óá¤ó'f«¾„2Ÿ»“ò·\…ç[V¤ÜØhê³]Nφ‚òææßôC™iË#cÊÑo/‹Ár(1¦üP£³Å À¿âú…š'"$èg\‚sÈÊвCÜp~0±O‡„ðZ$FÞ’‡Œ+^¡õÏ‘qlqEÏ0q·u–ÇeøÌ_Ûë|œÇûÓ¢ ÿñ*[>e]µ£õÎôêW°æUå{ß 2›°?<|/kµÞqÆ©#‹º* qíeå¨Q0‹mN:nÅf‘·B9 Ç_¡´‹É[ÛF‹nOèdy-ϬÍg Á±’s4ªýˆ ö rm’óÿÑÓ]YÎDWµ*Ì*¯})pÃm+µ1¬€ €hÒ½—sÄØ:5ñ”‹’X7ØÉ†(Fîz¨2{\íì³ø#RÞòþßWÀk'éåfO"Euìðb¢!ع Xí˜ø¾8kRUH«Ç$ÑP‹Ž–ñ|âõ®BÚ¿’öàÔgS=èy½˜Üóe#“j‚è j#Ô ƒ•xf[»#¼þò›ÐGx\¾ß™…î˜W BÌŒkN-á·žö¹±‰傹üž°jš&N³K0 ¦#J’ÜÌÎÁúëjRrg¢nÈØú59ÞyÂ&CLp6µ\ {뎗œcÐî !sÿ>9²yZ6Kcí¥s掹 E/]YˆëäÞŸ8 ºMZð8?WtÚC§²bDàúäâùCþÉ‚™cßîÅí®c?dZ£[TÜÃÕ•bœö¹õÜjøß®JIH)Åõ^×¥ƒ'J½†ÿ<§X[7âieø™øŠz' ª ¯Õ$(ýÒ÷È^uÙšˆù÷ì¶·x«xUÔ…ŒìtÚ´¶É Ía hâxJ±ïqÿ¹¨¼Ù¾gq O+¶†ì¢ §ñþÜ?d”TfË9ÓêØ/”Q6©qW> }°ul¡4¨èÑÙ‡¸iHÜ…¶¢–21ùæ`ÒBˆÊ‰’~NbÍ¿>sû2kOÖµ´ÓL /ñ=¼Ï!#VþMÓéÂà?i2K)¥ Ž/4õ…XP`Ô9ªuJ ‰ø€ÀÂ@¸öÃyΰ'¤§\’þ¸(Ï÷Š˜¼Á‘wò„ ÿt¶ïÀSÜÁVÆ ´H1¶N²Î÷ÓÙ˜ªÁõA‰Æ"­ï­„«ÁÝðŠa`¥4‘Ò,«Ç^М–òÐt²C+oFÛF+¾£…ÆP'Ø@vÇÎNm?€_“iû5‰3! TùkÄâ)“ƒ”^ ‘©Ž½NZ4#Š ^ ‘©Ž½N¨/¿£Ü||¸ü\H¤–Yã›bú bÛÍoch¦9· -’?TÀÍTE/üè ©ç½ˆ¼Cš+•_#¨tÝ»N¿iÏ,XG±M •Ž ´Ð¤Ámx§cJ­#ig|T9O^`k^‘»Í-ôÏ:1⌗b`ƒ_ï1kÏj3d}#+gŸ}Ú¹1ÚZs_n³#:H[×ÿøZ>ØQ8?¥ šXÙó¿üÖªS7¢y†àöU 3k›ñýÞÌG}QWùQØ­V ö9ð#«ŸÍº5‹Úˆ*Š …¤ï³f„¼UþÅNRg&øsDÖû  —z!µÂæl£ˆu!KRƒ“棰߲ï:dÉÅÇgÆú¢Zu²Ø ÉÅÇgÆú¢iÌÿTÄóO}œ+…°’åtŽèÆÞ)öŠO‘¹Ñ¦è*~¾MÿeärHHÞu!ì[nF—Í?Yà#Š·{îAj:×êx‰T >  €!ÜÐ[qê¹A™RD¬ÛkŒ–Ø¿mZlý– \57 ÛkŒ–Ø¿mIûþ>üxGN«7f§ „t ôy¼R¿ükÍ&ù:3ãþ¦Jc\hˆåj2óOžá­Ñz¦T‚\^³Õ#4×4POâf·¡`‘y—4³oX‡.ßÇ<¡ì³¨umenüy\N~ÎOͧ»åZ$kg¥“…žkº¨!ÛÅ9/f7Ww™MSzzÙ§Cª;VÔòÛ†¥TBº[ðGßyìRôzšuÕ0­c"oVEFñ`æaw¨Õƒ ·ÞMj¸[“N¼lŶ»G äJh@¯ªét±†jÕ¡Æ Hî9¾[lï(Õ¥½°ÔJµ0Vÿ~®xwQÍ ·\*>r¯T()¬WHë¾fÿ-•ÿ·€4!âÈ®Ë>í¯½eZèâǨÈ®Hŵ_ºTq;¶QéÖ’]Ì´^*‰ƒH@'4g©t/ HXâGa'obR¨~Ç/áEP›ÔåzÒ¦/!<âoRÍp™ÿA°&• ÜÎùÃ%ÿNÕ5ï5ô õ ¦òqÙ6ŠŽ˜gõâ Eß‹ âAÉ5¨›¹0ŸÕƒ’ã2‹ùÎó‰Û˜üÀÕ¦³¸gáådJ¹.VUìéè—g@ 4EÖ/°¡/Zµ!mx· BÅ”;ŒJI‡±¬â˜Ø.œâ§u–°­y‰3!l P§½˜÷žŽq«xZë•ñ“)ÀZ»‘u xZë•ñ“)Àª ž‚fÿCyGüã>ˆ‰qî0?û4Š]˜¡]ŽS€°‹4qÑsÖLRêíô)+-œ\Ãß·0"aAè jao”RX{©þI´‡Gz)œ’æz‡ÆØ«7Mo¯¯Nmp\©SwPåq<=g&fØ¢Â-ÊVÕiÁ~YÔýŽf¤PŒÀ€}ñö0j.£*ÁÆö0d1•£톷_Rz‚èšðfýyer\3ýFð%oÅŒ¸6$³Ÿs‰oåGÀC®¶Ìƒ´\m1…ù„qôÀ·š]¤l@åðåKHMzLÃ1&p„!”v¹¼çlÙjiæ´˜ºÈeEh÷h“)Pzþ,Ö[m+æ>_xU.¾åh\;ï÷¿¦esEÙJ‚ƒ -öžãæôU•\ à}꫹°¢F~u³p»ç 3ò±Êžï¬7úî€ÇÁ&p"ÑÃvŒÖÇZ]RDÌ £|–Xˆ»ôÈ Óm‰!S°òË褜„G#*.•›ÕÓ·/Œñ;á¦Ço£/hIÅËñì-Ó²B¼hð/EkæFgh/ïÖØ¥4gÞÊ[®bCAØS\d´m_“f–)$ݫՠèx1_5nÝ8žtòËÕŽÓñèÛ'+8ÎûíÜ;²Òš£S[[)õfÔƒïæÊάªÜËE˜u¯±æþ yàä‰3 !n¼íxkwbß(Ÿ`¾ßОͩZõr ¾ßОͩ˜¨ú_Ź+×40>µ¯ ºG“^yZ–gHO†rë~ìBAð¿qU,k«[‡Ì_¤Û[éú;ægÿºì€ Éð\½Ãj<…8b²^ÆÏDé¾ÿ ³ï_ LèÎ(ô´ÆèÀ¼¨†8v¿Q™#û±<ï0…¼¶%½ÝÿKúºƒæÑuR7Ûã³Ï:]îü^ UÈÇgt2&ŠÇu׿®/tA6§³Í]9æ Z,æ‘zJòž ÄÅmÇ×aQí4ØP§A¡ð›$º ¼ì2›ÔO‘P¶ííjUÂ>_z5Ÿ;{Îú¬ÏIÂÙ\G+¦ ¨w¼ ï7²ÉŒò“¤-L~¥ü 8b‚•Û·ÔåT³+Ø2Žûö mDÀôIm´ê7” ÝÃìÔc> ’3'—/Öx×?7¶jÁc O¼‹„ó|Ô"«$³o˜fûtX.cÂÖ}…‡ï¿I…øv¥â¢ÀŽÙ˜ïì¹Òú“@5 º09:Ü7-ö ÏâÆ”3´oš®¾p1ŠÄ.ô¤Æú8dÄWp€¯¹êÀ‘^Óp’Ú³ž¾×Ûÿi"[LaÄ–¦!uÆ:4ÎoµXH3#ôzLÁéJ¨‰†e:ínŽáÐ¥îg»·ù»õƒÍ!s½^aþïÆUjÏ¢ùÒœRSñízR¥­ô±<¥>|›ˆu !ò-DŽ-äcà£AàBʪ¼Ø)h[;}F Bʪ¼Ø)h&Tþ*„¯Öj43_ùû²<‰4üXò´4|™ó¬çή¨>ÿIöœid¢Ï³‹M„)W‡>«w¾£’BBZóùÅçÞï´XGentoo ebuild repository signing key (Automated Signing Key) ‰T >!ÜÐ[qê¹A™RD¬ÛkŒ–Ø¿m[<íù \57   € ÛkŒ–Ø¿mà´ÿbJG¯ÆHÓ?>÷O¶Yоu=§½¶ pm 4ªüÐâÖ›Ó5TÆ¥$G_ø§í…Ó0Ô«Û~J"ŽöÑÊÖ&®r©´~ @z™:õ)  à³Ö•9ÒÌò«-ܬÃŒ u=çPIiÁ¶úb¢'kÞÇxCMhl»L·MèeÊ:{¼æ8<Ô(JWºÕó*¢.,ÑÏ=Ë<ÅËÒF Ý7Ù¾¯Ǹ”ñ©VÒssì¦A‹ŒÑx+C(D&CÀ¿Q¥Ø²LˆÏ}M:« ÕPQ5tÙ˜º²‚7Âf|å{Í’":åVމ†]Âe ì,ûKK®bšþ#_PÇ!‚ÜK’?kó£b÷R¸ìÔÕz9pµßPYN 1D¼w*©jArM%ÿƒ$5ÝI5‚yuî¹ó3€ðåÄB¬‰š¼fJÖÔŒ¦[?Óp¡ÓSìf„à{®¢ÅVJsž›¾ß¤ÙM¬LÁˆé?mÔóÇ1ÁZ>þzrvr ÷zJdÕ#çi8ä¨A­B|d_hu®SaS𒬇†±¤6¦Æd´?¼…9EŒD»¡e ·f…9há{,*ZÄ£Ëïke•(¿..~4Yp?6u ü-Ußfyö0_ò—o6¿úŽ[lœð[Æ"؇{}VuÊ&Q”J»“Ÿ5H¯q:»‰T >   €!ÜÐ[qê¹A™RD¬ÛkŒ–Ø¿m\+xÅ =‹< ÛkŒ–Ø¿mWâÿVÊ÷–ýcÏ®~¶"ÑDbŸe‘)+kèØ­¨ oŠäÃdÄÔò~(Œ›‡°ç Wc¸ Y¼Æ8ó©¾@¨B²I €ãlFè1"öÖMVø/åäÌ]‡@¦¿ÀB,\Ù|<БŸÒÙßÎX†[zGµêätV S":‘rËr€{\’Ž 7wd"?UuJú' x¶Æf…ùÈÙÌ»9ŒÿWÀîK » ÷†¸tÕÙƒ£úÜTëëwˬŸ¬&•ÏÇçì1ƒv JΔä° ËdCÝñ†Hüpƒ^àJd™Ò½^)o/¦@1P6¯ ‰k îï¥@í7ºD^©Gbmýš{þo["cNÊL7»¹`¤wò-StvòìJ•§œòŸ£}\FÍòÊ“¢¬ç‘eýŽ÷Èz/ËÿL© Êç)µ!øç–ÝžÊ`~ŠÜö _¡Ð¯C“·¨•LóïÃÆþîyÑN8n™”™ÚKBÓzêGi”Ì^T˜£Qò+¾ñc2„ÇE̱Z`±W 8§ºq—’I’Ιi çHHÞ1@ÿ-``o;½èFRÐ[dXzg+–|õŸöûüJ¬ ´p'B«ë/tŽ&Y• Ó;-\01ÒžÀ[þ†ª™–plNÚ²¥séÀ×/iÕ€´š4h„›—e-T6¹ NÏ!*·È=ì ÔØ“i.5­šªP( ™ºõó èõDišmâvÃOÚï€tÎ.ðCZÏÄSöƒ¡„nRë ßi­ŠvÖã(xúÍ+cG™6ù½×TùÉÆ„C‚hì%}²¨¢â)©é^+~u‚—ÛÍLêI‘Oùê­Õgw×Í@Ûr*Šõ?/HSl²y­Äñ­mƺ*%üI($¶ìšŒ€Ë8šd)Ð'”ÂEá2÷šàã„ô´ô!ÿ¿ºÊƒžV« —’íjµ"@Úmè6 Ž‹%m-$îºl*5M(踀à]‘†ák‘lIIÄÊG>%×"ÂÅìöó~¯Þ›­¶{Ȭ(„bxS]Ƚ¸šA'üc”9oUfd¿ë§cŸPÊ Å»~ï|$(òlXuwzùÅÆ¾@Lñ“Fг2:Bá½¶Ès¤õ¹]u¤ö¬Äê?„EdÃÇ(IZä¡„$JqVªÉ–~šÚGÄOVk On`ݓݴcæM–µZ%Ñ»)‰[Áz›8éDU ƒ¨w´©•-L«bk`ý‰DWww  i¡)Á] NÏ!* ìYêÉ’Pîþ6rJŒ— ¾Û+ ç7¬¹Xè §Ó„ 9 $jàŒ©­KK\xÝüúüc”hƒÁp;ôNNô\€ßÓä Àt9èŠSò4YÍëXÓEˆœ]˼ÖPWÝUIÖ­ëþÛØA§“vÁÏE}áæê`  àáµ!l,@õ7v=Œí^4ÄÚß@oŒ2ö°ïá0()ÐdÀ\‹³¦ß˜S¸\IHÞ³cV¹üóõ ¼%E××âI ˆr¨ÑBÑ®ãÉÚI`Ò—é. mGJ¯¾¼( ­UYöÉg*Ñ¥ÿÿ²Iì”È®š²ÑŠ‘E- ‹wÆe)ÛÀ÷V&žuˆûœžÊØ«w¾—ññ_ýzò}?“!JÏ4Ù¸°ª˜(ºGÉØê~^¿VÏlÁÌ( kÐB®8Äþ³Üó’ÁÜ܃¢¯·ÈúR£³ŸÂq‰Fgq¼zµ:)ç0*Rñ›a!qï2ÿÖ¿@U¶KQÇÄ {Š%/u{E–u~ææqSeÇ”“ƒ¾|7¥­Ät•PÈcÎB8Îçõ~ ‹ÔÛš3θuµŸðüáb“]³µê2-¯ÓèéàéAò*sÅú¬X¯P|ôõ3Üê•iKÜ‘(ËBbÁÓ—g.ÆîÃRðY@³¯qA[ºë?ýÕOÄ0³ŽPBç­»ƒˆoï ÛkŒ–Ø¿mÑþ1®éVÆ6$+‚ô½Y«}팉qŽÀÊÈŸ oÐÀ`çs’Éøƒô-ê#­†²ãy(ß9 v³ÑSm®8ÖŠ6Ýσ#áÂ~ô†öλ&'\ : –é r<™þ×1¬Zl/ËîSï±üMií@©íxA3¼]‘ äP’¼àT”dlO]“¬†ÊKËÔ!Ë‘÷ä-SìL¼ÖšMãØ‰1„ø-dš³q5y}ØèÚœqØo5uòç´TŠlo±Ň–= .n|DµgW$| =UðzB÷,ôtæRFQ{GKî ýÄSÿ¹)£fâjU…Ñè ³+ò5P*¿~B•v4ÛbùŽ{z\&}Šºªê•ºÜOHäÈly [è²&wnyµ×C㎰ô{ÜUî.õldÄGæîwwnð=œ¢ÇGîtòMlâ1Hfò¾Úš$èdà’MGÖeì©@Þ°}?GrÏG¸ ÀQ^›´Æ3 ¬oÀ1ðÒÂȇ^­‹d%?ne:Bw ê½÷}”SZpßèEŸ õ8p¬º-bGq‰1EÞ‘ feCð>Q¨*ÀN(^Îô­’ÎV¯f0ˆ¢ç_=§&lµ†_6iÒŠ+ª98 pª¬uš•?µë0À5KaZ¦F´dõ-Š+nÉÊèS°¼ñP1®‰[ &!ÜÐ[qê¹A™RD¬ÛkŒ–Ø¿mZlý– \5)Á] NÏ!* ìYêÉ’Pîþ6rJŒ— ¾Û+ ç7¬¹Xè §Ó„ 9 $jàŒ©­KK\xÝüúüc”hƒÁp;ôNNô\€ßÓä Àt9èŠSò4YÍëXÓEˆœ]˼ÖPWÝUIÖ­ëþÛØA§“vÁÏE}áæê`  àáµ!l,@õ7v=Œí^4ÄÚß@oŒ2ö°ïá0()ÐdÀ\‹³¦ß˜S¸\IHÞ³cV¹üóõ ¼%E××âI ˆr¨ÑBÑ®ãÉÚI`Ò—é. mGJ¯¾¼( ­UYöÉg*Ñ¥ÿÿ²Iì”È®š²ÑŠ‘E- ‹wÆe)ÛÀ÷V&žuˆûœžÊØ«w¾—ññ_ýzò}?“!JÏ4Ù¸°ª˜(ºGÉØê~^¿VÏlÁÌ( kÐB®8Äþ³Üó’ÁÜ܃¢¯·ÈúR£³ŸÂq‰Fgq¼zµ:)ç0*Rñ›a!qï2ÿÖ¿@U¶KQÇÄ {Š%/u{E–u~ææqSeÇ”“ƒ¾|7¥­Ät•PÈcÎB8Îçõ~ ‹ÔÛš3θuµŸðüáb“]³µê2-¯ÓèéàéAò*sÅú¬X¯P|ôõ3Üê•iKÜ‘(ËBbÁÓ—g.ÆîÃRðY@³¯qA[ºë?ýÕOÄ0³ŽPBç­»ƒˆoï ÛkŒ–Ø¿m€«öã*¬Â>¼ ;ˆúzµx]gþ‚¡°Aß‚ãáÿÍØH6íù˜ï­+¤Ä€ ùÂì:óŽÄ<ϵ¾ÎµXVñáto/Qâܺ•vZSLovSNÎî‡ä:©™‘ôä¬5•ÈWr, ÚØaû ,Óʽø±Á¸)èOU4¥ëp™óX‚P‰™y…ª’§þ™îäÚð#¿Í¼ï¬¯kκ„Úµnè†òpÂ9ø-ä¹×62ô-øÆ˜ô1Îè×W »§åÇ'h“ª«Ëåiœ”¶\ Ý ‡TCKçi¾í}æùêØWQc(6 f–~|SvÈ…H>&ŸÖ׿n½Àq°0CHQì=`Erù<ƒt{¿(+Ú±2ÚïíØT{YÙ À¨ŽCè È{`´r®¥;ýæ4Þ;î‘Èù—Έà0&c§(aºeßR#¿¿`€„\Í_ÄÓ8õ¥OÅ ‡1²ÿ!HÉ$⑈î†5—Z˜>¯õîØ>•4UæI6ãw°Òè—Ó±\¥(è÷þ®¾—4‰[ &!ÜÐ[qê¹A™RD¬ÛkŒ–Ø¿m\+¾v =ÐÌ)Á] NÏ!* ìYêÉ’Pîþ6rJŒ— ¾Û+ ç7¬¹Xè §Ó„ 9 $jàŒ©­KK\xÝüúüc”hƒÁp;ôNNô\€ßÓä Àt9èŠSò4YÍëXÓEˆœ]˼ÖPWÝUIÖ­ëþÛØA§“vÁÏE}áæê`  àáµ!l,@õ7v=Œí^4ÄÚß@oŒ2ö°ïá0()ÐdÀ\‹³¦ß˜S¸\IHÞ³cV¹üóõ ¼%E××âI ˆr¨ÑBÑ®ãÉÚI`Ò—é. mGJ¯¾¼( ­UYöÉg*Ñ¥ÿÿ²Iì”È®š²ÑŠ‘E- ‹wÆe)ÛÀ÷V&žuˆûœžÊØ«w¾—ññ_ýzò}?“!JÏ4Ù¸°ª˜(ºGÉØê~^¿VÏlÁÌ( kÐB®8Äþ³Üó’ÁÜ܃¢¯·ÈúR£³ŸÂq‰Fgq¼zµ:)ç0*Rñ›a!qï2ÿÖ¿@U¶KQÇÄ {Š%/u{E–u~ææqSeÇ”“ƒ¾|7¥­Ät•PÈcÎB8Îçõ~ ‹ÔÛš3θuµŸðüáb“]³µê2-¯ÓèéàéAò*sÅú¬X¯P|ôõ3Üê•iKÜ‘(ËBbÁÓ—g.ÆîÃRðY@³¯qA[ºë?ýÕOÄ0³ŽPBç­»ƒˆoï ÛkŒ–Ø¿m#ü =TC ¹òûïsìÛâõ0gjãO:è–—„º‘^ÌC}vñìŽ|-5CÚW‘dߦtØ »§`¥À8?}!Jër8¾…pŸJ±íˆ¼ Á&Öç—Ë'wÊ0šGIL|ŠŒ{…¥ŸYÙFÝ“Î]³z…_*/2ó\ÿÀ†°’Ù°z¡èrž. Ü™ox™ê­Âz‚¹g<×%†>H/ãDPJ™„ä´#ž~ÊŒŸ®ß!_¸9v8¹tº•òåá­ÙúCp;J`" ­á&ÖŸô6ÙÏ”ô„¡¸4¼'âúÜ—VŠ®/ͺšœ™(D›òâZ’uQãERÿA¶âi1lG)x,Î×ÈÃ?AúC±À&Æ+Œï6»(žþeZ/në$Y˜>£Éj7ŽRFã ;fÿí—óii|}Û»C´þ±)ÆDœÇApwó@ÿpto&°Å²Äh‡ò^ïZ·‘VBHán ¡»¡{c,:p`ÇsòŸ=9åmˆ¦è [‡¶h)½f5xK¼ÎM1³û²³*ŸK{=|x…œB`YÁ %׸Ÿ cïÒLàCGßðÅš–ì‚€â sҘȅ€ÓäÀÚòÍô®Ræý½eÆ!lrŽ-gËÕ³¤—N8X\´hʸöžhýl%$¤|Ò¡š.>c™¢@üx˜ ¨nu5šô/p=éÔ¡‚M¨Ús#ž+±_´œÞ+æ€4æiAyßG¬á#˜T‚ÃBgÇŽaŒ)0©IuˆFAeÎÌ …R¸ûšùC Â¢ÙDyÝá˦Š]ϡݘ76 “Ž˜D@» {kP}ØUÜC¦Þ ˆFCHåe ¯)9ÀŠ+ÁЇœC-¯ü?žJát}[D3T8Ÿu"ï•ÎI±[“!g½ËeuJ¸ˆFCW»/ 5 c ẋE  ¡°ˆ8”?z-+4\[5jƒtWM%ŸilŸ¨Ø‚rô‚,Üõß5×|˜É}ˆFD uw Ö¬çŽˆP3Ÿ|¨­Û!fÀÅ 2†5T…3±ËŸBj*ÀfÞBåc™éXp=‡ÞÖ‡ ˆFDæG" å|ö«—ºü[pŸ^ÁmÄi;«–öG:»1sûŸkø³áñçØ;FÆ—‰Œc±ˆFDæÛ¡ ¬Ô›\ˆÿF÷'^ædv¤ÜƼýÓ6LYßÄŸQõV•ñPL€ºÌëÙX™o–i|ˆFDç8 ²ßä‘ÉÙcìÙ,Ÿd,?jáb‡£K´>ažkôg›êfØ"vZ\R¾aç¨?«N5½ˆFDìq ‘>%4„·éçœ÷wÝRîÒd‚J± ð-)–kΞ/[A‰š|³Ø/!`ªþ¶µI§ÊˆFDíEµ S•Ê é«üÒIž!Q›œÔIë~¯l´‘8@Lrýý„ ˆY »öÅSòf<^o…–ªˆFDîB Mq²¤ƒª3PÁZ®‘Š®îÐñ´áD_¸#ÝR Vª 2çqóì^i‡ƒP›ˆFDîB% >°¡?ÌÙ/&uN §JþÑKÀ•îí¿•Ôï#Gl”C æ_>­ø[¼ kewú4°côÜ@ˆFD÷eL gó1n´”þ ž%A5”Œ(9–Âèn$èœJÎ=¢ºž4Õ ’ ª[L˜¢©V^5¤4ÁZ딈FE8Ç Й6WP“C! ™NJ*®ô Iº³²Iòí _’±GŒ/|¥žËùE•“åÞzhxˆFEÝÑÛ ÿUp4Eœ5GÞŸzª™ˆmV÷Ôœª+|ÑÑèÏ?Á7]Ÿ}A’%yv䬛Å~ó`åa4ˆFFN  ÊãUošŸhæˆ<†JÐ3Ø71wìÂpÛ$[Om!¡ŸOÄÔÞò=#ã½Ð¦_ðaÖ’É)ˆFFÕ×¾ -v ~Ĩ¬{Ô €/ÁA¢¥?‘)*2[K½ zJ –¿}žã‡¿Ù#"©LòÉ0ˆFG/– …6·¢ì=G*ŸqÖ$ƒ‚r/o-õ;•ϵ¤žŸwê]./¯†²}S3ÕOdÈ4ˆFG9Ó À) á 2¬e> ÇPŒÏW…ðäUmû×µðØÏ=Ô" ÆŒÈù 7rŽ1Пշ–]áˆFG×éà ` ž¬ïÈÀž*iÔÈHŽÃ 6T?‘€e‘ˆFF’ã0 Ç5`>«Hqûs$¤†ën ½~ùïÙ™…ËM~÷žs´ÂêõWŸkÆ£t¼Ô~ˆ¦¸»&ºƒâ^‘0ŸzíéZùõc¼Û™…v5§´$Ÿ ˆL AòŽsƒÌP’ }%Ê Á)§Â(H›žý[›JÔð(ä.¼°×ž­]X€Ë­Æ­ôjÐQ–±¨ê\ˆL B룃©ób ÍñU!¯Ø}þË °½Wpã•3ûTãæo~ÜRf”ŸTcCÞ "¶ÛÞ›;&™#°@¢}ˆL B¸xƒŸ& >¦ýãU¤Ëeýœºåp*E²^Taà¾e®°ž$ˆÔÅn RZŸr1.¹¡³¤×óûˆL B$ⵃ™üP =¼ÁpŽ_æŸOwýR] ׫ \íà®(ÅE˜Àž8l Õ«:’ôSðˆ:¯4ËÔˆL BERƒy]³ ƒæÖáÕÏ–Ê} ˆh½‘”ŠúkæÉôö{Ìaƒ,í1öž=–Éì Üô.š;8’™‹ˆL Bh¶ƒVÄO &±Åã N°=Ç ¢…Óÿ.Yë0Å¢7âmˆºù  •¶DÆ”Z¹ j€‘G9l¾î÷%ˆL C;ƒ¸¤ ¦¯ø££Sﬞ,ÞÅ”e%\ [ªTK*÷:é(‹% Ü"÷Q`UD:úCY·÷íjÄqˆL Aý<éƒÁ¢ ’òã»S¼z¤o^ž5ŒÿҮˆOŒ¡†%4„·éºáž;ˆO’ v„ŠÀŒï*ßH`…½ÜŸC¿Y Ûv ,w;äŒéL‘ˆL B½fƒ§!Ÿ FÉ·x9»¹rEŸNÅWù§ÊN•RWõ2TQ!˜ž-šïþ—\ineå­Í…kI¼ôňL Bƒ¦]ÿ vÁ¢1n¡_œ ŽÕ^øÔËa¼dW¸Ã8:çWµöŸi=” ! fNÏã¢37&Ör] ˆL B>°Sƒ€.² i¨íIêÚ|Y¯¸ ÄÇ?àuè g>n‚¹’¼æ%¬÷ŸLøùYÏ&ŠžÒ •¾Î*{ß±vô§˜üêÔ‘Y«'™£Óåþ©cETw¥™ùã$šˆqæÕf2&dk¿¼¦ˆoÂ'ëžgôåé®Ñ¾PN¾½u{Æ„§èÆh¤½HÚõ;”²@ 㛺ö×.hªŠ¿g6Dd£È¹y칬ñÝ€¼£‘,ˆ¢ AI¥ƒ·•` Šuk¡‰XUŸÿb¸ƒ§ {ïÞ~j9ó·÷ËåxZ6.|šV†ª2•¼Z­ý¨’‹8¹c5Þ76«—7FD“ŒÏrÔ5€ˆ'ÀFT(•¼¢ý@—&8Ç%IsMðêfrÌ¿©½‚qÂ>Ä4´±ƒ­BšVѰ1͘ŸVÏÁ `ú±çêï.À»A"‹Úh»ôŠžD†©¨md{Äè*o¼¤¢ñ‡Éi¨ÎúzÞ#eCôò¸`‡<&Ô}†u²8[;ØX‰û÷ · Ïy½šXbÒûhÂ0£ÆæÈ,d9~3@{{V6@ó1MU$×Én6¡btƒ‰MÇ͵ dXÓÔ}µÈyýÆÒ®óÓÕ¢>ZD%“X…•U··?Ýo_îÿ@éä®Â&^‘—Fø+Z¶Ý`ÖWß0‚¬†AŒÃ £ ãe¢¼bÑ©%b"²öãËMáb¦7jõ¨f v·¹‘EGŒ´¨Û¶DHÖ«4'WƒÚ §¼½,ŽgÔÌ– ­Ÿ:˜{ðåãDOzð˜ô/O‹µ;«ÙÚh:;Nƒ:’SW²·¢…Sd½½N/ѤxpÏ›Äs:ŒôñÔ¹(¶ý¤ÖXÈßÄæ¹QæÄ„¥³«†›¿54Hˆ¤¦x­GÏ]³Dª Ó8i}| fW:& ŽÜ> ]àð‰Rßju /&xÒ<]š¤8Ÿ‹^ï Èu'’ŸëVÆé¯\ôo4º°Îû¦²Ci×{ê¸.Y)ÅÞ®•3ÝgjpÓå»òÑwƒÓ©#êwô Õ,wÇ~¡Pr¬T—j 8Âó…¿kÁ‘4”RdWC"‘ã¤_óq€ªŠËwÈö÷cMÙ¾?Q¢±Õ£¶ ïj€KÛ•®°r1ƒÇþÖâæ)<à%30JöžÙJWË„ø·;Q{„ÛµLÍþé‚ùZ†ì²—­[éF#¥¶¥É:Æë†¨6òµFBp²H9u‹ E\ ¹ü¯ÛŠN„tñ"ª’¤~9;0Ç4žQ6çöaóšŠÆÓyë‹m*‰ M½ˆµ å+½¼¥®Ý”ÿFv ð;®2£é{D”µ5'*“(jnvžCÜVK]Hú|r‘}çzÁh¼A„:üÝ…;D3]x„Å@mªCÊQʳœ©¸ÔZX´ áƒ4kJî¡Á–M‹m[M÷~2Ø,–5Dåd¦ *$¤NZš÷iGa¾Ü/A<ñi–ï(àFZ( >èŸi’S³’è°’å‡A—ÿ1kà!$Blˆþ;±2º7ö@dÄv®ž ²,0Ò‘ƒ €¥2}òè‚Áf[ËÙ»L€A‰/Íól¹-+äMÖ—ôÙÐþ4ìïfvxþ*ãTåtaç*~é+:õY j4^Ì#-‰" Bb4Ÿu —¸›ÊW­|˜¶ªlS½‚CÚa)"¨ÖV’hƒ¹O-Ó¶ð.ÁËt¸êJƒÞV³ºk±ÉJ£°ÿbp'X M Dh¿FIfðÐU‹¢W7cŸF/“zËõØx{ì úìUŒç¯¸I(M¹ùÆiRlBð×x‰æ ¶µÝ“¦+DôàƒN. ëK`9÷óÕÀIq/Ε ”œÂáÍH­•é©oÏRÓ·dXïµÚ *2UÝqïyÑ„;©²på7»UEØgR-‚'Ñ ›0Õ0­|å›ç²FÃëDÛmÞ¿o’3„¿B~ >õÖ–æ\Þ’ `rŸED½UÛðÉ?³é‰" BbÜBu —¸›ÊW­|©ùü 4å`mÏtü’z³ñg´N_MV´r§g›ÿ8:kùj72'ofJ<Æ6 ý =ôß­‚Bd'éÆV8HÆÄéòH¯Åáôî7ãf*3Š#´Çy˜âY;u‹É…=Y“îÀ>º:ÉšGûf3ö©þ¦þk[7ŽÁif1´êñNhï"àº2 NIБµT´›"\µ{o…° ÃÎ Þ¢N~r~JlZ—•ØÞzGLKI~ ¿Æ›p¶“±@•¾œŠ˜™î©ÿî‚¶Á|þSžVú$™mwÜ—sÝœ?÷WA›q°ùMnë¨ l"`sÉ!¨À%ùù ¢¸Çƒ‰" BuZuu —¸›ÊW­|2ü ”±q è–„¥îÊh«ÙH$öýòßÓ›\ÆôÆÊ|ŸÌCU6¦ÇÄÈ “¨"­@ƒ4êÑ%Î{Ž//-¯ÂÌ1ûG™YÛFìàȈ4èô8ëí»±#A«Cíq<:ºš!³Ý„“?Öb 6Ã%š$&‹7óœ| ×KW«–BÀ(Ô…ç7/¸Ô¡¾\L¸zUòá-¨S8¿_-#-ØnX1·dÏß6‰ Ç€?Õg¥}ºíƒúdeÕø¡fy"ˆm ¸ÁKš·;èãëÌ븢€,¨bcžä>f³k¼¼}ŒÉ°ˆŠ‘v¼ˆó±—I¥°;VŒÑ±¨Xõ±Ô}SÅšQ‰" B¯Ô!u —¸›ÊW­|É ýÍÖ¿ûÓ¹¨¥³Ð›˜S<9uàó{¶9CÐë°ý:Ë;t¶8|ôŸñÄÞƒw =ózÏ“òbûqÚ ¾g›ß2º:Û>Š¥4à0Ó—£ÀK5’ùËGó† Cñ¶T½·Ìr:¸)—L¡ å¹y‚5c)>ë)îÍ„,8‘°0–/aP)(ŽÍ–³1^Òþ[‘¢üÎüv¼õ½ó&k»ÎI{ŠofWŒR³/Zæ• ûë†oú;ÈðºèªL–¨ºÎÃÖ‡&K¾D–§Œ¾Në*§jBçÅðs¸iÈùÔD¥$À¯5=–ü]«VÈ‘!N²-ñåݘiØ“´¹©‰" Bµzu —¸›ÊW­|ÆÿszM,þ ¹Üšèj:«“ýni²ï[uE6x³÷q{|Ç΄ÀÍû{à,ÐÆ½ Ýl_üK×;Y&¢Î«|285˜3Ë›ù$=` åOðü Iº+J¡ñ´ù’ÈÇðå~ü÷¡+/N9ø©J’Jˆ3ÕÕ%S;bïA+ÇÞ=–#–—8á&lîäq(ýu`¹¶°«èb£ÿñá²Y“ŒîwˆËý›²–å+Tr?Zm•Ͷ«cóbª Xß혊Vÿ/rLÚ¼]äðǘndWF4¶K·šu·–þ”F+¦ŸµÊ" ój'=Äyӻ݉" B·yu —¸›ÊW­|: ÿ@æù jy Ñ2¯ô9_¬àô64B‰AoÁC–k¼}ºÑ%LÔéi;‹Z+"B÷5–Š·"Â{ceÕïŒ^l‘sîòÁ媺.f#r½|‰J·µ•­tüùx!EfYÿ}^ÌGEÌk¥B‰õ‡B =¶Àôý/+úÒ„ 5¾S|$Zäh`þäÉMBoe¤gNÀîlü¼ýÌï}A2–Dó3ƒÇÃ?øõ{7›Xl昩e÷ù†êç7ÑA±1‰T‹žÖ"a•7ºxjÏŒæ›ßòuб•”èÄ´ó°˜Ad×%ò?5mˆUªˇs1„‘䮺„ éTì¦üåó‰" BÈåru —¸›ÊW­|è°´DTÙ]†È6Sž@/Až¯oÇffš¾âtœšxš1 &‘k뾋ˆƒ}ô= }ó›—í´8$ÀC¹6.`q.ì2hX*”ßEДaˆ«¯gð–/Í„õÛúÈŠ¼{ïC§¼Ê0¦»÷V— í)¿ô™–‹›g¿ãè-ÉÅR9•—‚¾üIUÕÁ,܈åv|`×EȉrrT“$ó×ö¯šL=Û-?Œs•=ÁGÕÜÚ9Ñܸ.7Rš¢ÅY=$çžúeUKÜÆ·Ë^A2þæšãÝl…™¹r @̆èá“2Læ*¬>ñ¬92_á¾aà/ÎI»‰" BÌØëu —¸›ÊW­|ý¤ý݉¢­žl˜x4±¡#Ša:d'á„TemÕÞ—Ø2„Øõük4–Òâ>„Dïé]˲i I¿%ÒâY%+¢/Æ}%F—ã†)(B\˜ùò×:”Þ1—G /Œ † ûÍn̉‘<.WlÀ” 3y²=ADðô¯ßŒí^ j&t¹aîÂfå4•¦Ï+i®›ýÿâɗѲ¶ò‘x‡-m‚}{,r7I¿œ´/~híÏ$G‰\ðÊv“ ºÎ]0RJµ“{;0#ë/¸Ù6’dë/¸qçJ1õÎY‰]’íÏ]-Y×u.w\*t»œðªD ‰" BÑwGu —¸›ÊW­|ˆo—–áožs+z¼„HJF=,䉹‹ˆÂ Єrú]ærÏŒ>ÀJ¬©ôr2U}O+#^L›þ½As‹k a›BÜYä\ކzÐ×ã7¤þIÞ þz—Åøø¡k<°Åwsð·ÅÞºPXÕŠ ߦµø¿• Ýøáåñ¬X~[K ¥Ö 'Ö8-SœÀ\€àòj€V¶mO6ÕÄ‚iÄœàÅ=ý“2òoB@xgÃ/0¿¿ÓYÝ«'x¦uzCÝÈŸÊ|ç^•,Ĥ×G¬•àeëá(ÞY[Áx/ºYIJþ™¡DI™¦@r¤-¡öÀ²Áu«Ð– ‰" BãC5u —¸›ÊW­|aùÿG@™o´êö@œß9|ÝÖP’,ê‡Ö8®&S–øgÚ{%ý•ÅXàÇ·èÙ¢Û)ù6HæöcXägf¼¶î‹™Å7Nç-΀¶'—¯Ód½/Që44‡‹”C¨mdŠúTh>Œ}TGxÂew‹¬–)³ x„M3jï"ë*‡^ÿÐÖÍL 'EÞþÀHñÚ—ÖmÂôŒ«t9èæd%ÒºU—úLß¿Oð<Èân¬âkB¢,Ø'>”ä ÷I8—ЬO AƒïØ Ü!±*ÆPÞEùÙ…‡^ô"‹{dö €jtûàŠ~B‡ÝÜL¡ ýÊ<ÛFO7¦×_¨‰" Bãë u —¸›ÊW­|CÕþ %žñ}'½CS —ŒÅøs#\FÞxëÂz)ßO!¿Ð-ž$UW/è†`Ì{Ä2õõMP*5ÍIöÁè©©<(ËÄK(#ÿ¦O˺!›&¬~Ôš‡^Ö–Mæ˜çŸÑ“-K_0W2BkÎ¡Èø6ç€ÿÿ¥§”CXÎÀÛReºƒ‰U(£Ùù¼wž:ÝMyƒd¶,_¡…ö²©‹Óe`ñ‘¶z7UmO 4]ò*’¶*^eA¤ºRl†.©*øò.žn¨ù𛋵áî¶QîãŒAª5¶—m]¹öf˜–—ÍSÙ»Ù.§²ÅNr ‰" Bì~u —¸›ÊW­|r/þ1j!"4°"ëªhÙÜädö7Ï 8G2"6]ÙǬY,#»â/ºad ·É¿ù»œ Y-óu¸×‹fr%dZ¯¿çi;þï‘+wÍÊÐö¶lŒ¹*Ÿ‰Ælöv¶ ^ÇÑ^ÅÈÎ i ú8†žJö*~ }¦ÿ¯þáΠþ‡ÊgÃ)gb!VÞl‘9WóEŲõ¯È Ý‹Á G@ûY¤muþõ˜GW¤ºšs Š%¯õÊ4XTR•ƒÊ°p‡¢ì¼;µF¡ƒWIŽ|O>yöŽe¼ïßtSøôån’‚ô©ÃÙ¿tUýVð·ÐåáŠÙ‰> ŸËaAD؉" Bí&u —¸›ÊW­|.¨É—E)`ú÷ŸlâU1*„Áž#ò°+0„þ«I!ä(Ô»ˆ@•Cõèadt¸LY<Ã|g+kà-Ãmä¾Áº'q±'ŽŽZû,J°ùfe(?R>"¦kÿ &õ{6\3Ȱ?² “¿î‰µ§¦N¦¯­Cmy}Æ«+ü#C6ðA1»ˆæ]äH²ÔNÒÒ¼ 'üíçò€*.*Z¬n%?ëÿQ{Fw}hé?÷asr¤–{c_£FÛkP’j­ZÔ²E4`$¸:¬&- زlâŠM±F¹ôxÂ×Q€xEÛ áSGö0D}oF.þž`5UCFÿ~ª¼õRw‰" Bÿœ¨u —¸›ÊW­|£õ´6þÍŽcâZ©U¨ß俵÷6ACþ"­}FC4Bæ‡~i÷ü¿~0ÎP°ŠÏH”•ÿF tåO‘höyÕåJ¯ªOz·«Dvµ ¬¨“Ìc»ú¿œ¶ñ¿±úÎeÁ|¸”²Ío½kJÂÉò¬z¯Ãc~pÍAŽÁïÒc﫪.˜Ä§w\ Ü/YZz®]4tl9 µwHâkNAj*lÎWPö û«p†…¼)‹¤Êg ٢܅ÿL'¨×M­ÄÐOàûëCþða‘Ò IÖÑ€ìwE¹¥Ä¤!¡}?fºó&8óñi#%ØN9WÎ_‹Že 2—œO¬æä}{‰" D­j”u —¸›ÊW­|G­¯bé4W}?lØ ?ŒN ¸}L‰6¶k[ç-ñÔzìå>å7ÎÐ^ñ3!Ñê+¢L‘ê÷è!PµJâãéb_NM× ŽïЃ+§~]K~.Wãy˜wø¸l`[ÐÐ¥io’ÏÖR×(‡TdQÀ67ɨþ[õߥu1Œx(*0ÃR(\0ëeÍ×GÅ_5HjB4‹‚Í$~¥n³:•†+o°ÊJkµ×@ Ü¹è¶ èû¾º&Šð湃¥x´O|h>Õr°ÒËáI7ñÝ`?æþqòél}Þ’§†&ú¡šÖ’èµÆÝYB„•Ò"`ºµÑw½Â†D0°Ñ"àIJl埈õ 7Ü¥¶¤d%HŸM‘&?$¶–Ú-ÑɆ`±§,NM"+¾Aäð6×­…šûº‘D /QÖl ž›ad+á›ýoXd‹z¼zÔ©í\0¤2ØD>Þ‘,*°—G{çǧ‰A}ð~ ljÇÿ,é6Qþ1: ©ó šÿCz+uúˆíxÏQä%(§AøŸ@ZºÞp²7·òŽ7µ×Ž ®ŽÔmî@D<ÛÖàJ¡‡ìôÇžŽÄô¼'nõ'd·Eê\O:U/cà¥o`NƒÖ†/n·÷ l~n¶85^-@eÏ´UªÃ»õeÝìÿ†je€©[ßç\®½/ö›"¼· u"U.$š‹É‚|ÑÈ"dN"¢ra浕81¡öȌޟ¢­> ²ÉkýÕvE tYÅzïÙP¿ý X_åy€“LŠþ9‘ @Ñ-^ôW´êx&¤‹¶Êí£Ø0¦hçºЂ^#†¶;Éÿó´|T†Œ&ºËÑÀÜ}¶éFé>d…hÞÀõÀÍhe‹¬Ã‡¸8v¤«Íïí¬²={[Ôc|.<72㞘%¾ ñ šcCÊkxÃä?Œ™¾áÙˆç+Òû&‡²µZÞ-—G-¯Oá÷ùÜ0k·›'@d RéŒ KZ?àIåK㉉FpæO)¾Cè5ná:\x„ÝŠJ“6©]lp¤H· Oâ컦¢d–ý]ÊÏTZ)wÊ!Pä×ðÕÓPËPåOÛM(aÎs“„de!Â,ÙMÐ#v0së3Ñ1„Ü{^µ§‹Uþ3#©ÎîJƒwë7ó«p¨Ô’fM¢Ã|©³‹I‰F¿h ‹DÙ­Ê;2ªÑM’HÄœ~È5ÈÚçƒh6Z§!%ÑÛ¾)¸BüÛ¤‹!Š$E˜?Ì'éoqÁaÞ䘬þ¬»uO›”éx(Ñj¸þÈçÁÂÑ‚NœôgÌE¤%6Ð Ö=ú€ð~O0òeâí¯qì^­q—][6þ9 ˆÃ Ÿö68GªIúH+—(ÖÓ×~.ç wu'&B¶*P¤áÈóîhr–pm àÆ]³Û‡Œ“¢íÇ òìíp%Òÿùž|†ÎïoÆ/<0öhŽ¢™{𠸘{>ÉÄ7QN-™MðwŽ0Ú.;ìAã6yâiùÏ/¦¨1ó|ÑW«Lüèdm»ã™Šk©§5w’Ά»ûÿ‘ù¥{ ¥ËN¥µØòÁŽß¾@jWâpÄId(¶D`4Ç´dÓ.úS‘©Ç”"…Ïí¨Ã¥¥‘¯»GS9ó®H)öÔÙ)-ÿp›C6¼UÿMºôQ¶o]€üZãbÚòüæP?qþ$· +Ú½d¶Ó¡?₃2|Û¿{óœÛÎ$ެmðÿ RÙÒ~Øþ®µ‰­Éé¡ßÇ‹ö;où$Ç!–Žð‚Ο~Ôê1ÄxÅ87×–æ£^ŠßmrLº8ã,‡ ©&œ^‹µ¬½¤õß^1Öõ]7ôARTЏ)(I©¦†;Ã^7 cÃùN‡Ü¾ÁœìJèäþ“30Ì΃ŹOϯx"úæsÖã¬ã­M ÄgA”oÛÔ­æ¸?ï‹}iÑ»äó¡Fì,¼?¿ŒZ PåxÓ—³y€Aó ‹d€^Õ•¾éÅLÞ &U˲zVùÚjK,\WŽò"StWq»œàB(Šj‹½­CˆVÍrœ,NùÔÇÚ÷@O %ôjÙ;–{È !ì ß2žÎ(t6V„Åyh‹è0¥›ô2ãç‡r‚-ËP–ñÉc“Ð9W¢*°Ó1]qÌcçâÌÎeŠ.ÎGÔR`ªÚªT VÐ@‘\õZmí²îÊ\Ø`•scFzËДê,¸YƦڂ–9rˆ˜d Bzý!À2À ö<1QüÃÄRÅ >Iɵ+–°ïúì~~ù, dø)ÉáqøJhV‰[Uùwþ×–P%(ïvrº.·¼ê¦òœóð"1È%.ûô:®¥’z©U‹÷b1þ;ü*Êy>s0#w{ÛA¹A¡ß?«¸RJ>ÌgZVÀÑyr›øú„{~çc+E ß_A+®ûƒéé[ï”o¬9~„çg†—ɉéœíc bù~f~`uð.N“uDrO¶O‘"ÍÆnn•_÷Ü_§ÚÛ;JFµE©š‘V¹ª­ èù¥eù£AiiÄf¶àÎDò…ÌDwvÑ« ˜»Að6¯"–Í?‰ÇïÄZG"ïxb[dõÕ•aŒòh'ŸH"Óýq6ÞÏÉ" Bëê)ƒÒôÜ ,.FÖq”+S…ÿw§>JpÛ!NùœS;Ñ¥¨ó˜†ääŠ[w¦¤ø§jÊœü¦ˆœ/¸7ÃL4±˜‰qr ÷‘+)¢ªÞiþKG ãó}ªÃÓéDz-|¾ùîÅ1\u›rŽw7¡\µ˜#ª@hÚs‰*Gk$¶÷ù´¼q3tO¸ƒ(Iòôî:Ï:ÿv‘$i×.”‰ ¤ƒèˆ¼+xZ˜—ý|:dXeñõmª0 ›­E¯›%h¶8¥‚AÃÏX¢¹7K ëøq±VVÓµ _TŒÛåxM6' Iº6qèv“êŒeéënŸŠéñmÓ—U•ok†VT—Ák/¼¤9ÐàK §{µ"(4,šÉ2l¿èŽÝƪ­:‘‰:KXÀ,õñ¢(=l1Ï0_˜Ì&ŠŒ°³•‡îò˜'Ej×W¹ÈswnŽsá4R9 ~UÇDª0@!§Üg¦:~!¸$}0—$™¼+c—²t’Ê Tmàz.¼vEÁ){J ¶(Ûõ,X* ÓÄ9ÿõ/¼êc|ßÇ!eõÀVá5nddˆºö?Äêã,=S>œÝ4"Êhe/hE)ƒ³èþŽûSê¥x4ü1“,yØõµPQ£Ù“~ÖÔž¡DQ‰" AÒ ÑƒìÕ4 v^%ª ñx¡âþ%ù3Ñ´£ˆ ÉQnævwOˆKrûvXZÍܽ[ÔñYµn¹†ÊçvxÛµ„ÿSC£Ä±fŒJË©šh(+åç=ó-IJ©Çû¿)<üæñ$†àBì'ÍGc]Œ3ù ¿¡5: 7(Õaºg„ÙœŽÕšÓL6(užœ¨LL@Š,{äv=µ@Ëùíö-/áÔ!ÐÀÁ9§õøè³îT‹ uVAß»CÏ¥‡› Ö¬íüŸ²¨! úq¯Ø|•’€w¾Âô(EáÕ%s@çóÓ†¯è©Ñ¹í%½úà`áèdªéD—âÓ—*šªÜØ·yàÜÝZdò&ù@ÿøT|kˆý K?âàq j›së¹úN|·‹Dè`DîôòÀ³:ð?–ɱ*¹èÜœ a~ГxWE…ðù(ã™Ù‡¿ÿ4®¼†O~”ŒþóÆäúÕ.‰ð:ú½—"`÷—a_yo¿hfºk}~r=Œ‹ý©(ÚFÙæqóEb÷ÿtßr²€•‰Þæ h|×¼³¾ðl›wÐÙIœcßS•`=UìÕk’ãa=­Ô˜†FôÌœ…glŽKãæØ-¸ÐO@š¤_èÓ{M-f¦TÓÚ}T?Í´¥q»Z6‹µWQSÚ0Š‘ïJ>ö-èÈJìóq#Îó[Æ©9¸yî«Ñw•ÂnO~µ†Óú_† °ñÞ Ad¤+öÜ•¿9Ð|ö.i„Ö‰˜WÓåuŒK‚ Ô\ÈÎ°Š¼™ ãCEÀàH ‚S]ÿBz5STPy²³r8'Ë)grž€x©ßƒ¢ˆ `Á(œøs.—v´ÛQ.T·ÅÖ±Òiqsà?[²öÁïjþí©Dˆ{¢ñMGŽy†¸Ín!¾OÎôñú½ÂÿØmR¥š÷€©R°qÃÝ­ &Ã×–a"”NgÛ;2‹T>‘nÉKüÙj_©1‹e}|nˆd$ €WvÂŒ <¬­ žd8È XßÞþLm“âÇN©9ý1ùëvÎ9 ˆªmOIB43ë‰(†ò2–6ëI‰Y}” ?œK÷DH7)?“ŒýÕ†Æñv¯|BÜ/bdòŽ]¢èÔk+޾˜Ówz|ÒMU­KÕÌr.ÅŸ,‘`‚Zÿ^Õ®´ÁÕ w”JÒð)…œXþÜ–º†Ge›t”Í(åf@Ýü^ÍØÇÜŽl{1&p£u­Ò:ŠðPµÒ»G\Ïp¶|Cšlº:Ì2oNªÒ¿ñ¨1«ï ã郔d©ù4î(‰QYZWå¬VœÆ¬LŽ0"9þFê*2k®$‚ë‚sP»ñ£}½Buþôq°ÈA†0¤ žÂ¬ä£De „üj‰3! TùkÄâ)“ƒ”^ ‘©Ž½NZ$O› ^ ‘©Ž½NE.þ/|œíæß?ðcž3nÉ¿ 3F´µ¨ÄGb¨‘  ç¹]uÔ;ì®Ä‘ÿohW,ÿr9Si)\vñŽ™ã¢ÍëÒªÝ( ‹gñ;%í+v›oV#„êóc2£±«ìñh乄aRp0èˆpª¯_Ëù´ mƒbí½^‹×ç–Àìñÿm¶ðk£šÓaá/0í`³ÕÈ'½FFo²†£¤¢XþPL“‘AÔæ‹#·ü` àˆxwšQÑ'V)×d Þªzt`ë5xáløÛ‘߃òå(rX˜±ÐÐkr;Dú´‰Z D! Ø#ÿzó ôg >…%/›06XÔ2·&https://keybase.pub/h5/pgp/policy.txt …%/›06g¶?þ$j_á/åøÈ½Éëù厗be©§ Î[ûÌ*˜2_”Þ܉4Ý,@äÈïx XÊí÷S ®´^@ÃÔ6°E€Eñ›ïª*k^°ôq¢³1ˆ xnñ§ƒÈ¢A&½†ÎºF­dEªéÍ£]!’ºò䨴Jâ*|”17!Oæªc‚W'ªnÃöPò¢%ئi¿BŒ|›&i³ÿš ]—ëG$xVBE·»£Ø ±´lSERΨÓxìÔîÛV˜ŠÃÐKÍdp˜_Ÿ8M~U° 踤o•‰ï•âJy…gøÈï.w\´Ë-¸ Iɤëß²ÍQnß› „.`h—|YMP:ðZ©9§¬BT5BãŸH—¨Aa}\. -[üù _xS/R?†Âî4„q Ðü¥¡D§ª"»uxMú¦!6Œ,Éÿ–œÂÓs{Í ·ca¯~ÞaàÐ"hk[ 9‡nNÄÆo~Ù®V.¤¯g§µÍ=;öþX"4µd›i…á—H’òf¬«w>ÒÈü·rµðùÙ-—&ÝÕ~7sí#f¿!Õ ¿¤rr_¨y뽩_`ÅÊ·~¾‰K1Sê4[Š.~K¾/Ýì¤`]Ttƒ´p[«&WÅch˜"¹bìDžLŽC¹äR°:õ]½qÑMiç™A°"tî„ÐÍžã¿{ÍÄrØ|žâ©¸˜Ød6‚¥¨³e̓ë3š~ØÐ_æE‘úl›÷÷¥l3º qÞ?DÏ—ø‹“š€´l/¬àrB|íÞU9U’àH³ßisáÎ\̆Ù_(¾+ŒB “¹PΦ’fçÕÕ¡ü/IÓÓÒº6¬Ä&+Ö[…ÁžæëHí¥ó([F0U ¥à˜;õÏʶàiCqħ`=虤½)¿}\ÎŽ¡Bq)ëñg®Yê‡*Æê¾[K¿qf’&ƒLÞ£’ƒÊÐ)r3Ñ™m »Äæjæ~H<»ù¿Ê~1öJïVšm<ÍgƜٰ´rÂpf]IH}u‚:Öž™›Ý«‘ÁÖØ6¼ÐŒGd¨‰‹®üħ´ÌÙîoIô?‡ìûK¤UJ‹Š2 ààÇ4ŠïrgÆ€°AáÝje¹Ï:h΢ã3ÅBQÐï‘V“âÓúÉbí # ¦/M©ì ÊåÀ•àš¨qû?îæó$-Ë 4ávNV#Z ˆ”?Aöx; Ä!°|Ñ;)ëNawÔý¤ÍwÿY­ 7%;ÀeNmq6(0¿Ž0à±V°åk0IÇȆEð(6—¥!E+×hc¯ëÒã¼Ë{fÅ&ýáÞ‚ÖŒ:ˆõÓ ™æÞp­å–¥þEx 1=ÛW5áøÁ¥/ä7:— ì—`7ø¥[¸²Npo"¥ò Æ |Kî耚ùjö-‰Ÿ øQ‹ )´Ú@PÉ·¾J\É]&){imkt•ŠJ¦—Ö/D„ÿ!½+@ƒTøÞ2’ãüö˜Éò=êsuYè»vã¼)QAWøÂvÖ—x» â$G¹F«$¼ÅO—’X¤Á¿o Hnµ) JÍuÒÝÅ ·;ð¬Ü<õi¹2Lo¸ÒkGÈAæF¡|t€”ߥËÇœ¿»ODàwí¢]$ýúè_ZýžýÍ¢ÚÔ¬ñoí|«0(àìªe A>ð–! -UAžÆÝ]yÃ~©=Ùh·JÚ‹è~ *Ê‘¸B(^R)Zˆ¸6x³!É#º­¨kŽð¶Á§‹:aŸ±tƒSW ÃfSôA3~n4X_$­/ ÈÞÕXKë¾_®ñÎæÿ#éRüL¡}ïJöV+dqÍ]Ø`K4ʩض„–œÍñ²ÒC—îHÑ]ðü>~š¨e£|‡>xv¥(z·8g£eÝõì3þ¯j^ןÄÓL"Áîj%,Ý‹w*¹B¢¶;@õî\ ÂÜP–ñ»S غaÔ«g&±«ùõ‡MsŽ”™qš)›Â–CüNõ˜ @.eª¬Ö_XjÅé¯#Êó¶ËÂ^•gl`W¹Ä×k#wïµH<<B©úÍ8 ÉŸ4S¹3‡Oän§Õ>ˆ6(aé¼<ÜG¨H_!ü¨³¦™#–d“Ô g,L³Ç [­ž…ÙQ„ã˜øB-„ÓnÝrÄ]ÕUh̽“ìD¡¡9MÑP¹»IA$‚lòAé­»aOxžäÀí™LO“O¾k©—i¡ÌVû7½à)®ÌZÛ7îIcT%aR.Ï–+“ AËk›ÉùÁ×£þá UE2ãÐ 8‚ ³ŽLFÝ£!ÿN½mL~EA&ôöÅ3½éËCU”Ãô­Òˆ¤‚è† f$¥››%‚†Âˆv78D̉ìæ.l¢jϬ­ÎǽŠ\k®œÉð/) "Ò ÅaÝÅx#¡ªÄS.צ¶ð°>âÒå÷…­è+9ölÖ±Fß>G´°ÙΟüaúFP ©q†ß9, $_µ÷¬(íåÙpZâÆÝÏ+(öOŽ>±tŸâkØ-½Xö”ÈPõd|û]Ï ÉÓò×â¬5G‹p E–D—ç £Ïl¿]jÀQ2ÕJåòšWm]£FZÔ졮 “ Ò¡"ÆÈßÒ£|÷EË…Œ[òOû/ËpÍgZÁöê/:ï$® á3;w}ƒ<"#öø»´E_»`ÓºTΤ5e¬i¼wŽhÿ/B+莿ÌhŸz8'°Â?˜›T£]ÐCv”NL“ÅHVU -º]6äê†Ü`EÚ‡ò_]ÜÖ“±0È.1w%5€Šyª çÜÙUÝÉ¥mûÄ[ª‰3!l P§½˜÷žŽq«xZë•ñ“)ÀZ»‘ª xZë•ñ“)À{™ª„ŽÏEm;§ËÏø6°ÐpØ"h°F›ãsÍÔ¾ÆD×À¿`Ýëþ&§S®º1[‚³t'õ\Ÿ&­zÙÍ'kÚcMU­Ü‰M^缞 €5ÙîÜû “Ÿ±žÃHËBÊÏìÏwMñ6ÜD:á9²é º§’Ã[ú½Ý)I¶¸zÀ áâN:2¸­« ^´]V¹ÁÖüFYà •Å#ì*‘à‡ŒÍŸËaQþS‚Ì×eHNüO7oC} rìèà ÷iâ¥ûG $ËåJ"gÚÊøR[£ô«'XÄ»øÏa ÁÝ`¥È{p¼ƒ`I ›jm˜ž‰•b¸óž‘ðÏÅV—¹ ¶*§óyÞ‰f7¢—j]¯F¯¿…ùö-ÕvÜ3Ö$*ÑÑÀuÇ mcm÷ ˆQ F*#ÈæÍTXÈQ¢öÆ Ú –¥“&¬Âô% (ÍúAß!½ï]‡còƒ}iOà¯u²%‚÷W9Ç˶Š× v»Ê΄ÄèÞœ¦$lz!¯:u‘z][ê–†KÖ~Õ—Vú;êLÖôªlùžÆ:4´à‡·{Ÿöh_ÉqÑãpðÝ£ïoö®dœà”¢#8o´ú?fuö÷„}›u$(‹Ï`÷ÖöZü~pY¥Ì?A‚ª3ô‰½ßãŒ!WNËOUæ,|=y¡ía7ü™¾=‰3 !n¼íxkwbß(Ÿ`¾ßОͩZõqÑ ¾ßОͩgQý”íû"«žÂ,H?‚:U3mÕM·á]&W˜R¡^wZëEÜrÒ¦„n(®'µÍçòÛsÛù‡A&ÛÑÍsŸ·w”NûÒãÀ XË~@”°:ÊÿWÖ«£­‚_Z¦I3o5ƒÜ„u%–…”؈_&üma£Å‚Ï€Â.õÆrn ½Ñä½ÜtÜÐæx6zÎî sp‡êw¯hŒÑJ¤k+ûê\ªO§€¥‡d]Òwkä…Yá¹\ÑF¿U@•ùû„o§ÌQ4ãE/íƒQyõ(BXtëä½G„ha93—ÆM{o•=öôJ”Êc¨„½y ¡ ¾âPL,îivb}˜ÍÔp:DƒÔ`öf`¥ÁìK&§ÌÇä8ýmÔ®1O;š —Z£ e'ú£•’³–ÑÂ’IF¡(ÇÒKð3*oCôê_*ÈŒnu³•9’?ïˆt£ˆª¹"v#ÖN:G>pë«Ç<Â`Üñ+ƒSc;8ìV™ã¿Êj±…ªÂu#xøŽÿeãf¸p¸Ü†Ó£â7}øWZô9#©Þ'ÊÆÛ5¸…ÆâCÙ’©*$:ŽIFÓÇŸ˜løò™¨‹Yæu4M ‘Bœ4ØK7+’%†øF¬S@¶áC?m„²Í>Y;ÌPq&Æ[нZÚIhòx=á†UiiYy4•[uˆ{; €!Ùž¬sy¨P¼ä}¥òžd8È X[5%p ¼ žd8È XC ¾Ò…ù'SøL50Å >ý›Ùž?ׂúá8†3´%›hˆQ‚j{¹ @üx‚Ï|Wå¤[ˆ*ùþlõ¥f±¼^¹Íôé—S¶XK±Î™,IŽøÊ¾³ë3¢ ‚nD>$ñØâÿµ¦=tni,˜… ÁþV=éf&záûŸqÞXø–·X=ô§5&V£rVØ lÐ…†µÜç5¹‰ªku8͹P‡6‚i‚0·=´UÍxLeú¡ÝX\öC­Àǘ:ðŒ7D[^툨ÓæÀ ÕìTF=‰wÏ)|y’Ûø]Æ·ál‡@Ž0Uág>¸§´¸À(^ŸuŸrÕzîd—a8ÐA{µØþg'£x+º&/¢ Píl-î´Å0Çžè/þ-öJ`ù[É™ÙÇÓÌjÚÉúØM¯‚@N²l@Éq¢ —[ÇP@0lå»’£ÇVÙêP*2Où…Ž”¬Å¶Ý ê‰zïÚëÈÊ-|À¾Æ[‰-U” `”ÅÃñqh¨â”‚ô²¯¼) ^Þ¦H´šqé,Ïáð•9·@•’7A ø"+zp—ë­³Êë4"0Û"2Êò>l¦eØßA”¬—ÙÆZVç잤` a£U«ÿV…Z*TÛ»ÁoKšÅ1{ú¸iírogÑ?˹Tñý‚Fï~#`4ÆV¡¨ù»~%ºÊíÿ¢…>%íîê@;›Ç¡EõˆO Wwx$ <¬¢ žd8È Xă'¤‹"2 T´ýïm/î]wŽ£µ›‹üÁH¶êÄÕÛ\•z7á¦n¼ˆf& !Ùž¬sy¨P¼ä}¥òžd8È X[5%€ ± žd8È Xé  –Ñ‚"„aþ8ðý×J°qBón ºsщó p ›Óp ¼<;fÙ J”[8—~Ö†øunID©ÚA" ’9X[ò› (NçαÖÌ÷w¾¦É›Âü>:ÓG4/Ƈ 2æWñãæ-çCø¤@U¹:>”^ùu«,Y…ìfR5 gÑãÌôòŽ½× 6ýÑF\©O¦í`ÆäíMTŠë8ºña~ ±Šüí“er½§Ù(ðÇ(w­J¸sMïp` Ïÿ$°˜öeÄÊõ‡µŸ{ÓÕrm L…ÍG¾y3ŽÕä÷!,[³«Ú+?6> ÍŽ8ÛOCÈJùÊEåt E«Ë¥ BH•¬µCFG|~¼‹/Dzäœ`V‚Yáç!¡UЖ æRSZgËHóÛ],?,†§#éÔ¥õ;¤m©õ-u#ߨV|†u@fø&{GœzE¯·Š¢ ÚÎKK2—8kÉÍsªaûF§]×èsî-»…‡š ¡2ø¢|eÊÉh‘ §JW}ÉÜâì2‘ÁL›JµV‹oݳia×*1Ø9Šé²·­¥«×_:ç­àÓUu$¨Æ@=·$3ê§U ð'ªH‚¢îÊŠ›TN‹’o‡“š¹¥»àÕÊD¡ÖX vÐCÌè1Áô´ü,9CØÉ¥î÷†“rÝ.‘’0²š–ÍÎ¥žso¡‘Mœ÷p`¥ø{@ý Ý*¯7 4Y«žýå´SGentoo Linux Release Engineering (Automated Weekly Release Key) ‰R < € x y!ë½¾Þzw]ý±º»W.-)\r©] »W.-)]@þ=Á.2§ûYÞ²ààò½_~9&þ1ÅJž5‡¼ ÍÕèV[;‚eó°_ȱË~—ù)HFq_y·È>^…k*-„ÙäôÄ"\é ‡><Ü`’q†°ÞöÃäé‘ûƒEõ†¬dHñÔ_?•H:M»‰Úv«òZGçþÈñëíÁN¿ieO¨NnMðG“Á¬0üÔ[÷Ì ÉL‘ág:,/9A^àÁÙ \A8\éGÆó8{œ$‘‹¶Ü%;¯¾r`•®2A¸ÜpæÁåa+Lõ1ó@|ÖØ^फ´Ó×¹N¡uL/‘™8DLzC¥ÿ£î¶ë—þÜ Š=”D%#ÛÐk_G¸¤»HF‘`‡§qÌPÛ–ÿe#,*`õ-+W3-Ŧ“×Fÿ´yEWpù±=À"<éS?0üè8åq¥PCê{ý‰Äg®@´UêæåŠ¡v<ùTSaÛ)ÍÛWK^`?Ÿ q–Ÿê—@}h:øBàfVæJï æÿwˆ®%÷Ä‹9n™z°(LæY ZðL°¶¯èBŽ)'óÄVDç\H Áž"%j7ïŽqO÷µ°tÄRæ(cË'ög.éë7%w±¨ƒÍ·]ϼ—“©ÚcÖ>gm½PøIæåª…Ƙ¦£“ ~>×ôŽ„_ý€t¹ \q5R«¯Ó„¬ºã‡Å7Ýß¡Ÿ÷sLxfØï£8ÿÅ?ÅB ’ïw‘fy€ºoâqä5õH ¸eÑ#p;5EI•9ÇŽ>j/Upé%z nAäV¾Äøàê´á8âˆÝ5 8Œqú- $Løvtÿ^»¸Ñ"`è88{ ãÖ ó§|ŽbJ°2ÀS†möw,l³XPN ƒRË1¸Ïl„k6MÆÊ‚ÎÛa> ÎHþˆ Åæý ãõð`×îœa9O¨¹áû,žº9€$˜ÕÏ¥šì>8f4"¢(ypŽ88”-DGAήÌ_Áj¨¬Høz±ͳ ÉRAû‰Ò &!ë½¾Þzw]ý±º»W.-)\q5R ›FX  »W.-)ÀÔ  }!SNB «IîáÁ–,Di]¹ö=\q5R_€.(issuer-fpr@notations.openpgp.fifthhorseman.net534E4209AB49EEE1C19D96162C44695DB9F6043D ,Di]¹ö=.?ÿ~§G²Ým|{Òé:Ÿ Hëpø±Í¸yk™=†™šdˆæŸQ´TbÊÍIcš¸?\¼!oæÁr%cNMHšõ¨'Ø•-®œ$*³xÅk¤"¡º¿¢YÌß,?™ÜÐ G&þÝs ,üU”³#’*Ç”YACßÅ—ˆöÚì¸ÄíçHfÓ|Ë.´cÝ#;˜å_‚ÜÏtþèa-eÿÓšÒ§ú¹¯ú’ˆ«€ýÍ “Q  /­ÍÉÎÜÙ ícW¸Ôñlf ·ÿ0ãçÏaÓG‡´¬­]šRã)ù%|ðèŒ?‰ˆ•pÑ¢Öñ¦Xî¤À[zRÒÄ>ŽX*6‚Bx.ÿ|!oÿñOY‡ ()ãÕ…J›Ó!Gý„kü÷Cx­CŽ&ò¬­²Öy)Q‚]c(W4gÚ„![Ž£CØÊѦaH«—Àf/ybÖþ¬Df 3¸¬¢|´Šìùɱ¸ß‰…ó·mM/tóÝo›b—¾>w8?¯®ŒßR˜hkY¯OBàĘ‹ y×A-„©Zð)}ðÙ+n¬ÁF\£¤Ñ™‰|Š·K;-º°.†—(r"¹ŒÿF¶bÁsmç1sÏe@[ÔÆ/Ÿ#¾Öïg#³Lɪ‰ÐŽ eclöò k!HM;“ðê¸ «€ïÀIð>Ë“šmWÄ'é´Ÿ';Ðç²2|÷óÂ|B³WO6ÎO½Ñ¢I„b÷~X5lQ\ùêÐÐñ'þ_ñA!8ú?þDÅ…PUñÔŠ ŸIãP­ðfIôéÀÉ5·ôùô à^žÁ¶ оÉbs‰½íÑC©!†¤Ý+TùÃûžÚ=UE? ²ÿC¨t5IÉ$±ðgh›Nˆyÿ5à‡ÑI¤ê¥A‡ZspsOv§Bê~¿î©@úù·Œà ëìoU«£œÁÏ ,ìÅk¯åÑkÚCºÈ!RèczßãêÜAs5Á?䩲§F•¿ô3*ßkÇ£-–²KiêÝ­1í 8úv=@© ¸*™ [ þÇa)fžüy¨°VrEú9ë‹#÷€2 ǯ¯´ù\iãš—Æ·¤¢¡éˆ´Ú{îÂ-¼C“åBÕÍtdMìD銸's‹€¦×|¤×p®jçÔQäöÜ”°v!+Fpî¤rØOímúOŽ„#2¡»·íÌ[æÐŸCê6Α…´¦p3TYœSß1BÚ0Ëó¼.–‰ÔêÎII(ï-s~·=1ý’+›÷{E {EÅéM÷=xÝ¥@7| iÏ”@o;”ü}¤‰ðÖá;OŒº¢+Ó}G%ó|dŸ%Žå,Ê ä[  âV€Ïì[·“yÏS•Õn°¶0ÎP]U­U´J¸8{Ê!‡ÅŹp´*°“S£œ},§ÓEfd½–>žóU=0Ì3ÈdéòI½H аJ©Áñ몱ErVw£±Q4]1&TÕù]J"A°¯åWï:‰T >   €!ï•8ÉèæC¥,Þß¡=ñ‘Nzr\q5/ }$ ¡=ñ‘NzrÒ þ YzE¯ c€QÆSßÚÏÁ@? `&{SÞǸ€«D±4±¡€€øyê✟tú«# _z~,¾r·‹œëTy–ªàüYÏ¿ô>W $LQ©Ñý"¶PÆüp÷—•rð|:U–á³'rê‡øЈ|O}» “Nns)ô— ýïõjÅ-¾Ûzü^¢ä rMDÎÀe¬}ðõOÇXcõÚÚä[HWQ?iœ¨Kû`iØCk8 àÄÐD¹Õ" ú,K¦ðR“q^Ø 00ÉG8á7~¾·M’»†S{È(/k†¥¢rf$nwNÎvÃàêwZb‚É-]/—Qmö•ÐìN·ÄŒ™Ön—x4ñÞÊÙ‡ï(I‹ÃG<-å n'ˆ´*´¬µç:4JiZ!ýÄJ«åDÈ6§2Æß±ÓÒ^~±À©â:+k$=Ù` ¯8žc1ÕÄ«š„ý?ˆa¹Ëˆ;”÷WÝÀ?OÄteAhZ§uêe‚®˜â­p†¶áe"ôެo èëïÔ,ß¼ëQ47Ý%RŽUt’Ÿ€™¤Ueh{”Ý4î†ýG0ëŠòZÎ÷÷¡ÊoHué×&pVºµ|ÿ¼¯Á•S¸½éõˆ‰T>!ï•8ÉèæC¥,Þß¡=ñ‘Nzr[ þ Âg   € ¡=ñ‘Nzr.èÿt_ÝÕîå" @¾ÝŠkuÁ]Ÿ„1ãUç¸át‹Y%ÅÄ õßmý séë„:6p³vqÓªh3Õ ‘‰þ?ÛhøÊÍ@ƒBU#]§1/5¸®¥‹ÿ@ù¡>6¢{"$scR ¤>ñÑ@µ‰N¢éí#@çËåH0É#ÄJÌK/FЛ>×Þ,¯/ѵÊ2s„¿²Éþí°ªÓÎÊÞòõØ—ë|Ð¾å ½$tÿŒ¸g.–Ë7= qF0`ÂAm>ùhA¶‡ŽÌÝ«óé—Æ62˜*™Q¯=Sd~ãòmj^Æ 2êÊþái^eª?GF‰¥nÄ]–9KБÁÂ^n)„ª@ê'Лp,’ó†;þK-f5A¼ˆ¬-žF™ùí^ 3$»"•<+Æ—Âq±†Û»‰!ºÊÑèЂ 6JeJ ¡Š 2à2¼’å³>²Dóö¡uÐu™hÿ>¡7œ4÷â.ÄÂl ìƒ8볇匿Á¼S}xhÛí)iW;3êòéðè´Ä ÿÔÖð§³ kå+M]žé¬·¸Fm¢z žcECI¥.‡ÁÕºÆk.8æ?ê‰$O߯ªêÊqaŸ™»²3%:ýǃF}úáU–c ù‡ÝqÇ"6­ö¾˜Žú6—þÒB…›ÆkýgóËb[Ó`K‰3!l P§½˜÷žŽq«xZë•ñ“)À[AO xZë•ñ“)Àó|ý´g½­¤ (5sèüþìfËQ‹ãs]Ås:´Ãå,­½M;³€³¸‘!ÃÎþɆß`ÈnHý’2í9ã;ínY$IÕ.Ÿ8ð¦{’‹il]Í­~–Íe‡¬Ñð¶Ù"³Ïœú­ )ÍgÒ%¶c :XвQ µ5ªó¼ÁÕÿ½HàWªÙ,¡ÈR‹u(ÆÞJXÐ_Í‘BÖiƒ‡§Ñ’Ø®Õ4T‚föâ§‚¼…àµÃçwøâuçb?øyAPv‘K‹éYîÀüáreûóxë$»Ea¤\‰ˆÜ8Á» CϰÆgQð3м@4@ÉÿZQAe|j.?¿–‰:ÞÕ¹HÉ÷×+ºpÜCÏ ÅséÚëþ`&(X.¹EÔÏdi*þ˜–®agÌ5QÆŽK?Ôu© ¬ô'­I w™%­nò‡ì›zt· ¹Õ^õÀS€[ÿ8l _ÄØŒðr–Æ([›züÞ[̱UYØZY`~«¯M¿‚êÁŒ¤DƒF¾ î>ìq¢~”õ ñ™˜9Z_%ËMJî;IBÃØ“¬_Š™³ï¾ï»å–Rj7áäÎmÄRá4ö‰T >   €!ï•8ÉèæC¥,Þß¡=ñ‘Nzr[ Ë â9¾ ¡=ñ‘NzrÅ™ü E4ÏŸÒ_êjô€{5”²SúëöÜL¶’”ÏHÒµ­<*˜jÛþå-VS±pïÛ;óG`äÝÏÚQˆÛ¡buœ˜.[¾@öW´ð\*ÀAˆkkÝ’˜}º8M4 ¥XOâׂ•™<¾ù×Ô˳™ÈÏø¬¹–(Òƒ ÌÍr¼+͸v’”Kë ÊsmSjª„Ь¬Š…¨’y£ýETùV\<~”…>Ë•EE©îAµü8à´Ó–Hâ=«D+íÇ)ð)-HàGù}¦ 졘Šs£µ€ÈHØÙöcû{‹W¹Ÿ’,¶µ¿~õ z¬HT!ÂI%×ä&6$@FB©è:?šAšð>xç·H >áÄu4î$ Ýs ½+UÛ2ø½7È«ëòçI=Ky§ø¡Œ¬¸‘v0£lÚY2Ú‘M»ÅPŠ/'Ó½B“{ëN¶ðw%- Š'cØþtžïO—2º•üx+@¸êVû…ì@÷œ 7~×öÉ•ùј³/z?fåÊó-õ¦/˧W˜¹~Ñ.}fù¾w¤^p^žx\ñ¦ o^NaI ]’XröNª;‚=¦hÁs^=;w\¹¬UpWƒׂvUjJ¿¿Âl~?¤Ùo—–adbHþÙKhƒZ!¡Q…¦žËò;ƒ¯ôL™L“ÉÅ 2€?‰T >   €!ï•8ÉèæC¥,Þß¡=ñ‘Nzr[ú\¥ }$ ¡=ñ‘NzrœPÿI6+Oýñu°vÑA˜[bè{›Î‚F$+¥$=U— |»IN„ òçn”u°7tŸmîXLHÀ´Ww¸ŽÈ>Ÿ(ÉT[ÆõÔÁ’ºÏJp‹_t„áààøº‘²øÎÃm½™õ{@DÙMÝ ;¢MБtä"° Ãår!_ä±P§âN±ÜY-9¤¬ƒzžÚé¡aއNì#Œ_Ô}b'ŸTÍÀn!A6-ÙZµœ¿Å;~þ¼jHš<™‚)ç­C©üwƾèÂÅ[[k`!í64þìÏ›'C@H& K<½©3¦¼CîO-vžÑi’ð¤ÄÍ©Xí -ÖÀœ¤˜oF,ªfÕ¨\wÔì³c@m¿<nýœüC¤C¼òF˜³emJr•à#×­»_wÅjÔX/!Ë0•ÃêŒ^ »ŸÕõ? þq;£¾½ö6)iÞ—ç)Ô1•B¢NzŒØIáë-§ÌD–’ï}œŸk#ÙÂD lS¯ËõÄäx¢"ÙÃK.ñª5½ð&h…-Ÿt*ÈkiN”ÒÚéÓîž™ÒU[¿ñÁ,ÇØ’ó” ±)?D(«™œaÎNš?1z0îWrš½|›y€rßq8dˆh? ÷–.ä_y2¶(EUõ¨ö×è0T«ÝŒ3èOí'Å©²Â(Ø ¹ [ ÿ±'ݨÆI#d¾ Åríï„®#)˹—kšYyiã5!aÝÖ*ÅÕrÛCÝZ¹Pa˜N8ýòóØÁm­€èkÖþt#€K\-oÉfŸ5C&ËáR3å±±¿GG¾0äl8±m=FÂ>!Ó ãG¦°]€ýOPØíº)Ñ'x…Oð"¤V<úUèËP U üÓ‰r &!ï•8ÉèæC¥,Þß¡=ñ‘Nzr\q4ú |ª@Àt !÷Hé³Ä~9<ÂL¯|*ÀœÙ.ß[ ÿ |*ÀœÙ.ßóÅÿC2L,lˆ"xŒ&ª·Xù–z©ÿ@O‹[™b:å“WB «ögµ¾¼Z–¶gÉOX~°0×Ón<·‡dô»»Ð€ü˲†ôªw=AƒÉ|bø¶ ësë¢÷×wBŒÞs3jéšFޏ…#Ûü»Ì.gtÌ5 —@Ò$¤X…Lâ=:ŠÜôæÂº+M Ð|Ô'6÷@‡„½ÌïLÁïˆR̪§ÕØÔy#ôU4ûR鈀ó.ÂÏN¼•쿲.©,. õ$v¼1áÖ"õcȸn Û«C–­ôc.dÒ;©÷0 ’â5#ÒpÃíy¤€ž9¶l]uRÃ*O‘ðÒ’{ú/ˆ\·¯ù^B;Á%ß=‹¦µf±#{f¸VêëÅÄ^`ÔŒ“ô:Æþœ>‹žž'Ã@~:õçÒM­+)¨k4¶ß‘«#™²Mm.äd å:UTy$®´<0óˆÞñ\ Žy饟ˆL"jêqu^AžbL¨¾Í^ÿîÅ»€ï>ûZ¢~Xåz3ŸJ¤JY™,ÚO õ“¶ Âãb©á³ žC ã½p<`ðµg9\¶š·µ šJ„Fbž‚v*J:sjG‡)hžêùWŒÄÄ|å@iGa"gˆióI#^ËeW‡"yý’+Ç%‡âE£‹•Ä64õ'!ÑOŒ:ëň#diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/bin/0000775000175000017500000000000013640271564024536 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/bin/unfix_shm0000775000175000017500000000166413640271474026473 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2017 Matthew Thode # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [[ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]]; then set -x fi set -eu set -o pipefail # unmount tmpfs # care about anything still using it [[ ! -e /run/lock/shm_fixed ]] && exit 0 # shm hasn't been modified umount /dev/shm if fuser /dev/shm; then rmdir /dev/shm fi if [[ -e /dev/shm.orig ]]; then mv /dev/shm.orig /dev/shm fi rm /run/lock/shm_fixed diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/bin/fix_shm0000775000175000017500000000257713640271474026134 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2017 Matthew Thode # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [[ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]]; then set -x fi set -eu set -o pipefail # make /dev/shm dir if it doesn't exist # mount tmpfs and chown it # existing programs could be using /dev/shm # This means it cannot be moved or backed # up as a copy easily. The only remaining # option is to move the link if it exists # as a link. Existing programs will still # hold the file handle of the original # location open and new programs can use # the fixed /dev/shm. [[ -e /run/lock/shm_fixed ]] && exit 0 # shm has already been fixed if [[ ! -d /dev/shm ]]; then if [[ ! -e /dev/shm ]]; then if [[ -L /dev/shm ]]; then mv /dev/shm /dev/shm.orig fi mkdir /dev/shm fi fi mount -t tmpfs none /dev/shm chmod 1777 /dev/shm mkdir -p /run/lock touch /run/lock/shm_fixed diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/bin/install-packages0000775000175000017500000000763713640271474027723 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2016 Matthew Thode # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [[ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]]; then set -x fi set -eu set -o pipefail # env is not sourced with user specified package inclusions # set the default bash array if GENTOO_EMERGE_ENV is not defined as an array if ! declare -p GENTOO_EMERGE_ENV 2> /dev/null | grep -q '^declare \-a'; then declare -a GENTOO_EMERGE_ENV GENTOO_EMERGE_ENV+=("USE=\"-build\"") GENTOO_EMERGE_ENV+=("FEATURES=\"binpkg-multi-instance buildpkg parallel-fetch parallel-install\"") GENTOO_EMERGE_ENV+=("PKGDIR=\"/tmp/portage-pkgdir\"") GENTOO_EMERGE_ENV+=("DISTDIR=\"/tmp/portage-distdir\"") GENTOO_EMERGE_ENV+=("PORTDIR=\"/tmp/portage-portdir\"") export GENTOO_EMERGE_ENV fi # iterate over the array, exporting each 'line' for (( i=0; i<${#GENTOO_EMERGE_ENV[@]}; i++ )); do eval export "${GENTOO_EMERGE_ENV[i]}" done # set default opts GENTOO_EMERGE_DEFAULT_OPTS=${GENTOO_EMERGE_DEFAULT_OPTS:-"--binpkg-respect-use --rebuilt-binaries=y --usepkg=y --with-bdeps=y --binpkg-changed-deps=y --quiet --jobs=2 --autounmask=n"} ACTION='install' SCRIPTNAME="$(basename $0)" function show_options { echo "Usage: ${SCRIPTNAME} [package ...]" echo echo 'Options:' echo ' -u -- update all packages' echo ' -e -- erase/remove packages' exit 0 } function install_gentoo_packages { RUN_ONCE_SHM='1' if mountpoint -q /dev/shm; then emerge ${GENTOO_EMERGE_DEFAULT_OPTS} $@ elif [[ -k /dev/shm ]]; then emerge ${GENTOO_EMERGE_DEFAULT_OPTS} $@ else fix_shm emerge ${GENTOO_EMERGE_DEFAULT_OPTS} $@ unfix_shm fi } TEMP="$(getopt -o huem: -n ${SCRIPTNAME} -- ${@})" if [[ "${?}" != 0 ]]; then echo 'Terminating...' >&2 exit 1 fi eval set -- "${TEMP}" while true; do case "${1}" in -u ) if [[ ! -f ${PORTDIR}/profiles ]]; then emerge-webrsync -q fi install_gentoo_packages --update --deep --newuse --complete-graph=y @world install_gentoo_packages --verbose=n --depclean install_gentoo_packages --usepkg=n @preserved-rebuild etc-update --automode -5 eselect news read new exit 0; ;; -e ) ACTION='remove' shift ;; -m ) MAP_ELEMENT="${2}" shift 2 ;; -h ) show_options ;; -- ) shift break ;; * ) echo "Error: unsupported option ${1}." exit 1 ;; esac done PKGS="${@}" if [[ -n "${MAP_ELEMENT:-}" ]]; then PKGS="$(pkg-map --element ${MAP_ELEMENT} ${@})" if [[ "${?}" != 0 ]]; then echo "bin/pkg-map error. ${PKGS}" exit 1 fi fi if [[ -z "${PKGS}" ]]; then echo "Not running install-packages ${ACTION} with empty packages list" else if [[ "${ACTION}" == 'install' ]]; then if [[ ! -f ${PORTDIR}/profiles ]]; then emerge-webrsync -q fi install_gentoo_packages -q --jobs=2 --changed-use "${PKGS}" elif [[ "${ACTION}" == 'remove' ]]; then if [[ ! -f ${PORTDIR}/profiles ]]; then emerge-webrsync -q fi install_gentoo_packages -C "${PKGS}" else echo 'something when really wrong, install action is not install or remove' fi fi diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/cleanup.d/0000775000175000017500000000000013640271564025637 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/cleanup.d/05-unmount0000775000175000017500000000331313640271474027514 0ustar zuulzuul00000000000000#!/bin/bash if [[ ${DIB_DEBUG_TRACE:-0} -gt 0 ]]; then set -x fi set -eu set -o pipefail [[ -n "${TMP_MOUNT_PATH}" ]] sudo umount -f "${TMP_MOUNT_PATH}${DISTDIR}" sudo umount -f "${TMP_MOUNT_PATH}${PKGDIR}" sudo umount -f "${TMP_MOUNT_PATH}${PORTDIR}" sudo rm -Rf "${TMP_MOUNT_PATH}"/root/.ccache/* "${TMP_MOUNT_PATH}"/usr/src/* "${TMP_MOUNT_PATH}"/var/cache/edb/dep/* "${TMP_MOUNT_PATH}"/var/cache/genkernel/* "${TMP_MOUNT_PATH}"/var/empty/* "${TMP_MOUNT_PATH}"/var/state/* "${TMP_MOUNT_PATH}"/var/tmp/* sudo rm -Rf "${TMP_MOUNT_PATH}"/etc/*- "${TMP_MOUNT_PATH}"/etc/*.old "${TMP_MOUNT_PATH}"/etc/ssh/ssh_host_* "${TMP_MOUNT_PATH}"/root/.*history "${TMP_MOUNT_PATH}"/root/.lesshst "${TMP_MOUNT_PATH}"/root/.ssh/known_hosts "${TMP_MOUNT_PATH}"/root/.viminfo "${TMP_MOUNT_PATH}"/usr/share/genkernel "${TMP_MOUNT_PATH}"/usr/lib64/python*/site-packages/gentoolkit/test/eclean/testdistfiles.tar.gz if [[ "${GENTOO_PORTAGE_CLEANUP}" != "False" ]]; then # remove portage files sudo rm -Rf "${TMP_MOUNT_PATH}${PORTDIR}"/* "${TMP_MOUNT_PATH}${PORTDIR}"/.git "${TMP_MOUNT_PATH}"/var/cache/portage/distfiles "${TMP_MOUNT_PATH}"/usr/portage/* fi # shrink a bit for i in $(sudo -- find "${TMP_MOUNT_PATH}"/var/log -type f); do sudo -- sh -c "echo > $i"; done sudo find "${TMP_MOUNT_PATH}"/usr/share/man/ -mindepth 1 -maxdepth 1 -path "${TMP_MOUNT_PATH}/usr/share/man/man*" -prune -o -exec rm -rf {} \; # make it so we don't have to reinstall grub if [[ -a ${TMP_MOUNT_PATH}/usr/sbin/grub2-install ]]; then sudo mkdir -p "${TMP_MOUNT_PATH}"/tmp/grub sudo touch "${TMP_MOUNT_PATH}"/tmp/grub/install fi # systemd id if [[ "${GENTOO_PROFILE}" == *"systemd"* ]]; then sudo cp /dev/null "${TMP_MOUNT_PATH}"/etc/machine-id fi diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/pre-install.d/0000775000175000017500000000000013640271564026442 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-00-set-profile0000775000175000017500000000033113640271474032543 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # set profile symlink to the hardcoded PORDIR ln -sf ../.."${PORTDIR}/profiles/${GENTOO_PROFILE}" /etc/portage/make.profile ././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-04-install-desired-pythondiskimage-builder-2.35.0/diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-04-install-desire0000775000175000017500000000527313640271474033247 0ustar zuulzuul00000000000000#!/bin/bash if [[ ${DIB_DEBUG_TRACE:-0} -gt 0 ]]; then set -x fi set -eu set -o pipefail if mountpoint -q /dev/shm; then echo "/dev/shm found in /proc/self/mountinfo" elif [[ -k /dev/shm ]]; then echo "/dev/shm exists and is stickied" else fix_shm fi [[ ! -f ${PORTDIR}/profiles ]] && emerge-webrsync -q echo "PYTHON_TARGETS=\"${GENTOO_PYTHON_TARGETS}\"" >> /etc/portage/make.conf [[ "${GENTOO_PYTHON_TARGETS}" == *"python3_6"* ]] && [[ ! -e /usr/lib64/libpython3.6m.so ]] && emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot dev-lang/python:3.6 [[ "${GENTOO_PYTHON_TARGETS}" == *"python3_5"* ]] && [[ ! -e /usr/lib64/libpython3.5m.so ]] && emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot dev-lang/python:3.5 [[ "${GENTOO_PYTHON_TARGETS}" == *"python3_4"* ]] && [[ ! -e /usr/lib64/libpython3.4m.so ]] && emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot dev-lang/python:3.4 [[ "${GENTOO_PYTHON_TARGETS}" == *"python2_7"* ]] && [[ ! -e /usr/lib64/libpython2.7.so ]] && emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot dev-lang/python:2.7 # disable python in git if we have to, it only supports python-2.7 [[ "${GENTOO_PYTHON_TARGETS}" != *"python2_7"* ]] && echo 'dev-vcs/git -python' >> /etc/portage/package.use/git # make sure we have the new python for portage bevore we possibly remove python 2.7 # this is done one by one with nodeps because it can sometimes have dependency loops PYTHON_PACKAGES="dev-python/six dev-python/packaging dev-python/appdirs dev-python/setuptools dev-python/pyparsing dev-python/certifi" for PACKAGE in ${PYTHON_PACKAGES}; do emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot --update --newuse --deep --nodeps "${PACKAGE}" done emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot --update --newuse --deep --complete-graph=y sys-apps/portage dev-python/pyxattr # set the active python version eselect python set ${GENTOO_PYTHON_ACTIVE_VERSION} # allow these uninstalls to fail as they may not be installed to begin with set +e [[ "${GENTOO_PYTHON_TARGETS}" != *"python2_7"* ]] && emerge -C -q dev-lang/python:2.7 [[ "${GENTOO_PYTHON_TARGETS}" != *"python3_4"* ]] && emerge -C -q dev-lang/python:3.4 [[ "${GENTOO_PYTHON_TARGETS}" != *"python3_5"* ]] && emerge -C -q dev-lang/python:3.5 [[ "${GENTOO_PYTHON_TARGETS}" != *"python3_6"* ]] && emerge -C -q dev-lang/python:3.6 set -e # make world consistant emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --complete-graph=y --update --newuse --deep @world # rebuild packages that might need it emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --usepkg=n @preserved-rebuild # remove unneeded packages emerge --verbose=n --depclean # rebuild packages that might have somehow depended on the unneeded packages emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --usepkg=n @preserved-rebuild unfix_shm ././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-03-enable-overlaysdiskimage-builder-2.35.0/diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-03-enable-overlay0000775000175000017500000000205013640271474033222 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [[ ${GENTOO_OVERLAYS} != '' ]]; then if mountpoint -q /dev/shm; then echo "/dev/shm found in /proc/self/mountinfo" elif [[ -k /dev/shm ]]; then echo "/dev/shm exists and is stickied" else fix_shm fi if [[ ! -f ${PORTDIR}/profiles ]]; then emerge-webrsync -q fi # upstream has problems with supporting other libcs still if [[ "${GENTOO_PROFILE}" == *"musl"* ]]; then echo '=sys-block/open-iscsi-2.0.877' >> /etc/portage/package.keywords/open-iscsi fi emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot openssl openssh # install layman emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot --deep --ignore-built-slot-operator-deps=y layman # sync the initial overlay list layman -S # enable the various overlays, ignore failures (overlay my already be enabled) set +e for OVERLAY in ${GENTOO_OVERLAYS}; do layman -a "${OVERLAY}" done set -e unfix_shm fi diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-02-flags0000775000175000017500000000345413640271474031421 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # get the directories in order mkdir -p /etc/portage/profile if [ -f /etc/portage/package.keywords ]; then mv /etc/portage/package.keywords /etc/portage/package.keywords.bak mkdir -p /etc/portage/package.keywords mv /etc/portage/package.keywords.bak /etc/portage/package.keywords/prebuilt-1 else mkdir -p /etc/portage/package.keywords fi [ -d /etc/portage/package.accept_keywords ] && mv /etc/portage/package.accept_keywords/* /etc/portage/package.keywords/ && rmdir /etc/portage/package.accept_keywords [ -f /etc/portage/package.accept_keywords ] && mv /etc/portage/package.accept_keywords /etc/portage/package.keywords/prebuilt-2 mkdir -p /etc/portage/package.mask mkdir -p /etc/portage/package.unmask mkdir -p /etc/portage/package.use # needed in order to install pip packages as root echo 'dev-python/pip vanilla' >> /etc/portage/package.use/pip # needed to create disk images echo 'sys-fs/lvm2 -thin' >> /etc/portage/package.use/grub echo 'sys-boot/grub device-mapper' >> /etc/portage/package.use/grub # needed in order to install pip packages as root echo '=dev-python/pip-9.0.1-r2 ~amd64' >> /etc/portage/package.keywords/pip if [[ "${GENTOO_PROFILE}" == *"systemd"* ]]; then # systemd import-tar is broken, use a more recent (fixed) version echo '~sys-apps/systemd-241 ~amd64' >> /etc/portage/package.keywords/systemd fi if [[ "${GENTOO_PROFILE}" == *"musl"* ]]; then echo "dev-vcs/git -gpg" >> /etc/portage/package.use/musl # gpg doesn't build on musl profiles echo "=sys-block/open-iscsi-2.0.874-r1 ~amd64" >> /etc/portage/package.keywords/musl echo "=sys-block/open-isns-0.97 ~amd64" >> /etc/portage/package.keywords/musl echo "sys-libs/pam cracklib" >> /etc/portage/package.use/musl fi diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/pre-install.d/02-gentoo-01-migrate-pax0000775000175000017500000000030613640271474032533 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # migrate pt_pax flags to xt_pax if [[ -a /usr/sbin/migrate-pax ]]; then /usr/sbin/migrate-pax -m fi diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/test-elements/0000775000175000017500000000000013640271564026557 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/test-elements/build-succeeds/0000775000175000017500000000000013640271564031452 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/test-elements/build-succeeds/README.rst0000664000175000017500000000006413640271474033141 0ustar zuulzuul00000000000000Test that we can successfully build a gentoo image. diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/test-elements/build-succeeds/element-deps0000664000175000017500000000000513640271474033752 0ustar zuulzuul00000000000000base diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/package-installs.yaml0000664000175000017500000000004313640271474030071 0ustar zuulzuul00000000000000sys-fs/dosfstools: app-admin/sudo: diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/README.rst0000664000175000017500000000475413640271474025467 0ustar zuulzuul00000000000000======== Gentoo ======== Use a Gentoo cloud image as the baseline for built disk images. The images are located in profile specific sub directories: http://distfiles.gentoo.org/releases/amd64/autobuilds/ As of this writing, only x86_64 images are available. Notes: * There are very frequently new automated builds that include changes that happen during the product maintenance. The download directories contain an unversioned name and a versioned name. The unversioned name will always point to the latest image, but will frequently change its content. The versioned one will never change content, but will frequently be deleted and replaced by a newer build with a higher version-release number. * In order to run the package-installs element you will need to make sure `dev-python/pyyaml` is installed on the host. * In order to run the vm element you will need to make sure `sys-block/parted` is installed on the host. * Other profiles can be used by exporting GENTOO_PROFILE with a valid profile. A list of valid profiles follows: default/linux/amd64/17.1 default/linux/amd64/17.1/no-multilib default/linux/amd64/17.1/hardened default/linux/amd64/17.1/no-multilib/hardened default/linux/amd64/17.1/systemd * You can set the `GENTOO_PORTAGE_CLEANUP` environment variable to False to disable the clean up of portage repositories (including overlays). This will make the image bigger if caching is also disabled. * Gentoo supports many different versions of python, in order to select one you may use the `GENTOO_PYTHON_TARGETS` environment variable to select the versions of python you want on your image. The format of this variable is a string as follows `"python2_7 python3_6"`. * In addition you can select the primary python version you wish to use (that which will be called by running the `python` command. The `GENTOO_PYTHON_ACTIVE_VERSION` is used to set that mapping. The variable contents can be something like `python3.6`. * You can enable overlays using the `GENTOO_OVERLAYS` variable. In it you should put a space separated list of overlays. The overlays must be in the official overlay list and must be git based. * `GENTOO_EMERGE_ENV` is a bash array containing default environment variables for package install, you can override it with another bash array. * `GENTOO_EMERGE_DEFAULT_OPTS` can be set to control the default options passed to emerge for all package actions, this includes operations like depclean and preserved-rebuild. diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/element-provides0000664000175000017500000000002113640271474027164 0ustar zuulzuul00000000000000operating-system diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/element-deps0000664000175000017500000000004713640271474026274 0ustar zuulzuul00000000000000cache-url install-bin package-installs diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/environment.d/0000775000175000017500000000000013640271564026554 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/environment.d/00-gentoo-envars.bash0000664000175000017500000000264313640271474032424 0ustar zuulzuul00000000000000export DIB_RELEASE=gentoo export DISTRO_NAME=gentoo export GENTOO_PROFILE=${GENTOO_PROFILE:-'default/linux/amd64/17.1'} export GENTOO_PORTAGE_CLEANUP=${GENTOO_PORTAGE_CLEANUP:-'True'} export GENTOO_PYTHON_TARGETS=${GENTOO_PYTHON_TARGETS:-'python2_7 python3_6'} export GENTOO_PYTHON_ACTIVE_VERSION=${GENTOO_PYTHON_ACTIVE_VERSION:-'python3.6'} export GENTOO_OVERLAYS=${GENTOO_OVERLAYS:-''} export GENTOO_EMERGE_DEFAULT_OPTS=${GENTOO_EMERGE_DEFAULT_OPTS:-"--binpkg-respect-use --rebuilt-binaries=y --usepkg=y --with-bdeps=y --binpkg-changed-deps=y --quiet --jobs=2 --autounmask=n"} # set the default bash array if GENTOO_EMERGE_ENV is not defined as an array if ! declare -p GENTOO_EMERGE_ENV 2> /dev/null | grep -q '^declare \-a'; then declare -a GENTOO_EMERGE_ENV GENTOO_EMERGE_ENV+=("USE=\"-build\"") GENTOO_EMERGE_ENV+=("FEATURES=\"binpkg-multi-instance buildpkg parallel-fetch parallel-install\"") GENTOO_EMERGE_ENV+=("PKGDIR=\"/tmp/portage-pkgdir\"") GENTOO_EMERGE_ENV+=("DISTDIR=\"/tmp/portage-distdir\"") GENTOO_EMERGE_ENV+=("PORTDIR=\"/tmp/portage-portdir\"") export GENTOO_EMERGE_ENV fi # itterate over the array, exporting each 'line' for (( i=0; i<${#GENTOO_EMERGE_ENV[@]}; i++ )); do eval export "${GENTOO_EMERGE_ENV[i]}" done if [[ "${GENTOO_PROFILE}" == *"systemd"* ]]; then export DIB_INIT_SYSTEM=${DIB_INIT_SYSTEM:-'systemd'} else export DIB_INIT_SYSTEM=${DIB_INIT_SYSTEM:-'openrc'} fi diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/finalise.d/0000775000175000017500000000000013640271564026002 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/finalise.d/99-cleanup0000775000175000017500000000260613640271474027622 0ustar zuulzuul00000000000000#!/bin/bash if [[ ${DIB_DEBUG_TRACE:-0} -gt 0 ]]; then set -x fi set -eu set -o pipefail if mountpoint -q /dev/shm; then echo "/dev/shm found in /proc/self/mountinfo" elif [[ -k /dev/shm ]]; then echo "/dev/shm exists and is stickied" else fix_shm fi # sync if needed [[ ! -e ${PORTDIR}/profiles ]] && emerge-webrsync # make world consistent emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --complete-graph=y --update --newuse --deep @world # rebuild packages that might need it emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --usepkg=n @preserved-rebuild # remove unneeded packages emerge --verbose=n --depclean # rebuild packages that might have somehow depended on the unneeded packages emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --usepkg=n @preserved-rebuild # update config files etc-update --automode -5 # clean up portage files emerge --verbose=n --depclean emaint all -f eselect news read all if [[ "${GENTOO_PORTAGE_CLEANUP}" != "False" ]]; then # remove the overlays if [[ ${GENTOO_OVERLAYS} != '' ]]; then for OVERLAY in ${GENTOO_OVERLAYS}; do layman -d "${OVERLAY}" done fi fi unfix_shm # remove within the chroot since /var/run is a symlink rm -Rf /var/run/* /run/* # after updating, set profile to where PORTDIR actually is (varies by profile) ln -sf ../.."$(env -u PORTDIR portageq get_repo_path / gentoo)/profiles/${GENTOO_PROFILE}" /etc/portage/make.profile diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/root.d/0000775000175000017500000000000013640271564025173 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/root.d/10-gentoo-image0000775000175000017500000001060113640271474027710 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2016 Matthew Thode # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then set -x fi set -eu set -o pipefail [ -n "${ARCH}" ] [ -n "${TARGET_ROOT}" ] if [ 'amd64' = "${ARCH}" ] ; then ARCH='x86_64' fi if ! [ 'x86_64' = "${ARCH}" ] ; then echo "Only x86_64 images are currently available but ARCH is set to ${ARCH}." exit 1 fi # valid gentoo profiles are as follows # default/linux/amd64/13.0 # default/linux/amd64/13.0/no-multilib # hardened/linux/amd64 # hardened/linux/amd64/no-multilib GENTOO_PROFILE=${GENTOO_PROFILE:-'default/linux/amd64/17.1'} if [[ "${GENTOO_PROFILE}" == "default/linux/amd64/17.1" ]]; then FILENAME_BASE='gentoo-stage4' SIGNED_SOURCE_SUFFIX='minimal' elif [[ "${GENTOO_PROFILE}" == "default/linux/amd64/17.1/no-multilib" ]]; then FILENAME_BASE='gentoo-stage4-nomultilib' SIGNED_SOURCE_SUFFIX='minimal-nomultilib' elif [[ "${GENTOO_PROFILE}" == "default/linux/amd64/17.1/hardened" ]]; then FILENAME_BASE='gentoo-stage4-hardened' SIGNED_SOURCE_SUFFIX='hardened+minimal' elif [[ "${GENTOO_PROFILE}" == "default/linux/amd64/17.1/no-multilib/hardened" ]]; then FILENAME_BASE='gentoo-stage4-hardened-nomultilib' SIGNED_SOURCE_SUFFIX='hardened+minimal-nomultilib' elif [[ "${GENTOO_PROFILE}" == "default/linux/amd64/17.1/systemd" ]]; then FILENAME_BASE='gentoo-stage4-systemd' SIGNED_SOURCE_SUFFIX='systemd' else echo 'invalid profile, please select from the following profiles' echo 'default/linux/amd64/17.1' echo 'default/linux/amd64/17.1/no-multilib' echo 'default/linux/amd64/17.1/hardened' echo 'default/linux/amd64/17.1/no-multilib/hardened' echo 'default/linux/amd64/17.1/systemd' exit 1 fi DIB_CLOUD_SOURCE=${DIB_CLOUD_SOURCE:-"http://distfiles.gentoo.org/releases/amd64/autobuilds/latest-stage4-amd64-${SIGNED_SOURCE_SUFFIX}.txt"} BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-"http://distfiles.gentoo.org/releases/amd64/autobuilds/$(curl ${DIB_CLOUD_SOURCE} -s -f | tail -n 1 | cut -d\ -f 1)"} BASE_IMAGE_FILE_SUFFIX=${BASE_IMAGE_FILE_SUFFIX:-"$(basename ${BASE_IMAGE_FILE} | cut -d. -f 2,3)"} SIGNATURE_FILE="${SIGNATURE_FILE:-${BASE_IMAGE_FILE}.DIGESTS.asc}" CACHED_FILE="${DIB_IMAGE_CACHE}/${FILENAME_BASE}.${BASE_IMAGE_FILE_SUFFIX}" CACHED_SIGNATURE_FILE="${DIB_IMAGE_CACHE}/${FILENAME_BASE}.asc" if [ -n "${DIB_OFFLINE}" -a -f "${CACHED_FILE}" ] ; then echo "Not checking freshness of cached ${CACHED_FILE}" else echo 'Fetching Base Image' "${TMP_HOOKS_PATH}"/bin/cache-url "${SIGNATURE_FILE}" "${CACHED_SIGNATURE_FILE}" "${TMP_HOOKS_PATH}"/bin/cache-url "${BASE_IMAGE_FILE}" "${CACHED_FILE}" pushd "${DIB_IMAGE_CACHE}" # import the key # this key can be verified at one of the following places # https://wiki.gentoo.org/wiki/Project:RelEng#Keys # https://dev.gentoo.org/~dolsen/releases/keyrings/gentoo-keys-*.tar.xz # http://distfiles.gentoo.org/distfiles/gentoo-keys-*.tar.xz GPGDIR=$(mktemp -d -t) gpg --no-default-keyring --keyring "${GPGDIR}"/gentookeys.gpg --import "${TMP_HOOKS_PATH}"/extra-data.d/gentoo-releng.gpg # check the sig file gpgv --keyring "${GPGDIR}"/gentookeys.gpg "${CACHED_SIGNATURE_FILE}" if [[ "${?}" != 0 ]]; then echo 'invalid signature file' exit 1 fi rm -rf "${GPGDIR}" echo 'valid key used' CACHED_SHA512SUM=$(grep -A1 -e 'SHA512' "${CACHED_SIGNATURE_FILE}" | grep -e "${BASE_IMAGE_FILE_SUFFIX}$" | cut -d\ -f 1) ACTUAL_SHA512SUM=$(sha512sum "${CACHED_FILE}" | cut -d\ -f 1) if [[ "${ACTUAL_SHA512SUM}" != "${CACHED_SHA512SUM}" ]]; then echo "invalid checksum on downloaded tarball: ${CACHED_FILE}" exit 1 fi echo 'valid checksum' popd fi # Extract the base image (use --numeric-owner to avoid UID/GID mismatch between # image tarball and host OS) sudo tar -C "${TARGET_ROOT}" --numeric-owner --xattrs -xf "${CACHED_FILE}" diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/root.d/50-gentoo-cache0000775000175000017500000000140313640271474027675 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail [ -n "${TARGET_ROOT}" ] GENTOO_PORTAGE_DISTFILES_DIR="${DIB_IMAGE_CACHE}/gentoo/distfiles" GENTOO_PORTAGE_PACKAGE_DIR="${DIB_IMAGE_CACHE}/gentoo/packages/${GENTOO_PROFILE}" GENTOO_PORTAGE_DIR="${DIB_IMAGE_CACHE}/gentoo/portage" mkdir -p "${GENTOO_PORTAGE_DIR}" "${GENTOO_PORTAGE_PACKAGE_DIR}" "${GENTOO_PORTAGE_DISTFILES_DIR}" mkdir -p "${TMP_MOUNT_PATH}${PORTDIR}" sudo mount --bind "${GENTOO_PORTAGE_DIR}" "${TMP_MOUNT_PATH}${PORTDIR}" mkdir -p "${TMP_MOUNT_PATH}${DISTDIR}" sudo mount --bind "${GENTOO_PORTAGE_DISTFILES_DIR}" "${TMP_MOUNT_PATH}${DISTDIR}" mkdir -p "${TMP_MOUNT_PATH}${PKGDIR}" sudo mount --bind "${GENTOO_PORTAGE_PACKAGE_DIR}" "${TMP_MOUNT_PATH}${PKGDIR}" diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/pre-finalise.d/0000775000175000017500000000000013640271564026566 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/gentoo/pre-finalise.d/01-gentoo-cache0000775000175000017500000000120713640271474031266 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail GENTOO_PORTAGE_DISTFILES_DIR="${DIB_IMAGE_CACHE}/gentoo/distfiles" GENTOO_PORTAGE_PACKAGE_DIR="${DIB_IMAGE_CACHE}/gentoo/packages/${GENTOO_PROFILE}" GENTOO_PORTAGE_DIR="${DIB_IMAGE_CACHE}/gentoo/portage" mkdir -p "${TMP_MOUNT_PATH}${PORTDIR}" sudo mount --bind "${GENTOO_PORTAGE_DIR}" "${TMP_MOUNT_PATH}${PORTDIR}" mkdir -p "${TMP_MOUNT_PATH}${DISTDIR}" sudo mount --bind "${GENTOO_PORTAGE_DISTFILES_DIR}" "${TMP_MOUNT_PATH}${DISTDIR}" mkdir -p "${TMP_MOUNT_PATH}${PKGDIR}" sudo mount --bind "${GENTOO_PORTAGE_PACKAGE_DIR}" "${TMP_MOUNT_PATH}${PKGDIR}" diskimage-builder-2.35.0/diskimage_builder/elements/ilo/0000775000175000017500000000000013640271564023256 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ilo/extra-data.d/0000775000175000017500000000000013640271564025532 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ilo/extra-data.d/50-ilo-firmware0000775000175000017500000000131113640271474030273 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ -z "${DIB_ILO_FIRMWARE_PATH:-}" ]; then echo "DIB_ILO_FIRMWARE_PATH not set in ilo element" >&2 exit 0 fi if [ ! -d "${DIB_ILO_FIRMWARE_PATH}" ]; then echo "Firmware path not found: ${DIB_ILO_FIRMWARE_PATH}" exit 1 fi # We copy to /tmp because its temporary - we do a mv later into the initramfs # image. mkdir -p "$TMP_MOUNT_PATH/tmp/ilo/" find "${DIB_ILO_FIRMWARE_PATH}" -type f \( -name '*.scexe' -o -name '*.exe' \) | while read FWNAME do TARGET="$TMP_MOUNT_PATH/tmp/ilo/$(basename "$FWNAME")" echo Unpacking $FWNAME to $TARGET bash "$FWNAME" "--unpack=$TARGET" echo Done done diskimage-builder-2.35.0/diskimage_builder/elements/ilo/init.d/0000775000175000017500000000000013640271564024443 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ilo/init.d/50-ilo-firmware0000664000175000017500000000133513640271474027207 0ustar zuulzuul00000000000000if [ -d /ilo ]; then find /ilo -type f \( -name flash_ilo3 -o -name flash_ilo4 \) | while read FWNAME do cd "$(dirname "$FWNAME")" logname="$(basename "$(dirname "$FWNAME")").log" echo Running $FWNAME "$FWNAME" --silent --log "$logname" result=$? echo Finished $FWNAME with result $? cat "$logname" #avoid leaking space during large runs rm "$logname" if [ $result -eq 2 ]; then echo "Firmware already up to date" elif [ $result -eq 4 ]; then echo "Firmware not applicable to machine" elif [ $result -ne 0 ]; then echo "Error applying firmware" troubleshoot fi done fi diskimage-builder-2.35.0/diskimage_builder/elements/ilo/README.rst0000664000175000017500000000131513640271474024745 0ustar zuulzuul00000000000000=== ilo === Ramdisk support for applying HP iLO firmware. The firmware files are copied in via an extra-data hook: the variable DIB\_ILO\_FIRMWARE\_PATH specifies a directory, and every file in that directory will be unpacked into a same-named directory in the ramdisk (using --unpack=...). If the path is not specified, a diagnostic is output but no error is triggered. During ramdisk init every found firmware installer will be executed using --silent --log=log The log is displayed after the firmware has executed. If the firmware exits with status 0 (ok), status 2 (same or older version) or 4 (ilo not detected) a diagnostic message is logged and init proceeds. Any other status code is treated as an error. diskimage-builder-2.35.0/diskimage_builder/elements/ilo/ramdisk-install.d/0000775000175000017500000000000013640271564026576 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ilo/ramdisk-install.d/50-ilo-firmware0000775000175000017500000000024513640271474031344 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ ! -d /tmp/ilo ]; then exit 0 fi mv /tmp/ilo "$TMP_MOUNT_PATH" diskimage-builder-2.35.0/diskimage_builder/elements/disable-selinux/0000775000175000017500000000000013640271564025563 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/disable-selinux/post-install.d/0000775000175000017500000000000013640271564030436 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/disable-selinux/post-install.d/15-disable-selinuxdiskimage-builder-2.35.0/diskimage_builder/elements/disable-selinux/post-install.d/15-disable-selinu0000775000175000017500000000030313640271474033503 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail config=/etc/selinux/config [ -e $config ] && sed -i "s%^\(SELINUX=\s*\).*$%SELINUX=disabled%" $config diskimage-builder-2.35.0/diskimage_builder/elements/disable-selinux/README.rst0000664000175000017500000000011213640271474027244 0ustar zuulzuul00000000000000disable-selinux --------------- Including this element disables SELinux. diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/0000775000175000017500000000000013640271564023420 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/extra-data.d/0000775000175000017500000000000013640271564025674 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/extra-data.d/01-copy-apt-keys0000775000175000017500000000214513640271474030547 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail DIB_ADD_APT_KEYS=${DIB_ADD_APT_KEYS:-""} if [ -z "${DIB_ADD_APT_KEYS}" ]; then echo "DIB_ADD_APT_KEYS is not set - not importing keys" exit 0 fi DIR=${TMP_MOUNT_PATH}/tmp/apt_keys if [ -e ${DIR} ]; then echo "${DIR} already exists!" exit 1 fi sudo mkdir -p ${DIR} # dib-lint: safe_sudo # Copy to DIR for KEY in $(find ${DIB_ADD_APT_KEYS} -type f); do sudo cp -L ${KEY} ${DIR} # dib-lint: safe_sudo done diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/bin/0000775000175000017500000000000013640271564024170 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/bin/install-packages0000775000175000017500000000411013640271474027334 0ustar zuulzuul00000000000000#!/bin/bash # Copyright 2012 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail # install-packages package [package ...] ACTION=install MAP_ELEMENT="" SCRIPTNAME=$(basename $0) function show_options () { echo "Usage: $SCRIPTNAME [package ...]" echo echo "Options:" echo " -u -- update all packages" echo " -e -- erase/remove packages" echo " -m -- use custom element package map (Example: -m nova)" exit 0 } install_deb_packages () { DEBIAN_FRONTEND=noninteractive \ http_proxy=${http_proxy:-} https_proxy=${https_proxy:-} \ no_proxy=${no_proxy:-} \ apt-get --option "Dpkg::Options::=--force-confold" \ --option "Dpkg::Options::=--force-confdef" --assume-yes "$@" } TEMP=$(getopt -o hudem: -n $SCRIPTNAME -- "$@") if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi eval set -- "$TEMP" while true ; do case "$1" in -u) install_deb_packages dist-upgrade; exit 0;; -e) ACTION="remove"; shift;; -m) MAP_ELEMENT=$2; shift 2;; -h) show_options;; --) shift; break ;; *) echo "Error: unsupported option $1."; exit 1;; esac done PKGS=$@ if [ -n "$MAP_ELEMENT" ]; then if ! PKGS=$(pkg-map --element $MAP_ELEMENT $@); then echo "bin/pkg-map error. $PKGS" exit 1 fi fi if [ -z "${PKGS}" ]; then echo "Not running install-packages $ACTION with empty packages list" else install_deb_packages $ACTION $PKGS fi diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/cleanup.d/0000775000175000017500000000000013640271564025271 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/cleanup.d/40-unblock-daemons0000775000175000017500000000055413640271474030525 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail [ -n "$TARGET_ROOT" ] sudo mv $TARGET_ROOT/sbin/start-stop-daemon.REAL $TARGET_ROOT/sbin/start-stop-daemon if [ -f $TARGET_ROOT/sbin/initctl.REAL ]; then sudo mv $TARGET_ROOT/sbin/initctl.REAL $TARGET_ROOT/sbin/initctl fi sudo rm $TARGET_ROOT/usr/sbin/policy-rc.d diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/cleanup.d/60-untrim-dpkg0000775000175000017500000000034013640271474027700 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail [ -n "$TARGET_ROOT" ] sudo rm $TARGET_ROOT/etc/dpkg/dpkg.cfg.d/02apt-speedup sudo rm $TARGET_ROOT/etc/apt/apt.conf.d/no-languages diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/cleanup.d/50-remove-img-build-proxy0000775000175000017500000000031213640271474031760 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail [ -n "$TARGET_ROOT" ] # Undo our proxy support sudo rm -f $TARGET_ROOT/etc/apt/apt.conf.d/60img-build-proxy diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/pre-install.d/0000775000175000017500000000000013640271564026074 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/pre-install.d/02-add-apt-keys0000775000175000017500000000201113640271474030516 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail KEY_DIRECTORY=/tmp/apt_keys if [ ! -d "${KEY_DIRECTORY}" ]; then exit 0 fi for KEY in ${KEY_DIRECTORY}/*; do if ! file -b "${KEY}" | grep -qE '(PGP public key block|GPG key public ring)'; then echo "Skipping ${KEY}, not a valid GPG public key" continue fi apt-key add ${KEY} done apt-get -y update diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/pre-install.d/00-disable-apt-recommends0000775000175000017500000000041013640271474032551 0ustar zuulzuul00000000000000#!/bin/bash # Prevent apt from installing recommended packages if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail dd of=/etc/apt/apt.conf.d/95disable-recommends << _EOF_ APT::Install-Recommends "0"; Apt::Install-Suggests "0"; _EOF_ diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/pre-install.d/99-apt-get-update0000775000175000017500000000025213640271474031101 0ustar zuulzuul00000000000000#!/bin/bash # Do an apt-get update, so that packages can be installed. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail apt-get -y update diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/README.rst0000664000175000017500000000276213640271474025116 0ustar zuulzuul00000000000000==== dpkg ==== Provide dpkg specific image building glue. The ubuntu element needs customisations at the start and end of the image build process that do not apply to RPM distributions, such as using the host machine HTTP proxy when installing packages. These customisations live here, where they can be used by any dpkg based element. The dpkg specific version of install-packages is also kept here. Environment Variables --------------------- DIB_ADD_APT_KEYS :Required: No :Default: None :Description: If an extra or updated apt key is needed then define ``DIB_ADD_APT_KEYS`` with the path to a folder. Any key files inside will be added to the key ring before any apt-get commands take place. :Example: ``DIB_ADD_APT_KEYS=/etc/apt/trusted.gpg.d`` DIB_APT_LOCAL_CACHE :Required: No :Default: 1 :Description: By default the ``$DIB_IMAGE_CACHE/apt/$DISTRO_NAME`` directory is mounted in ``/var/cache/apt/archives`` to cache the .deb files downloaded during the image creation. Use this variable if you wish to disable the internal cache of the ``/var/cache/apt/archives`` directory :Example: ``DIB_APT_LOCAL_CACHE=0`` will disable internal caching. DIB_DISABLE_APT_CLEANUP :Required: No :Default: 0 :Description: At the end of a dib run we clean the apt cache to keep the image size as small as possible. Use this variable to prevent cleaning the apt cache at the end of a dib run. :Example: ``DIB_DISABLE_APT_CLEANUP=1`` will disable cleanup. .. element_deps:: diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/element-deps0000664000175000017500000000004713640271474025726 0ustar zuulzuul00000000000000install-bin manifests package-installs diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/finalise.d/0000775000175000017500000000000013640271564025434 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/finalise.d/99-write-dpkg-manifest0000775000175000017500000000253013640271474031502 0ustar zuulzuul00000000000000#!/bin/bash # # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then set -x fi set -eu set -o pipefail DPKG_MANIFEST_NAME=dib-manifest-dpkg-$(basename ${IMAGE_NAME}) # Write the json preamble echo '{"packages": [' > ${DIB_MANIFEST_IMAGE_DIR}/${DPKG_MANIFEST_NAME} # Write a json-format output for the packages installed format='{"package": "${binary:Package}","arch": "${Architecture}","version": "${Version}","status": "${db:Status-Abbrev}"},' # Use the configurable dpkg --show output as a manifest dpkg-query --show --showformat="${format}" | tee -a ${DIB_MANIFEST_IMAGE_DIR}/${DPKG_MANIFEST_NAME} # Finish off the json structure and make it easier for human inspection sed -i -e 's/,$/\n]}/g' -e 's/\(},\)/ \1\n/g' ${DIB_MANIFEST_IMAGE_DIR}/${DPKG_MANIFEST_NAME} diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/finalise.d/99-clean-up-cache0000775000175000017500000000033013640271474030362 0ustar zuulzuul00000000000000#!/bin/bash # Do an apt-get clean. This will free some space. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail if [ "${DIB_DISABLE_APT_CLEANUP:-0}" != "1" ]; then apt-get clean fi diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/root.d/0000775000175000017500000000000013640271564024625 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/root.d/50-trim-dpkg0000775000175000017500000000062313640271474026674 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail [ -n "$TARGET_ROOT" ] # During image build, sync calls are expensive overhead echo 'force-unsafe-io' | sudo tee $TARGET_ROOT/etc/dpkg/dpkg.cfg.d/02apt-speedup > /dev/null # and remove the translations, too echo 'Acquire::Languages "none";' | sudo tee $TARGET_ROOT/etc/apt/apt.conf.d/no-languages > /dev/null diskimage-builder-2.35.0/diskimage_builder/elements/dpkg/root.d/50-block-apt-translations0000775000175000017500000000074613640271474031377 0ustar zuulzuul00000000000000#!/bin/bash if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi set -eu set -o pipefail [ -n "$TARGET_ROOT" ] # Configure APT not to fetch translations files sudo dd of=$TARGET_ROOT/etc/apt/apt.conf.d/95no-translations <> /etc/modprobe.d/blacklist.conf done diskimage-builder-2.35.0/diskimage_builder/elements/modprobe-blacklist/README.rst0000664000175000017500000000074513640271474027745 0ustar zuulzuul00000000000000================== modprobe-blacklist ================== Blacklist specific modules using modprobe.d/blacklist.conf. In order to use set DIB_MODPROBE_BLACKLIST to the name of your module. To disable multiple modules you can set DIB_MODPROBE_BLACKLIST to a list of string separated by spaces. Example: export DIB_MODPROBE_BLACKLIST="igb" .. note:: This element has been deprecated and replaced by the modprobe element, that covers 100% the modprobe-blacklist functionality. diskimage-builder-2.35.0/diskimage_builder/elements/ensure-venv/0000775000175000017500000000000013640271564024750 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/diskimage_builder/elements/ensure-venv/package-installs.yaml0000664000175000017500000000001613640271474031053 0ustar zuulzuul00000000000000python3-venv: diskimage-builder-2.35.0/diskimage_builder/elements/ensure-venv/README.rst0000664000175000017500000000014013640271474026432 0ustar zuulzuul00000000000000=========== ensure-venv =========== A simple element to make sure `python3 -m venv` will work. diskimage-builder-2.35.0/diskimage_builder/elements/ensure-venv/element-deps0000664000175000017500000000002113640271474027246 0ustar zuulzuul00000000000000package-installs diskimage-builder-2.35.0/diskimage_builder/elements/ensure-venv/pkg-map0000664000175000017500000000044713640271474026234 0ustar zuulzuul00000000000000{ "family": { "debian": { "python3-venv": "python3-venv" }, "gentoo": { "python3-venv": "dev-lang/python" }, "redhat": { "python3-venv": "python3" }, "suse": { "python3-venv": "python3" } }, "default": { "python3-venv": "" } } diskimage-builder-2.35.0/requirements.txt0000664000175000017500000000106213640271474020477 0ustar zuulzuul00000000000000# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. Babel!=2.4.0,>=2.3.4 # BSD # NOTE(fdegir): NetworkX 2.3 dropped support for Python 2 networkx>=1.10,<2.3;python_version<'3.0' # BSD networkx>=1.10;python_version>='3.4' # BSD pbr!=2.1.0,>=2.0.0 # Apache-2.0 PyYAML>=3.12 # MIT six>=1.10.0 # MIT stevedore>=1.20.0 # Apache-2.0 # NOTE(ianw) in here because dib-lint uses flake8 flake8<4.0.0,>=3.6.0 # MIT diskimage-builder-2.35.0/test-requirements.txt0000664000175000017500000000072413640271474021460 0ustar zuulzuul00000000000000# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. pylint==1.7.6;python_version=='2.7' # GPLv2 pylint;python_version>'3.0' #GPLv2 fixtures>=3.0.0 # Apache-2.0/BSD mock>=2.0.0 # BSD oslotest>=3.2.0 # Apache-2.0 testrepository>=0.0.18 # Apache-2.0/BSD testtools>=2.2.0 # MIT coverage!=4.4,>=4.0 # Apache-2.0 diskimage-builder-2.35.0/releasenotes/0000775000175000017500000000000013640271564017705 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/releasenotes/source/0000775000175000017500000000000013640271564021205 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/releasenotes/source/conf.py0000664000175000017500000001662113640271474022512 0ustar zuulzuul00000000000000# Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = ['openstackdocstheme', 'reno.sphinxext'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'diskimage-builder' copyright = u'2016, Diskimage-builder contributors' # openstackdocstheme options repository_name = 'openstack/diskimage-builder' bug_project = 'diskimage-builder' bug_tag = '' html_last_updated_fmt = '%Y-%m-%d %H:%M' # Release notes do not need a version in the title, they span # multiple versions. # The short X.Y version. release = '' # The full version, including alpha/beta/rc tags. version = '' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'openstackdocs' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". #html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. #html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'diskimage-builderdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', 'diskimage-builder-releasenotes.tex', u'diskimage-builder Documentation', u'OpenStack', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'diskimage-builder', u'diskimage-builder Release Notes', [u'OpenStack'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'diskimage-builder', u'diskimage-builder Release Notes', u'OpenStack', 'diskimage-builder', 'Build disk images for CI and more.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False # -- Options for Internationalization output ------------------------------ locale_dirs = ['locale/'] diskimage-builder-2.35.0/releasenotes/source/index.rst0000664000175000017500000000016413640271474023047 0ustar zuulzuul00000000000000=============================== diskimage-builder Release Notes =============================== .. release-notes:: diskimage-builder-2.35.0/releasenotes/notes/0000775000175000017500000000000013640271564021035 5ustar zuulzuul00000000000000diskimage-builder-2.35.0/releasenotes/notes/runtime-ssh-host-keys-7a2fc873cc90d33e.yaml0000664000175000017500000000045313640271474030425 0ustar zuulzuul00000000000000--- features: - New element (runtime-ssh-host-keys) to manage SSH host keys at boot. Since SSH host key generation is not standard across operating systems, add support for both Debian and Ubuntu to handle it. While this is a new element, simple-init has been updated to depend on it. diskimage-builder-2.35.0/releasenotes/notes/dracut-network-adaabf90da9f6866.yaml0000664000175000017500000000021613640271474027334 0ustar zuulzuul00000000000000--- deprecations: - The ``dracut-network`` element has been removed. It has not been functioning for some time due to incorrect paths. diskimage-builder-2.35.0/releasenotes/notes/opensuse-150-default-c047033b850d41ec.yaml0000664000175000017500000000054613640271474027635 0ustar zuulzuul00000000000000--- deprecations: - | Support in opensuse and opensuse-minimal for openSUSE 13.* has been removed as these are end of life. upgrade: - | The opensuse and opensuse-minimal element are now defaulting to build 15.0. Building for 42.2 and 42.3 is still supported, however requires setting DIB_RELEASE to '42.3' resp. '42.2' explicitly. diskimage-builder-2.35.0/releasenotes/notes/sysprep-fixes-8890b968a8fa7ac1.yaml0000664000175000017500000000071313640271474026776 0ustar zuulzuul00000000000000--- fixes: - | The sysprep element has been fixed to truncate ``/var/lib/dpkg/machine-id`` (``/etc/machine-id`` was already being truncated). This ensures a machine-id is not packaged in the image and systemd will be forced to generate a new one upon first boot. - | The sysprep element is added as a dependency to the ``debootstrap`` element to ensure that it runs on all Debian builds, including debian-minimal based images. diskimage-builder-2.35.0/releasenotes/notes/remove-solicit-delay-57a035b91922522a.yaml0000664000175000017500000000060013640271474027737 0ustar zuulzuul00000000000000--- deprecations: - | The ``DIB_SIMPLE_INIT_NETWORKMANAGER_IPV6_DELAY`` variable is removed as it turned out that increasing this delay increased the odds that NetworkManager would fail to configure IPv6 on an interface. Instead, glean has been updated to not up interfaces and relies on NetworkManager to do this. This results in reliable IPv4 and IPv6 config. diskimage-builder-2.35.0/releasenotes/notes/debian-security-b4f677a148fdf9c9.yaml0000664000175000017500000000040713640271474027331 0ustar zuulzuul00000000000000--- features: - | A new variable ``DIB_DEBIAN_SECURITY_SUBPATH`` is added to override the suite subpath of security repositories. Previously this was hard-coded to the upstream repository layout, which may not always match the mirror's layout. diskimage-builder-2.35.0/releasenotes/notes/sysprep-f3fd036bc1d2c405.yaml0000664000175000017500000000040613640271474025707 0ustar zuulzuul00000000000000--- features: - | Adds sysprep element included by all systemd distros fixes: - | Adds default sysprep element clearing /etc/machine-id which prevents duplicated /etc/machine-id by forcing systemd to generate a new id for each booted system. diskimage-builder-2.35.0/releasenotes/notes/pip-and-virtualenv-args-5d3f2512edd7f3a3.yaml0000664000175000017500000000053013640271474030670 0ustar zuulzuul00000000000000--- features: - | The ``pip-and-virtualenv`` element has added variables ``DIB_PYTHON_PIP`` and ``DIB_PYTHON_VIRTUALENV`` to make it more straight forward for other elements to install packages or create virtualenv environment deprecations: - | Source install for ``pip-and-virtualenv`` is deprecated for RHEL 8/CentOS 8diskimage-builder-2.35.0/releasenotes/notes/image-size-padding-mb-574104d40fdd2345.yaml0000664000175000017500000000023413640271474030020 0ustar zuulzuul00000000000000--- upgrade: - | The ``--image-extra-size`` argument has changed from gigabytes to megabytes to make it more practical for use on smaller images. diskimage-builder-2.35.0/releasenotes/notes/squashfs-output-91c1f0dc37474d3c.yaml0000664000175000017500000000006413640271474027327 0ustar zuulzuul00000000000000--- features: - New squashfs image output format. diskimage-builder-2.35.0/releasenotes/notes/1.18.1-ceeb514708dcb731.yaml0000664000175000017500000000042113640271474024735 0ustar zuulzuul00000000000000--- fixes: - Fix issue where ironic-agent did not work on ppc due to missing dmidecode. - Fix issue where we were unable to create empty tempdirs in the target image. - Revert change where we were installing virtualenv on centos with both system and python packages. diskimage-builder-2.35.0/releasenotes/notes/block-device-mkfs-mount-fstab-42d7efe28fc2df04.yaml0000664000175000017500000000011613640271474032022 0ustar zuulzuul00000000000000--- features: - | Adds mkfs, mount and fstab to the block device layer. diskimage-builder-2.35.0/releasenotes/notes/openssh-server-0f6d065748a2fc18.yaml0000664000175000017500000000017113640271474027043 0ustar zuulzuul00000000000000--- features: - New openssh-server element to ensure that the openssh server is installed and enabled during boot. diskimage-builder-2.35.0/releasenotes/notes/block-device-handling-279cddba8a859718.yaml0000664000175000017500000000174613640271474030276 0ustar zuulzuul00000000000000--- features: - Add new block device handling. Unify and generalize the creation and usage of block device. This release includes setting up the general infrastructure and setting up loop device issues: - Because the implementation of the new block device layer is not complete, some features which are already implemented cannot be used because of limitations of the current environment. deprecations: - The current way of handling block devices is deprecated. The existing block device phase will be called for a limited time. If this phase delivers a result, this is used; if there is no result, the new way of block device handling is used. Please note that the old way of block device handling has some major limitations such as that it is only possible to use one block device. - The element 'partitioning-sfdisk' is deprecated. The new implementation will create the partition tables based on a tool independent description. diskimage-builder-2.35.0/releasenotes/notes/upgrade-pip-before-c-d2443847f9d58c7a.yaml0000664000175000017500000000053013640271474027770 0ustar zuulzuul00000000000000--- fixes: - | This fixes bug 1744403 where 60-ironic-agent-install fails to run when DIB_INSTALLTYPE_ironic_agent=source is set. pip installs constraints with the -c argument and this argument is a relatively newer addion. The currently installed pip may not support that option and must be upgraded before proceeding. diskimage-builder-2.35.0/releasenotes/notes/dibv2-omnibus-b30e0c7ecd76db8d.yaml0000664000175000017500000001012513640271474027034 0ustar zuulzuul00000000000000--- prelude: >- Version 2.0.0 of diskimage-builder incorporates recent work from the feature/v2 branch. This includes incorporating some largely internal changes to the way it finds and calls elements, enhancements to partitioning and removal of some long-deprecated elements. If you use dib exclusively via the command-line disk-image-create installed from a package or via pypi you are unlikely to notice any difference (if you run it directly from a git-tree checkout, you may be affected). features: - | 2.0.0 includes a new framework for partitioning contributed by Andreas Florath. This should allow for creating multiple partitions, images with encryption, LVM support and flexibility for multiple-devices, all of which are currently not supported. Please check the v2 documentation, specs and reach out if these features interest you (some parts still in review). - | Element override is now supported. If you have an element of the same name earlier in the ``ELEMENTS_PATH``, it will override later instances (previously, the behaviour was undefined). upgrade: - | For purposes of both users and development we want dib to be as "pythonic" as possible and behave like all other projects. Two major visible changes are: - command-line scripts are entry points (i.e. need to be installed) - elements have moved under diskimage_create module The result of the first is that ``./bin/disk-image-create`` from the source tree is no longer there. Like all other projects, you should install dib into a virtualenv (if you're developing, use pip -e) and ``disk-image-create`` will "just work". The second change, moving the inbuilt elements under the ``diskimage_create`` module, is a simplification so we always have a canonical path to our elements. Since we now always know where elements are relative to the imported diskimage_builder module we can drop all the path guessing complexity. This has other good flow-on effects such as ``testr`` being able to find unit-tests for elements in the normal fashion and having imports work as usual. We are aware there are a number of tools that like to take dib elements and do things with them. Reading some of the dib source you may find there is a canonical way to find out the included dib elements path -- ask dib itself, something like .. code-block:: shell DIB_ELEMENTS=$(python -c ' import diskimage_builder.paths; diskimage_builder.paths.show_path("elements")') Note you probably do not want this. As mentioned, another feature of v2 is override elements -- an element that appears first in the element path-list will override any built-in one (just like $PATH). There is a function, ``diskimage_builder.get_elements()``, which will correctly process the element path, calculate overrides and return a canonical list of elements, their dependencies and correct paths. *That* said, you probably do not want this either! There are a number of elements that do things on behalf of other elements -- they look for a file in the included elements, say, and use that as a manifest for something. Previously, these would just have to make up their own element processing via inspection of the command-line arguments. dib now exports pre-computed variables that an element can walk for all the current build elements -- a YAML list for easy python decoding and a function that builds an array for Bash elements. deprecations: - | A number of long-deprecated elements have been removed in v2, which are to the best of our knowledge unused. - ``partitioning-sfdisk`` - ``deploy-ironic-element`` - ``ironc-discovered-ramdisk`` - ``serial-console-element`` - ``map-services`` - | We have removed and deprecated the ``dib-utils`` package. This was intended to be a more generic repository of tools that might be useful outside dib, but that did not eventuate and it has been folded back into dib for simplicity. diskimage-builder-2.35.0/releasenotes/notes/simple-init-nm-5d19e249c0a4560b.yaml0000664000175000017500000000034713640271474026720 0ustar zuulzuul00000000000000--- upgrade: - | The ``simple-init`` element will now default to using NetworkManager for CentOS and Fedora platforms. For CentOS 8 and Fedora, the ``DIB_SIMPLE_INIT_NETWORKMANAGER=0`` option is no longer supported. diskimage-builder-2.35.0/releasenotes/notes/opensuse-minimal-45267f5be1112c22.yaml0000664000175000017500000000043313640271474027251 0ustar zuulzuul00000000000000--- features: - New zypper-minimal and opensuse-minimal elements to create basic openSUSE images. These two new elements are also making use of the existing zypper element which has been extended to include the functionality previously present in the opensuse element. diskimage-builder-2.35.0/releasenotes/notes/rhel7-element-deprecation-b0c1b57be8cd06ac.yaml0000664000175000017500000000037413640271474031311 0ustar zuulzuul00000000000000--- deprecations: - | The rhel7 element is deprecated and is left only for backwards compatibility. Use the `rhel` element instead. Note that you should set DIB_RELEASE to 7 to indicate which release you are using. Please read the notes. diskimage-builder-2.35.0/releasenotes/notes/logfile-quiet-b18f2de4059eecfd.yaml0000664000175000017500000000033113640271474027126 0ustar zuulzuul00000000000000--- features: - | Setting ``--logfile`` will now imply ``DIB_QUIET=1`` (i.e. logs will not appear on stdout). You can override this with an explicit ``DIB_QUIET=0`` if you want stdout and file logging. diskimage-builder-2.35.0/releasenotes/notes/ensure-venv-d7c16a2a04fd3b8f.yaml0000664000175000017500000000100413640271474026540 0ustar zuulzuul00000000000000--- features: - | The `ensure-venv` module is added to ensure that `python3 -m venv` is available on the host. This can be useful if you wish to install non-distribution-packaged Python software on a host during build, but not mix any non-distro installation. This works on all platforms with Python 3 available. depreceations: - | The `simple-init` element now uses `ensure-venv` so is technically Python 3 only. At this stage, all supported platforms have Python 3 available.diskimage-builder-2.35.0/releasenotes/notes/element-info-entry-point-448bf622be6061a0.yaml0000664000175000017500000000057613640271474030725 0ustar zuulzuul00000000000000--- deprecations: - The ``element-info`` script is now provided by a standard python entry-point, rather than an explicit wrapper script. This may affect you if you were running this script directly out of ``bin`` in the source directory without installing. See developer notes for details on using developer-installs with virtual environments for testing. diskimage-builder-2.35.0/releasenotes/notes/bootloader-commandline-d2db7524f1f9ad28.yaml0000664000175000017500000000042313640271474030636 0ustar zuulzuul00000000000000--- other: - It has been clarified that the ``DIB_BOOTLOADER_DEFAULT_CMDLINE`` variable appends its values to grubs ``GRUB_CMDLINE_LINUX_DEFAULT``, which is used during all normal boots but not rescue boots; as opposed to applying to ``GRUB_CMDLINE_LINUX`` diskimage-builder-2.35.0/releasenotes/notes/add-modprobe-element-8e3b0287ebb11920.yaml0000664000175000017500000000062713640271474030040 0ustar zuulzuul00000000000000--- features: - Add new modprobe element. This element will replace modprobe-blacklist element. It wil still have the blacklist functionality, but it also adds the feature of passing a complete file with settings to the modprobe.d directory. Adding this functionality, that will allow elements that depends on this module, to just copy the specified files to the final directory. diskimage-builder-2.35.0/releasenotes/notes/centos-minimal-8-aca6314862741177.yaml0000664000175000017500000000015413640271474027000 0ustar zuulzuul00000000000000--- features: - | The ``centos-minimal`` supports CentOS 8 builds when run with ``DIB_RELEASE=8`` diskimage-builder-2.35.0/releasenotes/notes/efi-bootloader-disk-size-4c1a9f18967104fb.yaml0000664000175000017500000000034213640271474030654 0ustar zuulzuul00000000000000--- fixes: - | When using the ``block-device-efi`` element to create an EFI based system (most notably, with ARM64), the final disk size is now expanded for the 512MiB system EFI partition introduced with 2.24.0 diskimage-builder-2.35.0/releasenotes/notes/opensuse-423-default-3bc73fff69374cd0.yaml0000664000175000017500000000036313640271474030021 0ustar zuulzuul00000000000000--- upgrade: - | The opensuse and opensuse-minimal element are now defaulting to 42.3, which is the latest stable openSUSE release. Building for 42.2 is still supported, however requires setting DIB_RELEASE to '42.2' explicitly. diskimage-builder-2.35.0/releasenotes/notes/move_tidy_logs_to_main-a8c03427fe1a445c.yaml0000664000175000017500000000060613640271474030662 0ustar zuulzuul00000000000000--- features: - Cleaning logs was split, some was done in the img-functions.finalise_base, some was done in the base element. The version unifies tidy up logs in the lib/img-functions. Especially when building docker container images the base element cannot be used. This patch removes about some hundreds KB of useless logs in cases when the base element is not used.diskimage-builder-2.35.0/releasenotes/notes/element-vars-c6bf2e6795002f01.yaml0000664000175000017500000000033313640271474026453 0ustar zuulzuul00000000000000--- features: - Elements that need access to the other elements being used during the build should use the new ``IMAGE_ELEMENT_YAML`` environment variable and it's Bash equivalent ``get_image_element_array``.diskimage-builder-2.35.0/releasenotes/notes/simple-init-nm-delay-f579e05467785219.yaml0000664000175000017500000000077113640271474027627 0ustar zuulzuul00000000000000--- fixes: - | The ``DIB_SIMPLE_INIT_NETWORKMANAGER_IPV6_DELAY`` variable is added for the ``simple-init`` element to set the ``net.ipv6.conf.default.router_solicition_delay`` sysctl setting (it defaults to 30s). If you are seeing an extra "blank" interface in ``nmcli con show`` it is likely that NM has not correctly configured itself in the presence of an interface already configured with IPV6 by the kernel. Increasing this value may help work-around the problem. diskimage-builder-2.35.0/releasenotes/notes/timestamp-43015aa5434e8ddb.yaml0000664000175000017500000000122513640271474026127 0ustar zuulzuul00000000000000--- features: - A ``--logfile`` option is added to save output to a given file. - By default, all ``stdout`` will log with timestamps (this used to be inconsistent; python tools logged with a timestamp, and bash parts did not). If you set ``DIB_NO_TIMESTAMP`` to ``1`` the timestamp prefix will be suppressed (this would be appropriate if you are running diskimage-builder and capturing its output, and adding your own timestamp). Note that output to ``--logfile`` will always be timestamped. - You can set ``DIB_QUIET`` to ``1`` to suppress all output. This is likely only useful when used with the ``--logfile`` command.diskimage-builder-2.35.0/releasenotes/notes/grub-timeout-1cdd14a2b1467d89.yaml0000664000175000017500000000036213640271474026557 0ustar zuulzuul00000000000000--- features: - The ``bootloader`` element will explicitly set the timeout to ``5`` seconds when using ``grub`` (previously this was undefined, but platform defaults were usually 5 seconds). Set this to ``0`` for faster boots. diskimage-builder-2.35.0/releasenotes/notes/fedora26-690b9fd9ac3c3d4f.yaml0000664000175000017500000000030113640271474025710 0ustar zuulzuul00000000000000--- upgrade: - The ``fedora-minimal`` and ``fedora`` elements have been updated to default to Fedora 26. Note if you to pin to specific versions, be sure to specify ``DIB_RELEASE``. diskimage-builder-2.35.0/releasenotes/notes/fix_rdisc6_loop-32a308a97de99f0f.yaml0000664000175000017500000000022613640271474027240 0ustar zuulzuul00000000000000--- fixes: - | The ``dhcp-all-interfaces`` element could not configure network interfaces properly when ``rdisc6`` is present on the system diskimage-builder-2.35.0/releasenotes/notes/yum-cache-removal-148c33012515e56e.yaml0000664000175000017500000000074313640271474027231 0ustar zuulzuul00000000000000--- deprecations: - The ``DIB_YUMCHROOT_USE_CACHE`` variable has been removed and the Fedora and CentOS ``-minimal`` initial chroot will always be created by the package manager. The default creation of a chroot tarball is stopped for these elements. This unused option was unsafe; there is no guarantee that the base system will not change even between runs. Getting the package manager to reuse the cache for the initial chroot install is future work. diskimage-builder-2.35.0/releasenotes/notes/bootloader-gpt-d1047f81f3a0631b.yaml0000664000175000017500000000041613640271474026766 0ustar zuulzuul00000000000000--- features: - | GPT support is added to the bootloader; see documentation for configuration examples. This should be considered a technology preview; there may be minor behaviour modifications as we enable UEFI and support across more architectures.diskimage-builder-2.35.0/releasenotes/notes/incorrect-grub-label-5d2000215c0cc73e.yaml0000664000175000017500000000023013640271474030026 0ustar zuulzuul00000000000000--- fixes: - | This fixes bug 1742170 where the grub root label is different than the file system label when booting from a whole disk image. diskimage-builder-2.35.0/releasenotes/notes/yum-minimal-firmware-194846961a6a1cb9.yaml0000664000175000017500000000022413640271474030053 0ustar zuulzuul00000000000000--- fixes: - | The yum-minimal element now removes the linux-firmware and linux-firmware-whence packages to save space in cloud images. diskimage-builder-2.35.0/releasenotes/notes/post-root-stage-51da051bcdfbc55f.yaml0000664000175000017500000000047113640271474027414 0ustar zuulzuul00000000000000--- features: - | A ``post-root`` stage is added that runs outside the chroot and before the image size calculation. For example, this may be useful for running things that copy much data into the image and need to be outside of the chroot and after install stages which run inside the chroot. diskimage-builder-2.35.0/releasenotes/notes/pre-finalise-stage-574ae7886274bcba.yaml0000664000175000017500000000053213640271474027625 0ustar zuulzuul00000000000000--- features: - | A ``pre-finalise`` stage is added that runs outside the chroot and before the ``finalise`` stage. For example, this may be useful for mounting external resources that are used inside the chroot during the ``finalise`` stage, but do not need to be distributed in the final image such as build-time caches. diskimage-builder-2.35.0/releasenotes/notes/simple-init-nm-f0896124dee92a03.yaml0000664000175000017500000000020113640271474026712 0ustar zuulzuul00000000000000--- features: - | The `simple-init` element can now use NetworkManager instead of legacy scripts on Red Hat platforms. diskimage-builder-2.35.0/releasenotes/notes/root-journal-size-618e064d6681699a.yaml0000664000175000017500000000020713640271474027340 0ustar zuulzuul00000000000000--- features: - The ``--mkfs-journal-size`` option is added to override the default journal size for basic ext4 root partitions. diskimage-builder-2.35.0/releasenotes/notes/package-install-arch-38bb5a6e61794fa5.yaml0000664000175000017500000000043413640271474030120 0ustar zuulzuul00000000000000--- features: - The ``package-installs`` element now supports a list of architectures to install the package for in the ``arch`` field and negative matching with a ``not-arch`` field. This allows greater flexibility when installing packages for only some architectures.diskimage-builder-2.35.0/releasenotes/notes/deprecate-ironic-agent-element.yaml0000664000175000017500000000026313640271474027662 0ustar zuulzuul00000000000000--- deprecations: - The "ironic-agent" element can now be found at ironic-python-agent-builder to build the ramdisk. This element is deprecated from diskimage-builder. diskimage-builder-2.35.0/releasenotes/notes/opensuse-151-default-67ccfffbc134704d.yaml0000664000175000017500000000054513640271474030072 0ustar zuulzuul00000000000000--- deprecations: - | Support in opensuse and opensuse-minimal for openSUSE 42.2 has been removed as these are end of life. upgrade: - | The opensuse and opensuse-minimal element are now defaulting to build 15.1. Building for 42.3 and 15.0 is still supported, however requires setting DIB_RELEASE to '42.3' resp. '15.0' explicitly. diskimage-builder-2.35.0/releasenotes/notes/gpt-esp-partition-size-200568cb6fcc8788.yaml0000664000175000017500000000034613640271474030432 0ustar zuulzuul00000000000000--- fixes: - | The size of the ESP partition when building EFI based images is increased considerably from 12MiB to 550MiB, in line with modern guidelines. The existing size was often not enough to update packages. diskimage-builder-2.35.0/releasenotes/notes/skip-packages-env-c97e7b4820f9bfda.yaml0000664000175000017500000000036513640271474027625 0ustar zuulzuul00000000000000--- features: - | The `package-installs` element now supports skipping installation of packages based on an environment variable specified in the config file. See the `package-installs` element documentation for full details. diskimage-builder-2.35.0/releasenotes/notes/package-outside-debootstrap-ac93e9ce991819f1.yaml0000664000175000017500000000026113640271474031550 0ustar zuulzuul00000000000000--- fixes: - The `debian-minimal` and `ubuntu-minimal` elements now install directly from the updates repo, avoiding the need to double-install packages during build. diskimage-builder-2.35.0/releasenotes/notes/dib-init-system-5647bad17a01c602.yaml0000664000175000017500000000124713640271474027065 0ustar zuulzuul00000000000000--- deprecations: - | The ``dib-init-system`` element installs a utility ``/usr/local/bin/dib-init-system`` which would try to guess the init system (systemd, etc.). This was called from ``environment.d`` files, which means that in phases outside the chroot it was attempting to query the init system of the build host. This completely fails in a situation such as running inside a container without a full init system. To avoid this issue, each OS element will set DIB_INIT_SYSTEM directly. The ``dib-init-system`` script was not really intended to be called directly, but will now just report the value of ``DIB_INIT_SYSTEM``. diskimage-builder-2.35.0/releasenotes/notes/harden-sshd-config-3f84556136014f95.yaml0000664000175000017500000000056013640271474027312 0ustar zuulzuul00000000000000--- security: - a new post-install script was added in openssh-server element to ensure KexAlgorithms, Ciphers and MACs for sshd_config will be configured following good pratices on https://infosec.mozilla.org/guidelines/openssh. This option is activated by default, users can set DIB_OPENSSH_SERVER_HARDENING to 0 to disable this sshd configuration diskimage-builder-2.35.0/releasenotes/notes/python-venv-d5b04fcf57e460bf.yaml0000664000175000017500000000027413640271474026577 0ustar zuulzuul00000000000000--- fixes: - | The ``pip-and-virtualenv`` element also installs ``python3-venv`` on Python-3 Debian-like distributions to ensure ``$DIB_PYTHON_VIRTUALENV`` works as expected.diskimage-builder-2.35.0/releasenotes/notes/dib-run-parts-6f67d038aa5a4156.yaml0000664000175000017500000000072713640271474026553 0ustar zuulzuul00000000000000--- deprecations: - | The ``dib-run-parts`` element is no longer required as ``disk-image-create`` will directly source the internal version for running scripts within the chroot. This element was unintentionally leaving ``/usr/local/bin/dib-run-parts`` in the built image. From code search we do not believe anyone was relying on the presence of this script. If you do require it, you should source the ``dib-utils`` package to install. diskimage-builder-2.35.0/releasenotes/notes/add-efi-packages-70a19464d31ab8d7.yaml0000664000175000017500000000020613640271474027117 0ustar zuulzuul00000000000000--- upgrade: - | Adds `efibootmgr` and `efivar` packages to ironic-agent, so when building DIB images they will be present. diskimage-builder-2.35.0/releasenotes/notes/1.16.0-updates-bad91fc0b36c1755.yaml0000664000175000017500000000130413640271474026374 0ustar zuulzuul00000000000000--- fixes: - The ``yum-minimal`` element now correctly strips locale-archive files, but leaves en.US/en.US-UTF8 for compatibility with remote access. Better failure detection has been added to avoid leaving lock files behind if initial installs to the chroot fail. - The ``epel`` element was fixed to not incorrectly install EPEL6 on Centos 7. EPEL is added as a requirement of ``centos-minimal`` (previously, it was tacitly required but not expressed). - The ``dib-lint`` tool is now more verbose, has better documentation and more correctly detects errors in JSON & YAML. - The ``ironic-agent`` element no longer removes the ``sudo`` package in its cleanup phase. diskimage-builder-2.35.0/releasenotes/notes/dib-distribution-mirror-8c241c0d3d4a539a.yaml0000664000175000017500000000063313640271474030712 0ustar zuulzuul00000000000000--- deprecations: - The ``DIB_[DISTRO]_DISTRIBUTION_MIRROR`` variables have been removed. These were undocumented ways to set ``DIB_DISTRIBUTION_MIRROR`` for some elements. It was not implemented consistently and causing some confusion. If you need to setup mirrors for testing purposes, the ``openstack-ci-mirrors`` element is a good example that is used by OpenStack gate testing.diskimage-builder-2.35.0/releasenotes/notes/Add-DIB-UBUNTU-KERNEL-5f75a809f3ce9bab.yaml0000664000175000017500000000041313640271474027366 0ustar zuulzuul00000000000000--- features: - | Added an environment variable, DIB_UBUNTU_KERNEL, that allows you to specify the kernel meta package to install in the image. It currently supports "linux-image-generic" (The default), "linux-image-kvm", and "linux-image-virtual". diskimage-builder-2.35.0/releasenotes/notes/centos-retired-f17ae9f6f03e57e3.yaml0000664000175000017500000000141213640271474027156 0ustar zuulzuul00000000000000--- deprecations: - | The ``centos`` and ``rhel`` elements have been removed. These were building version 6 which is no longer supported (mostly due to a lack of python 2.7). Version 7 support is available via the ``centos7`` and ``rhel7`` elements (which downloads and modifies the upstream cloud images) or via ``centos-minimal`` (which builds the image from a empty chroot; only available for CentOS). ``centos-minimal`` is suggested as this is what OpenStack Infrastructure uses for its elements. Unfortunately, ``centos-minimal`` sets ``DISTRO=centos`` while ``centos7`` sets ``DISTRO=centos7``, despite building the same thing as far as upper levels are concerned. We plan to rectify this in the version 8 time-frame. ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/releasenotes/notes/dib-init-system_fix_for_debian_jessie-c6f7261ee84dad27.yamldiskimage-builder-2.35.0/releasenotes/notes/dib-init-system_fix_for_debian_jessie-c6f7261ee84dad27.y0000664000175000017500000000032113640271474033130 0ustar zuulzuul00000000000000--- fixes: - dib-init-system did not correctly find the init system for Debian Jessie and Debian Stretch. This version also looks for /bin/systemctl as as hint for systemd and fixes the problem. diskimage-builder-2.35.0/releasenotes/notes/element-override-ccda78c24ab4a4ff.yaml0000664000175000017500000000035613640271474027703 0ustar zuulzuul00000000000000--- deprecations: - Element override behavior is now defined, with elements found in earlier entries of ``ELEMENTS_PATH`` overriding later ones (e.g. the same semantics as ``$PATH``). Previously the behavior was undefined.diskimage-builder-2.35.0/releasenotes/notes/gzip-env-variable-94e61e0c043f4f1f.yaml0000664000175000017500000000025413640271474027460 0ustar zuulzuul00000000000000--- features: - | The `DIB_GZIP_BIN` environment variable enables builders to change the path to `gzip`, such as when an alternate gzip is to be used (ie. pigz). diskimage-builder-2.35.0/releasenotes/notes/dib-run-parts-e18cc3a6c2d66c24.yaml0000664000175000017500000000061513640271474026703 0ustar zuulzuul00000000000000--- deprecations: - | dib no longer exports ``dib-run-parts``. Adding this was an oversight made during v2 development, since ``dib-utils`` already provides this. The ``dib-run-parts`` used internally (``diskimage_builder/lib/dib-run-parts``) is not intended to be used by external tools. If you require ``dib-run-parts``, you should install the ``dib-utils`` package.diskimage-builder-2.35.0/releasenotes/notes/doc-auto-element-dependency-cb7488c5bb7301a4.yaml0000664000175000017500000000020513640271474031405 0ustar zuulzuul00000000000000--- features: - Create sphinx directive 'element_deps' that automatically generates dependencies in the element documentation. diskimage-builder-2.35.0/releasenotes/notes/dash-p-after-install-58a87549c1c906c3.yaml0000664000175000017500000000040613640271474027730 0ustar zuulzuul00000000000000other: - The packages specified with the `-p` command-line operation are now installed after the `install.d` phase, not before. This is to give elements priority when installing packages. The flag documentation has been updated to describe this. diskimage-builder-2.35.0/releasenotes/notes/block-device-lvm-c3b8a214952b4db5.yaml0000664000175000017500000000010113640271474027242 0ustar zuulzuul00000000000000--- features: - Adds lvm support, allowing to create volumes. diskimage-builder-2.35.0/releasenotes/notes/add-version-less-rhel-element-82fac7f2609e16d3.yaml0000664000175000017500000000043413640271474031702 0ustar zuulzuul00000000000000--- features: - Adds a new element ``rhel`` to handle all supported RHEL releases, which are currently '7' and '8'. As of now, users of diskimage-builder will still be able to use the 'rhel7' element, or migrate to 'rhel' and specify their respective DIB_RELEASE value. ././@LongLink0000000000000000000000000000020400000000000011211 Lustar 00000000000000diskimage-builder-2.35.0/releasenotes/notes/fix-dnf-clean-old-kernels-use-rpm-to-erase-in-case-running-kernel-0401f78d63daca77.yamldiskimage-builder-2.35.0/releasenotes/notes/fix-dnf-clean-old-kernels-use-rpm-to-erase-in-case-runni0000664000175000017500000000045113640271474033361 0ustar zuulzuul00000000000000--- fixes: - | Fixed an issue where cleaning old kernels on systems runing ``dnf`` would fail in case the kernel packages being removed matches the running kernel of the system building the image. See Bug: `1623409 `_. diskimage-builder-2.35.0/releasenotes/notes/add-centos-8-support-4fd28eb04e11ba43.yaml0000664000175000017500000000042613640271474030104 0ustar zuulzuul00000000000000--- features: - Added CentOS 8 support. deprecations: - | The ``centos7`` element is deprecated and is left only for backward compatibility. Use the ``centos`` element instead. Note that you should set ``DIB_RELEASE`` to ``7`` when using the ``centos`` element. diskimage-builder-2.35.0/releasenotes/notes/block-device-partitioning-237249e7ed2bad26.yaml0000664000175000017500000000055313640271474031176 0ustar zuulzuul00000000000000--- features: - Create partitions with MBR layout optimized for performance and highly configurable. deprecations: - The new partitions are created based on configuration rather than on a list of provided commands for a special partitioning tool. Therefore elements using tools (like partitioning-sfdisk) are deprecated and will be removed. diskimage-builder-2.35.0/releasenotes/notes/start-using-reno-446b3d52a467a273.yaml0000664000175000017500000000114313640271474027213 0ustar zuulzuul00000000000000--- fixes: - We now use ``fstrim`` rather than ``zerofree`` to reduce final image size. This is considered current best practice. - Fix an occasional failure to build ``centos-minimal`` and ``fedora-minimal`` due to suspected rpmdb failures. The main symptom was ``dnf`` or ``yum`` thinking packages were not installed when they were. - The ``debian-minimal`` element now obeys ``DIB_DEBIAN_COMPONENTS`` for adding components. - Fix some issues with Gentoo, and add to supported distributions. Testing is currently non-voting other: - Start using reno for release notes diskimage-builder-2.35.0/releasenotes/notes/1.17.0-ef744f36d277dba4.yaml0000664000175000017500000000222313640271474024751 0ustar zuulzuul00000000000000--- features: - The ``dib-lint`` tool now has a best-effort sudo check to help flag uses of ``sudo`` outside the chroot environment. This can help avoid some classes of breakout problems that can interfere with the host system. - Running with ``-x`` will give a more verbose log output that includes function and line-numbers. Work is ongoing to further reduce noise in the verbose logs to make it as useful as possible. Feedback is welcome on the new format. - the ``pkg-map`` element can now install different packages based on the distribution release. fixes: - Locale stripping for ``yum-minimal`` has been reworked to be more reliable for Fedora 23 and CentOS. - The Ubuntu Precise kernel is too old to use the online ``growroot`` element, so we returned to using ``cloud-initramfs-growroot`` in the ``debootstrap`` element for it. - The ``dib-lint`` tool now better matches python files. - The ``apt-sources`` element was fixed to work with the ``debian-minimal`` element. - Dependencies for the systemd target in ``dhcp-all-interfaces`` were updated to correctly wait for interfaces. diskimage-builder-2.35.0/releasenotes/notes/init-ibft-interfaces-9458d97dfcecc3ae.yaml0000664000175000017500000000033013640271474030377 0ustar zuulzuul00000000000000--- features: - | Adds a new element ``init-ibft-interfaces`` to initialize network interfaces with configuration provided via iBFT. The new element is now a dependency of the ``ironic-agent`` element. diskimage-builder-2.35.0/releasenotes/notes/image-size-padding-24f88d1c4a215221.yaml0000664000175000017500000000023613640271474027423 0ustar zuulzuul00000000000000--- features: - The ``--image-extra-size`` option is provided to override the default 60% padding growth of the image size with a fixed gigabyte value. diskimage-builder-2.35.0/releasenotes/notes/ubuntu-arbitrary-images-c796f5c6dbd40679.yaml0000664000175000017500000000052313640271474030741 0ustar zuulzuul00000000000000--- upgrade: - | You would need to modify your ``DIB_CLOUD_IMAGES`` and possibly ``SHA256SUMS`` variables if you were using them to build Ubuntu with elements/ubuntu: ``DIB_CLOUD_IMAGES`` would need to contain URL with path, and ``SHA256SUMS`` would not now neccesarily point to ``$DIB_RELEASE/current/`` directory. diskimage-builder-2.35.0/releasenotes/notes/journal-console-752b46542ec5595e.yaml0000664000175000017500000000026513640271474027125 0ustar zuulzuul00000000000000--- features: - | The ``journal-to-console`` element is added to allow forwarding systemd output to the host console. This is useful for debugging early boot issues. diskimage-builder-2.35.0/releasenotes/notes/debian-security-7279855cf464f88b.yaml0000664000175000017500000000044113640271474027116 0ustar zuulzuul00000000000000--- features: - | A new variable ``DIB_DEBIAN_SECURITY_MIRROR`` is added to override the path to the security repositories. Previously this was hard-coded to the upstream repositories, which could get out of sync with mirrors specified with ``DIB_DISTRIBUTION_MIRROR``. diskimage-builder-2.35.0/releasenotes/notes/remove-dib-utils-37f70dfad54900a0.yaml0000664000175000017500000000031713640271474027317 0ustar zuulzuul00000000000000--- deprecations: - The `dib-utils` requirement has been removed as the `dib-run-parts` script is now shipped from within diskimage-builder. The `dib-utils` project is now considered retired. diskimage-builder-2.35.0/releasenotes/notes/1.18.0-4433d3076627f10d.yaml0000664000175000017500000000034713640271474024443 0ustar zuulzuul00000000000000--- features: - The ``fedora-minimal`` element now supports Fedora 24 - The ``pkg-map`` element now correctly supports images without python2 in the default install (such as the latest releases from Ubuntu and Fedora). diskimage-builder-2.35.0/releasenotes/notes/selinux-permissive-pre-install-ce19461ef17ec972.yaml0000664000175000017500000000035013640271474032251 0ustar zuulzuul00000000000000--- other: - | Setting values with the ``selinux-permissive`` element has been moved from ``install.d`` to ``pre-install.d`` phase to avoid selinux related packages being installed before the settings are applied.