├── .coveragerc ├── .dockerignore ├── .github ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── example-livemedia-creator.yml │ └── tests.yml ├── .gitignore ├── .gitleaks.toml ├── .tito ├── packages │ ├── .readme │ └── lorax └── tito.props ├── ANNOUNCE ├── AUTHORS ├── COPYING ├── Dockerfile.test ├── HACKING.md ├── Makefile ├── POLICY ├── README.md ├── RELEASE.md ├── TODO ├── docs ├── Makefile ├── conf.py ├── fedora-atomic-pxe-live-novirt.ks ├── fedora-atomic-pxe-live.ks ├── fedora-docker.ks ├── fedora-livemedia.ks ├── fedora-minimal.ks ├── fedora-minimized.ks ├── fedora-openstack.ks ├── fedora-vagrant.ks ├── html │ ├── .buildinfo │ ├── .doctrees │ │ ├── environment.pickle │ │ ├── image-minimizer.doctree │ │ ├── index.doctree │ │ ├── intro.doctree │ │ ├── livemedia-creator.doctree │ │ ├── lorax.doctree │ │ ├── mkksiso.doctree │ │ ├── modules.doctree │ │ ├── product-images.doctree │ │ └── pylorax.doctree │ ├── _modules │ │ ├── index.html │ │ ├── pylorax.html │ │ └── pylorax │ │ │ ├── base.html │ │ │ ├── buildstamp.html │ │ │ ├── cmdline.html │ │ │ ├── creator.html │ │ │ ├── decorators.html │ │ │ ├── discinfo.html │ │ │ ├── dnfbase.html │ │ │ ├── dnfhelper.html │ │ │ ├── executils.html │ │ │ ├── imgutils.html │ │ │ ├── installer.html │ │ │ ├── ltmpl.html │ │ │ ├── monitor.html │ │ │ ├── mount.html │ │ │ ├── sysutils.html │ │ │ ├── treebuilder.html │ │ │ └── treeinfo.html │ ├── _sources │ │ ├── image-minimizer.rst.txt │ │ ├── index.rst.txt │ │ ├── intro.rst.txt │ │ ├── livemedia-creator.rst.txt │ │ ├── lorax.rst.txt │ │ ├── mkksiso.rst.txt │ │ ├── modules.rst.txt │ │ ├── product-images.rst.txt │ │ └── pylorax.rst.txt │ ├── _static │ │ ├── _sphinx_javascript_frameworks_compat.js │ │ ├── basic.css │ │ ├── css │ │ │ ├── badge_only.css │ │ │ └── theme.css │ │ ├── doctools.js │ │ ├── documentation_options.js │ │ ├── file.png │ │ ├── jquery-3.5.1.js │ │ ├── jquery-3.6.0.js │ │ ├── jquery.js │ │ ├── js │ │ │ ├── badge_only.js │ │ │ └── theme.js │ │ ├── language_data.js │ │ ├── minus.png │ │ ├── plus.png │ │ ├── pygments.css │ │ ├── searchtools.js │ │ ├── sphinx_highlight.js │ │ ├── underscore-1.12.0.js │ │ ├── underscore-1.13.1.js │ │ └── underscore.js │ ├── composer-cli.html │ ├── genindex.html │ ├── image-minimizer.html │ ├── index.html │ ├── intro.html │ ├── livemedia-creator.html │ ├── lorax.html │ ├── mkksiso.html │ ├── modules.html │ ├── objects.inv │ ├── product-images.html │ ├── py-modindex.html │ ├── pylorax.html │ ├── search.html │ └── searchindex.js ├── image-minimizer.rst ├── index.rst ├── intro.rst ├── livemedia-creator.rst ├── lorax.rst ├── man │ ├── .doctrees │ │ ├── composer-cli.doctree │ │ ├── composer.cli.doctree │ │ ├── composer.doctree │ │ ├── environment.pickle │ │ ├── image-minimizer.doctree │ │ ├── index.doctree │ │ ├── intro.doctree │ │ ├── lifted.doctree │ │ ├── livemedia-creator.doctree │ │ ├── lorax-composer.doctree │ │ ├── lorax.doctree │ │ ├── mkksiso.doctree │ │ ├── modules.doctree │ │ ├── product-images.doctree │ │ ├── pylorax.api.doctree │ │ └── pylorax.doctree │ ├── image-minimizer.1 │ ├── livemedia-creator.1 │ ├── lorax.1 │ └── mkksiso.1 ├── mkksiso.rst ├── modules.rst ├── product-images.rst └── pylorax.rst ├── etc └── lorax.conf ├── lorax.spec ├── requirements.txt ├── setup.py ├── share └── templates.d │ └── 99-generic │ ├── aarch64.tmpl │ ├── appliance │ └── libvirt.tmpl │ ├── config_files │ ├── aarch64 │ │ ├── boot.msg │ │ └── grub2-efi.cfg │ ├── common │ │ ├── 91-anaconda-autoconnect-slaves.conf │ │ ├── 92-anaconda-loglevel-debug.conf │ │ ├── bash_history │ │ ├── i18n │ │ ├── inst.rngd.service │ │ ├── org.gtk.Settings.Debug.gschema.override │ │ ├── pam.sshd │ │ ├── profile │ │ ├── resolv.conf │ │ ├── rsyslog.conf │ │ ├── selinux.config │ │ ├── spice-vdagentd │ │ ├── sshd_config.anaconda │ │ ├── sysctl.conf │ │ ├── systemd-allowroot.conf │ │ └── vconsole.conf │ ├── ppc │ │ ├── bootinfo.txt │ │ └── grub.cfg.in │ ├── s390 │ │ ├── cdboot.prm │ │ ├── generic.ins │ │ ├── generic.prm │ │ ├── genericdvd.prm │ │ └── redhat.exec │ ├── sparc │ │ ├── boot.msg │ │ └── silo.conf │ └── x86 │ │ ├── boot.msg │ │ ├── grub2-bios.cfg │ │ ├── grub2-efi.cfg │ │ └── isolinux.cfg │ ├── efi.tmpl │ ├── live │ ├── aarch64.tmpl │ ├── config_files │ │ ├── aarch64 │ │ │ └── grub2-efi.cfg │ │ ├── ppc │ │ │ ├── bootinfo.txt │ │ │ └── grub.cfg.in │ │ ├── s390 │ │ │ ├── cdboot.prm │ │ │ ├── generic.ins │ │ │ ├── generic.prm │ │ │ ├── genericdvd.prm │ │ │ └── redhat.exec │ │ └── x86 │ │ │ ├── grub2-bios.cfg │ │ │ └── grub2-efi.cfg │ ├── efi.tmpl │ ├── live-install.tmpl │ ├── ppc64le.tmpl │ ├── s390.tmpl │ └── x86.tmpl │ ├── ppc64le.tmpl │ ├── pxe-live │ └── pxe-config.tmpl │ ├── runtime-cleanup.tmpl │ ├── runtime-install.tmpl │ ├── runtime-postinstall.tmpl │ ├── s390.tmpl │ └── x86.tmpl ├── src ├── bin │ ├── image-minimizer │ ├── livemedia-creator │ ├── lorax │ ├── mkefiboot │ └── mkksiso └── pylorax │ ├── __init__.py │ ├── base.py │ ├── buildstamp.py │ ├── cmdline.py │ ├── creator.py │ ├── decorators.py │ ├── discinfo.py │ ├── dnfbase.py │ ├── dnfhelper.py │ ├── executils.py │ ├── imgutils.py │ ├── installer.py │ ├── ltmpl.py │ ├── monitor.py │ ├── mount.py │ ├── output.py │ ├── sysutils.py │ ├── treebuilder.py │ └── treeinfo.py ├── systemd └── lorax.conf ├── test-packages ├── test ├── README.md ├── check-lorax ├── loraxtest.py ├── run └── vm.install ├── tests ├── __init__.py ├── image-minimizer │ ├── im-script.txt │ ├── minimizer.py │ └── test_minimizer.py ├── lib.py ├── lorax │ ├── lib │ │ └── lib.sh │ ├── test_boot_bootiso.sh │ └── test_build_bootiso.sh ├── mkksiso │ ├── data │ │ ├── BOOT-1.conf │ │ ├── BOOT-1.conf.result │ │ ├── BOOT.conf │ │ ├── BOOT.conf.result │ │ ├── bios-grub.cfg │ │ ├── bios-grub.cfg.result │ │ ├── cdboot.prm │ │ ├── cdboot.prm.result │ │ ├── generic.prm │ │ ├── generic.prm.result │ │ ├── isolinux.cfg │ │ ├── isolinux.cfg.result │ │ ├── uefi-grub-1.cfg │ │ ├── uefi-grub-1.cfg.result │ │ ├── uefi-grub.cfg │ │ └── uefi-grub.cfg.result │ ├── ks │ │ ├── extra-repo.ks │ │ └── liveimg.ks │ ├── mk-fake-rpm │ ├── mkksiso.py │ ├── test_boot_repo.sh │ ├── test_liveimg.sh │ ├── test_mkksiso.py │ └── test_mkksiso.sh ├── pylint │ └── runpylint.py ├── pylorax │ ├── __init__.py │ ├── templates │ │ ├── bad-template.tmpl │ │ ├── chmod-cmd.tmpl │ │ ├── copy-cmd.tmpl │ │ ├── createaddrsize-cmd.tmpl │ │ ├── hardlink-cmd.tmpl │ │ ├── install-cmd.tmpl │ │ ├── install-remove-test.tmpl │ │ ├── install-test.tmpl │ │ ├── installimg-cmd.tmpl │ │ ├── installinitrd-cmd.tmpl │ │ ├── installkernel-cmd.tmpl │ │ ├── installupgradeinitrd-cmd.tmpl │ │ ├── mkdir-cmd.tmpl │ │ ├── move-cmd.tmpl │ │ ├── parse-missing-quote.tmpl │ │ ├── parse-test.tmpl │ │ ├── remove-cmd.tmpl │ │ ├── removekmod-cmd.tmpl │ │ ├── replace-cmd.tmpl │ │ ├── runcmd-cmd.tmpl │ │ ├── symlink-cmd.tmpl │ │ ├── systemctl-cmd.tmpl │ │ ├── treeinfo-cmd.tmpl │ │ └── unknown-cmd.tmpl │ ├── test_buildstamp.py │ ├── test_creator.py │ ├── test_discinfo.py │ ├── test_executils.py │ ├── test_imgutils.py │ ├── test_ltmpl.py │ ├── test_monitor.py │ ├── test_mount.py │ ├── test_sysutils.py │ ├── test_treebuilder.py │ └── test_treeinfo.py ├── test_lorax.sh └── testenv.sh └── utils └── test-parse-template /.coveragerc: -------------------------------------------------------------------------------- 1 | [paths] 2 | source = . 3 | /lorax/ 4 | [run] 5 | relative_files = True 6 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .git/ 2 | .coverage 3 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 12 | -------------------------------------------------------------------------------- /.github/workflows/example-livemedia-creator.yml: -------------------------------------------------------------------------------- 1 | name: Build Fedora ISO 2 | # An example of how to use livemedia-creator in GitHub Actions 3 | # to build a custom Fedora ISO. 4 | 5 | 6 | on: 7 | workflow_dispatch: 8 | inputs: 9 | # Force host version to match OS it's building. 10 | # Recommended since we use '--no-virt' in livemedia-creator 11 | # https://weldr.io/lorax/livemedia-creator.html#anaconda-image-install-no-virt 12 | fedora_release: 13 | description: 'Fedora release to build' 14 | required: true 15 | default: 39 16 | type: number 17 | 18 | kickstart_path: 19 | description: 'Path to the kickstart file' 20 | required: true 21 | default: './docs/fedora-livemedia.ks' 22 | type: string 23 | 24 | jobs: 25 | 26 | fedora-build: 27 | runs-on: ubuntu-latest 28 | container: 29 | image: "fedora:${{ inputs.fedora_release }}" 30 | # --privileged needed for livemedia-creator 31 | options: --privileged 32 | steps: 33 | - uses: actions/checkout@v4 34 | 35 | - name: Install dependencies 36 | # zstd: Lets you use github caching actions inside fedora too 37 | # pykickstart: To lint the kickstart file 38 | # lorax lorax-lmc-novirt anaconda: To actually build the ISO 39 | run: dnf install -y zstd lorax lorax-lmc-novirt anaconda pykickstart 40 | 41 | - name: Lint Kickstart file 42 | run: ksvalidator "${{ inputs.kickstart_path }}" 43 | 44 | ## Create the ISO 45 | - name: Create the custom ISO 46 | # --no-virt: Needed since we're in a container, no host CPU 47 | run: | 48 | livemedia-creator \ 49 | --ks "${{ inputs.kickstart_path }}" \ 50 | --no-virt \ 51 | --make-iso \ 52 | --iso-only \ 53 | --iso-name Fedora-custom-example.iso \ 54 | --project Fedora \ 55 | --volid "Fedora-${{ inputs.fedora_release }}" \ 56 | --releasever "${{ inputs.fedora_release }}" \ 57 | --resultdir ./Results 58 | 59 | - name: Upload ISO 60 | uses: actions/upload-artifact@v4.3.1 61 | with: 62 | name: "Fedora-custom-example-${{ inputs.fedora_release }}.iso" 63 | path: ./Results/Fedora-custom-example.iso 64 | overwrite: True 65 | 66 | ## Capture debug info if run fails, AND logs exist: 67 | - name: "DEBUG: Print program.log" 68 | if: failure() && hashFiles('./program.log') != '' 69 | run: | 70 | ls -hl ./program.log 71 | cat ./program.log 72 | 73 | - name: "DEBUG: Print livemedia.log" 74 | if: failure() && hashFiles('./livemedia.log') != '' 75 | run: | 76 | ls -hl ./program.log 77 | cat ./livemedia.log 78 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Tests and Coverage 2 | # Make sure only one action triggers the job, otherwise pushing to a 3 | # pull-request will run it twice. 4 | on: 5 | pull_request: 6 | branches: 7 | - "*" 8 | push: 9 | branches: 10 | - master 11 | - rhel10-branch 12 | - rhel9-branch 13 | - rhel8-branch 14 | - rhel7-branch 15 | - f40-branch 16 | - f39-branch 17 | - f38-branch 18 | - f37-branch 19 | - f36-branch 20 | 21 | jobs: 22 | unit-tests: 23 | runs-on: ubuntu-latest 24 | steps: 25 | - name: "Clone Repository" 26 | uses: actions/checkout@v4 27 | - name: Run lorax tests in podman 28 | run: make test-in-podman && cp .test-results/.coverage .coverage 29 | - name: Coveralls 30 | uses: AndreMiras/coveralls-python-action@develop 31 | with: 32 | github-token: ${{ secrets.GITHUB_TOKEN }} 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.rpm 3 | src/pylorax/version.py* 4 | _build/ 5 | tests/pylint/.pylint.d/ 6 | __pycache__/ 7 | .coverage 8 | pylint-log 9 | .pytest_cache/ 10 | .test-results/ 11 | /lorax-*.tar.gz 12 | /bots 13 | /test/images 14 | /tmp 15 | -------------------------------------------------------------------------------- /.gitleaks.toml: -------------------------------------------------------------------------------- 1 | [allowlist] 2 | description = "Allow known fake secrets in lorax tests and documentation" 3 | ## These are go regexp patterns. See go doc regexp/syntax 4 | regexes = [ 5 | '\$6\$CHO2\$3rN8eviE2t50lmVyBYihTgVRHcaecmeCk31L\.\.\.' 6 | ] 7 | -------------------------------------------------------------------------------- /.tito/packages/.readme: -------------------------------------------------------------------------------- 1 | the rel-eng/packages directory contains metadata files 2 | named after their packages. Each file has the latest tagged 3 | version and the project's relative directory. 4 | -------------------------------------------------------------------------------- /.tito/packages/lorax: -------------------------------------------------------------------------------- 1 | 43.4-1 ./ 2 | -------------------------------------------------------------------------------- /.tito/tito.props: -------------------------------------------------------------------------------- 1 | [buildconfig] 2 | builder = tito.builder.Builder 3 | tagger = tito.tagger.VersionTagger 4 | changelog_do_not_remove_cherrypick = 0 5 | changelog_format = %s (%ae) 6 | sign_tag = 1 7 | -------------------------------------------------------------------------------- /ANNOUNCE: -------------------------------------------------------------------------------- 1 | Announcing lorax-0.1 2 | 3 | "I am the Lorax, I speak for the trees." 4 | 5 | (and images) 6 | 7 | 8 | WHAT IS IT 9 | ---------- 10 | 11 | lorax is a replacement for the buildinstall maze of scripts and tools we 12 | have in anaconda. It is written in Python in the hopes that it will be 13 | easier to hook in to programs like pungi. 14 | 15 | It also moves the tools that generate installation images in to a separate 16 | project from anaconda itself. 17 | 18 | 19 | WHAT DOES IT REPLACE? 20 | --------------------- 21 | 22 | All of these things from the anaconda source tree: 23 | 24 | scripts/buildinstall 25 | scripts/buildinstall.functions 26 | scripts/makestamp.py 27 | scripts/maketreeinfo.py 28 | scripts/mk-images 29 | scripts/mk-images.alpha 30 | scripts/mk-images.efi 31 | scripts/mk-images.ia64 32 | scripts/mk-images.ppc 33 | scripts/mk-images.s390 34 | scripts/mk-images.x86 35 | scripts/scrubtree 36 | scripts/upd-instroot 37 | 38 | utils/trimpciids 39 | utils/mk-s390-cdboot.c 40 | utils/filtermoddeps 41 | utils/geninitrdsz.c 42 | utils/genmodinfo 43 | utils/modlist 44 | 45 | 46 | WHY REWRITE BUILDINSTALL 47 | ------------------------ 48 | 49 | The buildinstall scripts were magic and maintaining them was sort of an art 50 | form. The entire collection of tools used in a buildinstall run are written 51 | in bash, Perl, Python, and C. Maintenance nightmare. 52 | 53 | The way packages were specified for inclusion in the instroot as well as 54 | what files were to be kept or removed were specified in the upd-instroot 55 | script. Again, difficult maintenance. 56 | 57 | Lorax is intended to mostly be a drop-in replacement for buildinstall. The 58 | frontend program accepts the same command line arguments as buildinstall, 59 | but all of the work is done through the pylorax Python module rather than 60 | separate scripts or programs. 61 | 62 | 63 | MAJOR CHANGES 64 | ------------- 65 | 66 | Aside from offering a standalone tool that replaces the buildinstall script 67 | collection and being written in Python, lorax introduces some policy changes 68 | for how install images are generated. 69 | 70 | (a) Keep everything by default, remove listed items. 71 | 72 | In the buildinstall scripts, we have the KEEPFILE set of variables that 73 | define what files (by wildcard or explicit names) we want to keep in a 74 | particular image. The standard policy for buildinstall is to unpack a set 75 | of packages (listed in PACKAGES variables) and then remove everything not 76 | explicitly listed in a KEEPFILE variable. This aspect causes a lot of 77 | maintenance headaches. 78 | 79 | The lorax approach is to trust yum and package maintainers to give us what 80 | we want. We define a set of packages we want for the image using 81 | configuration files in /etc/lorax. Using yum, the packages are installed to 82 | the staging root tree. Then tree scrubbing takes place, which is 83 | customizable by the user. So, the default policy of lorax is to keep 84 | everything a package gives us and only remove things explicitly listed for 85 | the scrub operation. 86 | 87 | (b) Maintain image building tools as a separate project. 88 | 89 | If release engineering needs to regenerate trees for a nightly build because 90 | a problem was encountered during image building, that requires a new 91 | anaconda build to show up. Lorax allows customization through configuration 92 | files and in cases where bugs are discovered in it, a new release can be 93 | made independent of anaconda. 94 | 95 | Lorax can (and should) be maintained jointly by releng and the anaconda team. 96 | 97 | (c) Logic is in the pylorax module. 98 | 99 | Pungi may ultimately import the pylorax module to generate images rather 100 | than running the lorax command line tool. Better integration in to Pungi 101 | is a goal of lorax. 102 | 103 | 104 | And there you have it. Lorax. 105 | 106 | -- 107 | David Cantrell 108 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Martin Gracik 2 | David Cantrell 3 | Will Woods 4 | -------------------------------------------------------------------------------- /Dockerfile.test: -------------------------------------------------------------------------------- 1 | FROM registry.fedoraproject.org/fedora:latest 2 | COPY test-packages . 3 | RUN dnf -y install $(cat test-packages) && touch /.in-container 4 | RUN useradd weldr 5 | VOLUME /lorax-ro 6 | VOLUME /test-results 7 | WORKDIR /lorax-ro 8 | -------------------------------------------------------------------------------- /HACKING.md: -------------------------------------------------------------------------------- 1 | # Hacking on Lorax 2 | 3 | Here's where to get the code: 4 | 5 | $ git clone https://github.com/weldr/lorax 6 | $ cd lorax/ 7 | 8 | How to build it: 9 | 10 | $ make 11 | 12 | ## How to run the tests 13 | 14 | To run the tests you need the following dependencies installed: 15 | 16 | $ yum install python3-nose python3-pytest-mock python3-pocketlint \ 17 | python3-mock python3-magic 18 | 19 | Run the basic linting tests like this: 20 | 21 | $ make check 22 | 23 | 24 | To run the broader unit and integration tests we use: 25 | 26 | $ make test 27 | 28 | The tests may also be run using a podman container: 29 | 30 | $ make test-in-podman 31 | -------------------------------------------------------------------------------- /POLICY: -------------------------------------------------------------------------------- 1 | Lorax is a tool for building bootable/installable Fedora images. Its primary 2 | focus is Fedora installation images but it should be able to create other 3 | types of images too. 4 | 5 | Some design precepts: 6 | 7 | * It should be easy to make small changes to images. 8 | - Image configs should be extendable/inheritable 9 | - Configs should be self-contained and portable - everything in one dir 10 | - kickstart, templates, config files, image-specific data files 11 | (bootloader templates, keymaps, service files, etc). 12 | 13 | * Templates should be brief but expressive. 14 | - Don't make the user maintain huge lists of files/packages 15 | (do filename globbing and brace expansion, resolve package deps, etc.) 16 | - Provide commands that allow blacklists/exceptions 17 | (e.g.: removefrom PKG --allbut FILE FILE...) 18 | 19 | * The template language should make common actions easy and obvious. 20 | - Avoid 'runcmd' - add new builtins instead! 21 | - Corollary: It should be easy to extend the template runner 22 | 23 | * Image configs should allow custom commands/scripts 24 | - If you already have a bunch of kickstarts/Ruby/whatever for setting up 25 | images, you should be able to use that too 26 | 27 | * Lorax should be usable as a script or a (python) library 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Lorax is a set of tools used to create bootable images. 2 | 3 | * lorax - creates the Anaconda boot.iso used to install Fedora 4 | * livemedia-creator - uses Anaconda to create bootable images 5 | 6 | See the [Weldr blog](https://weldr.io) for more info about BDCS and the [Lorax documentation](https://weldr.io/lorax) for more information about Lorax and associated tools. 7 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | ### Definitely do these: 2 | - Write man pages for the included executables 3 | - Write a templaterunner script 4 | 5 | ### These might be good ideas: 6 | - Move conf hash table to something more object-like 7 | - Merge treeinfo and discinfo stuff in to InstRoot class 8 | - Port OptionParser code to ArgumentParser 9 | 10 | ### These are some longer-term things: 11 | - Keep all build config files in one directory 12 | - Move everything in Lorax.{configure,run}() to config files/templates 13 | - Better debug output (esp. for tracebacks) 14 | -------------------------------------------------------------------------------- /docs/fedora-atomic-pxe-live-novirt.ks: -------------------------------------------------------------------------------- 1 | # Fedora Atomic PXE Live creation kickstart 2 | # Suitable for use with livemedia-creator --no-virt 3 | 4 | # Settings for unattended installation: 5 | lang en_US.UTF-8 6 | keyboard us 7 | timezone America/New_York 8 | clearpart --all --initlabel 9 | rootpw --plaintext atomic 10 | 11 | part / --fstype="ext4" --size=6000 12 | 13 | shutdown 14 | 15 | ostreesetup --nogpg --osname=fedora-atomic --remote=fedora-atomic --url=https://dl.fedoraproject.org/pub/fedora/linux/atomic/24/ --ref=fedora-atomic/rawhide/x86_64/docker-host 16 | 17 | services --disabled=cloud-init,cloud-init-local,cloud-final,cloud-config,docker-storage-setup 18 | 19 | # We copy content of separate /boot partition to root part when building live squashfs image, 20 | # and we don't want systemd to try to mount it when pxe booting 21 | %post 22 | cat /dev/null > /etc/fstab 23 | %end 24 | 25 | %post --erroronfail 26 | rm -f /etc/ostree/remotes.d/fedora-atomic.conf 27 | ostree remote add --set=gpg-verify=false fedora-atomic 'https://dl.fedoraproject.org/pub/fedora/linux/atomic/24/' 28 | %end 29 | -------------------------------------------------------------------------------- /docs/fedora-atomic-pxe-live.ks: -------------------------------------------------------------------------------- 1 | # Settings for unattended installation: 2 | lang en_US.UTF-8 3 | keyboard us 4 | timezone America/New_York 5 | clearpart --all --initlabel 6 | rootpw --plaintext atomic 7 | 8 | # We are only able to install atomic with separate /boot partition currently 9 | part / --fstype="ext4" --size=6000 10 | part /boot --size=500 --fstype="ext4" 11 | 12 | shutdown 13 | 14 | # Using ostree repo included in installation iso. Respective ostreesetup command is included here. 15 | # The included kickstart file with the command is created during installation iso compose. 16 | %include /usr/share/anaconda/interactive-defaults.ks 17 | 18 | services --disabled=cloud-init,cloud-init-local,cloud-final,cloud-config,docker-storage-setup 19 | 20 | # We copy content of separate /boot partition to root part when building live squashfs image, 21 | # and we don't want systemd to try to mount it when pxe booting 22 | %post 23 | cat /dev/null > /etc/fstab 24 | %end 25 | -------------------------------------------------------------------------------- /docs/fedora-docker.ks: -------------------------------------------------------------------------------- 1 | # Minimal Disk Image 2 | 3 | # Use network installation 4 | url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/" 5 | 6 | # Root password 7 | rootpw --plaintext replace-this-pw 8 | # Network information 9 | network --bootproto=dhcp --activate 10 | # System keyboard 11 | keyboard --xlayouts=us --vckeymap=us 12 | # System language 13 | lang en_US.UTF-8 14 | # SELinux configuration 15 | selinux --enforcing 16 | # Shutdown after installation 17 | shutdown 18 | # System timezone 19 | timezone US/Eastern 20 | # System bootloader configuration 21 | bootloader --disabled 22 | # Partition clearing information 23 | clearpart --all --initlabel 24 | # Disk partitioning information 25 | part / --fstype="ext4" --size=3000 26 | 27 | %post 28 | # Remove random-seed 29 | rm /var/lib/systemd/random-seed 30 | %end 31 | 32 | %packages --nocore --instLangs en 33 | httpd 34 | -kernel 35 | %end 36 | -------------------------------------------------------------------------------- /docs/fedora-minimal.ks: -------------------------------------------------------------------------------- 1 | # Minimal Disk Image 2 | # 3 | sshpw --username=root --plaintext randOmStrinGhERE 4 | # Firewall configuration 5 | firewall --enabled 6 | # Use network installation 7 | url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/" 8 | # Network information 9 | network --bootproto=dhcp --device=link --activate 10 | 11 | # Root password 12 | rootpw --plaintext removethispw 13 | # System keyboard 14 | keyboard --xlayouts=us --vckeymap=us 15 | # System language 16 | lang en_US.UTF-8 17 | # SELinux configuration 18 | selinux --enforcing 19 | # Shutdown after installation 20 | shutdown 21 | # System timezone 22 | timezone US/Eastern 23 | # System bootloader configuration 24 | bootloader --location=mbr 25 | # Partition clearing information 26 | clearpart --all --initlabel 27 | # Disk partitioning information 28 | reqpart 29 | part / --fstype="ext4" --size=4000 30 | part swap --size=1000 31 | 32 | %post 33 | # Remove root password 34 | passwd -d root > /dev/null 35 | 36 | # Remove random-seed 37 | rm /var/lib/systemd/random-seed 38 | %end 39 | 40 | # Architecture specific packages 41 | # The bootloader package requirements are different 42 | %pre 43 | PKGS=/tmp/arch-packages.ks 44 | echo > $PKGS 45 | ARCH=$(uname -m) 46 | case $ARCH in 47 | x86_64) 48 | echo "%packages" >> $PKGS 49 | echo "shim" >> $PKGS 50 | echo "grub2" >> $PKGS 51 | echo "grub2-efi" >> $PKGS 52 | echo "efibootmgr" >> $PKGS 53 | echo "%end" >> $PKGS 54 | ;; 55 | aarch64) 56 | echo "%packages" >> $PKGS 57 | echo "efibootmgr" >> $PKGS 58 | echo "grub2-efi" >> $PKGS 59 | echo "shim-aa64" >> $PKGS 60 | echo "%end" >> $PKGS 61 | ;; 62 | ppc64le) 63 | echo "%packages" >> $PKGS 64 | echo "powerpc-utils" >> $PKGS 65 | echo "grub2-tools" >> $PKGS 66 | echo "grub2-tools-minimal" >> $PKGS 67 | echo "grub2-tools-extra" >> $PKGS 68 | echo "grub2-ppc64le" >> $PKGS 69 | echo "%end" >> $PKGS 70 | ;; 71 | s390x) 72 | echo "%packages" >> $PKGS 73 | echo "s390utils-base" >> $PKGS 74 | echo "%end" >> $PKGS 75 | ;; 76 | esac 77 | %end 78 | 79 | %include /tmp/arch-packages.ks 80 | 81 | %packages 82 | @core 83 | kernel 84 | # Make sure that DNF doesn't pull in debug kernel to satisfy kmod() requires 85 | kernel-modules 86 | kernel-modules-extra 87 | -dracut-config-rescue 88 | 89 | # dracut needs these included 90 | dracut-network 91 | tar 92 | %end 93 | -------------------------------------------------------------------------------- /docs/fedora-minimized.ks: -------------------------------------------------------------------------------- 1 | # Minimal Disk Image -- Example of image-minimizer usage in %post 2 | # 3 | sshpw --username=root --plaintext randOmStrinGhERE 4 | # Firewall configuration 5 | firewall --enabled 6 | # Use network installation 7 | url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/" 8 | # Network information 9 | network --bootproto=dhcp --device=link --activate 10 | 11 | # Root password 12 | rootpw --plaintext removethispw 13 | # System keyboard 14 | keyboard --xlayouts=us --vckeymap=us 15 | # System language 16 | lang en_US.UTF-8 17 | # SELinux configuration 18 | selinux --enforcing 19 | # Shutdown after installation 20 | shutdown 21 | # System timezone 22 | timezone US/Eastern 23 | # System bootloader configuration 24 | bootloader --location=mbr 25 | # Partition clearing information 26 | clearpart --all --initlabel 27 | # Disk partitioning information 28 | part / --fstype="ext4" --size=4000 29 | part swap --size=1000 30 | 31 | %post 32 | # Remove root password 33 | passwd -d root > /dev/null 34 | 35 | # Remove random-seed 36 | rm /var/lib/systemd/random-seed 37 | %end 38 | 39 | # Architecture specific packages 40 | # The bootloader package requirements are different 41 | %pre 42 | PKGS=/tmp/arch-packages.ks 43 | echo > $PKGS 44 | ARCH=$(uname -m) 45 | case $ARCH in 46 | x86_64) 47 | echo "%packages" >> $PKGS 48 | echo "shim" >> $PKGS 49 | echo "grub2" >> $PKGS 50 | echo "grub2-efi" >> $PKGS 51 | echo "efibootmgr" >> $PKGS 52 | echo "%end" >> $PKGS 53 | ;; 54 | aarch64) 55 | echo "%packages" >> $PKGS 56 | echo "efibootmgr" >> $PKGS 57 | echo "grub2-efi" >> $PKGS 58 | echo "shim-aa64" >> $PKGS 59 | echo "%end" >> $PKGS 60 | ;; 61 | ppc64le) 62 | echo "%packages" >> $PKGS 63 | echo "powerpc-utils" >> $PKGS 64 | echo "grub2-tools" >> $PKGS 65 | echo "grub2-tools-minimal" >> $PKGS 66 | echo "grub2-tools-extra" >> $PKGS 67 | echo "grub2-ppc64le" >> $PKGS 68 | echo "%end" >> $PKGS 69 | ;; 70 | s390x) 71 | echo "%packages" >> $PKGS 72 | echo "s390utils-base" >> $PKGS 73 | echo "%end" >> $PKGS 74 | ;; 75 | esac 76 | %end 77 | 78 | %include /tmp/arch-packages.ks 79 | 80 | %packages 81 | @core 82 | kernel 83 | # Make sure that DNF doesn't pull in debug kernel to satisfy kmod() requires 84 | kernel-modules 85 | kernel-modules-extra 86 | -dracut-config-rescue 87 | 88 | # dracut needs these included 89 | dracut-network 90 | tar 91 | 92 | # lorax for image-minimizer 93 | lorax 94 | %end 95 | 96 | # 97 | # Use the image-minimizer to remove some packages and dirs 98 | # 99 | %post --interpreter=image-minimizer --nochroot 100 | 101 | 102 | # Kernel modules minimization 103 | # Drop many filesystems 104 | drop /lib/modules/*/kernel/fs 105 | keep /lib/modules/*/kernel/fs/ext* 106 | keep /lib/modules/*/kernel/fs/mbcache* 107 | keep /lib/modules/*/kernel/fs/squashfs 108 | keep /lib/modules/*/kernel/fs/jbd* 109 | keep /lib/modules/*/kernel/fs/btrfs 110 | keep /lib/modules/*/kernel/fs/cifs* 111 | keep /lib/modules/*/kernel/fs/fat 112 | keep /lib/modules/*/kernel/fs/nfs 113 | keep /lib/modules/*/kernel/fs/nfs_common 114 | keep /lib/modules/*/kernel/fs/fscache 115 | keep /lib/modules/*/kernel/fs/lockd 116 | keep /lib/modules/*/kernel/fs/nls/nls_utf8.ko 117 | keep /lib/modules/*/kernel/fs/configfs/configfs.ko 118 | keep /lib/modules/*/kernel/fs/fuse 119 | keep /lib/modules/*/kernel/fs/isofs 120 | # No sound 121 | drop /lib/modules/*/kernel/sound 122 | 123 | 124 | # Drop some unused rpms, without dropping dependencies 125 | droprpm checkpolicy 126 | droprpm dmraid-events 127 | droprpm gamin 128 | droprpm gnupg2 129 | droprpm linux-atm-libs 130 | droprpm make 131 | droprpm mtools 132 | droprpm mysql-libs 133 | droprpm perl 134 | droprpm perl-Module-Pluggable 135 | droprpm perl-Net-Telnet 136 | droprpm perl-PathTools 137 | droprpm perl-Pod-Escapes 138 | droprpm perl-Pod-Simple 139 | droprpm perl-Scalar-List-Utils 140 | droprpm perl-hivex 141 | droprpm perl-macros 142 | droprpm sgpio 143 | droprpm syslinux 144 | droprpm system-config-firewall-base 145 | droprpm usermode 146 | # Not needed after image-minimizer is done 147 | droprpm lorax 148 | %end 149 | -------------------------------------------------------------------------------- /docs/fedora-openstack.ks: -------------------------------------------------------------------------------- 1 | # Minimal Disk Image 2 | # 3 | # Firewall configuration 4 | firewall --enabled 5 | # Use network installation 6 | url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/" 7 | 8 | # Root password 9 | rootpw --plaintext replace-this-pw 10 | # Network information 11 | network --bootproto=dhcp --activate 12 | # System keyboard 13 | keyboard --xlayouts=us --vckeymap=us 14 | # System language 15 | lang en_US.UTF-8 16 | # SELinux configuration 17 | selinux --enforcing 18 | # Shutdown after installation 19 | shutdown 20 | # System timezone 21 | timezone US/Eastern 22 | # System bootloader configuration 23 | bootloader --location=mbr 24 | # Clear the Master Boot Record 25 | zerombr 26 | # Partition clearing information 27 | clearpart --all 28 | # Disk partitioning information 29 | part / --fstype="ext4" --size=3000 30 | 31 | %post 32 | # Remove random-seed 33 | rm /var/lib/systemd/random-seed 34 | %end 35 | 36 | %packages 37 | @core 38 | kernel 39 | # Make sure that DNF doesn't pull in debug kernel to satisfy kmod() requires 40 | kernel-modules 41 | kernel-modules-extra 42 | 43 | grub2-efi 44 | grub2 45 | shim 46 | -dracut-config-rescue 47 | 48 | # dracut needs these included 49 | dracut-network 50 | tar 51 | 52 | # Openstack support 53 | cloud-utils-growpart 54 | cloud-init 55 | 56 | %end 57 | -------------------------------------------------------------------------------- /docs/fedora-vagrant.ks: -------------------------------------------------------------------------------- 1 | # Minimal Vagrant Disk Image 2 | # 3 | 4 | # Firewall configuration 5 | firewall --enabled 6 | # Use network installation 7 | url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/" 8 | # Network information 9 | network --bootproto=dhcp --activate 10 | 11 | # Root account is locked, access via sudo from vagrant user 12 | rootpw --lock 13 | 14 | # Vagrant user with the INSECURE default public key 15 | user --name=vagrant 16 | sshkey --username=vagrant "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" 17 | 18 | # System keyboard 19 | keyboard --xlayouts=us --vckeymap=us 20 | # System language 21 | lang en_US.UTF-8 22 | # SELinux configuration 23 | selinux --enforcing 24 | # Shutdown after installation 25 | shutdown 26 | # System timezone 27 | timezone US/Eastern 28 | # System bootloader configuration 29 | bootloader --location=mbr 30 | # Partition clearing information 31 | clearpart --all --initlabel 32 | # Disk partitioning information 33 | part / --fstype="ext4" --size=4000 34 | part swap --size=1000 35 | 36 | %post 37 | # Remove random-seed 38 | rm /var/lib/systemd/random-seed 39 | 40 | # Setup sudoers for Vagrant 41 | echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 42 | sed -i 's/Defaults\s*requiretty/Defaults !requiretty/' /etc/sudoers 43 | 44 | # SSH setup 45 | sed -i 's/.*UseDNS.*/UseDNS no/' /etc/ssh/sshd_config 46 | %end 47 | 48 | %packages --excludedocs 49 | @core 50 | kernel 51 | # Make sure that DNF doesn't pull in debug kernel to satisfy kmod() requires 52 | kernel-modules 53 | kernel-modules-extra 54 | 55 | grub2-efi 56 | grub2 57 | shim 58 | -dracut-config-rescue 59 | 60 | # dracut needs these included 61 | dracut-network 62 | tar 63 | 64 | # Useful tools for Vagrant 65 | openssh-server 66 | openssh-clients 67 | sudo 68 | rsync 69 | %end 70 | -------------------------------------------------------------------------------- /docs/html/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: a853571d656ae5212a1a9600dd43a5c2 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /docs/html/.doctrees/environment.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/html/.doctrees/environment.pickle -------------------------------------------------------------------------------- /docs/html/.doctrees/image-minimizer.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/html/.doctrees/image-minimizer.doctree -------------------------------------------------------------------------------- /docs/html/.doctrees/index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/html/.doctrees/index.doctree -------------------------------------------------------------------------------- /docs/html/.doctrees/intro.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/html/.doctrees/intro.doctree -------------------------------------------------------------------------------- /docs/html/.doctrees/livemedia-creator.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/html/.doctrees/livemedia-creator.doctree -------------------------------------------------------------------------------- /docs/html/.doctrees/lorax.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/html/.doctrees/lorax.doctree -------------------------------------------------------------------------------- /docs/html/.doctrees/mkksiso.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/html/.doctrees/mkksiso.doctree -------------------------------------------------------------------------------- /docs/html/.doctrees/modules.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/html/.doctrees/modules.doctree -------------------------------------------------------------------------------- /docs/html/.doctrees/product-images.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/html/.doctrees/product-images.doctree -------------------------------------------------------------------------------- /docs/html/.doctrees/pylorax.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/html/.doctrees/pylorax.doctree -------------------------------------------------------------------------------- /docs/html/_sources/image-minimizer.rst.txt: -------------------------------------------------------------------------------- 1 | image-minimizer 2 | =============== 3 | 4 | :Authors: 5 | Brian C. Lane 6 | 7 | `image-minimizer` is a script used as an interpreter for kickstart `%post` 8 | sections. It is used to remove rpm packages and individual files from the 9 | system that Anaconda has just installed. 10 | 11 | It processes a list of commands that tell it which files or rpms to remove, and 12 | which to keep. 13 | 14 | 15 | image-minimizer cmdline arguments 16 | --------------------------------- 17 | 18 | `usage: image-minimizer [-h] [-i STRING] [--dryrun] [-v] STRING` 19 | 20 | Optional arguments 21 | ^^^^^^^^^^^^^^^^^^ 22 | 23 | -h, --help show this help message and exit 24 | -i STRING, --installroot STRING 25 | Root path to prepend to all file patterns and 26 | installation root for RPM operations. Defaults to 27 | INSTALL_ROOT or /mnt/sysimage/ 28 | --dryrun If set, no filesystem changes are made. 29 | -v, --verbose Display every action as it is performed. 30 | 31 | Positional arguments 32 | ^^^^^^^^^^^^^^^^^^^^ 33 | 34 | :STRING: Filename to process 35 | 36 | 37 | NOTES 38 | ----- 39 | 40 | You cannot pass any arguments to `image-minimizer` when using it from the 41 | kickstart `%post`. 42 | 43 | When using this from a kickstart the image-minimizer package needs to be available. 44 | It is not included on the standard boot.iso, so you will need to include `lorax` in 45 | the `%package` section. You can use `image-minimizer` to remove lorax from the install. 46 | 47 | If you are using this with `livemedia-creator` it can be installed on the host 48 | system so that `lorax` isn't needed in the `%package` list, and it doesn't need 49 | to be removed. 50 | 51 | 52 | commands 53 | -------- 54 | 55 | Commands are listed one per line, followed by a space, and then by the 56 | package, file, or glob. The globs used are Unix style pathname patterns using 57 | `*`, `?`, and `[]` character ranges. globbing is implemented using the python 58 | glob module. 59 | 60 | 61 | * drop 62 | This will remove files from the installation. 63 | 64 | * keep 65 | This will keep files, and should follow any `drop` commands including globs. 66 | 67 | * droprpm 68 | Remove matching rpm packages. Dependencies are not remove, just individual 69 | packages matching the glob. 70 | 71 | * keeprpm 72 | Do not remove matching rpm packages, it should follow any `droprpm` commands 73 | that include globs. 74 | 75 | 76 | example 77 | ------- 78 | 79 | Example Anaconda `%post` usage:: 80 | 81 | %post --interpreter=image-minimizer --nochroot 82 | 83 | drop /lib/modules/*/kernel/fs 84 | keep /lib/modules/*/kernel/fs/ext* 85 | keep /lib/modules/*/kernel/fs/mbcache* 86 | keep /lib/modules/*/kernel/fs/squashfs 87 | 88 | droprpm make 89 | droprpm mtools 90 | droprpm mysql-libs 91 | droprpm perl 92 | droprpm perl-Pod-* 93 | droprpm syslinux 94 | keeprpm perl-Pod-Simple 95 | 96 | # Not needed after image-minimizer is done 97 | droprpm lorax 98 | 99 | %end 100 | -------------------------------------------------------------------------------- /docs/html/_sources/index.rst.txt: -------------------------------------------------------------------------------- 1 | .. Lorax documentation master file, created by 2 | sphinx-quickstart on Wed Apr 8 13:46:00 2015. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to Lorax's documentation! 7 | ================================= 8 | 9 | Contents: 10 | 11 | .. toctree:: 12 | :maxdepth: 1 13 | 14 | intro 15 | lorax 16 | livemedia-creator 17 | mkksiso 18 | product-images 19 | image-minimizer 20 | modules 21 | 22 | Documentation for other Lorax Branches 23 | ====================================== 24 | 25 | * `Fedora 40 `_ 26 | * `Fedora 39 `_ 27 | * `Fedora 38 `_ 28 | 29 | Indices and tables 30 | ================== 31 | 32 | * :ref:`genindex` 33 | * :ref:`modindex` 34 | * :ref:`search` 35 | 36 | -------------------------------------------------------------------------------- /docs/html/_sources/intro.rst.txt: -------------------------------------------------------------------------------- 1 | Introduction to Lorax 2 | ===================== 3 | 4 | I am the Lorax. I speak for the trees [and images]. 5 | 6 | Lorax is used to build the Anaconda Installer boot.iso, it consists of a 7 | library, pylorax, a set of templates, and the lorax script. Its operation 8 | is driven by a customized set of Mako templates that lists the packages 9 | to be installed, steps to execute to remove unneeded files, and creation 10 | of the iso for all of the supported architectures. 11 | 12 | 13 | 14 | 15 | 16 | 17 | Before Lorax 18 | ============ 19 | 20 | Tree building tools such as pungi and revisor rely on 'buildinstall' in 21 | anaconda/scripts/ to produce the boot images and other such control files 22 | in the final tree. The existing buildinstall scripts written in a mix of 23 | bash and Python are unmaintainable. Lorax is an attempt to replace them 24 | with something more flexible. 25 | 26 | 27 | EXISTING WORKFLOW: 28 | 29 | pungi and other tools call scripts/buildinstall, which in turn call other 30 | scripts to do the image building and data generation. Here's how it 31 | currently looks: 32 | 33 | -> buildinstall 34 | * process command line options 35 | * write temporary yum.conf to point to correct repo 36 | * find anaconda release RPM 37 | * unpack RPM, pull in those versions of upd-instroot, mk-images, 38 | maketreeinfo.py, makestamp.py, and buildinstall 39 | 40 | -> call upd-instroot 41 | 42 | -> call maketreeinfo.py 43 | 44 | -> call mk-images (which figures out which mk-images.ARCH to call) 45 | 46 | -> call makestamp.py 47 | 48 | * clean up 49 | 50 | 51 | PROBLEMS: 52 | 53 | The existing workflow presents some problems with maintaining the scripts. 54 | First, almost all knowledge of what goes in to the stage 1 and stage 2 55 | images lives in upd-instroot. The mk-images* scripts copy things from the 56 | root created by upd-instroot in order to build the stage 1 image, though 57 | it's not completely clear from reading the scripts. 58 | 59 | 60 | NEW IDEAS: 61 | 62 | Create a new central driver with all information living in Python modules. 63 | Configuration files will provide the knowledge previously contained in the 64 | upd-instroot and mk-images* scripts. 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /docs/html/_sources/modules.rst.txt: -------------------------------------------------------------------------------- 1 | src 2 | === 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | 7 | pylorax 8 | -------------------------------------------------------------------------------- /docs/html/_sources/product-images.rst.txt: -------------------------------------------------------------------------------- 1 | Product and Updates Images 2 | ========================== 3 | 4 | Lorax now supports creation of product.img and updates.img as part of the build 5 | process. This is implemented using the installimg template command which will 6 | take the contents of a directory and create a compressed archive from it. The 7 | directory must be created by one of the packages installed by 8 | runtime-install.tmpl or by passing ``--installpkgs `` to lorax at 9 | runtime. The x86, ppc, ppc64le and aarch64 templates all look for 10 | /usr/share/lorax/product/ and /usr/share/lorax/updates/ directories in the 11 | install chroot while creating the final install tree. If there are files in 12 | those directories lorax will create images/product.img and/or 13 | images/updates.img 14 | 15 | These archives are just like an anaconda updates image -- their contents are 16 | copied over the top of the filesystem at boot time so that you can drop in 17 | files to add to or replace anything on the filesystem. 18 | 19 | Anaconda has several places that it looks for updates, the one for product.img 20 | is in /run/install/product. So for example, to add an installclass to Anaconda 21 | you would put your custom class here: 22 | 23 | ``/usr/share/lorax/product/run/install/product/pyanaconda/installclasses/custom.py`` 24 | 25 | If the packages containing the product/updates files are not included as part 26 | of normal dependencies you can add specific packages with the ``--installpkgs`` 27 | command or the installpkgs paramater of :class:`pylorax.treebuilder.RuntimeBuilder` 28 | -------------------------------------------------------------------------------- /docs/html/_sources/pylorax.rst.txt: -------------------------------------------------------------------------------- 1 | pylorax package 2 | =============== 3 | 4 | Submodules 5 | ---------- 6 | 7 | pylorax.base module 8 | ------------------- 9 | 10 | .. automodule:: pylorax.base 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pylorax.buildstamp module 16 | ------------------------- 17 | 18 | .. automodule:: pylorax.buildstamp 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pylorax.cmdline module 24 | ---------------------- 25 | 26 | .. automodule:: pylorax.cmdline 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | pylorax.creator module 32 | ---------------------- 33 | 34 | .. automodule:: pylorax.creator 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | pylorax.decorators module 40 | ------------------------- 41 | 42 | .. automodule:: pylorax.decorators 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | pylorax.discinfo module 48 | ----------------------- 49 | 50 | .. automodule:: pylorax.discinfo 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | pylorax.dnfbase module 56 | ---------------------- 57 | 58 | .. automodule:: pylorax.dnfbase 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | 63 | pylorax.dnfhelper module 64 | ------------------------ 65 | 66 | .. automodule:: pylorax.dnfhelper 67 | :members: 68 | :undoc-members: 69 | :show-inheritance: 70 | 71 | pylorax.executils module 72 | ------------------------ 73 | 74 | .. automodule:: pylorax.executils 75 | :members: 76 | :undoc-members: 77 | :show-inheritance: 78 | 79 | pylorax.imgutils module 80 | ----------------------- 81 | 82 | .. automodule:: pylorax.imgutils 83 | :members: 84 | :undoc-members: 85 | :show-inheritance: 86 | 87 | pylorax.installer module 88 | ------------------------ 89 | 90 | .. automodule:: pylorax.installer 91 | :members: 92 | :undoc-members: 93 | :show-inheritance: 94 | 95 | pylorax.ltmpl module 96 | -------------------- 97 | 98 | .. automodule:: pylorax.ltmpl 99 | :members: 100 | :undoc-members: 101 | :show-inheritance: 102 | 103 | pylorax.monitor module 104 | ---------------------- 105 | 106 | .. automodule:: pylorax.monitor 107 | :members: 108 | :undoc-members: 109 | :show-inheritance: 110 | 111 | pylorax.mount module 112 | -------------------- 113 | 114 | .. automodule:: pylorax.mount 115 | :members: 116 | :undoc-members: 117 | :show-inheritance: 118 | 119 | pylorax.output module 120 | --------------------- 121 | 122 | .. automodule:: pylorax.output 123 | :members: 124 | :undoc-members: 125 | :show-inheritance: 126 | 127 | pylorax.sysutils module 128 | ----------------------- 129 | 130 | .. automodule:: pylorax.sysutils 131 | :members: 132 | :undoc-members: 133 | :show-inheritance: 134 | 135 | pylorax.treebuilder module 136 | -------------------------- 137 | 138 | .. automodule:: pylorax.treebuilder 139 | :members: 140 | :undoc-members: 141 | :show-inheritance: 142 | 143 | pylorax.treeinfo module 144 | ----------------------- 145 | 146 | .. automodule:: pylorax.treeinfo 147 | :members: 148 | :undoc-members: 149 | :show-inheritance: 150 | 151 | Module contents 152 | --------------- 153 | 154 | .. automodule:: pylorax 155 | :members: 156 | :undoc-members: 157 | :show-inheritance: 158 | -------------------------------------------------------------------------------- /docs/html/_static/css/badge_only.css: -------------------------------------------------------------------------------- 1 | .clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-style:normal;font-weight:400;src:local("FontAwesome"),url('/.sysassets/fonts/fontawesome/fontawesome-webfont.ttf') format("truetype")}.fa:before{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1}.fa:before,a .fa{text-decoration:inherit}.fa:before,a .fa,li .fa{display:inline-block}li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before,.icon-book:before{content:"\f02d"}.fa-caret-down:before,.icon-caret-down:before{content:"\f0d7"}.fa-caret-up:before,.icon-caret-up:before{content:"\f0d8"}.fa-caret-left:before,.icon-caret-left:before{content:"\f0d9"}.fa-caret-right:before,.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60}.rst-versions .rst-current-version:after{clear:both;content:"";display:block}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}} -------------------------------------------------------------------------------- /docs/html/_static/documentation_options.js: -------------------------------------------------------------------------------- 1 | const DOCUMENTATION_OPTIONS = { 2 | VERSION: '41.3', 3 | LANGUAGE: 'en', 4 | COLLAPSE_INDEX: false, 5 | BUILDER: 'html', 6 | FILE_SUFFIX: '.html', 7 | LINK_SUFFIX: '.html', 8 | HAS_SOURCE: true, 9 | SOURCELINK_SUFFIX: '.txt', 10 | NAVIGATION_WITH_KEYS: false, 11 | SHOW_SEARCH_SUMMARY: true, 12 | ENABLE_SEARCH_SHORTCUTS: true, 13 | }; -------------------------------------------------------------------------------- /docs/html/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/html/_static/file.png -------------------------------------------------------------------------------- /docs/html/_static/js/badge_only.js: -------------------------------------------------------------------------------- 1 | !function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}({4:function(e,t,r){}}); -------------------------------------------------------------------------------- /docs/html/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/html/_static/minus.png -------------------------------------------------------------------------------- /docs/html/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/html/_static/plus.png -------------------------------------------------------------------------------- /docs/html/composer-cli.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/html/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/html/objects.inv -------------------------------------------------------------------------------- /docs/image-minimizer.rst: -------------------------------------------------------------------------------- 1 | image-minimizer 2 | =============== 3 | 4 | :Authors: 5 | Brian C. Lane 6 | 7 | `image-minimizer` is a script used as an interpreter for kickstart `%post` 8 | sections. It is used to remove rpm packages and individual files from the 9 | system that Anaconda has just installed. 10 | 11 | It processes a list of commands that tell it which files or rpms to remove, and 12 | which to keep. 13 | 14 | 15 | image-minimizer cmdline arguments 16 | --------------------------------- 17 | 18 | `usage: image-minimizer [-h] [-i STRING] [--dryrun] [-v] STRING` 19 | 20 | Optional arguments 21 | ^^^^^^^^^^^^^^^^^^ 22 | 23 | -h, --help show this help message and exit 24 | -i STRING, --installroot STRING 25 | Root path to prepend to all file patterns and 26 | installation root for RPM operations. Defaults to 27 | INSTALL_ROOT or /mnt/sysimage/ 28 | --dryrun If set, no filesystem changes are made. 29 | -v, --verbose Display every action as it is performed. 30 | 31 | Positional arguments 32 | ^^^^^^^^^^^^^^^^^^^^ 33 | 34 | :STRING: Filename to process 35 | 36 | 37 | NOTES 38 | ----- 39 | 40 | You cannot pass any arguments to `image-minimizer` when using it from the 41 | kickstart `%post`. 42 | 43 | When using this from a kickstart the image-minimizer package needs to be available. 44 | It is not included on the standard boot.iso, so you will need to include `lorax` in 45 | the `%package` section. You can use `image-minimizer` to remove lorax from the install. 46 | 47 | If you are using this with `livemedia-creator` it can be installed on the host 48 | system so that `lorax` isn't needed in the `%package` list, and it doesn't need 49 | to be removed. 50 | 51 | 52 | commands 53 | -------- 54 | 55 | Commands are listed one per line, followed by a space, and then by the 56 | package, file, or glob. The globs used are Unix style pathname patterns using 57 | `*`, `?`, and `[]` character ranges. globbing is implemented using the python 58 | glob module. 59 | 60 | 61 | * drop 62 | This will remove files from the installation. 63 | 64 | * keep 65 | This will keep files, and should follow any `drop` commands including globs. 66 | 67 | * droprpm 68 | Remove matching rpm packages. Dependencies are not remove, just individual 69 | packages matching the glob. 70 | 71 | * keeprpm 72 | Do not remove matching rpm packages, it should follow any `droprpm` commands 73 | that include globs. 74 | 75 | 76 | example 77 | ------- 78 | 79 | Example Anaconda `%post` usage:: 80 | 81 | %post --interpreter=image-minimizer --nochroot 82 | 83 | drop /lib/modules/*/kernel/fs 84 | keep /lib/modules/*/kernel/fs/ext* 85 | keep /lib/modules/*/kernel/fs/mbcache* 86 | keep /lib/modules/*/kernel/fs/squashfs 87 | 88 | droprpm make 89 | droprpm mtools 90 | droprpm mysql-libs 91 | droprpm perl 92 | droprpm perl-Pod-* 93 | droprpm syslinux 94 | keeprpm perl-Pod-Simple 95 | 96 | # Not needed after image-minimizer is done 97 | droprpm lorax 98 | 99 | %end 100 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. Lorax documentation master file, created by 2 | sphinx-quickstart on Wed Apr 8 13:46:00 2015. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to Lorax's documentation! 7 | ================================= 8 | 9 | Contents: 10 | 11 | .. toctree:: 12 | :maxdepth: 1 13 | 14 | intro 15 | lorax 16 | livemedia-creator 17 | mkksiso 18 | product-images 19 | image-minimizer 20 | modules 21 | 22 | Documentation for other Lorax Branches 23 | ====================================== 24 | 25 | * `Fedora 40 `_ 26 | * `Fedora 39 `_ 27 | * `Fedora 38 `_ 28 | 29 | Indices and tables 30 | ================== 31 | 32 | * :ref:`genindex` 33 | * :ref:`modindex` 34 | * :ref:`search` 35 | 36 | -------------------------------------------------------------------------------- /docs/intro.rst: -------------------------------------------------------------------------------- 1 | Introduction to Lorax 2 | ===================== 3 | 4 | I am the Lorax. I speak for the trees [and images]. 5 | 6 | Lorax is used to build the Anaconda Installer boot.iso, it consists of a 7 | library, pylorax, a set of templates, and the lorax script. Its operation 8 | is driven by a customized set of Mako templates that lists the packages 9 | to be installed, steps to execute to remove unneeded files, and creation 10 | of the iso for all of the supported architectures. 11 | 12 | 13 | 14 | 15 | 16 | 17 | Before Lorax 18 | ============ 19 | 20 | Tree building tools such as pungi and revisor rely on 'buildinstall' in 21 | anaconda/scripts/ to produce the boot images and other such control files 22 | in the final tree. The existing buildinstall scripts written in a mix of 23 | bash and Python are unmaintainable. Lorax is an attempt to replace them 24 | with something more flexible. 25 | 26 | 27 | EXISTING WORKFLOW: 28 | 29 | pungi and other tools call scripts/buildinstall, which in turn call other 30 | scripts to do the image building and data generation. Here's how it 31 | currently looks: 32 | 33 | -> buildinstall 34 | * process command line options 35 | * write temporary yum.conf to point to correct repo 36 | * find anaconda release RPM 37 | * unpack RPM, pull in those versions of upd-instroot, mk-images, 38 | maketreeinfo.py, makestamp.py, and buildinstall 39 | 40 | -> call upd-instroot 41 | 42 | -> call maketreeinfo.py 43 | 44 | -> call mk-images (which figures out which mk-images.ARCH to call) 45 | 46 | -> call makestamp.py 47 | 48 | * clean up 49 | 50 | 51 | PROBLEMS: 52 | 53 | The existing workflow presents some problems with maintaining the scripts. 54 | First, almost all knowledge of what goes in to the stage 1 and stage 2 55 | images lives in upd-instroot. The mk-images* scripts copy things from the 56 | root created by upd-instroot in order to build the stage 1 image, though 57 | it's not completely clear from reading the scripts. 58 | 59 | 60 | NEW IDEAS: 61 | 62 | Create a new central driver with all information living in Python modules. 63 | Configuration files will provide the knowledge previously contained in the 64 | upd-instroot and mk-images* scripts. 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /docs/man/.doctrees/composer-cli.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/composer-cli.doctree -------------------------------------------------------------------------------- /docs/man/.doctrees/composer.cli.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/composer.cli.doctree -------------------------------------------------------------------------------- /docs/man/.doctrees/composer.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/composer.doctree -------------------------------------------------------------------------------- /docs/man/.doctrees/environment.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/environment.pickle -------------------------------------------------------------------------------- /docs/man/.doctrees/image-minimizer.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/image-minimizer.doctree -------------------------------------------------------------------------------- /docs/man/.doctrees/index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/index.doctree -------------------------------------------------------------------------------- /docs/man/.doctrees/intro.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/intro.doctree -------------------------------------------------------------------------------- /docs/man/.doctrees/lifted.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/lifted.doctree -------------------------------------------------------------------------------- /docs/man/.doctrees/livemedia-creator.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/livemedia-creator.doctree -------------------------------------------------------------------------------- /docs/man/.doctrees/lorax-composer.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/lorax-composer.doctree -------------------------------------------------------------------------------- /docs/man/.doctrees/lorax.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/lorax.doctree -------------------------------------------------------------------------------- /docs/man/.doctrees/mkksiso.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/mkksiso.doctree -------------------------------------------------------------------------------- /docs/man/.doctrees/modules.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/modules.doctree -------------------------------------------------------------------------------- /docs/man/.doctrees/product-images.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/product-images.doctree -------------------------------------------------------------------------------- /docs/man/.doctrees/pylorax.api.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/pylorax.api.doctree -------------------------------------------------------------------------------- /docs/man/.doctrees/pylorax.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/docs/man/.doctrees/pylorax.doctree -------------------------------------------------------------------------------- /docs/modules.rst: -------------------------------------------------------------------------------- 1 | src 2 | === 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | 7 | pylorax 8 | -------------------------------------------------------------------------------- /docs/product-images.rst: -------------------------------------------------------------------------------- 1 | Product and Updates Images 2 | ========================== 3 | 4 | Lorax now supports creation of product.img and updates.img as part of the build 5 | process. This is implemented using the installimg template command which will 6 | take the contents of a directory and create a compressed archive from it. The 7 | directory must be created by one of the packages installed by 8 | runtime-install.tmpl or by passing ``--installpkgs `` to lorax at 9 | runtime. The x86, ppc, ppc64le and aarch64 templates all look for 10 | /usr/share/lorax/product/ and /usr/share/lorax/updates/ directories in the 11 | install chroot while creating the final install tree. If there are files in 12 | those directories lorax will create images/product.img and/or 13 | images/updates.img 14 | 15 | These archives are just like an anaconda updates image -- their contents are 16 | copied over the top of the filesystem at boot time so that you can drop in 17 | files to add to or replace anything on the filesystem. 18 | 19 | Anaconda has several places that it looks for updates, the one for product.img 20 | is in /run/install/product. So for example, to add an installclass to Anaconda 21 | you would put your custom class here: 22 | 23 | ``/usr/share/lorax/product/run/install/product/pyanaconda/installclasses/custom.py`` 24 | 25 | If the packages containing the product/updates files are not included as part 26 | of normal dependencies you can add specific packages with the ``--installpkgs`` 27 | command or the installpkgs paramater of :class:`pylorax.treebuilder.RuntimeBuilder` 28 | -------------------------------------------------------------------------------- /docs/pylorax.rst: -------------------------------------------------------------------------------- 1 | pylorax package 2 | =============== 3 | 4 | Submodules 5 | ---------- 6 | 7 | pylorax.base module 8 | ------------------- 9 | 10 | .. automodule:: pylorax.base 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pylorax.buildstamp module 16 | ------------------------- 17 | 18 | .. automodule:: pylorax.buildstamp 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pylorax.cmdline module 24 | ---------------------- 25 | 26 | .. automodule:: pylorax.cmdline 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | pylorax.creator module 32 | ---------------------- 33 | 34 | .. automodule:: pylorax.creator 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | pylorax.decorators module 40 | ------------------------- 41 | 42 | .. automodule:: pylorax.decorators 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | pylorax.discinfo module 48 | ----------------------- 49 | 50 | .. automodule:: pylorax.discinfo 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | pylorax.dnfbase module 56 | ---------------------- 57 | 58 | .. automodule:: pylorax.dnfbase 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | 63 | pylorax.dnfhelper module 64 | ------------------------ 65 | 66 | .. automodule:: pylorax.dnfhelper 67 | :members: 68 | :undoc-members: 69 | :show-inheritance: 70 | 71 | pylorax.executils module 72 | ------------------------ 73 | 74 | .. automodule:: pylorax.executils 75 | :members: 76 | :undoc-members: 77 | :show-inheritance: 78 | 79 | pylorax.imgutils module 80 | ----------------------- 81 | 82 | .. automodule:: pylorax.imgutils 83 | :members: 84 | :undoc-members: 85 | :show-inheritance: 86 | 87 | pylorax.installer module 88 | ------------------------ 89 | 90 | .. automodule:: pylorax.installer 91 | :members: 92 | :undoc-members: 93 | :show-inheritance: 94 | 95 | pylorax.ltmpl module 96 | -------------------- 97 | 98 | .. automodule:: pylorax.ltmpl 99 | :members: 100 | :undoc-members: 101 | :show-inheritance: 102 | 103 | pylorax.monitor module 104 | ---------------------- 105 | 106 | .. automodule:: pylorax.monitor 107 | :members: 108 | :undoc-members: 109 | :show-inheritance: 110 | 111 | pylorax.mount module 112 | -------------------- 113 | 114 | .. automodule:: pylorax.mount 115 | :members: 116 | :undoc-members: 117 | :show-inheritance: 118 | 119 | pylorax.output module 120 | --------------------- 121 | 122 | .. automodule:: pylorax.output 123 | :members: 124 | :undoc-members: 125 | :show-inheritance: 126 | 127 | pylorax.sysutils module 128 | ----------------------- 129 | 130 | .. automodule:: pylorax.sysutils 131 | :members: 132 | :undoc-members: 133 | :show-inheritance: 134 | 135 | pylorax.treebuilder module 136 | -------------------------- 137 | 138 | .. automodule:: pylorax.treebuilder 139 | :members: 140 | :undoc-members: 141 | :show-inheritance: 142 | 143 | pylorax.treeinfo module 144 | ----------------------- 145 | 146 | .. automodule:: pylorax.treeinfo 147 | :members: 148 | :undoc-members: 149 | :show-inheritance: 150 | 151 | Module contents 152 | --------------- 153 | 154 | .. automodule:: pylorax 155 | :members: 156 | :undoc-members: 157 | :show-inheritance: 158 | -------------------------------------------------------------------------------- /etc/lorax.conf: -------------------------------------------------------------------------------- 1 | # Lorax configuration file 2 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Mako 2 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | import os 3 | 4 | # config file 5 | data_files = [("/etc/lorax", ["etc/lorax.conf"]), 6 | ("/usr/lib/tmpfiles.d/", ["systemd/lorax.conf"])] 7 | 8 | # shared files 9 | for root, dnames, fnames in os.walk("share"): 10 | for fname in fnames: 11 | data_files.append((root.replace("share", "/usr/share/lorax", 1), 12 | [os.path.join(root, fname)])) 13 | 14 | # executable 15 | data_files.append(("/usr/bin", ["src/bin/lorax", "src/bin/mkefiboot", 16 | "src/bin/livemedia-creator", 17 | "src/bin/image-minimizer", "src/bin/mkksiso"])) 18 | 19 | setup(name="lorax", 20 | version="43.4", 21 | description="Lorax", 22 | long_description="Tools for creating bootable images, including the Anaconda boot.iso", 23 | author="Martin Gracik, Will Woods , Brian C. Lane ", 24 | author_email="bcl@redhat.com", 25 | url="http://www.github.com/weldr/lorax/", 26 | download_url="http://www.github.com/weldr/lorax/releases/", 27 | license="GPLv2+", 28 | packages=["pylorax"], 29 | package_dir={"" : "src"}, 30 | data_files=data_files 31 | ) 32 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/aarch64.tmpl: -------------------------------------------------------------------------------- 1 | <%page args="kernels, runtime_img, basearch, inroot, outroot, product, isolabel"/> 2 | <% 3 | configdir="tmp/config_files/aarch64" 4 | PXEBOOTDIR="images/pxeboot" 5 | KERNELDIR=PXEBOOTDIR 6 | STAGE2IMG="images/install.img" 7 | LORAXDIR="usr/share/lorax/" 8 | 9 | ## Don't allow spaces or escape characters in the iso label 10 | def valid_label(ch): 11 | return ch.isalnum() or ch == '_' 12 | 13 | isolabel = ''.join(ch if valid_label(ch) else '-' for ch in isolabel) 14 | 15 | import os 16 | from os.path import basename 17 | from pylorax.sysutils import joinpaths 18 | 19 | # Test the runtime_img, if it is > 4GiB we need to set -iso-level to 3 20 | if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3: 21 | isoargs = "-iso-level 3" 22 | else: 23 | isoargs = "" 24 | %> 25 | 26 | mkdir images 27 | install ${runtime_img} ${STAGE2IMG} 28 | treeinfo stage2 mainimage ${STAGE2IMG} 29 | 30 | ## install kernels 31 | mkdir ${KERNELDIR} 32 | %for kernel in kernels: 33 | ## normal aarch64 34 | installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz 35 | installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img 36 | %endfor 37 | 38 | #FIXME: this will need adjusted when we have a real bootloader. 39 | ## WHeeeeeeee, EFI. 40 | ## We could remove the basearch restriction someday.. 41 | <% efiargs=""; efigraft="" %> 42 | %if exists("boot/efi/EFI/*/gcdaa64.efi"): 43 | <% 44 | efiarch32 = None 45 | efiarch64 = 'AA64' 46 | efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot) 47 | images = ["images/efiboot.img"] 48 | %> 49 | %for img in images: 50 | <% 51 | efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot".format(img) 52 | efigraft += " {0}={1}/{0}".format(img,outroot) 53 | %> 54 | treeinfo images-${basearch} ${img|basename} ${img} 55 | %endfor 56 | <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch32=efiarch32, efiarch64=efiarch64, isolabel=isolabel"/> 57 | %endif 58 | 59 | # Create optional product.img and updates.img 60 | <% filegraft=""; images=["product", "updates"] %> 61 | %for img in images: 62 | %if exists("%s/%s/" % (LORAXDIR, img)): 63 | installimg ${LORAXDIR}/${img}/ images/${img}.img 64 | treeinfo images-${basearch} ${img}.img images/${img}.img 65 | <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %> 66 | %endif 67 | %endfor 68 | 69 | # Inherit iso-graft/ if it exists from external templates 70 | <% 71 | import os 72 | if os.path.exists(workdir + "/iso-graft"): 73 | filegraft += " " + workdir + "/iso-graft" 74 | %> 75 | 76 | # Add the license files 77 | %for f in glob("usr/share/licenses/*-release-common/*"): 78 | install ${f} ${f|basename} 79 | <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %> 80 | %endfor 81 | 82 | %if exists("boot/efi/EFI/*/gcdaa64.efi"): 83 | ## make boot.iso 84 | runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \ 85 | ${efiargs} -R -J -V '${isolabel}' \ 86 | -graft-points \ 87 | .discinfo=${outroot}/.discinfo \ 88 | ${KERNELDIR}=${outroot}/${KERNELDIR} \ 89 | ${STAGE2IMG}=${outroot}/${STAGE2IMG} \ 90 | ${efigraft} ${filegraft} 91 | treeinfo images-${basearch} boot.iso images/boot.iso 92 | %endif 93 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/appliance/libvirt.tmpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | ${name} 4 | 5 | 6 | 7 | ${arch} 8 | 9 | 10 | 11 | 12 | %for disk, letter in zip(disks, range(97, 123)): 13 | 14 | %endfor 15 | 16 | 17 | ${vcpus} 18 | ${memory} 19 | %for net in networks: 20 | 21 | %endfor 22 | 23 | 24 | 25 | 26 | %for disk in disks: 27 | 28 | %if disk.checksum: 29 | ${disk.checksum} 30 | %endif 31 | 32 | %endfor 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/aarch64/boot.msg: -------------------------------------------------------------------------------- 1 | 2 | splash.lss 3 | 4 | - Press the 0107 key to begin the installation process. 5 | 6 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/aarch64/grub2-efi.cfg: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | if [ x$feature_all_video_module = xy ]; then 5 | insmod all_video 6 | else 7 | insmod efi_gop 8 | insmod efi_uga 9 | insmod ieee1275_fb 10 | insmod vbe 11 | insmod vga 12 | insmod video_bochs 13 | insmod video_cirrus 14 | fi 15 | } 16 | 17 | load_video 18 | set gfxpayload=keep 19 | insmod gzio 20 | insmod part_gpt 21 | insmod ext2 22 | 23 | set timeout=60 24 | ### END /etc/grub.d/00_header ### 25 | 26 | search --no-floppy --set=root -l '@ISOLABEL@' 27 | 28 | ### BEGIN /etc/grub.d/10_linux ### 29 | menuentry 'Install @PRODUCT@ @VERSION@' --class red --class gnu-linux --class gnu --class os { 30 | linux @KERNELPATH@ @ROOT@ ro 31 | initrd @INITRDPATH@ 32 | } 33 | menuentry 'Test this media & install @PRODUCT@ @VERSION@' --class red --class gnu-linux --class gnu --class os { 34 | linux @KERNELPATH@ @ROOT@ rd.live.check 35 | initrd @INITRDPATH@ 36 | } 37 | submenu 'Troubleshooting -->' { 38 | menuentry 'Install @PRODUCT@ @VERSION@ in basic graphics mode' --class red --class gnu-linux --class gnu --class os { 39 | linux @KERNELPATH@ @ROOT@ nomodeset 40 | initrd @INITRDPATH@ 41 | } 42 | menuentry 'Rescue a @PRODUCT@ system' --class red --class gnu-linux --class gnu --class os { 43 | linux @KERNELPATH@ @ROOT@ inst.rescue 44 | initrd @INITRDPATH@ 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/91-anaconda-autoconnect-slaves.conf: -------------------------------------------------------------------------------- 1 | [connection] 2 | connection.autoconnect-slaves=1 3 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/92-anaconda-loglevel-debug.conf: -------------------------------------------------------------------------------- 1 | [logging] 2 | level=DEBUG 3 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/bash_history: -------------------------------------------------------------------------------- 1 | kill -USR1 `cat /var/run/anaconda.pid` 2 | kill -USR2 `cat /var/run/anaconda.pid` 3 | kill -HUP `cat /var/run/anaconda.pid` 4 | udevadm info --export-db | less 5 | tail -f /tmp/storage.log 6 | echo b > /proc/sysrq-trigger 7 | dmsetup table 8 | multipath -d 9 | HOME=/root chroot /mnt/sysimage bash -l -i 10 | less /tmp/anaconda.log 11 | grep -v _yum_lock /tmp/packaging.log 12 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/i18n: -------------------------------------------------------------------------------- 1 | SYSFONT="eurlatgr" 2 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/inst.rngd.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Hardware RNG Entropy Gatherer Daemon 3 | ConditionVirtualization=!container 4 | ConditionKernelCommandLine=|inst.rngd 5 | ConditionKernelCommandLine=!inst.rngd=0 6 | 7 | # The "-f" option is required for the systemd service rngd to work with Type=simple 8 | [Service] 9 | Type=simple 10 | EnvironmentFile=/etc/sysconfig/rngd 11 | ExecStart=/usr/bin/rngd -f $RNGD_ARGS 12 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/org.gtk.Settings.Debug.gschema.override: -------------------------------------------------------------------------------- 1 | [org.gtk.Settings.Debug] 2 | enable-inspector-keybinding=true 3 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/pam.sshd: -------------------------------------------------------------------------------- 1 | #%PAM-1.0 2 | auth required pam_env.so 3 | auth sufficient pam_unix.so likeauth nullok 4 | auth required pam_deny.so 5 | account required pam_unix.so 6 | password sufficient pam_unix.so nullok use_authtok md5 shadow 7 | password required pam_deny.so 8 | session required pam_limits.so 9 | session required pam_unix.so 10 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/profile: -------------------------------------------------------------------------------- 1 | PS1="[anaconda \u@\h \W]\\$ " 2 | PATH=/usr/bin:/mnt/sysimage/usr/bin 3 | export PATH PS1 4 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/resolv.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/share/templates.d/99-generic/config_files/common/resolv.conf -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/rsyslog.conf: -------------------------------------------------------------------------------- 1 | # minimal rsyslog configuration file for the installer boot.iso 2 | 3 | # provides support for local system logging (e.g. via logger command) 4 | # disables message dropping, we need all of them 5 | # Turn off message reception via local log socket; 6 | # local messages are retrieved through imjournal now. 7 | module(load="imuxsock" 8 | SysSock.RateLimit.Interval="0" 9 | SysSock.Use="off") 10 | 11 | # provides access to the systemd journal 12 | # Disable rate limiting to the journal, we need all the messages for debugging 13 | module(load="imjournal" 14 | Ratelimit.Interval="0" 15 | Ratelimit.Burst="0" 16 | StateFile="imjournal.state") 17 | 18 | module(load="imfile" mode="inotify") 19 | input(type="imfile" 20 | File="/tmp/X.log" 21 | Tag="xserver:" 22 | Facility="local1") 23 | 24 | input(type="imfile" 25 | File="/tmp/anaconda-tb-all.log" 26 | Tag="anaconda-tb:" 27 | Facility="local1") 28 | 29 | module(load="builtin:omfile" 30 | Template="RSYSLOG_TraditionalFileFormat" 31 | ) 32 | 33 | 34 | #### GLOBAL DIRECTIVES #### 35 | 36 | # Where to place auxiliary files 37 | global(workDirectory="/var/lib/rsyslog") 38 | 39 | # Include all config files in /etc/rsyslog.d/ 40 | include(file="/etc/rsyslog.d/*.conf") 41 | 42 | #### TEMPLATES #### 43 | 44 | $template anaconda_tty4, "%syslogseverity-text:::uppercase% %programname%:%msg%\n" 45 | $template anaconda_syslog, "%timestamp:8:$:date-rfc3164%,%timestamp:1:3:date-subseconds% %syslogseverity-text:::uppercase% %programname%:%msg%\n" 46 | $template virtio_ForwardFormat, "<%PRI%>%TIMESTAMP:::date-rfc3339% localhost %syslogtag:1:32%%msg:::sp-if-no-1st-sp%%msg%\n" 47 | 48 | #### RULES #### 49 | 50 | # log everything except anaconda-specific records from local1 (those are stored 51 | # directly into files via python logging) 52 | 53 | # discard messages from dracut regenerating initrd 54 | :programname,isequal,"dracut" stop 55 | 56 | *.*;\ 57 | authpriv.none;\ 58 | local1.none /tmp/syslog;anaconda_syslog 59 | & /dev/tty4;anaconda_tty4 60 | 61 | 62 | # ### begin forwarding rule ### 63 | # The statement between the begin ... end define a SINGLE forwarding 64 | # rule. They belong together, do NOT split them. If you create multiple 65 | # forwarding rules, duplicate the whole block! 66 | # Remote Logging (we use TCP for reliable delivery) 67 | # 68 | # An on-disk queue is created for this action. If the remote host is 69 | # down, messages are spooled to disk and sent when it is up again. 70 | #$ActionQueueFileName fwdRule1 # unique name prefix for spool files 71 | $ActionQueueMaxDiskSpace 1m # space limit (use as much as possible) 72 | $ActionQueueSaveOnShutdown off # do not save messages to disk on shutdown 73 | #$ActionQueueType LinkedList # run asynchronously 74 | #$ActionResumeRetryCount -1 # infinite retries if host is down 75 | # remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional 76 | #*.* @@remote-host:514 77 | # ### end of the forwarding rule ### 78 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/selinux.config: -------------------------------------------------------------------------------- 1 | SELINUX=permissive 2 | SELINUXTYPE=targeted 3 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/spice-vdagentd: -------------------------------------------------------------------------------- 1 | SPICE_VDAGENTD_EXTRA_ARGS=-X 2 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/sshd_config.anaconda: -------------------------------------------------------------------------------- 1 | PermitRootLogin yes 2 | PrintMotd yes 3 | SyslogFacility AUTHPRIV 4 | PasswordAuthentication yes 5 | PermitEmptyPasswords yes 6 | PermitUserEnvironment yes 7 | Subsystem sftp internal-sftp 8 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/sysctl.conf: -------------------------------------------------------------------------------- 1 | kernel.printk=1 2 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/systemd-allowroot.conf: -------------------------------------------------------------------------------- 1 | [Unit] 2 | ConditionUser= 3 | 4 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/common/vconsole.conf: -------------------------------------------------------------------------------- 1 | KEYMAP=us 2 | FONT=eurlatgr 3 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/ppc/grub.cfg.in: -------------------------------------------------------------------------------- 1 | set default=0 2 | set timeout=60 3 | 4 | echo -e "\nWelcome to the @PRODUCT@ @VERSION@ installer!\n\n" 5 | 6 | menuentry "Install @PRODUCT@ @VERSION@ (64-bit kernel)" --class fedora --class gnu-linux --class gnu --class os { 7 | linux /ppc/ppc64/vmlinuz @ROOT@ ro 8 | initrd /ppc/ppc64/initrd.img 9 | } 10 | 11 | menuentry "Test this media & install @PRODUCT@ @VERSION@ (64-bit kernel)" --class fedora --class gnu-linux --class gnu --class os { 12 | linux /ppc/ppc64/vmlinuz @ROOT@ rd.live.check ro 13 | initrd /ppc/ppc64/initrd.img 14 | } 15 | 16 | menuentry "Rescue a @PRODUCT@ system (64-bit kernel)" --class fedora --class gnu-linux --class gnu --class os { 17 | linux /ppc/ppc64/vmlinuz @ROOT@ inst.rescue ro 18 | initrd /ppc/ppc64/initrd.img 19 | } 20 | 21 | submenu 'Other options...' { 22 | menuentry 'Reboot' { 23 | reboot 24 | } 25 | 26 | menuentry 'Exit to Open Firmware' { 27 | exit 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/s390/cdboot.prm: -------------------------------------------------------------------------------- 1 | ro @ROOT@ 2 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/s390/generic.ins: -------------------------------------------------------------------------------- 1 | * minimal lpar ins file 2 | images/kernel.img 0x00000000 3 | images/initrd.img @INITRD_LOAD_ADDRESS@ 4 | images/genericdvd.prm 0x00010480 5 | images/initrd.addrsize 0x00010408 6 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/s390/generic.prm: -------------------------------------------------------------------------------- 1 | ro ramdisk_size=40000 cio_ignore=all,!condev 2 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/s390/genericdvd.prm: -------------------------------------------------------------------------------- 1 | ro ramdisk_size=40000 cio_ignore=all,!condev rd.cmdline=ask 2 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/s390/redhat.exec: -------------------------------------------------------------------------------- 1 | /* */ 2 | 'CL RDR' 3 | 'PURGE RDR ALL' 4 | 'SPOOL PUNCH * RDR' 5 | 'PUNCH KERNEL IMG A (NOH' 6 | 'PUNCH GENERIC PRM A (NOH' 7 | 'PUNCH INITRD IMG A (NOH' 8 | 'CH RDR ALL KEEP NOHOLD' 9 | 'I 00C' 10 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/sparc/boot.msg: -------------------------------------------------------------------------------- 1 |  2 | Welcome to @PRODUCT@ @VERSION@! 3 | 4 | - To install in graphical mode, press the  key. 5 | 6 | - To install in text mode, type: linux text . 7 | 8 | - To enter rescue mode type: linux inst.rescue . 9 | 10 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/sparc/silo.conf: -------------------------------------------------------------------------------- 1 | partition=1 2 | default=linux 3 | read-write 4 | timeout=600 5 | message=/boot/boot.msg 6 | image[sun4u]=/boot/vmlinuz 7 | label=linux 8 | alias=install 9 | append="@ROOT@" 10 | initrd=/boot/initrd.img 11 | image[sun4u]=/boot/vmlinuz 12 | label=text 13 | append="@ROOT@ text" 14 | initrd=/boot/initrd.img 15 | image[sun4u]=/boot/vmlinuz 16 | label=ks 17 | append="@ROOT@ ks" 18 | initrd=/boot/initrd.img 19 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/x86/boot.msg: -------------------------------------------------------------------------------- 1 | 2 | splash.lss 3 | 4 | - Press the 0107 key to begin the installation process. 5 | 6 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/x86/grub2-bios.cfg: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod all_video 5 | } 6 | 7 | load_video 8 | set gfxpayload=keep 9 | insmod gzio 10 | insmod part_gpt 11 | insmod ext2 12 | insmod chain 13 | 14 | set timeout=60 15 | ### END /etc/grub.d/00_header ### 16 | 17 | search --no-floppy --set=root -l '@ISOLABEL@' 18 | 19 | ### BEGIN /etc/grub.d/10_linux ### 20 | menuentry 'Install @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { 21 | linux @KERNELPATH@ @ROOT@ quiet 22 | initrd @INITRDPATH@ 23 | } 24 | menuentry 'Test this media & install @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { 25 | linux @KERNELPATH@ @ROOT@ rd.live.check quiet 26 | initrd @INITRDPATH@ 27 | } 28 | submenu 'Troubleshooting -->' { 29 | menuentry 'Install @PRODUCT@ @VERSION@ in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { 30 | linux @KERNELPATH@ @ROOT@ nomodeset quiet 31 | initrd @INITRDPATH@ 32 | } 33 | menuentry 'Rescue a @PRODUCT@ system' --class fedora --class gnu-linux --class gnu --class os { 34 | linux @KERNELPATH@ @ROOT@ inst.rescue quiet 35 | initrd @INITRDPATH@ 36 | } 37 | menuentry 'Boot first drive' --class fedora --class gnu-linux --class gnu --class os { 38 | chainloader (hd0)+1 39 | } 40 | menuentry 'Boot second drive' --class fedora --class gnu-linux --class gnu --class os { 41 | chainloader (hd1)+1 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/x86/grub2-efi.cfg: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod efi_gop 5 | insmod efi_uga 6 | insmod video_bochs 7 | insmod video_cirrus 8 | insmod all_video 9 | } 10 | 11 | load_video 12 | set gfxpayload=keep 13 | insmod gzio 14 | insmod part_gpt 15 | insmod ext2 16 | 17 | set timeout=60 18 | ### END /etc/grub.d/00_header ### 19 | 20 | search --no-floppy --set=root -l '@ISOLABEL@' 21 | 22 | ### BEGIN /etc/grub.d/10_linux ### 23 | menuentry 'Install @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { 24 | linux @KERNELPATH@ @ROOT@ quiet 25 | initrd @INITRDPATH@ 26 | } 27 | menuentry 'Test this media & install @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { 28 | linux @KERNELPATH@ @ROOT@ rd.live.check quiet 29 | initrd @INITRDPATH@ 30 | } 31 | submenu 'Troubleshooting -->' { 32 | menuentry 'Install @PRODUCT@ @VERSION@ in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { 33 | linux @KERNELPATH@ @ROOT@ nomodeset quiet 34 | initrd @INITRDPATH@ 35 | } 36 | menuentry 'Rescue a @PRODUCT@ system' --class fedora --class gnu-linux --class gnu --class os { 37 | linux @KERNELPATH@ @ROOT@ inst.rescue quiet 38 | initrd @INITRDPATH@ 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/config_files/x86/isolinux.cfg: -------------------------------------------------------------------------------- 1 | default vesamenu.c32 2 | timeout 600 3 | 4 | display boot.msg 5 | 6 | # Clear the screen when exiting the menu, instead of leaving the menu displayed. 7 | # For vesamenu, this means the graphical background is still displayed without 8 | # the menu itself for as long as the screen remains in graphics mode. 9 | menu clear 10 | menu background splash.png 11 | menu title @PRODUCT@ @VERSION@ 12 | menu vshift 8 13 | menu rows 18 14 | menu margin 8 15 | #menu hidden 16 | menu helpmsgrow 15 17 | menu tabmsgrow 13 18 | 19 | # Border Area 20 | menu color border * #00000000 #00000000 none 21 | 22 | # Selected item 23 | menu color sel 0 #ffffffff #00000000 none 24 | 25 | # Title bar 26 | menu color title 0 #ff7ba3d0 #00000000 none 27 | 28 | # Press [Tab] message 29 | menu color tabmsg 0 #ff3a6496 #00000000 none 30 | 31 | # Unselected menu item 32 | menu color unsel 0 #84b8ffff #00000000 none 33 | 34 | # Selected hotkey 35 | menu color hotsel 0 #84b8ffff #00000000 none 36 | 37 | # Unselected hotkey 38 | menu color hotkey 0 #ffffffff #00000000 none 39 | 40 | # Help text 41 | menu color help 0 #ffffffff #00000000 none 42 | 43 | # A scrollbar of some type? Not sure. 44 | menu color scrollbar 0 #ffffffff #ff355594 none 45 | 46 | # Timeout msg 47 | menu color timeout 0 #ffffffff #00000000 none 48 | menu color timeout_msg 0 #ffffffff #00000000 none 49 | 50 | # Command prompt text 51 | menu color cmdmark 0 #84b8ffff #00000000 none 52 | menu color cmdline 0 #ffffffff #00000000 none 53 | 54 | # Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message. 55 | 56 | menu tabmsg Press Tab for full configuration options on menu items. 57 | 58 | menu separator # insert an empty line 59 | menu separator # insert an empty line 60 | 61 | label linux 62 | menu label ^Install @PRODUCT@ @VERSION@ 63 | kernel vmlinuz 64 | append initrd=initrd.img @ROOT@ quiet 65 | 66 | label check 67 | menu label Test this ^media & install @PRODUCT@ @VERSION@ 68 | menu default 69 | kernel vmlinuz 70 | append initrd=initrd.img @ROOT@ rd.live.check quiet 71 | 72 | menu separator # insert an empty line 73 | 74 | # utilities submenu 75 | menu begin ^Troubleshooting 76 | menu title Troubleshooting @PRODUCT@ @VERSION@ 77 | 78 | label basic 79 | menu indent count 5 80 | menu label Install using ^basic graphics mode 81 | text help 82 | Try this option out if you're having trouble installing 83 | @PRODUCT@ @VERSION@. 84 | endtext 85 | kernel vmlinuz 86 | append initrd=initrd.img @ROOT@ nomodeset quiet 87 | 88 | label rescue 89 | menu indent count 5 90 | menu label ^Rescue a @PRODUCT@ system 91 | text help 92 | If the system will not boot, this lets you access files 93 | and edit config files to try to get it booting again. 94 | endtext 95 | kernel vmlinuz 96 | append initrd=initrd.img @ROOT@ inst.rescue quiet 97 | 98 | menu separator # insert an empty line 99 | 100 | label local 101 | menu label Boot from ^local drive 102 | localboot 0xffff 103 | 104 | menu separator # insert an empty line 105 | menu separator # insert an empty line 106 | 107 | label returntomain 108 | menu label Return to ^main menu 109 | menu exit 110 | 111 | menu end 112 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/efi.tmpl: -------------------------------------------------------------------------------- 1 | <%page args="configdir, KERNELDIR, efiarch32, efiarch64, isolabel"/> 2 | <% 3 | EFIBOOTDIR="EFI/BOOT" 4 | APPLE_EFI_ICON=inroot+"/usr/share/pixmaps/bootloader/fedora.icns" 5 | APPLE_EFI_DISKNAME=inroot+"/usr/share/pixmaps/bootloader/fedora-media.vol" 6 | %> 7 | 8 | mkdir ${EFIBOOTDIR} 9 | mkdir ${EFIBOOTDIR}/fonts/ 10 | %if efiarch64: 11 | install boot/efi/EFI/*/shim${efiarch64|lower}.efi ${EFIBOOTDIR}/BOOT${efiarch64}.EFI 12 | install boot/efi/EFI/*/mm${efiarch64|lower}.efi ${EFIBOOTDIR}/ 13 | install boot/efi/EFI/*/gcd${efiarch64|lower}.efi ${EFIBOOTDIR}/grub${efiarch64|lower}.efi 14 | %endif 15 | %if efiarch32: 16 | install boot/efi/EFI/*/shim${efiarch32|lower}.efi ${EFIBOOTDIR}/BOOT${efiarch32}.EFI 17 | install boot/efi/EFI/*/mm${efiarch32|lower}.efi ${EFIBOOTDIR}/ 18 | install boot/efi/EFI/*/gcd${efiarch32|lower}.efi ${EFIBOOTDIR}/grub${efiarch32|lower}.efi 19 | %endif 20 | install usr/share/grub/unicode.pf2 ${EFIBOOTDIR}/fonts/ 21 | 22 | ## actually make the EFI images 23 | ${make_efiboot("images/efiboot.img")} 24 | 25 | ## This is kinda gross, but then... so's EFI. 26 | <%def name="make_efiboot(img, include_kernel=False, disk=False, imgtype='default')"> 27 | <% 28 | kdir = EFIBOOTDIR if include_kernel else KERNELDIR 29 | eficonf = "%s/grub.cfg" % (EFIBOOTDIR, ) 30 | args = "--label=ANACONDA --debug" 31 | if disk: args += " --disk" 32 | %> 33 | %if include_kernel: 34 | copy ${KERNELDIR}/vmlinuz ${EFIBOOTDIR} 35 | copy ${KERNELDIR}/initrd.img ${EFIBOOTDIR} 36 | %endif 37 | install ${configdir}/grub2-efi.cfg ${eficonf} 38 | replace @PRODUCT@ '${product.name}' ${eficonf} 39 | replace @VERSION@ ${product.version} ${eficonf} 40 | replace @KERNELNAME@ vmlinuz ${eficonf} 41 | replace @KERNELPATH@ /${kdir}/vmlinuz ${eficonf} 42 | replace @INITRDPATH@ /${kdir}/initrd.img ${eficonf} 43 | replace @ISOLABEL@ '${isolabel}' ${eficonf} 44 | %if disk: 45 | replace @ROOT@ inst.stage2=hd:LABEL=ANACONDA ${eficonf} 46 | %else: 47 | replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${eficonf} 48 | %endif 49 | %if efiarch32 == 'IA32': 50 | copy ${eficonf} ${EFIBOOTDIR}/BOOT.conf 51 | %endif 52 | runcmd mkefiboot ${args} ${outroot}/${EFIBOOTDIR} ${outroot}/${img} 53 | %if include_kernel: 54 | remove ${EFIBOOTDIR}/vmlinuz 55 | remove ${EFIBOOTDIR}/initrd.img 56 | %endif 57 | 58 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/live/aarch64.tmpl: -------------------------------------------------------------------------------- 1 | <%page args="kernels, runtime_img, basearch, inroot, outroot, product, isolabel, extra_boot_args"/> 2 | <% 3 | configdir="tmp/config_files/aarch64" 4 | PXEBOOTDIR="images/pxeboot" 5 | KERNELDIR=PXEBOOTDIR 6 | LIVEDIR="LiveOS" 7 | LORAXDIR="usr/share/lorax/" 8 | 9 | ## Don't allow spaces or escape characters in the iso label 10 | def valid_label(ch): 11 | return ch.isalnum() or ch == '_' 12 | 13 | isolabel = ''.join(ch if valid_label(ch) else '-' for ch in isolabel) 14 | 15 | import os 16 | from os.path import basename 17 | from pylorax.sysutils import joinpaths 18 | 19 | # Test the runtime_img, if it is > 4GiB we need to set -iso-level to 3 20 | if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3: 21 | isoargs = "-iso-level 3" 22 | else: 23 | isoargs = "" 24 | %> 25 | 26 | mkdir ${LIVEDIR} 27 | install ${runtime_img} ${LIVEDIR}/squashfs.img 28 | treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img 29 | 30 | ## install kernels 31 | mkdir ${KERNELDIR} 32 | %for kernel in kernels: 33 | ## normal aarch64 34 | installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz 35 | installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img 36 | %endfor 37 | 38 | #FIXME: this will need adjusted when we have a real bootloader. 39 | ## WHeeeeeeee, EFI. 40 | ## We could remove the basearch restriction someday.. 41 | <% efiargs=""; efigraft="" %> 42 | %if exists("boot/efi/EFI/*/gcdaa64.efi"): 43 | <% 44 | efiarch32 = None 45 | efiarch64 = 'AA64' 46 | efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot) 47 | images = ["images/efiboot.img"] 48 | %> 49 | %for img in images: 50 | <% 51 | efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot".format(img) 52 | efigraft += " {0}={1}/{0}".format(img,outroot) 53 | %> 54 | treeinfo images-${basearch} ${img|basename} ${img} 55 | %endfor 56 | <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch32=efiarch32, efiarch64=efiarch64, isolabel=isolabel, extra_boot_args=extra_boot_args"/> 57 | %endif 58 | 59 | # Create optional product.img and updates.img 60 | <% filegraft=""; images=["product", "updates"] %> 61 | %for img in images: 62 | %if exists("%s/%s/" % (LORAXDIR, img)): 63 | installimg ${LORAXDIR}/${img}/ images/${img}.img 64 | treeinfo images-${basearch} ${img}.img images/${img}.img 65 | <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %> 66 | %endif 67 | %endfor 68 | 69 | # Add the license files 70 | %for f in glob("usr/share/licenses/*-release-common/*"): 71 | install ${f} ${f|basename} 72 | <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %> 73 | %endfor 74 | 75 | %if exists("boot/efi/EFI/*/gcdaa64.efi"): 76 | ## make boot.iso 77 | runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \ 78 | ${efiargs} -R -J -V '${isolabel}' \ 79 | -graft-points \ 80 | ${KERNELDIR}=${outroot}/${KERNELDIR} \ 81 | ${LIVEDIR}=${outroot}/${LIVEDIR} \ 82 | ${efigraft} ${filegraft} 83 | treeinfo images-${basearch} boot.iso images/boot.iso 84 | %endif 85 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/live/config_files/aarch64/grub2-efi.cfg: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | if [ x$feature_all_video_module = xy ]; then 5 | insmod all_video 6 | else 7 | insmod efi_gop 8 | insmod efi_uga 9 | insmod ieee1275_fb 10 | insmod vbe 11 | insmod vga 12 | insmod video_bochs 13 | insmod video_cirrus 14 | fi 15 | } 16 | 17 | load_video 18 | set gfxpayload=keep 19 | insmod gzio 20 | insmod part_gpt 21 | insmod ext2 22 | 23 | set timeout=60 24 | ### END /etc/grub.d/00_header ### 25 | 26 | search --no-floppy --set=root -l '@ISOLABEL@' 27 | 28 | ### BEGIN /etc/grub.d/10_linux ### 29 | menuentry 'Start @PRODUCT@ @VERSION@' --class red --class gnu-linux --class gnu --class os { 30 | linux @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image quiet rhgb 31 | initrd @INITRDPATH@ 32 | } 33 | menuentry 'Test this media & start @PRODUCT@ @VERSION@' --class red --class gnu-linux --class gnu --class os { 34 | linux @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image rd.live.check quiet 35 | initrd @INITRDPATH@ 36 | } 37 | submenu 'Troubleshooting -->' { 38 | menuentry 'Install @PRODUCT@ @VERSION@ in basic graphics mode' --class red --class gnu-linux --class gnu --class os { 39 | linux @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image nomodeset quiet rhgb 40 | initrd @INITRDPATH@ 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/live/config_files/ppc/grub.cfg.in: -------------------------------------------------------------------------------- 1 | set default=0 2 | set timeout=5 3 | 4 | echo -e "\nWelcome to the @PRODUCT@ @VERSION@ installer!\n\n" 5 | 6 | menuentry "Start @PRODUCT@ @VERSION@ (64-bit kernel)" --class fedora --class gnu-linux --class gnu --class os { 7 | linux /ppc/ppc64/vmlinuz @ROOT@ @EXTRA@ ro rd.live.image quiet rhgb 8 | initrd /ppc/ppc64/initrd.img 9 | } 10 | 11 | menuentry "Test this media & start @PRODUCT@ @VERSION@ (64-bit kernel)" --class fedora --class gnu-linux --class gnu --class os { 12 | linux /ppc/ppc64/vmlinuz @ROOT@ @EXTRA@ rd.live.image rd.live.check ro quiet 13 | initrd /ppc/ppc64/initrd.img 14 | } 15 | 16 | submenu 'Other options...' { 17 | menuentry 'Reboot' { 18 | reboot 19 | } 20 | 21 | menuentry 'Exit to Open Firmware' { 22 | exit 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/live/config_files/s390/cdboot.prm: -------------------------------------------------------------------------------- 1 | ro @ROOT@ rd.live.image @EXTRA@ 2 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/live/config_files/s390/generic.ins: -------------------------------------------------------------------------------- 1 | * minimal lpar ins file 2 | images/kernel.img 0x00000000 3 | images/initrd.img @INITRD_LOAD_ADDRESS@ 4 | images/genericdvd.prm 0x00010480 5 | images/initrd.addrsize 0x00010408 6 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/live/config_files/s390/generic.prm: -------------------------------------------------------------------------------- 1 | ro ramdisk_size=40000 cio_ignore=all,!condev @EXTRA@ 2 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/live/config_files/s390/genericdvd.prm: -------------------------------------------------------------------------------- 1 | ro ramdisk_size=40000 cio_ignore=all,!condev rd.cmdline=ask 2 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/live/config_files/s390/redhat.exec: -------------------------------------------------------------------------------- 1 | /* */ 2 | 'CL RDR' 3 | 'PURGE RDR ALL' 4 | 'SPOOL PUNCH * RDR' 5 | 'PUNCH KERNEL IMG A (NOH' 6 | 'PUNCH GENERIC PRM A (NOH' 7 | 'PUNCH INITRD IMG A (NOH' 8 | 'CH RDR ALL KEEP NOHOLD' 9 | 'I 00C' 10 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/live/config_files/x86/grub2-bios.cfg: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod all_video 5 | } 6 | 7 | load_video 8 | set gfxpayload=keep 9 | insmod gzio 10 | insmod part_gpt 11 | insmod ext2 12 | insmod chain 13 | 14 | set timeout=60 15 | ### END /etc/grub.d/00_header ### 16 | 17 | search --no-floppy --set=root -l '@ISOLABEL@' 18 | 19 | ### BEGIN /etc/grub.d/10_linux ### 20 | menuentry 'Start @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { 21 | linux @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image quiet rhgb 22 | initrd @INITRDPATH@ 23 | } 24 | menuentry 'Test this media & start @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { 25 | linux @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image rd.live.check quiet 26 | initrd @INITRDPATH@ 27 | } 28 | submenu 'Troubleshooting -->' { 29 | menuentry 'Start @PRODUCT@ @VERSION@ in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { 30 | linux @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image nomodeset vga=791 quiet rhgb 31 | initrd @INITRDPATH@ 32 | } 33 | menuentry 'Boot first drive' --class fedora --class gnu-linux --class gnu --class os { 34 | chainloader (hd0)+1 35 | } 36 | menuentry 'Boot second drive' --class fedora --class gnu-linux --class gnu --class os { 37 | chainloader (hd1)+1 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/live/config_files/x86/grub2-efi.cfg: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod efi_gop 5 | insmod efi_uga 6 | insmod video_bochs 7 | insmod video_cirrus 8 | insmod all_video 9 | } 10 | 11 | load_video 12 | set gfxpayload=keep 13 | insmod gzio 14 | insmod part_gpt 15 | insmod ext2 16 | 17 | set timeout=60 18 | ### END /etc/grub.d/00_header ### 19 | 20 | search --no-floppy --set=root -l '@ISOLABEL@' 21 | 22 | ### BEGIN /etc/grub.d/10_linux ### 23 | menuentry 'Start @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { 24 | linux @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image quiet rhgb 25 | initrd @INITRDPATH@ 26 | } 27 | menuentry 'Test this media & start @PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os { 28 | linux @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image rd.live.check quiet 29 | initrd @INITRDPATH@ 30 | } 31 | submenu 'Troubleshooting -->' { 32 | menuentry 'Start @PRODUCT@ @VERSION@ in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { 33 | linux @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image nomodeset quiet rhgb 34 | initrd @INITRDPATH@ 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/live/efi.tmpl: -------------------------------------------------------------------------------- 1 | <%page args="configdir, KERNELDIR, efiarch32, efiarch64, isolabel, extra_boot_args"/> 2 | <% 3 | EFIBOOTDIR="EFI/BOOT" 4 | APPLE_EFI_ICON=inroot+"/usr/share/pixmaps/bootloader/fedora.icns" 5 | APPLE_EFI_DISKNAME=inroot+"/usr/share/pixmaps/bootloader/fedora-media.vol" 6 | %> 7 | 8 | mkdir ${EFIBOOTDIR} 9 | mkdir ${EFIBOOTDIR}/fonts/ 10 | %if efiarch64: 11 | install boot/efi/EFI/*/shim${efiarch64|lower}.efi ${EFIBOOTDIR}/BOOT${efiarch64}.EFI 12 | install boot/efi/EFI/*/mm${efiarch64|lower}.efi ${EFIBOOTDIR}/ 13 | install boot/efi/EFI/*/gcd${efiarch64|lower}.efi ${EFIBOOTDIR}/grub${efiarch64|lower}.efi 14 | %endif 15 | %if efiarch32: 16 | install boot/efi/EFI/*/shim${efiarch32|lower}.efi ${EFIBOOTDIR}/BOOT${efiarch32}.EFI 17 | install boot/efi/EFI/*/mm${efiarch32|lower}.efi ${EFIBOOTDIR}/ 18 | install boot/efi/EFI/*/gcd${efiarch32|lower}.efi ${EFIBOOTDIR}/grub${efiarch32|lower}.efi 19 | %endif 20 | install usr/share/grub/unicode.pf2 ${EFIBOOTDIR}/fonts/ 21 | 22 | ## actually make the EFI images 23 | ${make_efiboot("images/efiboot.img")} 24 | 25 | ## This is kinda gross, but then... so's EFI. 26 | <%def name="make_efiboot(img, include_kernel=False, disk=False, imgtype='default')"> 27 | <% 28 | kdir = EFIBOOTDIR if include_kernel else KERNELDIR 29 | eficonf = "%s/grub.cfg" % (EFIBOOTDIR, ) 30 | args = "--label=ANACONDA" 31 | if disk: args += " --disk" 32 | %> 33 | %if include_kernel: 34 | copy ${KERNELDIR}/vmlinuz ${EFIBOOTDIR} 35 | copy ${KERNELDIR}/initrd.img ${EFIBOOTDIR} 36 | %endif 37 | install ${configdir}/grub2-efi.cfg ${eficonf} 38 | replace @PRODUCT@ '${product.name}' ${eficonf} 39 | replace @VERSION@ ${product.version} ${eficonf} 40 | replace @KERNELNAME@ vmlinuz ${eficonf} 41 | replace @KERNELPATH@ /${kdir}/vmlinuz ${eficonf} 42 | replace @INITRDPATH@ /${kdir}/initrd.img ${eficonf} 43 | replace @ISOLABEL@ '${isolabel}' ${eficonf} 44 | replace @EXTRA@ '${extra_boot_args}' ${eficonf} 45 | %if disk: 46 | replace @ROOT@ root=live:LABEL=ANACONDA ${eficonf} 47 | %else: 48 | replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' ${eficonf} 49 | %endif 50 | %if efiarch32 == 'IA32': 51 | copy ${eficonf} ${EFIBOOTDIR}/BOOT.conf 52 | %endif 53 | runcmd mkefiboot ${args} ${outroot}/${EFIBOOTDIR} ${outroot}/${img} 54 | %if include_kernel: 55 | remove ${EFIBOOTDIR}/vmlinuz 56 | remove ${EFIBOOTDIR}/initrd.img 57 | %endif 58 | 59 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/live/live-install.tmpl: -------------------------------------------------------------------------------- 1 | ## livemedia-creator: Install packages needed for iso creation using per-arch templates 2 | <%page args="basearch"/> 3 | 4 | ## arch-specific bootloader packages 5 | %if basearch == "aarch64": 6 | installpkg efibootmgr 7 | installpkg grub2-efi-aa64-cdboot shim-aa64 8 | %endif 9 | %if basearch == "x86_64": 10 | installpkg grub2-tools-efi 11 | installpkg efibootmgr 12 | installpkg shim-x64 grub2-efi-x64-cdboot 13 | installpkg shim-ia32 grub2-efi-ia32-cdboot 14 | installpkg biosdevname 15 | installpkg grub2-tools grub2-tools-minimal grub2-tools-extra 16 | installpkg grub2-pc-modules 17 | %endif 18 | %if basearch == "ppc64le": 19 | installpkg powerpc-utils 20 | installpkg grub2-tools grub2-tools-minimal grub2-tools-extra 21 | installpkg grub2-${basearch} 22 | %endif 23 | %if basearch == "s390x": 24 | installpkg s390utils-base 25 | %endif 26 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/live/ppc64le.tmpl: -------------------------------------------------------------------------------- 1 | <%page args="kernels, runtime_img, basearch, libdir, inroot, outroot, product, isolabel, extra_boot_args"/> 2 | <% 3 | configdir="tmp/config_files/ppc" 4 | BOOTDIR="ppc" 5 | GRUBDIR="boot/grub" 6 | LIVEDIR="LiveOS" 7 | LORAXDIR="usr/share/lorax/" 8 | 9 | ## NOTE: yaboot freaks out and stops parsing its config if it sees a '\', 10 | ## so we can't use the udev escape sequences in the root arg. 11 | ## Instead we'll just replace any non-ASCII characters in the isolabel 12 | ## with '_', which means we won't need any udev escapes. 13 | isolabel = ''.join(ch if ch.isalnum() else '_' for ch in isolabel) 14 | 15 | import os 16 | from os.path import basename 17 | from pylorax.sysutils import joinpaths 18 | 19 | # Test the runtime_img, if it is > 4GiB we need to set -iso-level to 3 20 | if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3: 21 | isoargs = "-iso-level 3" 22 | else: 23 | isoargs = "" 24 | %> 25 | 26 | mkdir ${LIVEDIR} 27 | install ${runtime_img} ${LIVEDIR}/squashfs.img 28 | treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img 29 | 30 | ## install the bootloaders 31 | ## ppc/chrp: for normal PPC systems. 32 | ## uses /ppc/bootinfo.txt in the iso root 33 | ## uses /boot/grub/grub.cfg in the iso root 34 | mkdir ${BOOTDIR} 35 | ## boot stuff for normal (CHRP/PREP) PPC systems 36 | install ${configdir}/bootinfo.txt ${BOOTDIR} 37 | 38 | mkdir ${GRUBDIR}/powerpc-ieee1275 39 | install /usr/lib/grub/powerpc-ieee1275/core.elf ${GRUBDIR}/powerpc-ieee1275 40 | install /usr/lib/grub/powerpc-ieee1275/*.mod ${GRUBDIR}/powerpc-ieee1275 41 | install /usr/lib/grub/powerpc-ieee1275/*.lst ${GRUBDIR}/powerpc-ieee1275 42 | 43 | install ${configdir}/grub.cfg.in ${GRUBDIR}/grub.cfg 44 | replace @PRODUCT@ '${product.name}' ${GRUBDIR}/grub.cfg 45 | replace @VERSION@ ${product.version} ${GRUBDIR}/grub.cfg 46 | replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' ${GRUBDIR}/grub.cfg 47 | replace @EXTRA@ '${extra_boot_args}' ${GRUBDIR}/grub.cfg 48 | 49 | ## Install kernel and bootloader config (in separate places for each arch) 50 | %for kernel in kernels: 51 | <% 52 | bits = 64 53 | ## separate dirs/images for each arch 54 | KERNELDIR=BOOTDIR+"/ppc%s" % bits 55 | %> 56 | ## install kernel 57 | mkdir ${KERNELDIR} 58 | installkernel images-${kernel.arch} ${kernel.path} ${KERNELDIR}/vmlinuz 59 | installinitrd images-${kernel.arch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img 60 | 61 | treeinfo images-${kernel.arch} zimage 62 | %endfor 63 | 64 | # Create optional product.img and updates.img 65 | <% filegraft=""; images=["product", "updates"] %> 66 | %for img in images: 67 | %if exists("%s/%s/" % (LORAXDIR, img)): 68 | installimg ${LORAXDIR}/${img}/ images/${img}.img 69 | treeinfo images-${basearch} ${img}.img images/${img}.img 70 | <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %> 71 | %endif 72 | %endfor 73 | 74 | # Add the license files 75 | %for f in glob("usr/share/licenses/*-release-common/*"): 76 | install ${f} ${f|basename} 77 | <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %> 78 | %endfor 79 | 80 | ## make boot.iso 81 | runcmd xorrisofs -v -U -J -R ${isoargs} \ 82 | -o ${outroot}/images/boot.iso \ 83 | -r -l -sysid PPC \ 84 | -A "${product.name} ${product.version}" -V '${isolabel}' \ 85 | -volset "${product.version}" -volset-size 1 -volset-seqno 1 \ 86 | -chrp-boot \ 87 | -graft-points \ 88 | ${BOOTDIR}=${outroot}/${BOOTDIR} \ 89 | ${GRUBDIR}=${outroot}/${GRUBDIR} \ 90 | ${LIVEDIR}=${outroot}/${LIVEDIR} ${filegraft} 91 | 92 | %for kernel in kernels: 93 | treeinfo images-${kernel.arch} boot.iso images/boot.iso 94 | %endfor 95 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/live/s390.tmpl: -------------------------------------------------------------------------------- 1 | <%page args="kernels, runtime_img, runtime_base, basearch, outroot, isolabel, extra_boot_args"/> 2 | <% 3 | configdir="tmp/config_files/s390" 4 | BOOTDIR="images" 5 | KERNELDIR=BOOTDIR 6 | INITRD_ADDRESS="0x02000000" 7 | LIVEDIR="LiveOS" 8 | LORAXDIR="usr/share/lorax/" 9 | MKS390IMAGE="/usr/bin/mk-s390image" 10 | # The assumption seems to be that there is only one s390 kernel, ever 11 | kernel = kernels[0] 12 | 13 | ## Don't allow spaces or escape characters in the iso label 14 | def valid_label(ch): 15 | return ch.isalnum() or ch == '_' 16 | 17 | isolabel = ''.join(ch if valid_label(ch) else '-' for ch in isolabel) 18 | 19 | from os.path import basename 20 | import os 21 | from pylorax.sysutils import joinpaths 22 | 23 | # Test the runtime_img, if it is > 4GiB we need to set -iso-level to 3 24 | if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3: 25 | isoargs = "-iso-level 3" 26 | else: 27 | isoargs = "" 28 | %> 29 | 30 | mkdir ${LIVEDIR} 31 | install ${runtime_img} ${LIVEDIR}/squashfs.img 32 | treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img 33 | 34 | mkdir ${BOOTDIR} 35 | ## install bootloader (such as it is) and bootloader config 36 | install ${configdir}/redhat.exec ${BOOTDIR} 37 | install ${configdir}/generic.prm ${BOOTDIR} 38 | install ${configdir}/cdboot.prm ${BOOTDIR} 39 | install ${configdir}/generic.ins . 40 | 41 | ## configure bootloader 42 | replace @INITRD_LOAD_ADDRESS@ ${INITRD_ADDRESS} generic.ins 43 | replace @EXTRA@ '${extra_boot_args}' ${BOOTDIR}/generic.prm 44 | replace @ROOT@ 'root=live:CDLABEL=${isolabel|udev}' ${BOOTDIR}/cdboot.prm 45 | replace @EXTRA@ '${extra_boot_args}' ${BOOTDIR}/cdboot.prm 46 | 47 | ## install kernel 48 | installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/kernel.img 49 | installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img 50 | 51 | ## s390 needs some extra boot config 52 | createaddrsize ${INITRD_ADDRESS} ${outroot}/${BOOTDIR}/initrd.img ${outroot}/${BOOTDIR}/initrd.addrsize 53 | 54 | ## s390 also has some special treeinfo data 55 | treeinfo images-${basearch} initrd.addrsize ${BOOTDIR}/initrd.addrsize 56 | treeinfo images-${basearch} generic.prm ${BOOTDIR}/generic.prm 57 | treeinfo images-${basearch} generic.ins generic.ins 58 | treeinfo images-${basearch} redhat.exec ${BOOTDIR}/redhat.exec 59 | treeinfo images-${basearch} cdboot.prm ${BOOTDIR}/cdboot.prm 60 | 61 | # Create optional product.img and updates.img 62 | <% filegraft=""; images=["product", "updates"] %> 63 | %for img in images: 64 | %if exists("%s/%s/" % (LORAXDIR, img)): 65 | installimg ${LORAXDIR}/${img}/ images/${img}.img 66 | treeinfo images-${basearch} ${img}.img images/${img}.img 67 | <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %> 68 | %endif 69 | %endfor 70 | 71 | # Add the license files 72 | %for f in glob("usr/share/licenses/*-release-common/*"): 73 | install ${f} ${f|basename} 74 | <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %> 75 | %endfor 76 | 77 | ## Make a combined kernel+initrd image for the iso 78 | runcmd ${MKS390IMAGE} ${outroot}/${KERNELDIR}/kernel.img \ 79 | ${outroot}/${BOOTDIR}/cdboot.img \ 80 | -r ${outroot}/${KERNELDIR}/initrd.img \ 81 | -p ${outroot}/${BOOTDIR}/cdboot.prm 82 | 83 | ## make boot.iso 84 | runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \ 85 | -b ${BOOTDIR}/cdboot.img -c ${BOOTDIR}/boot.cat \ 86 | -boot-load-size 4 -no-emul-boot \ 87 | -R -J -V '${isolabel}' -graft-points \ 88 | ${BOOTDIR}=${outroot}/${BOOTDIR} \ 89 | ${LIVEDIR}=${outroot}/${LIVEDIR} \ 90 | ${filegraft} 91 | treeinfo images-${basearch} boot.iso images/boot.iso 92 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/ppc64le.tmpl: -------------------------------------------------------------------------------- 1 | <%page args="kernels, runtime_img, basearch, libdir, inroot, outroot, product, isolabel"/> 2 | <% 3 | configdir="tmp/config_files/ppc" 4 | BOOTDIR="ppc" 5 | GRUBDIR="boot/grub" 6 | STAGE2IMG="images/install.img" 7 | LORAXDIR="usr/share/lorax/" 8 | 9 | ## Don't allow spaces or escape characters in the iso label 10 | def valid_label(ch): 11 | return ch.isalnum() or ch == '_' 12 | 13 | isolabel = ''.join(ch if valid_label(ch) else '-' for ch in isolabel) 14 | 15 | import os 16 | from os.path import basename 17 | from pylorax.sysutils import joinpaths 18 | 19 | # Test the runtime_img, if it is > 4GiB we need to set -iso-level to 3 20 | if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3: 21 | isoargs = "-iso-level 3" 22 | else: 23 | isoargs = "" 24 | %> 25 | 26 | mkdir images 27 | install ${runtime_img} ${STAGE2IMG} 28 | treeinfo stage2 mainimage ${STAGE2IMG} 29 | 30 | ## install the bootloaders 31 | ## ppc/chrp: for normal PPC systems. 32 | ## uses /ppc/bootinfo.txt in the iso root 33 | ## uses /boot/grub/grub.cfg in the iso root 34 | mkdir ${BOOTDIR} 35 | ## boot stuff for normal (CHRP/PREP) PPC systems 36 | install ${configdir}/bootinfo.txt ${BOOTDIR} 37 | 38 | mkdir ${GRUBDIR}/powerpc-ieee1275 39 | install /usr/lib/grub/powerpc-ieee1275/core.elf ${GRUBDIR}/powerpc-ieee1275 40 | install /usr/lib/grub/powerpc-ieee1275/*.mod ${GRUBDIR}/powerpc-ieee1275 41 | install /usr/lib/grub/powerpc-ieee1275/*.lst ${GRUBDIR}/powerpc-ieee1275 42 | 43 | install ${configdir}/grub.cfg.in ${GRUBDIR}/grub.cfg 44 | replace @PRODUCT@ '${product.name}' ${GRUBDIR}/grub.cfg 45 | replace @VERSION@ ${product.version} ${GRUBDIR}/grub.cfg 46 | replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${GRUBDIR}/grub.cfg 47 | 48 | ## Install kernel and bootloader config (in separate places for each arch) 49 | %for kernel in kernels: 50 | <% 51 | bits = 64 52 | ## separate dirs/images for each arch 53 | KERNELDIR=BOOTDIR+"/ppc%s" % bits 54 | %> 55 | ## install kernel 56 | mkdir ${KERNELDIR} 57 | installkernel images-${kernel.arch} ${kernel.path} ${KERNELDIR}/vmlinuz 58 | installinitrd images-${kernel.arch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img 59 | 60 | treeinfo images-${kernel.arch} zimage 61 | %endfor 62 | 63 | # Create optional product.img and updates.img 64 | <% filegraft=""; images=["product", "updates"] %> 65 | %for img in images: 66 | %if exists("%s/%s/" % (LORAXDIR, img)): 67 | installimg ${LORAXDIR}/${img}/ images/${img}.img 68 | treeinfo images-${basearch} ${img}.img images/${img}.img 69 | <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %> 70 | %endif 71 | %endfor 72 | 73 | # Inherit iso-graft/ if it exists from external templates 74 | <% 75 | import os 76 | if os.path.exists(workdir + "/iso-graft"): 77 | filegraft += " " + workdir + "/iso-graft" 78 | %> 79 | 80 | # Add the license files 81 | %for f in glob("usr/share/licenses/*-release-common/*"): 82 | install ${f} ${f|basename} 83 | <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %> 84 | %endfor 85 | 86 | ## make boot.iso 87 | runcmd xorrisofs -v -U -J -R ${isoargs} \ 88 | -o ${outroot}/images/boot.iso \ 89 | -r -l -sysid PPC \ 90 | -A "${product.name} ${product.version}" -V '${isolabel}' \ 91 | -volset "${product.version}" -volset-size 1 -volset-seqno 1 \ 92 | -chrp-boot \ 93 | -graft-points \ 94 | .discinfo=${outroot}/.discinfo \ 95 | ${BOOTDIR}=${outroot}/${BOOTDIR} \ 96 | ${GRUBDIR}=${outroot}/${GRUBDIR} \ 97 | ${STAGE2IMG}=${outroot}/${STAGE2IMG} ${filegraft} 98 | 99 | %for kernel in kernels: 100 | treeinfo images-${kernel.arch} boot.iso images/boot.iso 101 | %endfor 102 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/pxe-live/pxe-config.tmpl: -------------------------------------------------------------------------------- 1 | # PXE configuration template generated by livemedia-creator 2 | kernel ${kernel} 3 | append initrd=${initrd} root=live:/${liveimg} ${addargs} 4 | -------------------------------------------------------------------------------- /share/templates.d/99-generic/s390.tmpl: -------------------------------------------------------------------------------- 1 | <%page args="kernels, runtime_img, runtime_base, basearch, inroot, outroot, isolabel"/> 2 | <% 3 | configdir="tmp/config_files/s390" 4 | BOOTDIR="images" 5 | KERNELDIR=BOOTDIR 6 | INITRD_ADDRESS="0x02000000" 7 | LORAXDIR="usr/share/lorax/" 8 | MKS390IMAGE="/usr/bin/mk-s390image" 9 | # The assumption seems to be that there is only one s390 kernel, ever 10 | kernel = kernels[0] 11 | 12 | ## Don't allow spaces or escape characters in the iso label 13 | def valid_label(ch): 14 | return ch.isalnum() or ch == '_' 15 | 16 | isolabel = ''.join(ch if valid_label(ch) else '-' for ch in isolabel) 17 | 18 | import os 19 | from os.path import basename 20 | from pylorax.sysutils import joinpaths 21 | 22 | # Test the runtime_img, if it is > 4GiB we need to set -iso-level to 3 23 | if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3: 24 | isoargs = "-iso-level 3" 25 | else: 26 | isoargs = "" 27 | %> 28 | 29 | mkdir images 30 | install ${runtime_img} images 31 | treeinfo stage2 mainimage images/${runtime_base} 32 | 33 | ## install bootloader (such as it is) and bootloader config 34 | install ${configdir}/redhat.exec ${BOOTDIR} 35 | install ${configdir}/generic.prm ${BOOTDIR} 36 | install ${configdir}/genericdvd.prm ${BOOTDIR} 37 | install ${configdir}/cdboot.prm ${BOOTDIR} 38 | install ${configdir}/generic.ins . 39 | 40 | ## configure bootloader 41 | replace @INITRD_LOAD_ADDRESS@ ${INITRD_ADDRESS} generic.ins 42 | replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${BOOTDIR}/cdboot.prm 43 | 44 | ## install kernel 45 | installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/kernel.img 46 | installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img 47 | 48 | ## s390 needs some extra boot config 49 | createaddrsize ${INITRD_ADDRESS} ${outroot}/${BOOTDIR}/initrd.img ${outroot}/${BOOTDIR}/initrd.addrsize 50 | 51 | ## s390 also has some special treeinfo data 52 | treeinfo images-${basearch} initrd.addrsize ${BOOTDIR}/initrd.addrsize 53 | treeinfo images-${basearch} generic.prm ${BOOTDIR}/generic.prm 54 | treeinfo images-${basearch} genericdvd.prm ${BOOTDIR}/genericdvd.prm 55 | treeinfo images-${basearch} generic.ins generic.ins 56 | treeinfo images-${basearch} redhat.exec ${BOOTDIR}/redhat.exec 57 | 58 | # Create optional product.img and updates.img in /images/ 59 | <% filegraft=""; images=["product", "updates"] %> 60 | %for img in images: 61 | %if exists("%s/%s/" % (LORAXDIR, img)): 62 | installimg ${LORAXDIR}/${img}/ images/${img}.img 63 | treeinfo images-${basearch} ${img}.img images/${img}.img 64 | %endif 65 | %endfor 66 | 67 | # Inherit iso-graft/ if it exists from external templates 68 | <% 69 | import os 70 | if os.path.exists(workdir + "/iso-graft"): 71 | filegraft += " " + workdir + "/iso-graft" 72 | %> 73 | 74 | # Add the license files 75 | %for f in glob("usr/share/licenses/*-release-common/*"): 76 | install ${f} ${f|basename} 77 | <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %> 78 | %endfor 79 | 80 | ## Make a combined kernel+initrd image for the iso 81 | runcmd ${MKS390IMAGE} ${outroot}/${KERNELDIR}/kernel.img \ 82 | ${outroot}/${BOOTDIR}/cdboot.img \ 83 | -r ${outroot}/${KERNELDIR}/initrd.img \ 84 | -p ${outroot}/${BOOTDIR}/cdboot.prm 85 | 86 | ## make boot.iso 87 | runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \ 88 | -b ${BOOTDIR}/cdboot.img -c ${BOOTDIR}/boot.cat \ 89 | -boot-load-size 4 -no-emul-boot \ 90 | -R -J -V '${isolabel}' -graft-points \ 91 | .discinfo=${outroot}/.discinfo \ 92 | generic.ins=${outroot}/generic.ins \ 93 | ${BOOTDIR}=${outroot}/${BOOTDIR} \ 94 | ${filegraft} 95 | treeinfo images-${basearch} boot.iso images/boot.iso 96 | -------------------------------------------------------------------------------- /src/pylorax/base.py: -------------------------------------------------------------------------------- 1 | # 2 | # base.py 3 | # 4 | # Copyright (C) 2009-2015 Red Hat, Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | # Red Hat Author(s): Martin Gracik 20 | # 21 | 22 | from abc import ABCMeta, abstractmethod 23 | import sys 24 | 25 | import pylorax.output as output 26 | 27 | 28 | class BaseLoraxClass(object, metaclass=ABCMeta): 29 | @abstractmethod 30 | def __init__(self): 31 | self.output = output.LoraxOutput() 32 | 33 | def pcritical(self, msg, fobj=sys.stdout): 34 | self.output.critical(msg, fobj) 35 | 36 | def perror(self, msg, fobj=sys.stdout): 37 | self.output.error(msg, fobj) 38 | 39 | def pwarning(self, msg, fobj=sys.stdout): 40 | self.output.warning(msg, fobj) 41 | 42 | def pinfo(self, msg, fobj=sys.stdout): 43 | self.output.info(msg, fobj) 44 | 45 | def pdebug(self, msg, fobj=sys.stdout): 46 | self.output.debug(msg, fobj) 47 | 48 | 49 | class DataHolder(dict): 50 | 51 | def __init__(self, **kwargs): 52 | dict.__init__(self) 53 | 54 | for attr, value in kwargs.items(): 55 | self[attr] = value 56 | 57 | def __getattr__(self, attr): 58 | if attr in self: 59 | return self[attr] 60 | else: 61 | raise AttributeError 62 | 63 | def __setattr__(self, attr, value): 64 | self[attr] = value 65 | 66 | def copy(self): 67 | return DataHolder(**dict.copy(self)) 68 | -------------------------------------------------------------------------------- /src/pylorax/buildstamp.py: -------------------------------------------------------------------------------- 1 | # 2 | # buildstamp.py 3 | # 4 | # Copyright (C) 2010-2015 Red Hat, Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | # Red Hat Author(s): Martin Gracik 20 | # 21 | 22 | import logging 23 | logger = logging.getLogger("pylorax.buildstamp") 24 | 25 | import datetime 26 | import os 27 | 28 | 29 | class BuildStamp(object): 30 | 31 | def __init__(self, product, version, bugurl, isfinal, buildarch, variant=""): 32 | self.product = product 33 | self.version = version 34 | self.bugurl = bugurl 35 | self.isfinal = isfinal 36 | self.variant = variant 37 | 38 | if 'SOURCE_DATE_EPOCH' in os.environ: 39 | now = datetime.datetime.utcfromtimestamp( 40 | int(os.environ['SOURCE_DATE_EPOCH'])) 41 | else: 42 | now = datetime.datetime.now() 43 | now = now.strftime("%Y%m%d%H%M") 44 | self.uuid = "{0}.{1}".format(now, buildarch) 45 | 46 | def write(self, outfile): 47 | # get lorax version 48 | try: 49 | import pylorax.version 50 | except ImportError: 51 | vernum = "devel" 52 | else: 53 | vernum = pylorax.version.num 54 | 55 | logger.info("writing .buildstamp file") 56 | with open(outfile, "w") as fobj: 57 | fobj.write("[Main]\n") 58 | fobj.write("Product={0.product}\n".format(self)) 59 | fobj.write("Version={0.version}\n".format(self)) 60 | fobj.write("BugURL={0.bugurl}\n".format(self)) 61 | fobj.write("IsFinal={0.isfinal}\n".format(self)) 62 | fobj.write("UUID={0.uuid}\n".format(self)) 63 | if self.variant: 64 | fobj.write("Variant={0.variant}\n".format(self)) 65 | fobj.write("[Compose]\n") 66 | fobj.write("Lorax={0}\n".format(vernum)) 67 | -------------------------------------------------------------------------------- /src/pylorax/decorators.py: -------------------------------------------------------------------------------- 1 | # 2 | # decorators.py 3 | # 4 | # Copyright (C) 2009-2015 Red Hat, Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | # Red Hat Author(s): Martin Gracik 20 | # 21 | 22 | def singleton(cls): 23 | instances = {} 24 | 25 | def get_instance(): 26 | if cls not in instances: 27 | instances[cls] = cls() 28 | return instances[cls] 29 | 30 | return get_instance 31 | -------------------------------------------------------------------------------- /src/pylorax/discinfo.py: -------------------------------------------------------------------------------- 1 | # 2 | # discinfo.py 3 | # 4 | # Copyright (C) 2010-2015 Red Hat, Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | # Red Hat Author(s): Martin Gracik 20 | # 21 | 22 | import logging 23 | logger = logging.getLogger("pylorax.discinfo") 24 | 25 | import os 26 | import time 27 | 28 | 29 | class DiscInfo(object): 30 | 31 | def __init__(self, release, basearch): 32 | self.release = release 33 | self.basearch = basearch 34 | 35 | def write(self, outfile): 36 | if 'SOURCE_DATE_EPOCH' in os.environ: 37 | timestamp = int(os.environ['SOURCE_DATE_EPOCH']) 38 | else: 39 | timestamp = time.time() 40 | 41 | logger.info("writing .discinfo file") 42 | with open(outfile, "w") as fobj: 43 | fobj.write("{0:f}\n".format(timestamp)) 44 | fobj.write("{0.release}\n".format(self)) 45 | fobj.write("{0.basearch}\n".format(self)) 46 | -------------------------------------------------------------------------------- /src/pylorax/dnfhelper.py: -------------------------------------------------------------------------------- 1 | # 2 | # dnfhelper.py 3 | # 4 | # Copyright (C) 2010-2015 Red Hat, Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | # Red Hat Author(s): Martin Gracik 20 | # Brian C. Lane 21 | # 22 | 23 | import logging 24 | logger = logging.getLogger("pylorax.dnfhelper") 25 | import time 26 | import pylorax.output as output 27 | 28 | import libdnf5 as dnf5 29 | SUCCESSFUL = dnf5.repo.DownloadCallbacks.TransferStatus_SUCCESSFUL 30 | 31 | __all__ = ['LoraxDownloadCallback', 'LoraxRpmCallback'] 32 | 33 | def _paced(fn): 34 | """Execute `fn` no more often then every 2 seconds.""" 35 | def paced_fn(self, *args): 36 | now = time.time() 37 | if now - self.last_time < 2: 38 | return 39 | self.last_time = now 40 | return fn(self, *args) 41 | return paced_fn 42 | 43 | 44 | class LoraxDownloadCallback(dnf5.repo.DownloadCallbacks): 45 | def __init__(self, total_files): 46 | super(LoraxDownloadCallback, self).__init__() 47 | self.last_time = time.time() 48 | self.total_files = total_files 49 | self.pkgno = 0 50 | 51 | self.output = output.LoraxOutput() 52 | self.nevra = "unknown" 53 | 54 | def add_new_download(self, user_data, description, total_to_download): 55 | self.nevra = description or "unknown" 56 | 57 | # Returning anything here makes it crash 58 | return None 59 | 60 | @_paced 61 | def _update(self): 62 | msg = "Downloading %(pkgno)s / %(total_files)s RPMs\n" 63 | vals = { 64 | 'pkgno' : self.pkgno, 65 | 'total_files' : self.total_files, 66 | } 67 | self.output.write(msg % vals) 68 | 69 | def end(self, user_cb_data, status, msg): 70 | if status == SUCCESSFUL: 71 | self.pkgno += 1 72 | self._update() 73 | else: 74 | logger.critical("Failed to download '%s': %d - %s", self.nevra, status, msg) 75 | return 0 76 | 77 | def progress(self, user_cb_data, total_to_download, downloaded): 78 | self._update() 79 | return 0 80 | 81 | def mirror_failure(self, user_cb_data, msg, url, metadata): 82 | message = f"{url} - {msg}" 83 | logger.critical("Mirror failure on '%s': %s (%s)", self.nevra, message, metadata) 84 | return 0 85 | 86 | 87 | class LoraxRpmCallback(dnf5.rpm.TransactionCallbacks): 88 | def install_start(self, item, total): 89 | action = dnf5.base.transaction.transaction_item_action_to_string(item.get_action()) 90 | package = item.get_package().get_nevra() 91 | logger.info("%s %s", action, package) 92 | 93 | # pylint: disable=redefined-builtin 94 | def script_start(self, item, nevra, type): 95 | if not item or not type: 96 | return 97 | 98 | package = item.get_package().get_nevra() 99 | script_type = self.script_type_to_string(type) 100 | logger.info("Running %s for %s", script_type, package) 101 | 102 | ## NOTE: These likely will not work right, SWIG seems to crash when raising errors 103 | ## from callbacks. 104 | def unpack_error(self, item): 105 | package = item.get_package().get_nevra() 106 | raise RuntimeError(f"unpack_error on {package}") 107 | 108 | def cpio_error(self, item): 109 | package = item.get_package().get_nevra() 110 | raise RuntimeError(f"cpio_error on {package}") 111 | 112 | # pylint: disable=redefined-builtin 113 | def script_error(self, item, nevra, type, return_code): 114 | package = item.get_package().get_nevra() 115 | script_type = self.script_type_to_string(type) 116 | raise RuntimeError(f"script_error on {package}: {script_type} rc={return_code}") 117 | -------------------------------------------------------------------------------- /src/pylorax/mount.py: -------------------------------------------------------------------------------- 1 | # mount.py 2 | # 3 | # Copyright (C) 2011-2015 Red Hat, Inc. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | # 18 | # Author(s): Brian C. Lane 19 | # 20 | import logging 21 | log = logging.getLogger("livemedia-creator") 22 | 23 | import os 24 | import iso9660 25 | 26 | from pylorax.imgutils import mount, umount 27 | 28 | class IsoMountpoint(object): 29 | """ 30 | Mount the iso and check to make sure the vmlinuz and initrd.img files exist 31 | 32 | Also check the iso for a a stage2 image and set a flag and extract the 33 | iso's label. 34 | 35 | stage2 can be either LiveOS/squashfs.img or images/install.img 36 | """ 37 | def __init__(self, iso_path, initrd_path=None): 38 | """ 39 | Mount the iso 40 | 41 | :param str iso_path: Path to the iso to mount 42 | :param str initrd_path: Optional path to initrd 43 | 44 | initrd_path can be used to point to a tree with a newer 45 | initrd.img than the iso has. The iso is still used for stage2. 46 | 47 | self.kernel and self.initrd point to the kernel and initrd. 48 | self.stage2 is set to True if there is a stage2 image. 49 | self.repo is the path to the mounted iso if there is a /repodata dir. 50 | """ 51 | self.label = None 52 | self.iso_path = iso_path 53 | self.initrd_path = initrd_path 54 | 55 | if not self.initrd_path: 56 | self.mount_dir = mount(self.iso_path, opts="loop") 57 | else: 58 | self.mount_dir = self.initrd_path 59 | 60 | kernel_list = [("/isolinux/vmlinuz", "/isolinux/initrd.img"), 61 | ("/ppc/ppc64/vmlinuz", "/ppc/ppc64/initrd.img"), 62 | ("/images/pxeboot/vmlinuz", "/images/pxeboot/initrd.img"), 63 | ("/images/kernel.img", "/images/initrd.img")] 64 | 65 | if os.path.isdir(self.mount_dir+"/repodata"): 66 | self.repo = self.mount_dir 67 | else: 68 | self.repo = None 69 | self.stage2 = os.path.exists(self.mount_dir+"/LiveOS/squashfs.img") or \ 70 | os.path.exists(self.mount_dir+"/images/install.img") 71 | 72 | try: 73 | for kernel, initrd in kernel_list: 74 | if (os.path.isfile(self.mount_dir+kernel) and 75 | os.path.isfile(self.mount_dir+initrd)): 76 | self.kernel = self.mount_dir+kernel 77 | self.initrd = self.mount_dir+initrd 78 | break 79 | else: 80 | raise RuntimeError("Missing kernel and initrd file in iso, failed" 81 | " to search under: {0}".format(kernel_list)) 82 | except: 83 | self.umount() 84 | raise 85 | 86 | self.get_iso_label() 87 | 88 | def umount( self ): 89 | """Unmount the iso""" 90 | if not self.initrd_path: 91 | umount(self.mount_dir) 92 | 93 | def get_iso_label(self): 94 | """ 95 | Get the iso's label using pycdio 96 | 97 | Sets self.label if one is found 98 | """ 99 | try: 100 | iso = iso9660.ISO9660.IFS(source=self.iso_path) 101 | if not iso.is_open(): 102 | raise RuntimeError("error opening file") 103 | 104 | self.label = iso.get_volume_id() 105 | if self.label is None: 106 | self.label = "" 107 | raise RuntimeError("error reading volume id") 108 | except RuntimeError as e: 109 | log.error("Problem reading label from %s: %s", self.iso_path, e) 110 | -------------------------------------------------------------------------------- /src/pylorax/output.py: -------------------------------------------------------------------------------- 1 | # 2 | # output.py 3 | # 4 | # Copyright (C) 2009-2015 Red Hat, Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | # Red Hat Author(s): Martin Gracik 20 | # 21 | 22 | import sys 23 | import re 24 | 25 | import pylorax.decorators as decorators 26 | 27 | 28 | # output levels 29 | CRITICAL = 50 30 | ERROR = 40 31 | WARNING = 30 32 | INFO = 20 33 | DEBUG = 10 34 | NOTSET = 0 35 | 36 | 37 | # color codes 38 | C_DEFAULT = "\x1b[39m" 39 | C_RESET = "\x1b[0m" 40 | 41 | C_BLACK = "\x1b[0;30m" 42 | C_WHITE = "\x1b[1;37m" 43 | C_RED = "\x1b[0;31m" 44 | C_GREEN = "\x1b[0;32m" 45 | C_BLUE = "\x1b[0;34m" 46 | C_LIGHTRED = "\x1b[1;31m" 47 | C_LIGHTGREEN = "\x1b[1;32m" 48 | C_LIGHTBLUE = "\x1b[1;34m" 49 | 50 | C_BOLD = "\x1b[1m" 51 | C_UNDERLINE = "\x1b[4m" 52 | 53 | 54 | # format tags 55 | TAGS = [(re.compile(r""), C_BOLD), 56 | (re.compile(r""), C_UNDERLINE), 57 | (re.compile(r""), C_RED), 58 | (re.compile(r""), C_GREEN), 59 | (re.compile(r""), C_BLUE), 60 | (re.compile(r""), C_RESET)] 61 | 62 | 63 | @decorators.singleton 64 | class LinuxTerminalOutput(object): 65 | 66 | def __init__(self): 67 | self._output_level = INFO 68 | self._colors = True 69 | self._encoding = "utf-8" 70 | self._ignored_messages = set() 71 | self._indent_level = 0 72 | 73 | self.width = 79 74 | 75 | def basic_config(self, output_level=None, colors=None, encoding=None): 76 | self._output_level = output_level or self._output_level 77 | if colors is not None: 78 | self._colors = colors 79 | self._encoding = encoding or self._encoding 80 | 81 | def ignore(self, message): 82 | self._ignored_messages.add(message) 83 | 84 | def indent(self): 85 | self._indent_level += 1 86 | 87 | def unindent(self): 88 | if self._indent_level > 0: 89 | self._indent_level -= 1 90 | 91 | def write(self, s, fout=sys.stdout): 92 | if self._colors: 93 | s = self.__format(s) 94 | else: 95 | s = self.__raw(s) 96 | 97 | fout.write(s) 98 | fout.flush() 99 | 100 | def writeline(self, s, fout=sys.stdout): 101 | s = "{0}{1}\n".format(" " * self._indent_level, s) 102 | self.write(s, fout=fout) 103 | 104 | def critical(self, s, fout=sys.stdout): 105 | s = "** critical: {0}".format(s) 106 | if (self._output_level <= CRITICAL and 107 | self.__raw(s) not in self._ignored_messages): 108 | self.writeline(s, fout=fout) 109 | 110 | def error(self, s, fout=sys.stdout): 111 | s = "** error: {0}".format(s) 112 | if (self._output_level <= ERROR and 113 | self.__raw(s) not in self._ignored_messages): 114 | self.writeline(s, fout=fout) 115 | 116 | def warning(self, s, fout=sys.stdout): 117 | s = "** warning: {0}".format(s) 118 | if (self._output_level <= WARNING and 119 | self.__raw(s) not in self._ignored_messages): 120 | self.writeline(s, fout=fout) 121 | 122 | def info(self, s, fout=sys.stdout): 123 | if self._output_level <= INFO: 124 | self.writeline(s, fout=fout) 125 | 126 | def debug(self, s, fout=sys.stdout): 127 | if self._output_level <= DEBUG: 128 | self.writeline(s, fout=fout) 129 | 130 | def __format(self, s): 131 | for tag, ccode in TAGS: 132 | s = tag.sub(ccode, s) 133 | return s 134 | 135 | def __raw(self, s): 136 | for tag, _ in TAGS: 137 | s = tag.sub("", s) 138 | return s 139 | 140 | 141 | # set up the output type to be used by lorax 142 | LoraxOutput = LinuxTerminalOutput 143 | -------------------------------------------------------------------------------- /src/pylorax/treeinfo.py: -------------------------------------------------------------------------------- 1 | # 2 | # treeinfo.py 3 | # 4 | # Copyright (C) 2010-2015 Red Hat, Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | # Red Hat Author(s): Martin Gracik 20 | # 21 | 22 | import logging 23 | logger = logging.getLogger("pylorax.treeinfo") 24 | 25 | import configparser 26 | import os 27 | import time 28 | 29 | 30 | class TreeInfo(object): 31 | 32 | def __init__(self, product, version, variant, basearch, 33 | packagedir=""): 34 | 35 | self.c = configparser.ConfigParser() 36 | 37 | if 'SOURCE_DATE_EPOCH' in os.environ: 38 | timestamp = os.environ['SOURCE_DATE_EPOCH'] 39 | else: 40 | timestamp = str(time.time()) 41 | 42 | section = "general" 43 | data = {"timestamp": timestamp, 44 | "family": product, 45 | "version": version, 46 | "name": "%s-%s" % (product, version), 47 | "variant": variant or "", 48 | "arch": basearch, 49 | "packagedir": packagedir} 50 | 51 | self.c.add_section(section) 52 | list(self.c.set(section, key, value) for key, value in data.items()) 53 | 54 | def add_section(self, section, data): 55 | if not self.c.has_section(section): 56 | self.c.add_section(section) 57 | 58 | list(self.c.set(section, key, value) for key, value in data.items()) 59 | 60 | def write(self, outfile): 61 | logger.info("writing .treeinfo file") 62 | with open(outfile, "w") as fobj: 63 | self.c.write(fobj) 64 | -------------------------------------------------------------------------------- /systemd/lorax.conf: -------------------------------------------------------------------------------- 1 | # Prevent systemd from removing installtree files 2 | # This should eventually be fixed by - https://github.com/systemd/systemd/pull/11482 3 | x /var/tmp/lorax 750 root root 4 | -------------------------------------------------------------------------------- /test-packages: -------------------------------------------------------------------------------- 1 | anaconda-tui 2 | beakerlib 3 | e2fsprogs 4 | git 5 | isomd5sum 6 | libselinux-python3 7 | make 8 | pbzip2 9 | pigz 10 | pykickstart 11 | python3-coverage 12 | python3-coveralls 13 | python3-librepo 14 | python3-libdnf5 15 | python3-magic 16 | python3-mako 17 | python3-pocketlint 18 | python3-psutil 19 | python3-pycdio 20 | python3-pylint 21 | python3-pytest 22 | python3-pytest-cov 23 | python3-rpmfluff 24 | python3-sphinx 25 | python3-sphinx-argparse 26 | python3-sphinx-reredirects 27 | python3-sphinx_rtd_theme 28 | qemu-img 29 | rsync 30 | squashfs-tools 31 | erofs-utils 32 | sudo 33 | which 34 | xorriso 35 | xz-lzma-compat 36 | -------------------------------------------------------------------------------- /test/check-lorax: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | 4 | import tempfile 5 | import loraxtest 6 | 7 | 8 | class LoraxTestCase(loraxtest.TestCase): 9 | def setUp(self): 10 | self.setUpTestMachine() 11 | 12 | # Upload the contents of the ./tests/ directory to the machine (it must have beakerlib already installed) 13 | self.machine.upload(["../tests"], "/") 14 | 15 | def tearDown(self): 16 | super().tearDownTestMachine() 17 | 18 | def runLoraxTest(self, script): 19 | extra_env = [] 20 | if self.sit: 21 | extra_env.append("COMPOSER_TEST_FAIL_FAST=1") 22 | 23 | r = self.execute(["TEST=" + self.id(), 24 | *extra_env, 25 | "/tests/test_lorax.sh", script]) 26 | self.assertEqual(r.returncode, 0) 27 | 28 | def runShellTest(self, script): 29 | """Run a shell script directly, without the beakerlib wrapper""" 30 | extra_env = [] 31 | r = self.execute(["TEST=" + self.id(), 32 | *extra_env, 33 | script]) 34 | self.assertEqual(r.returncode, 0) 35 | 36 | 37 | class TestLorax(LoraxTestCase): 38 | def test_boot_iso(self): 39 | self.runLoraxTest("/tests/lorax/test_build_bootiso.sh") 40 | 41 | with tempfile.TemporaryDirectory(prefix="/var/tmp/lorax-test.") as tmpdir: 42 | # Copy the resulting iso and shut down the VM 43 | self.tearDownVirt(virt_dir="/var/tmp/test-results/*", local_dir=tmpdir) 44 | 45 | # Boot the image, login with ssh (no key needed) 46 | self.setUpTestMachine(tmpdir + "/images/boot.iso") 47 | 48 | # Upload the contents of the ./tests/ directory to the machine 49 | self.machine.upload(["../tests"], "/") 50 | 51 | # Run the test on the booted image 52 | # NOTE: The boot.iso cannot run beakerlib so this test is called directly 53 | self.runShellTest("/tests/lorax/test_boot_bootiso.sh") 54 | 55 | 56 | if __name__ == '__main__': 57 | loraxtest.main() 58 | -------------------------------------------------------------------------------- /test/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # This is the expected entry point for Cockpit CI; will be called without 3 | # arguments but with an appropriate $TEST_OS, and optionally $TEST_SCENARIO 4 | 5 | if [ "$TEST_SCENARIO" != "osbuild-composer" ]; then 6 | echo "$TEST_SCENARIO no longer supported by lorax" 7 | exit 1 8 | fi 9 | make vm 10 | test/check-lorax TestLorax 11 | -------------------------------------------------------------------------------- /test/vm.install: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eux 2 | 3 | SRPM="$1" 4 | 5 | # always remove older versions of these RPMs if they exist 6 | # to ensure newly built packages have been installed 7 | yum -y remove lorax 8 | 9 | if ! rpm -q beakerlib; then 10 | if [ $(. /etc/os-release && echo $ID) = "rhel" ]; then 11 | (cd /etc/yum.repos.d; curl -O -L http://download.devel.redhat.com/beakerrepos/beaker-client-RedHatEnterpriseLinux.repo) 12 | 13 | # The beaker repository doesn't include repos for minor releases 14 | VERSION=$(. /etc/os-release && echo ${VERSION_ID%.*}) 15 | yum install -y --releasever=$VERSION --setopt=sslverify=0 beakerlib 16 | 17 | # prevent yum from trying to sync the cache again later (it fails without sslverify=0) 18 | rm /etc/yum.repos.d/beaker-client-RedHatEnterpriseLinux.repo 19 | else 20 | yum install -y beakerlib 21 | fi 22 | fi 23 | 24 | # disable mirrors & re-enable direct download 25 | sed -i "s/metalink.*//" /etc/yum.repos.d/*.repo 26 | sed -i "s/#\(baseurl=.*\)/\1/" /etc/yum.repos.d/*.repo 27 | sed -i "s/download.fedoraproject/dl.fedoraproject/" /etc/yum.repos.d/*.repo 28 | 29 | # HACK: Fedora ships baseurl with `example.com` as domain 30 | # Example: `#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/$basearch/` 31 | sed -i "s/download.example/dl.fedoraproject.org/" /etc/yum.repos.d/*.repo 32 | 33 | # Grow root partition on LVM test images to make room for built images 34 | PVS=$(pvs --noheadings -opv_name) 35 | if [ -n "$PVS" ]; then 36 | echo ", +" | sfdisk -N 2 -f /dev/vda 37 | partprobe 38 | echo "$PVS" | xargs pvresize 39 | rootlv=$(findmnt --noheadings -oSOURCE /) 40 | lvresize $rootlv -l+100%FREE -r 41 | fi 42 | 43 | rm -rf build-results 44 | su builder -c "/usr/bin/mock --verbose --no-clean --resultdir build-results --rebuild $SRPM" 45 | 46 | packages=$(find build-results -name '*.rpm' -not -name '*.src.rpm') 47 | yum install -y $packages 48 | 49 | if [ -f /usr/bin/docker ]; then 50 | yum remove -y $(rpm -qf /usr/bin/docker) 51 | fi 52 | 53 | if ! rpm -q podman-docker; then 54 | yum install -y podman-docker 55 | fi 56 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/tests/__init__.py -------------------------------------------------------------------------------- /tests/image-minimizer/im-script.txt: -------------------------------------------------------------------------------- 1 | # test script for image-minimizer 2 | drop /etc/pki/rpm-gpg/* 3 | keep /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-11-primary 4 | keep /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-12-primary 5 | drop /usr/share/zoneinfo/* 6 | keep /usr/share/zoneinfo/America 7 | keep /usr/share/zoneinfo/US 8 | keep /usr/share/zoneinfo/UTC 9 | droprpm fedora-* 10 | keeprpm fedora-release 11 | keeprpm fedora-gpg-keys 12 | -------------------------------------------------------------------------------- /tests/image-minimizer/minimizer.py: -------------------------------------------------------------------------------- 1 | ../../src/bin/image-minimizer -------------------------------------------------------------------------------- /tests/image-minimizer/test_minimizer.py: -------------------------------------------------------------------------------- 1 | import os 2 | from subprocess import check_call, CalledProcessError 3 | import tempfile 4 | import unittest 5 | 6 | from minimizer import ImageMinimizer 7 | 8 | class MinimizerTestCase(unittest.TestCase): 9 | def test_minimizer_ok(self): 10 | with tempfile.TemporaryDirectory(prefix="minimize.test.") as rootdir: 11 | check_call(["dnf", "--use-host-config", "--installroot", rootdir, "install", "-y", \ 12 | "filesystem", "tzdata"]) 13 | 14 | im = ImageMinimizer("./tests/image-minimizer/im-script.txt", rootdir, False, False) 15 | im.filter() 16 | 17 | # /etc/pki/rpm-gpg/ should only have 2 files 18 | self.assertEqual(sorted(os.listdir(f"{rootdir}/etc/pki/rpm-gpg/")), ["RPM-GPG-KEY-fedora-11-primary", "RPM-GPG-KEY-fedora-12-primary"]) 19 | 20 | # zoneinfo should have 2 directories and a file 21 | self.assertEqual(sorted(os.listdir(f"{rootdir}/usr/share/zoneinfo/")), ["America", "US", "UTC"]) 22 | 23 | check_call(["rpm", "--root", rootdir, "-q", "fedora-release", "fedora-gpg-keys"]) 24 | 25 | with self.assertRaises(CalledProcessError): 26 | check_call(["rpm", "--root", rootdir, "-q", "fedora-repos"]) 27 | 28 | def test_minimizer_empty(self): 29 | ## No packages in tree (this is ok, nothing to remove) 30 | with tempfile.TemporaryDirectory(prefix="minimize.test.") as rootdir: 31 | im = ImageMinimizer("./tests/image-minimizer/im-script.txt", rootdir, False, False) 32 | im.filter() 33 | 34 | def test_minimizer_missing_script(self): 35 | ## No minimizer script 36 | with tempfile.TemporaryDirectory(prefix="minimize.test.") as rootdir: 37 | im = ImageMinimizer("./tests/image-minimizer/missing.txt", rootdir, False, False) 38 | with self.assertRaises(FileNotFoundError): 39 | im.filter() 40 | 41 | def test_minimizer_missing_root(self): 42 | ## Missing directory 43 | im = ImageMinimizer("./tests/image-minimizer/im-script.txt", "/tmp/minimizer.root", False, False) 44 | with self.assertRaises(FileNotFoundError): 45 | im.filter() 46 | -------------------------------------------------------------------------------- /tests/lib.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2018 Red Hat, Inc. 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | # 17 | import sys 18 | from contextlib import contextmanager 19 | import magic 20 | from io import StringIO 21 | 22 | @contextmanager 23 | def captured_output(): 24 | new_out, new_err = StringIO(), StringIO() 25 | old_out, old_err = sys.stdout, sys.stderr 26 | try: 27 | sys.stdout, sys.stderr = new_out, new_err 28 | yield sys.stdout, sys.stderr 29 | finally: 30 | sys.stdout, sys.stderr = old_out, old_err 31 | 32 | def get_file_magic(filename): 33 | """Get the file type details using libmagic 34 | 35 | Returns "" on failure or a string containing the description of the file 36 | """ 37 | details = "" 38 | try: 39 | details = magic.from_file(filename) 40 | except Exception: 41 | pass 42 | 43 | return details 44 | -------------------------------------------------------------------------------- /tests/lorax/lib/lib.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # lorax specific functions 3 | 4 | . "$(dirname $0)/../cli/lib/lib.sh" 5 | -------------------------------------------------------------------------------- /tests/lorax/test_boot_bootiso.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Note: execute this file from inside the booted boot.iso 3 | # We cannot use beakerlib because the boot.iso is missing some of the executables it depends on 4 | # 5 | 6 | ##### 7 | # 8 | # Test a booted boot.iso 9 | # 10 | ##### 11 | 12 | set -e 13 | 14 | if ! grep anaconda /root/lorax-packages.log; then 15 | echo "ERROR: anaconda not included in boot.iso package list" 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /tests/lorax/test_build_bootiso.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Note: execute this file from the project root directory 3 | 4 | ##### 5 | # 6 | # Builds a boot.iso with lorax 7 | # 8 | ##### 9 | 10 | set -e 11 | 12 | . /usr/share/beakerlib/beakerlib.sh 13 | . "$(dirname $0)/lib/lib.sh" 14 | 15 | CLI="${CLI:-./src/bin/lorax}" 16 | 17 | # Make up a name (slightly unsafe), should not exist before running lorax so use -u 18 | rlJournalStart 19 | rlPhaseStartTest "Build lorax boot.iso" 20 | rlAssertEquals "SELinux operates in enforcing mode" "$(getenforce)" "Enforcing" 21 | lorax -p Fedora-Lorax-Test -v "$RELEASE" -r "$RELEASE" \ 22 | --repo /etc/yum.repos.d/fedora.repo \ 23 | --repo /etc/yum.repos.d/fedora-updates.repo \ 24 | --sharedir "$SHARE_DIR" /var/tmp/test-results/ 25 | rlAssertEquals "exit code should be zero" $? 0 26 | IMAGE="/var/tmp/test-results/images/boot.iso" 27 | rlAssertExists "$IMAGE" 28 | rlPhaseEnd 29 | rlJournalEnd 30 | rlJournalPrintText 31 | -------------------------------------------------------------------------------- /tests/mkksiso/data/BOOT-1.conf: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod efi_gop 5 | insmod efi_uga 6 | insmod video_bochs 7 | insmod video_cirrus 8 | insmod all_video 9 | } 10 | 11 | load_video 12 | set gfxpayload=keep 13 | insmod gzio 14 | insmod part_gpt 15 | insmod ext2 16 | 17 | set timeout=60 18 | ### END /etc/grub.d/00_header ### 19 | 20 | search --no-floppy --set=root -l 'Fedora-rawhide-test' 21 | 22 | ### BEGIN /etc/grub.d/10_linux ### 23 | menuentry 'Install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 24 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test console=ttyUSB0 quiet 25 | initrd /images/pxeboot/initrd.img 26 | } 27 | menuentry 'Test this media & install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 28 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test rd.live.check quiet 29 | initrd /images/pxeboot/initrd.img 30 | } 31 | submenu 'Troubleshooting -->' { 32 | menuentry 'Install Fedora rawhide in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { 33 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test nomodeset quiet 34 | initrd /images/pxeboot/initrd.img 35 | } 36 | menuentry 'Rescue a Fedora system' --class fedora --class gnu-linux --class gnu --class os { 37 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test inst.rescue quiet 38 | initrd /images/pxeboot/initrd.img 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/mkksiso/data/BOOT-1.conf.result: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod efi_gop 5 | insmod efi_uga 6 | insmod video_bochs 7 | insmod video_cirrus 8 | insmod all_video 9 | } 10 | 11 | load_video 12 | set gfxpayload=keep 13 | insmod gzio 14 | insmod part_gpt 15 | insmod ext2 16 | 17 | set timeout=60 18 | ### END /etc/grub.d/00_header ### 19 | 20 | search --no-floppy --set=root -l 'Fedora-mkksiso-rawhide-test' 21 | 22 | ### BEGIN /etc/grub.d/10_linux ### 23 | menuentry 'Install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 24 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 25 | initrd /images/pxeboot/initrd.img 26 | } 27 | menuentry 'Test this media & install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 28 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test rd.live.check inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 29 | initrd /images/pxeboot/initrd.img 30 | } 31 | submenu 'Troubleshooting -->' { 32 | menuentry 'Install Fedora rawhide in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { 33 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test nomodeset inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 34 | initrd /images/pxeboot/initrd.img 35 | } 36 | menuentry 'Rescue a Fedora system' --class fedora --class gnu-linux --class gnu --class os { 37 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test inst.rescue inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 38 | initrd /images/pxeboot/initrd.img 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/mkksiso/data/BOOT.conf: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod efi_gop 5 | insmod efi_uga 6 | insmod video_bochs 7 | insmod video_cirrus 8 | insmod all_video 9 | } 10 | 11 | load_video 12 | set gfxpayload=keep 13 | insmod gzio 14 | insmod part_gpt 15 | insmod ext2 16 | 17 | set timeout=60 18 | ### END /etc/grub.d/00_header ### 19 | 20 | search --no-floppy --set=root -l 'Fedora-rawhide-test' 21 | 22 | ### BEGIN /etc/grub.d/10_linux ### 23 | menuentry 'Install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 24 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test console=ttyUSB0 quiet 25 | initrdefi /images/pxeboot/initrd.img 26 | } 27 | menuentry 'Test this media & install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 28 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test rd.live.check quiet 29 | initrdefi /images/pxeboot/initrd.img 30 | } 31 | submenu 'Troubleshooting -->' { 32 | menuentry 'Install Fedora rawhide in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { 33 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test nomodeset quiet 34 | initrdefi /images/pxeboot/initrd.img 35 | } 36 | menuentry 'Rescue a Fedora system' --class fedora --class gnu-linux --class gnu --class os { 37 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test inst.rescue quiet 38 | initrdefi /images/pxeboot/initrd.img 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/mkksiso/data/BOOT.conf.result: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod efi_gop 5 | insmod efi_uga 6 | insmod video_bochs 7 | insmod video_cirrus 8 | insmod all_video 9 | } 10 | 11 | load_video 12 | set gfxpayload=keep 13 | insmod gzio 14 | insmod part_gpt 15 | insmod ext2 16 | 17 | set timeout=60 18 | ### END /etc/grub.d/00_header ### 19 | 20 | search --no-floppy --set=root -l 'Fedora-mkksiso-rawhide-test' 21 | 22 | ### BEGIN /etc/grub.d/10_linux ### 23 | menuentry 'Install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 24 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 25 | initrdefi /images/pxeboot/initrd.img 26 | } 27 | menuentry 'Test this media & install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 28 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test rd.live.check inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 29 | initrdefi /images/pxeboot/initrd.img 30 | } 31 | submenu 'Troubleshooting -->' { 32 | menuentry 'Install Fedora rawhide in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { 33 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test nomodeset inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 34 | initrdefi /images/pxeboot/initrd.img 35 | } 36 | menuentry 'Rescue a Fedora system' --class fedora --class gnu-linux --class gnu --class os { 37 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test inst.rescue inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 38 | initrdefi /images/pxeboot/initrd.img 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/mkksiso/data/bios-grub.cfg: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod all_video 5 | } 6 | 7 | load_video 8 | set gfxpayload=keep 9 | insmod gzio 10 | insmod part_gpt 11 | insmod ext2 12 | 13 | set timeout=60 14 | ### END /etc/grub.d/00_header ### 15 | 16 | search --no-floppy --set=root -l 'Fedora-rawhide-test' 17 | 18 | ### BEGIN /etc/grub.d/10_linux ### 19 | menuentry 'Install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 20 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test console=ttyUSB0 quiet 21 | initrd /images/pxeboot/initrd.img 22 | } 23 | menuentry 'Test this media & install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 24 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test rd.live.check quiet 25 | initrd /images/pxeboot/initrd.img 26 | } 27 | submenu 'Troubleshooting -->' { 28 | menuentry 'Install Fedora rawhide in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { 29 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test nomodeset quiet 30 | initrd /images/pxeboot/initrd.img 31 | } 32 | menuentry 'Rescue a Fedora system' --class fedora --class gnu-linux --class gnu --class os { 33 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test inst.rescue quiet 34 | initrd /images/pxeboot/initrd.img 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/mkksiso/data/bios-grub.cfg.result: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod all_video 5 | } 6 | 7 | load_video 8 | set gfxpayload=keep 9 | insmod gzio 10 | insmod part_gpt 11 | insmod ext2 12 | 13 | set timeout=60 14 | ### END /etc/grub.d/00_header ### 15 | 16 | search --no-floppy --set=root -l 'Fedora-mkksiso-rawhide-test' 17 | 18 | ### BEGIN /etc/grub.d/10_linux ### 19 | menuentry 'Install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 20 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 21 | initrd /images/pxeboot/initrd.img 22 | } 23 | menuentry 'Test this media & install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 24 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test rd.live.check inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 25 | initrd /images/pxeboot/initrd.img 26 | } 27 | submenu 'Troubleshooting -->' { 28 | menuentry 'Install Fedora rawhide in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { 29 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test nomodeset inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 30 | initrd /images/pxeboot/initrd.img 31 | } 32 | menuentry 'Rescue a Fedora system' --class fedora --class gnu-linux --class gnu --class os { 33 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test inst.rescue inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 34 | initrd /images/pxeboot/initrd.img 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/mkksiso/data/cdboot.prm: -------------------------------------------------------------------------------- 1 | ro inst.stage2=hd:LABEL=Fedora-rawhide-test 2 | console=ttyUSB0 3 | quiet 4 | -------------------------------------------------------------------------------- /tests/mkksiso/data/cdboot.prm.result: -------------------------------------------------------------------------------- 1 | ro inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test inst.ks=file:///installer.ks 2 | quoted="A longer string with spaces that is quoted should not be split" 3 | console=ttyS0,115200n8 console=tty1 4 | -------------------------------------------------------------------------------- /tests/mkksiso/data/generic.prm: -------------------------------------------------------------------------------- 1 | ro ramdisk_size=40000 cio_ignore=all,!condev 2 | console=ttyUSB0 3 | quiet 4 | -------------------------------------------------------------------------------- /tests/mkksiso/data/generic.prm.result: -------------------------------------------------------------------------------- 1 | ro ramdisk_size=40000 cio_ignore=all,!condev inst.ks=file:///installer.ks 2 | quoted="A longer string with spaces that is quoted should not be split" 3 | console=ttyS0,115200n8 console=tty1 4 | -------------------------------------------------------------------------------- /tests/mkksiso/data/isolinux.cfg: -------------------------------------------------------------------------------- 1 | default vesamenu.c32 2 | timeout 600 3 | 4 | display boot.msg 5 | 6 | # Clear the screen when exiting the menu, instead of leaving the menu displayed. 7 | # For vesamenu, this means the graphical background is still displayed without 8 | # the menu itself for as long as the screen remains in graphics mode. 9 | menu clear 10 | menu background splash.png 11 | menu title Fedora rawhide 12 | menu vshift 8 13 | menu rows 18 14 | menu margin 8 15 | #menu hidden 16 | menu helpmsgrow 15 17 | menu tabmsgrow 13 18 | 19 | # Border Area 20 | menu color border * #00000000 #00000000 none 21 | 22 | # Selected item 23 | menu color sel 0 #ffffffff #00000000 none 24 | 25 | # Title bar 26 | menu color title 0 #ff7ba3d0 #00000000 none 27 | 28 | # Press [Tab] message 29 | menu color tabmsg 0 #ff3a6496 #00000000 none 30 | 31 | # Unselected menu item 32 | menu color unsel 0 #84b8ffff #00000000 none 33 | 34 | # Selected hotkey 35 | menu color hotsel 0 #84b8ffff #00000000 none 36 | 37 | # Unselected hotkey 38 | menu color hotkey 0 #ffffffff #00000000 none 39 | 40 | # Help text 41 | menu color help 0 #ffffffff #00000000 none 42 | 43 | # A scrollbar of some type? Not sure. 44 | menu color scrollbar 0 #ffffffff #ff355594 none 45 | 46 | # Timeout msg 47 | menu color timeout 0 #ffffffff #00000000 none 48 | menu color timeout_msg 0 #ffffffff #00000000 none 49 | 50 | # Command prompt text 51 | menu color cmdmark 0 #84b8ffff #00000000 none 52 | menu color cmdline 0 #ffffffff #00000000 none 53 | 54 | # Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message. 55 | 56 | menu tabmsg Press Tab for full configuration options on menu items. 57 | 58 | menu separator # insert an empty line 59 | menu separator # insert an empty line 60 | 61 | label linux 62 | menu label ^Install Fedora rawhide 63 | kernel vmlinuz 64 | append initrd=initrd.img inst.stage2=hd:LABEL=Fedora-rawhide-test console=ttyUSB0 quiet 65 | 66 | label check 67 | menu label Test this ^media & install Fedora rawhide 68 | menu default 69 | kernel vmlinuz 70 | append initrd=initrd.img inst.stage2=hd:LABEL=Fedora-rawhide-test rd.live.check quiet 71 | 72 | menu separator # insert an empty line 73 | 74 | # utilities submenu 75 | menu begin ^Troubleshooting 76 | menu title Troubleshooting Fedora rawhide 77 | 78 | label basic 79 | menu indent count 5 80 | menu label Install using ^basic graphics mode 81 | text help 82 | Try this option out if you're having trouble installing 83 | Fedora rawhide. 84 | endtext 85 | kernel vmlinuz 86 | append initrd=initrd.img inst.stage2=hd:LABEL=Fedora-rawhide-test nomodeset quiet 87 | 88 | label rescue 89 | menu indent count 5 90 | menu label ^Rescue a Fedora system 91 | text help 92 | If the system will not boot, this lets you access files 93 | and edit config files to try to get it booting again. 94 | endtext 95 | kernel vmlinuz 96 | append initrd=initrd.img inst.stage2=hd:LABEL=Fedora-rawhide-test inst.rescue quiet 97 | 98 | menu separator # insert an empty line 99 | 100 | label local 101 | menu label Boot from ^local drive 102 | localboot 0xffff 103 | 104 | menu separator # insert an empty line 105 | menu separator # insert an empty line 106 | 107 | label returntomain 108 | menu label Return to ^main menu 109 | menu exit 110 | 111 | menu end 112 | -------------------------------------------------------------------------------- /tests/mkksiso/data/isolinux.cfg.result: -------------------------------------------------------------------------------- 1 | default vesamenu.c32 2 | timeout 600 3 | 4 | display boot.msg 5 | 6 | # Clear the screen when exiting the menu, instead of leaving the menu displayed. 7 | # For vesamenu, this means the graphical background is still displayed without 8 | # the menu itself for as long as the screen remains in graphics mode. 9 | menu clear 10 | menu background splash.png 11 | menu title Fedora rawhide 12 | menu vshift 8 13 | menu rows 18 14 | menu margin 8 15 | #menu hidden 16 | menu helpmsgrow 15 17 | menu tabmsgrow 13 18 | 19 | # Border Area 20 | menu color border * #00000000 #00000000 none 21 | 22 | # Selected item 23 | menu color sel 0 #ffffffff #00000000 none 24 | 25 | # Title bar 26 | menu color title 0 #ff7ba3d0 #00000000 none 27 | 28 | # Press [Tab] message 29 | menu color tabmsg 0 #ff3a6496 #00000000 none 30 | 31 | # Unselected menu item 32 | menu color unsel 0 #84b8ffff #00000000 none 33 | 34 | # Selected hotkey 35 | menu color hotsel 0 #84b8ffff #00000000 none 36 | 37 | # Unselected hotkey 38 | menu color hotkey 0 #ffffffff #00000000 none 39 | 40 | # Help text 41 | menu color help 0 #ffffffff #00000000 none 42 | 43 | # A scrollbar of some type? Not sure. 44 | menu color scrollbar 0 #ffffffff #ff355594 none 45 | 46 | # Timeout msg 47 | menu color timeout 0 #ffffffff #00000000 none 48 | menu color timeout_msg 0 #ffffffff #00000000 none 49 | 50 | # Command prompt text 51 | menu color cmdmark 0 #84b8ffff #00000000 none 52 | menu color cmdline 0 #ffffffff #00000000 none 53 | 54 | # Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message. 55 | 56 | menu tabmsg Press Tab for full configuration options on menu items. 57 | 58 | menu separator # insert an empty line 59 | menu separator # insert an empty line 60 | 61 | label linux 62 | menu label ^Install Fedora rawhide 63 | kernel vmlinuz 64 | append initrd=initrd.img inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 65 | 66 | label check 67 | menu label Test this ^media & install Fedora rawhide 68 | menu default 69 | kernel vmlinuz 70 | append initrd=initrd.img inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test rd.live.check inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 71 | 72 | menu separator # insert an empty line 73 | 74 | # utilities submenu 75 | menu begin ^Troubleshooting 76 | menu title Troubleshooting Fedora rawhide 77 | 78 | label basic 79 | menu indent count 5 80 | menu label Install using ^basic graphics mode 81 | text help 82 | Try this option out if you're having trouble installing 83 | Fedora rawhide. 84 | endtext 85 | kernel vmlinuz 86 | append initrd=initrd.img inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test nomodeset inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 87 | 88 | label rescue 89 | menu indent count 5 90 | menu label ^Rescue a Fedora system 91 | text help 92 | If the system will not boot, this lets you access files 93 | and edit config files to try to get it booting again. 94 | endtext 95 | kernel vmlinuz 96 | append initrd=initrd.img inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test inst.rescue inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 97 | 98 | menu separator # insert an empty line 99 | 100 | label local 101 | menu label Boot from ^local drive 102 | localboot 0xffff 103 | 104 | menu separator # insert an empty line 105 | menu separator # insert an empty line 106 | 107 | label returntomain 108 | menu label Return to ^main menu 109 | menu exit 110 | 111 | menu end 112 | -------------------------------------------------------------------------------- /tests/mkksiso/data/uefi-grub-1.cfg: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod efi_gop 5 | insmod efi_uga 6 | insmod video_bochs 7 | insmod video_cirrus 8 | insmod all_video 9 | } 10 | 11 | load_video 12 | set gfxpayload=keep 13 | insmod gzio 14 | insmod part_gpt 15 | insmod ext2 16 | 17 | set timeout=60 18 | ### END /etc/grub.d/00_header ### 19 | 20 | search --no-floppy --set=root -l 'Fedora-rawhide-test' 21 | 22 | ### BEGIN /etc/grub.d/10_linux ### 23 | menuentry 'Install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 24 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test console=ttyUSB0 quiet 25 | initrd /images/pxeboot/initrd.img 26 | } 27 | menuentry 'Test this media & install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 28 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test rd.live.check quiet 29 | initrd /images/pxeboot/initrd.img 30 | } 31 | submenu 'Troubleshooting -->' { 32 | menuentry 'Install Fedora rawhide in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { 33 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test nomodeset quiet 34 | initrd /images/pxeboot/initrd.img 35 | } 36 | menuentry 'Rescue a Fedora system' --class fedora --class gnu-linux --class gnu --class os { 37 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test inst.rescue quiet 38 | initrd /images/pxeboot/initrd.img 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/mkksiso/data/uefi-grub-1.cfg.result: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod efi_gop 5 | insmod efi_uga 6 | insmod video_bochs 7 | insmod video_cirrus 8 | insmod all_video 9 | } 10 | 11 | load_video 12 | set gfxpayload=keep 13 | insmod gzio 14 | insmod part_gpt 15 | insmod ext2 16 | 17 | set timeout=60 18 | ### END /etc/grub.d/00_header ### 19 | 20 | search --no-floppy --set=root -l 'Fedora-mkksiso-rawhide-test' 21 | 22 | ### BEGIN /etc/grub.d/10_linux ### 23 | menuentry 'Install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 24 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 25 | initrd /images/pxeboot/initrd.img 26 | } 27 | menuentry 'Test this media & install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 28 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test rd.live.check inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 29 | initrd /images/pxeboot/initrd.img 30 | } 31 | submenu 'Troubleshooting -->' { 32 | menuentry 'Install Fedora rawhide in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { 33 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test nomodeset inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 34 | initrd /images/pxeboot/initrd.img 35 | } 36 | menuentry 'Rescue a Fedora system' --class fedora --class gnu-linux --class gnu --class os { 37 | linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test inst.rescue inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 38 | initrd /images/pxeboot/initrd.img 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/mkksiso/data/uefi-grub.cfg: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod efi_gop 5 | insmod efi_uga 6 | insmod video_bochs 7 | insmod video_cirrus 8 | insmod all_video 9 | } 10 | 11 | load_video 12 | set gfxpayload=keep 13 | insmod gzio 14 | insmod part_gpt 15 | insmod ext2 16 | 17 | set timeout=60 18 | ### END /etc/grub.d/00_header ### 19 | 20 | search --no-floppy --set=root -l 'Fedora-rawhide-test' 21 | 22 | ### BEGIN /etc/grub.d/10_linux ### 23 | menuentry 'Install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 24 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test console=ttyUSB0 quiet 25 | initrdefi /images/pxeboot/initrd.img 26 | } 27 | menuentry 'Test this media & install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 28 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test rd.live.check quiet 29 | initrdefi /images/pxeboot/initrd.img 30 | } 31 | submenu 'Troubleshooting -->' { 32 | menuentry 'Install Fedora rawhide in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { 33 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test nomodeset quiet 34 | initrdefi /images/pxeboot/initrd.img 35 | } 36 | menuentry 'Rescue a Fedora system' --class fedora --class gnu-linux --class gnu --class os { 37 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-rawhide-test inst.rescue quiet 38 | initrdefi /images/pxeboot/initrd.img 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/mkksiso/data/uefi-grub.cfg.result: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod efi_gop 5 | insmod efi_uga 6 | insmod video_bochs 7 | insmod video_cirrus 8 | insmod all_video 9 | } 10 | 11 | load_video 12 | set gfxpayload=keep 13 | insmod gzio 14 | insmod part_gpt 15 | insmod ext2 16 | 17 | set timeout=60 18 | ### END /etc/grub.d/00_header ### 19 | 20 | search --no-floppy --set=root -l 'Fedora-mkksiso-rawhide-test' 21 | 22 | ### BEGIN /etc/grub.d/10_linux ### 23 | menuentry 'Install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 24 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 25 | initrdefi /images/pxeboot/initrd.img 26 | } 27 | menuentry 'Test this media & install Fedora rawhide' --class fedora --class gnu-linux --class gnu --class os { 28 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test rd.live.check inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 29 | initrdefi /images/pxeboot/initrd.img 30 | } 31 | submenu 'Troubleshooting -->' { 32 | menuentry 'Install Fedora rawhide in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { 33 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test nomodeset inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 34 | initrdefi /images/pxeboot/initrd.img 35 | } 36 | menuentry 'Rescue a Fedora system' --class fedora --class gnu-linux --class gnu --class os { 37 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-mkksiso-rawhide-test inst.rescue inst.ks=file:///installer.ks quoted="A longer string with spaces that is quoted should not be split" console=ttyS0,115200n8 console=tty1 38 | initrdefi /images/pxeboot/initrd.img 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/mkksiso/ks/extra-repo.ks: -------------------------------------------------------------------------------- 1 | url --url="https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/$basearch/os/" 2 | repo --name=extra-repo --baseurl=file:///run/install/repo/extra-repo/ 3 | 4 | lang en_US.UTF-8 5 | keyboard us 6 | rootpw --plaintext asdasd 7 | timezone --utc America/New_York 8 | 9 | # partitioning - nuke and start fresh 10 | clearpart --initlabel --all 11 | autopart --type=plain 12 | bootloader --location=mbr 13 | shutdown 14 | 15 | %packages 16 | extra-package 17 | %end 18 | -------------------------------------------------------------------------------- /tests/mkksiso/ks/liveimg.ks: -------------------------------------------------------------------------------- 1 | install 2 | lang en_US.UTF-8 3 | keyboard us 4 | rootpw --plaintext asdasd 5 | timezone --utc America/New_York 6 | 7 | # partitioning - nuke and start fresh 8 | clearpart --initlabel --all 9 | autopart --type=plain 10 | bootloader --location=mbr 11 | shutdown 12 | 13 | liveimg --url=file:///run/install/repo/root.tar.xz 14 | -------------------------------------------------------------------------------- /tests/mkksiso/mk-fake-rpm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # Copyright (C) 2019 Red Hat, Inc. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | # 18 | from contextlib import contextmanager 19 | from rpmfluff import SimpleRpmBuild, expectedArch 20 | import os 21 | import shutil 22 | import sys 23 | import tempfile 24 | 25 | @contextmanager 26 | def in_tempdir(prefix='tmp'): 27 | """Execute a block of code with chdir in a temporary location""" 28 | oldcwd = os.getcwd() 29 | tmpdir = tempfile.mkdtemp(prefix=prefix) 30 | os.chdir(tmpdir) 31 | try: 32 | yield 33 | finally: 34 | os.chdir(oldcwd) 35 | shutil.rmtree(tmpdir) 36 | 37 | 38 | def makeFakeRPM(repo_dir, name, epoch, version, release): 39 | """Make a fake rpm file in repo_dir""" 40 | p = SimpleRpmBuild(name, version, release) 41 | if epoch: 42 | p.epoch = epoch 43 | p.add_simple_payload_file_random() 44 | with in_tempdir("lorax-test-rpms."): 45 | p.make() 46 | rpmfile = p.get_built_rpm(expectedArch) 47 | shutil.move(rpmfile, repo_dir) 48 | 49 | if __name__ == '__main__': 50 | if len(sys.argv) != 3: 51 | print("%s DIRECTORY RPM-NAME" % os.path.basename(sys.argv[0])) 52 | sys.exit(1) 53 | 54 | makeFakeRPM(os.path.abspath(sys.argv[1]), sys.argv[2], 0, "1.0.0", "1") 55 | -------------------------------------------------------------------------------- /tests/mkksiso/mkksiso.py: -------------------------------------------------------------------------------- 1 | ../../src/bin/mkksiso -------------------------------------------------------------------------------- /tests/mkksiso/test_boot_repo.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | # Note: execute this file from the project root directory 3 | set -e 4 | 5 | [ -z "$1" ] && (echo "$0: Missing path to iso"; exit 1) 6 | [ -z "$2" ] && (echo "$0: Missing kickstart"; exit 1) 7 | [ "$(id -u)" -eq 0 ] || (echo "$0 must be run as root"; exit 1) 8 | 9 | . /usr/share/beakerlib/beakerlib.sh 10 | CLI="${CLI:-./src/bin/mkksiso}" 11 | 12 | rlJournalStart 13 | rlPhaseStartSetup "Setup repo with fake rpm" 14 | TMP_DIR=$(mktemp -d -p /var/tmp) 15 | rlRun -t -c "mkdir $TMP_DIR/extra-repo/" 16 | rlRun -t -c "$(dirname "$0")/mk-fake-rpm $TMP_DIR/extra-repo/ extra-package" 17 | rlRun -t -c "createrepo_c $TMP_DIR/extra-repo/" 18 | rlPhaseEnd 19 | 20 | rlPhaseStartTest "Make new iso with kickstart and extra-repo" 21 | rlRun -t -c "$CLI --add $TMP_DIR/extra-repo --ks $2 $1 $TMP_DIR/ks-boot.iso" 22 | rlAssertExists "$TMP_DIR/ks-boot.iso" 23 | rlPhaseEnd 24 | 25 | rlPhaseStartTest "Check the new ISO" 26 | ISO_DIR="$TMP_DIR/mnt-iso/" 27 | rlRun -t -c "mkdir $ISO_DIR" 28 | rlRun "mount $TMP_DIR/ks-boot.iso $ISO_DIR" 29 | fail=0 30 | rlLogInfo "Checking for kickstart $(basename "$2")" 31 | if [ ! -e "$ISO_DIR$(basename "$2")" ]; then 32 | rlLogError "The kickstart is missing from the iso" 33 | fail=1 34 | fi 35 | for cfg in isolinux/isolinux.cfg EFI/BOOT/grub.cfg EFI/BOOT/BOOT.conf \ 36 | boot/grub/grub.cfg images/generic.prm; do 37 | if [ -e "$ISO_DIR$cfg" ]; then 38 | rlLogInfo "Checking $cfg" 39 | if ! grep -q "$(basename "$2")" "$ISO_DIR$cfg"; then 40 | rlLogError "$cfg is missing the kickstart" 41 | fail=1 42 | fi 43 | fi 44 | done 45 | rlLogInfo "Checking for /extra-repo/ on iso" 46 | if [ ! -e "$TMP_DIR/extra-repo/" ]; then 47 | rlLogError"The extra-repo directory is missing from the iso" 48 | fail=1 49 | fi 50 | rlAssertEquals "All checks have passed" $fail 0 51 | rlPhaseEnd 52 | 53 | rlPhaseStartCleanup 54 | rlRun -t -c "umount $ISO_DIR" 55 | rlRun -t -c "rm -rf $TMP_DIR" 56 | rlPhaseEnd 57 | rlJournalEnd 58 | rlJournalPrintText 59 | -------------------------------------------------------------------------------- /tests/mkksiso/test_liveimg.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | # Note: execute this file from the project root directory 3 | set -e 4 | 5 | [ -z "$1" ] && (echo "$0: Missing path to iso"; exit 1) 6 | [ -z "$2" ] && (echo "$0: Missing kickstart"; exit 1) 7 | [ "$(id -u)" -eq 0 ] || (echo "$0 must be run as root"; exit 1) 8 | 9 | . /usr/share/beakerlib/beakerlib.sh 10 | CLI="${CLI:-./src/bin/mkksiso}" 11 | 12 | rlJournalStart 13 | rlPhaseStartSetup "Setup a fake root image" 14 | TMP_DIR=$(mktemp -d -p /var/tmp) 15 | rlRun -t -c "mkdir -p $TMP_DIR/fake-root/etc" 16 | rlRun -t -c "touch $TMP_DIR/fake-root/etc/passwd" 17 | rlRun -t -c "tar -cvaf $TMP_DIR/root.tar.xz -C $TMP_DIR/fake-root/ ." 18 | rlPhaseEnd 19 | 20 | rlPhaseStartTest "Make a new iso with kickstart and root.tar.xz" 21 | rlRun -t -c "$CLI --add $TMP_DIR/root.tar.xz --ks $2 $1 $TMP_DIR/liveimg-boot.iso" 22 | rlAssertExists "$TMP_DIR/liveimg-boot.iso" 23 | rlPhaseEnd 24 | 25 | rlPhaseStartTest "Check the new ISO" 26 | ISO_DIR="$TMP_DIR/mnt-iso/" 27 | rlRun -t -c "mkdir $ISO_DIR" 28 | rlRun "mount $TMP_DIR/liveimg-boot.iso $ISO_DIR" 29 | fail=0 30 | rlLogInfo "Checking for kickstart $(basename "$2")" 31 | if [ ! -e "$ISO_DIR$(basename "$2")" ]; then 32 | rlLogError "The kickstart is missing from the iso" 33 | fail=1 34 | fi 35 | for cfg in isolinux/isolinux.cfg EFI/BOOT/grub.cfg EFI/BOOT/BOOT.conf \ 36 | boot/grub/grub.cfg images/generic.prm; do 37 | if [ -e "$ISO_DIR$cfg" ]; then 38 | rlLogInfo "Checking $cfg" 39 | if ! grep -q "$(basename "$2")" "$ISO_DIR$cfg"; then 40 | rlLogError "$cfg is missing the kickstart" 41 | fail=1 42 | fi 43 | fi 44 | done 45 | rlLogInfo "Checking for root.tar.xz on iso" 46 | if [ ! -e "$TMP_DIR/root.tar.xz" ]; then 47 | rlLogError "The root.tar.xz file is missing from the iso" 48 | fail=1 49 | fi 50 | rlAssertEquals "All checks have passed" $fail 0 51 | rlPhaseEnd 52 | 53 | rlPhaseStartCleanup 54 | rlRun -t -c "umount $ISO_DIR" 55 | rlRun -t -c "rm -rf $TMP_DIR" 56 | rlPhaseEnd 57 | rlJournalEnd 58 | rlJournalPrintText 59 | -------------------------------------------------------------------------------- /tests/mkksiso/test_mkksiso.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Note: execute this file from the project root directory 3 | 4 | set -eu 5 | 6 | [ "$(id -u)" -eq 0 ] || (echo "$0 must be run as root"; exit 1) 7 | 8 | BEAKERLIB_DIR=$(mktemp -d /tmp/mkksiso-test.XXXXXX) 9 | export BEAKERLIB_DIR 10 | CLI="${CLI:-}" 11 | 12 | # Override downloading the iso 13 | TEST_ISO="${TEST_ISO:-}" 14 | 15 | if [ -z "$CLI" ]; then 16 | top_srcdir=$(pwd) 17 | export top_srcdir 18 | . ./tests/testenv.sh 19 | fi 20 | 21 | # Fetch the boot.iso for the current arch and return the path to a temporary directory 22 | ISO_DIR=$(mktemp -d -p /var/tmp/) 23 | function finish { 24 | [ -n "$ISO_DIR" ] && rm -rf "$ISO_DIR" 25 | } 26 | trap finish EXIT 27 | 28 | pushd "$ISO_DIR" 29 | ARCH=$(uname -m) 30 | 31 | if [ -z "$TEST_ISO" ]; then 32 | # Use the Fedora mirrors to select the iso source 33 | BASEURL=$(curl "https://mirrors.fedoraproject.org/mirrorlist?repo=fedora-31&arch=$ARCH" | \ 34 | grep -v "^#" | head -n 1) 35 | curl --remote-name-all "$BASEURL/images/boot.iso" 36 | TEST_ISO="$ISO_DIR/boot.iso" 37 | elif [ ! -e "$TEST_ISO" ]; then 38 | echo "$TEST_ISO is missing." 39 | exit 1 40 | fi 41 | popd 42 | 43 | export BEAKERLIB_JOURNAL=0 44 | ./tests/mkksiso/test_boot_repo.sh "$TEST_ISO" ./tests/mkksiso/ks/extra-repo.ks 45 | ./tests/mkksiso/test_liveimg.sh "$TEST_ISO" ./tests/mkksiso/ks/liveimg.ks 46 | 47 | . $BEAKERLIB_DIR/TestResults 48 | 49 | if [ "$TESTRESULT_RESULT_ECODE" != 0 ]; then 50 | echo "Test failed. Leaving log in $BEAKERLIB_DIR" 51 | exit "$TESTRESULT_RESULT_ECODE" 52 | fi 53 | 54 | rm -rf "$BEAKERLIB_DIR" 55 | -------------------------------------------------------------------------------- /tests/pylint/runpylint.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | import sys 4 | 5 | import astroid 6 | from pocketlint import FalsePositive, PocketLintConfig, PocketLinter 7 | import pylint 8 | 9 | class LoraxLintConfig(PocketLintConfig): 10 | def __init__(self): 11 | PocketLintConfig.__init__(self) 12 | 13 | self.falsePositives = [ FalsePositive(r"Module 'pylorax' has no 'version' member"), 14 | FalsePositive(r"Catching too general exception Exception"), 15 | # See https://bugzilla.redhat.com/show_bug.cgi?id=1739167 16 | FalsePositive(r"Module 'rpm' has no '.*' member"), 17 | FalsePositive(r"raise-missing-from"), 18 | FalsePositive(r"redundant-u-string-prefix"), 19 | FalsePositive(r"unspecified-encoding"), 20 | # Python 3.12 problems with pylint/astroid 21 | # see https://github.com/pylint-dev/pylint/issues/8852 22 | FalsePositive(r"Class 'datetime' has no '(now|utcfromtimestamp)' member"), 23 | ] 24 | 25 | @property 26 | def pylintPlugins(self): 27 | retval = super(LoraxLintConfig, self).pylintPlugins 28 | # Not using threads so we can skip this 29 | retval.remove("pocketlint.checkers.environ") 30 | # No markup used 31 | retval.remove("pocketlint.checkers.markup") 32 | return retval 33 | 34 | @property 35 | def ignoreNames(self): 36 | return { "bots", "rpmbuild" } 37 | 38 | @property 39 | def extraArgs(self): 40 | return ["--extension-pkg-whitelist=rpm"] 41 | 42 | @property 43 | def disabledOptions(self): 44 | retval = super(LoraxLintConfig, self).disabledOptions 45 | 46 | # Remove messages that are no longer supported in py3 47 | for msg in ["W0110", "W0141", "W0142", "I0012"]: 48 | try: 49 | retval.remove(msg) 50 | except ValueError: 51 | pass 52 | return retval 53 | 54 | if __name__ == "__main__": 55 | print("INFO: Using pylint v%s, astroid v%s" % (pylint.version, astroid.version)) 56 | conf = LoraxLintConfig() 57 | linter = PocketLinter(conf) 58 | rc = linter.run() 59 | sys.exit(rc) 60 | -------------------------------------------------------------------------------- /tests/pylorax/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weldr/lorax/f531618fcc771f7a7eb06736b1757ecfc40ec19e/tests/pylorax/__init__.py -------------------------------------------------------------------------------- /tests/pylorax/templates/bad-template.tmpl: -------------------------------------------------------------------------------- 1 | <%page args="missing" /> 2 | This is a bad template 3 | 4 | -------------------------------------------------------------------------------- /tests/pylorax/templates/chmod-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | append /lorax-file "A text file" 3 | chmod /lorax-file 0641 4 | -------------------------------------------------------------------------------- /tests/pylorax/templates/copy-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | append /lorax-file "A text file" 3 | copy /lorax-file /copied-file 4 | -------------------------------------------------------------------------------- /tests/pylorax/templates/createaddrsize-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page args="root" /> 2 | <% 3 | INITRD_ADDRESS="0x02000000" 4 | %> 5 | append /initrd.img "I AM AN INITRD. TRUST ME!" 6 | createaddrsize ${INITRD_ADDRESS} ${root}/initrd.img ${root}/initrd.addrsize 7 | -------------------------------------------------------------------------------- /tests/pylorax/templates/hardlink-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | append /lorax-file "A hardlinked file" 3 | mkdir /lorax-dir 4 | hardlink /lorax-file /linked-file 5 | hardlink /lorax-file /lorax-dir 6 | -------------------------------------------------------------------------------- /tests/pylorax/templates/install-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | mkdir /etc 3 | append /etc/lorax-test "TESTING LORAX TEMPLATES" 4 | install /etc/lorax-test /etc/lorax-test-dest 5 | -------------------------------------------------------------------------------- /tests/pylorax/templates/install-remove-test.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | # Must be run after run_pkg_transaction is executed in another template 3 | removefrom lots-of-files --allbut /lorax-files/file-one.txt 4 | removepkg known-path 5 | -------------------------------------------------------------------------------- /tests/pylorax/templates/install-test.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | installpkg anaconda-core 3 | installpkg --optional exact-1.3.17 4 | installpkg --except fake-homer --except fake-milhouse --except fake-lisa fake-* 5 | installpkg --required lots-of-files 6 | installpkg known-path 7 | -installpkg missing-package 8 | installpkg fake-milhouse>1.0.0-4 9 | installpkg fake-lisa<1.2.0-1 10 | run_pkg_transaction 11 | -------------------------------------------------------------------------------- /tests/pylorax/templates/installimg-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | mkdir /product 3 | append /product/a-file "TEXT INSIDE A FILE" 4 | mkdir /images 5 | installimg /product images/product.img 6 | installimg --gzip -3 /product images/product.img.gz 7 | -------------------------------------------------------------------------------- /tests/pylorax/templates/installinitrd-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | append /lorax-initrd "NOT REALLY AN INITRD" 3 | mkdir /kernels/ 4 | installinitrd images /lorax-initrd /kernels/initrd.img 5 | -------------------------------------------------------------------------------- /tests/pylorax/templates/installkernel-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | append /lorax-kernel "NOT REALLY A KERNEL" 3 | mkdir /kernels/ 4 | installkernel images /lorax-kernel /kernels/vmlinuz 5 | -------------------------------------------------------------------------------- /tests/pylorax/templates/installupgradeinitrd-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | append /lorax-upgrade "NOT REALLY AN INITRD" 3 | mkdir /kernels/ 4 | installupgradeinitrd images /lorax-upgrade /kernels/upgrade.img 5 | -------------------------------------------------------------------------------- /tests/pylorax/templates/mkdir-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | mkdir /etc/lorax-mkdir 3 | -------------------------------------------------------------------------------- /tests/pylorax/templates/move-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | append /lorax-file "A text file" 3 | move /lorax-file /moved-file 4 | -------------------------------------------------------------------------------- /tests/pylorax/templates/parse-missing-quote.tmpl: -------------------------------------------------------------------------------- 1 | <%page args="basearch"/> 2 | 3 | # missing quote 4 | replace @ROOT@ 'inst.stage2=hd:LABEL=foo isolinux.cfg 5 | -------------------------------------------------------------------------------- /tests/pylorax/templates/parse-test.tmpl: -------------------------------------------------------------------------------- 1 | <%page args="basearch"/> 2 | 3 | installpkg common-package 4 | installpkg foo-{one,two} 5 | 6 | %if basearch != "s390x": 7 | installpkg not-s390x-package 8 | %endif 9 | 10 | run_pkg_transaction 11 | -------------------------------------------------------------------------------- /tests/pylorax/templates/remove-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | append /lorax-file "A text file" 3 | remove /lorax-* 4 | -------------------------------------------------------------------------------- /tests/pylorax/templates/removekmod-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | mkdir /lib/modules/1.2.3/kernel/sound 3 | mkdir /lib/modules/1.2.3/kernel/drivers/video 4 | append /lib/modules/1.2.3/kernel/sound/foo1.ko "I AM A DRIVER" 5 | append /lib/modules/1.2.3/kernel/sound/foo2.ko "I AM A DRIVER" 6 | append /lib/modules/1.2.3/kernel/drivers/video/bar1.ko "I AM A DRIVER" 7 | append /lib/modules/1.2.3/kernel/drivers/video/bar2.ko "I AM A DRIVER" 8 | 9 | removekmod sound 10 | removekmod drivers/video --allbut bar1 11 | -------------------------------------------------------------------------------- /tests/pylorax/templates/replace-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | append /etc/lorax-replace "Running @VERSION@ for lorax" 3 | replace @VERSION@ 1.2.3 /etc/lorax-replace 4 | 5 | # Test 4 different ways to lock root account 6 | append /etc/lorax-shadow-1 "root:!::0:99999:7:::" 7 | append /etc/lorax-shadow-2 "root:*::0:99999:7:::" 8 | append /etc/lorax-shadow-3 "root:!*::0:99999:7:::" 9 | append /etc/lorax-shadow-4 "root:!unprovisioned::0:99999:7:::" 10 | 11 | # All of these should end up the same 12 | replace "root:.*?:" "root::" /etc/lorax-shadow-1 13 | replace "root:.*?:" "root::" /etc/lorax-shadow-2 14 | replace "root:.*?:" "root::" /etc/lorax-shadow-3 15 | replace "root:.*?:" "root::" /etc/lorax-shadow-4 16 | -------------------------------------------------------------------------------- /tests/pylorax/templates/runcmd-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page args="root" /> 2 | runcmd touch ${root}/lorax-runcmd 3 | -------------------------------------------------------------------------------- /tests/pylorax/templates/symlink-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | append /lorax-file "A symlinked file" 3 | append /existing-file "An existing file" 4 | symlink /lorax-file /symlinked-file 5 | symlink /lorax-file /existing-file 6 | -------------------------------------------------------------------------------- /tests/pylorax/templates/systemctl-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | mkdir /etc/systemd/system/ 3 | append /etc/systemd/system/foo.service "[unit]\nDescription=foo\n[Install]\nWantedBy=multi-user.target" 4 | systemctl enable foo.service 5 | -------------------------------------------------------------------------------- /tests/pylorax/templates/treeinfo-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | treeinfo images boot.iso images/boot.iso 3 | -------------------------------------------------------------------------------- /tests/pylorax/templates/unknown-cmd.tmpl: -------------------------------------------------------------------------------- 1 | <%page /> 2 | run_unknonwn_command 3 | -------------------------------------------------------------------------------- /tests/pylorax/test_buildstamp.py: -------------------------------------------------------------------------------- 1 | import io 2 | import unittest 3 | from unittest.mock import patch 4 | 5 | from pylorax import buildstamp 6 | 7 | class BuildStampTestCase(unittest.TestCase): 8 | def setUp(self): 9 | self.bstamp = buildstamp.BuildStamp( 10 | 'Lorax Tests', 11 | '0.1', 12 | 'https://github.com/rhinstaller/lorax/issues', 13 | True, 14 | 'noarch', 15 | 'Server' 16 | ) 17 | 18 | def test_write_produces_file_with_expected_content(self): 19 | out_file = io.StringIO() 20 | with patch.object(out_file, 'close'): 21 | with patch.object(buildstamp, 'open', return_value=out_file): 22 | self.bstamp.write('/tmp/stamp.ini') 23 | self.assertIn("[Main]\nProduct=Lorax Tests\nVersion=0.1\nBugURL=https://github.com/rhinstaller/lorax/issues\nIsFinal=True\n", out_file.getvalue()) 24 | # Skip UUID which is between IsFinal and Variant 25 | try: 26 | import pylorax.version 27 | except ImportError: 28 | self.assertIn("Variant=Server\n[Compose]\nLorax=devel", out_file.getvalue()) 29 | else: 30 | self.assertIn("Variant=Server\n[Compose]\nLorax=" + pylorax.version.num, out_file.getvalue()) 31 | -------------------------------------------------------------------------------- /tests/pylorax/test_discinfo.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2018 Red Hat, Inc. 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | # 17 | import unittest 18 | import tempfile 19 | 20 | from pylorax.discinfo import DiscInfo 21 | 22 | class DiscInfoTest(unittest.TestCase): 23 | def test_discinfo(self): 24 | with tempfile.NamedTemporaryFile(mode="w+t") as f: 25 | di = DiscInfo("1.0", "x86_64") 26 | di.write(f.name) 27 | f.seek(0) 28 | self.assertTrue(f.readline().strip() not in ["", None]) 29 | self.assertEqual(f.readline().strip(), "1.0") 30 | self.assertEqual(f.readline().strip(), "x86_64") 31 | -------------------------------------------------------------------------------- /tests/pylorax/test_monitor.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import time 3 | import unittest 4 | 5 | from pylorax.monitor import LogMonitor 6 | 7 | class LogMonitorTest(unittest.TestCase): 8 | def test_monitor(self): 9 | monitor = LogMonitor(timeout=1) 10 | try: 11 | with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: 12 | s.connect((monitor.host, monitor.port)) 13 | s.sendall("Just a test string\nwith two and a half\nlines in it".encode("utf8")) 14 | time.sleep(1) 15 | self.assertFalse(monitor.server.log_check()) 16 | s.sendall("\nAnother line\nTraceback (Not a real traceback)\n".encode("utf8")) 17 | time.sleep(1) 18 | self.assertTrue(monitor.server.log_check()) 19 | self.assertEqual(monitor.server.error_line, "Traceback (Not a real traceback)") 20 | finally: 21 | monitor.shutdown() 22 | 23 | def test_monitor_repo(self): 24 | monitor = LogMonitor(timeout=1) 25 | try: 26 | with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: 27 | s.connect((monitor.host, monitor.port)) 28 | # Test a base repo cdrom failure 29 | # This does NOT cause an error, it can happen when using rhsm in the kickstart 30 | s.sendall("18:10:59,811 ERR anaconda:packaging: base repo (CDROM/file:///run/install/sources/mount-0000-cdrom) not valid -- removing it\n".encode("utf8")) 31 | time.sleep(1) 32 | self.assertFalse(monitor.server.log_check()) 33 | 34 | # Test a base repo failure message 35 | s.sendall("18:10:59,811 ERR anaconda:packaging: base repo (https://foo.bar) not valid -- removing it\n".encode("utf8")) 36 | time.sleep(1) 37 | self.assertTrue(monitor.server.log_check()) 38 | finally: 39 | monitor.shutdown() 40 | 41 | def test_monitor_IGNORED(self): 42 | monitor = LogMonitor(timeout=1) 43 | try: 44 | with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: 45 | s.connect((monitor.host, monitor.port)) 46 | s.sendall("Just a test string\nwith two and a half\nlines in it".encode("utf8")) 47 | time.sleep(1) 48 | self.assertFalse(monitor.server.log_check()) 49 | s.sendall("\nAnother line\nIGNORED: Traceback (Not a real traceback)\n".encode("utf8")) 50 | time.sleep(1) 51 | self.assertFalse(monitor.server.log_check()) 52 | self.assertEqual(monitor.server.error_line, "") 53 | finally: 54 | monitor.shutdown() 55 | 56 | def test_monitor_timeout(self): 57 | # Timeout is in minutes so to shorten the test we pass 0.1 58 | monitor = LogMonitor(timeout=0.1) 59 | try: 60 | with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: 61 | s.connect((monitor.host, monitor.port)) 62 | s.sendall("Just a test string\nwith two and a half\nlines in it".encode("utf8")) 63 | time.sleep(1) 64 | self.assertFalse(monitor.server.log_check()) 65 | time.sleep(7) 66 | self.assertTrue(monitor.server.log_check()) 67 | self.assertEqual(monitor.server.error_line, "") 68 | finally: 69 | monitor.shutdown() 70 | 71 | 72 | def test_monitor_utf8(self): 73 | ## If a utf8 character spans the end of the 4096 byte buffer it will fail to 74 | ## decode. Test to make sure it is reassembled correctly. 75 | monitor = LogMonitor(timeout=1) 76 | try: 77 | with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: 78 | s.connect((monitor.host, monitor.port)) 79 | 80 | # Simulate a UTF8 character that gets broken into parts by buffering, etc. 81 | data = "Just a test string\nTraceback (Not a real traceback)\nWith A" 82 | s.sendall(data.encode("utf8") + b"\xc3") 83 | time.sleep(1) 84 | self.assertTrue(monitor.server.log_check()) 85 | self.assertEqual(monitor.server.error_line, "Traceback (Not a real traceback)") 86 | finally: 87 | monitor.shutdown() 88 | -------------------------------------------------------------------------------- /tests/pylorax/test_mount.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import tempfile 4 | import unittest 5 | 6 | from pylorax.mount import IsoMountpoint 7 | from pylorax.sysutils import joinpaths 8 | 9 | 10 | def mktestiso(rootdir, volid): 11 | # Make some fake files 12 | for f in ("/images/pxeboot/vmlinuz", "/images/pxeboot/initrd.img", "/LiveOS/squashfs.img"): 13 | p = joinpaths(rootdir, "sysroot", f) 14 | os.makedirs(os.path.dirname(p), exist_ok=True) 15 | with open(p, "w") as ff: 16 | ff.write("I AM FAKE FILE %s" % f.upper()) 17 | 18 | # Make an iso of the files 19 | make_iso = ["xorrisofs", "-o", joinpaths(rootdir, "test.iso"), 20 | "-R", "-J", "-V", volid, 21 | "-graft-points", "/=%s" % joinpaths(rootdir, "sysroot")] 22 | subprocess.check_call(make_iso) 23 | 24 | @unittest.skipUnless(os.geteuid() == 0 and not os.path.exists("/.in-container"), "requires root privileges, and no containers") 25 | class IsoMountpointTest(unittest.TestCase): 26 | def test_volid(self): 27 | with tempfile.TemporaryDirectory(prefix="lorax.test.") as work_dir: 28 | mktestiso(work_dir, "Fedora-test-iso-x86_64") 29 | self.assertTrue(os.path.exists(joinpaths(work_dir, "test.iso"))) 30 | 31 | iso = IsoMountpoint(joinpaths(work_dir, "test.iso")) 32 | self.addCleanup(iso.umount) 33 | self.assertEqual(iso.iso_path, joinpaths(work_dir, "test.iso")) 34 | self.assertIsNotNone(iso.mount_dir) 35 | self.assertTrue(iso.stage2) 36 | self.assertTrue(iso.kernel.endswith("vmlinuz")) 37 | self.assertTrue(iso.initrd.endswith("initrd.img")) 38 | self.assertEqual(iso.label, "Fedora-test-iso-x86_64") 39 | -------------------------------------------------------------------------------- /tests/pylorax/test_treeinfo.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2018 Red Hat, Inc. 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | # 17 | import unittest 18 | import tempfile 19 | import configparser 20 | import os 21 | 22 | from pylorax.treeinfo import TreeInfo 23 | 24 | class TreeInfoTest(unittest.TestCase): 25 | def test_treeinfo(self): 26 | with tempfile.NamedTemporaryFile() as f: 27 | ti = TreeInfo("Lorax-Test", "1.0", "Server", "x86_64", "Packages") 28 | ti.add_section("images", {"initrd": "images/pxeboot/initrd.img", 29 | "kernel": "images/pxeboot/vmlinuz"}) 30 | ti.write(f.name) 31 | 32 | config = configparser.ConfigParser() 33 | config.read(f.name) 34 | 35 | self.assertEqual(config.get("general", "family"), "Lorax-Test") 36 | self.assertEqual(config.get("general", "version"), "1.0") 37 | self.assertEqual(config.get("general", "name"), "Lorax-Test-1.0") 38 | self.assertEqual(config.get("general", "variant"), "Server") 39 | self.assertEqual(config.get("general", "arch"), "x86_64") 40 | self.assertEqual(config.get("general", "packagedir"), "Packages") 41 | self.assertTrue(config.get("general", "timestamp") not in ["", None]) 42 | 43 | self.assertEqual(config.get("images", "initrd"), "images/pxeboot/initrd.img") 44 | self.assertEqual(config.get("images", "kernel"), "images/pxeboot/vmlinuz") 45 | 46 | def test_source_time(self): 47 | """Test treeinfo with SOURCE_DATE_EPOCH environmental variable set""" 48 | os.environ["SOURCE_DATE_EPOCH"] = str(499137660) 49 | with tempfile.NamedTemporaryFile() as f: 50 | ti = TreeInfo("Lorax-Test", "1.0", "Server", "x86_64", "Packages") 51 | ti.write(f.name) 52 | 53 | config = configparser.ConfigParser() 54 | config.read(f.name) 55 | 56 | self.assertEqual(config.get("general", "timestamp"), str(499137660)) 57 | -------------------------------------------------------------------------------- /tests/test_lorax.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Note: execute this file from the project root directory 3 | # 4 | # Test building a boot.iso using lorax 5 | 6 | set -eu 7 | 8 | BEAKERLIB_DIR=$(mktemp -d /tmp/lorax-test.XXXXXX) 9 | CLI="${CLI:-}" 10 | export BEAKERLIB_DIR 11 | source /usr/share/beakerlib/beakerlib.sh 12 | 13 | RELEASE=$(awk -F: '{ print $5 }' /etc/system-release-cpe) 14 | export RELEASE 15 | 16 | function setup_tests { 17 | local share_dir=$1 18 | 19 | # Make the boot.iso boot more quickly (isolinux.cfg) 20 | for cfg in "$share_dir"/templates.d/99-generic/config_files/*/isolinux.cfg; do 21 | sed -i.orig 's/^timeout.*/timeout 20/' "$cfg" 22 | sed -i 's/quiet$/inst.sshd=1 console=ttyS0,115200n8/' "$cfg" 23 | done 24 | 25 | # Make the boot.iso boot more quickly (grub.conf) 26 | for cfg in "$share_dir"/templates.d/99-generic/config_files/*/grub.conf; do 27 | sed -i.orig 's/^timeout.*/timeout 2/' "$cfg" 28 | sed -i 's/quiet$/inst.sshd=1 console=ttyS0,115200n8/' "$cfg" 29 | done 30 | 31 | # Make the boot.iso boot more quickly (grub2-efi.cfg) 32 | for cfg in "$share_dir"/templates.d/99-generic/config_files/*/grub2-efi.cfg; do 33 | sed -i.orig 's/^set timeout.*/set timeout=2/' "$cfg" 34 | sed -i 's/\(.*linux .* ro$\)/\1 inst.sshd=1 console=ttyS0,115200n8/' "$cfg" 35 | done 36 | 37 | } 38 | 39 | function teardown_tests { 40 | local share_dir=$1 41 | 42 | # Restore all the configuration files 43 | for cfg in "$share_dir"/templates.d/99-generic/config_files/*/*.orig; do 44 | mv "$cfg" "${cfg%%.orig}" 45 | done 46 | } 47 | 48 | SHARE_DIR=$(mktemp -d '/tmp/lorax-share.XXXXX') 49 | export SHARE_DIR 50 | if [ -z "$CLI" ]; then 51 | cp -R /usr/share/lorax/* "$SHARE_DIR" 52 | else 53 | top_srcdir=$(pwd) 54 | export top_srcdir 55 | source ./tests/testenv.sh 56 | cp -R ./share/* "$SHARE_DIR" 57 | fi 58 | chmod a+rx -R "$SHARE_DIR" 59 | setup_tests "$SHARE_DIR" 60 | 61 | export BEAKERLIB_JOURNAL=0 62 | 63 | if [ -z "$*" ]; then 64 | # Run all the lorax tests 65 | for t in ./tests/lorax/test_*sh; do 66 | $t 67 | done 68 | else 69 | # execute other tests which need more adjustments in the calling environment 70 | # or can't be executed inside Travis CI 71 | for TEST in "$@"; do 72 | $TEST 73 | done 74 | fi 75 | 76 | 77 | teardown_tests "$SHARE_DIR" 78 | 79 | source "$BEAKERLIB_DIR/TestResults" 80 | 81 | if [ $TESTRESULT_RESULT_ECODE != 0 ]; then 82 | echo "Test failed. Leaving log in $BEAKERLIB_DIR" 83 | exit $TESTRESULT_RESULT_ECODE 84 | fi 85 | 86 | rm -rf "$BEAKERLIB_DIR" 87 | -------------------------------------------------------------------------------- /tests/testenv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | top_srcdir="${top_srcdir:-}" 4 | top_buildir="${top_builddir:-}" 5 | PYTHONPATH="${PYTHONPATH:-}" 6 | 7 | if [ -z "$top_srcdir" ]; then 8 | echo "*** top_srcdir must be set" 9 | exit 1 10 | fi 11 | 12 | # If no top_builddir is set, use top_srcdir 13 | : "${top_builddir:=$top_srcdir}" 14 | 15 | if [ -z "$PYTHONPATH" ]; then 16 | PYTHONPATH="${top_builddir}/src/:${top_srcdir}/tests/lib" 17 | else 18 | PYTHONPATH="${PYTHONPATH}:${top_srcdir}/src/:${top_srcdir}:${top_srcdir}/tests/lib" 19 | fi 20 | 21 | export PYTHONPATH 22 | export top_srcdir 23 | export top_builddir 24 | -------------------------------------------------------------------------------- /utils/test-parse-template: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # test-parse-template - parse and print (but don't execute!) a Lorax Template. 3 | # Copyright (C) 2011-2015 Red Hat, Inc. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | # 18 | # Red Hat Author(s): Will Woods 19 | 20 | import sys, inspect 21 | from pylorax.base import DataHolder 22 | from pylorax.ltmpl import LoraxTemplate 23 | from mako.exceptions import text_error_template 24 | 25 | data = DataHolder() 26 | data.arch = DataHolder(basearch='ARCH.BASEARCH', buildarch='ARCH.BUILDARCH', libdir='ARCH.LIBDIR') 27 | data.product = DataHolder(name='PRODUCT.NAME', version='PRODUCT.VERSION') 28 | data.glob = lambda g: ['glob.1', 'glob.2'] 29 | data.exists = lambda e: True 30 | data.udev = lambda s: "UDEV_ESCAPE(%s)" % s.upper() 31 | data.removelocales = ['REMOVELOCALE1', 'REMOVELOCALE2'] 32 | data.kernels = [DataHolder(path="/path/to/vmlinuz", initrd=DataHolder(path="/path/to/initrd.img"), flavor=None, arch=data.arch.basearch)] 33 | data.basearch = data.arch.basearch # pylint: disable=no-member 34 | data.libdir = data.arch.libdir # pylint: disable=no-member 35 | 36 | def get_args(template): 37 | sig = inspect.signature(template.module.render_body) 38 | return set(list(sig.parameters)[1:]) # skip "context" 39 | 40 | def readtemplate(filename): 41 | parser = LoraxTemplate(directories=['.']) 42 | from mako.lookup import TemplateLookup 43 | lookup = TemplateLookup(directories=parser.directories) 44 | return lookup.get_template(filename) 45 | 46 | if __name__ == '__main__': 47 | # check args 48 | if len(sys.argv) == 1: 49 | print("usage: %s TEMPLATE [arg1=value1] [arg2=value2] ...") 50 | 51 | # read template 52 | templatefile = sys.argv[1] 53 | print("parsing %s" % templatefile) 54 | t = readtemplate(templatefile) 55 | reqargs = get_args(t) 56 | print("required args: %s" % ' '.join(reqargs)) 57 | 58 | # parse extra commandline args 59 | if len(sys.argv) > 2: 60 | for arg in sys.argv[2:]: 61 | if '=' in arg: 62 | k,v = arg.split('=',1) 63 | data[k] = v 64 | 65 | # fill in remaining blanks 66 | for a in reqargs.difference(data): 67 | data[a] = a.upper() 68 | 69 | print("rendering %s using values:" % templatefile) 70 | for a in data: 71 | print(" %s=%s" % (a,repr(data[a]))) 72 | 73 | # render and print 74 | try: 75 | lines = t.render(**data).splitlines() 76 | for line in lines: 77 | print(line) 78 | except Exception: 79 | print(text_error_template().render()) 80 | raise SystemExit(1) 81 | --------------------------------------------------------------------------------